Deleted Added
full compact
usbhid.c (174826) usbhid.c (187994)
1/* $NetBSD: usbhid.c,v 1.14 2000/07/03 02:51:37 matt Exp $ */
1/* $NetBSD: usbhid.c,v 1.14 2000/07/03 02:51:37 matt Exp $ */
2/* $FreeBSD: head/usr.bin/usbhidctl/usbhid.c 174826 2007-12-21 03:40:36Z imp $ */
2/* $FreeBSD: head/usr.bin/usbhidctl/usbhid.c 187994 2009-02-02 00:49:39Z alfred $ */
3
4/*
5 * Copyright (c) 1998 The NetBSD Foundation, Inc.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Lennart Augustsson (augustss@netbsd.org).
10 *

--- 26 unchanged lines hidden (view full) ---

37 * POSSIBILITY OF SUCH DAMAGE.
38 */
39
40#include <stdio.h>
41#include <stdlib.h>
42#include <string.h>
43#include <sys/types.h>
44#include <fcntl.h>
3
4/*
5 * Copyright (c) 1998 The NetBSD Foundation, Inc.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Lennart Augustsson (augustss@netbsd.org).
10 *

--- 26 unchanged lines hidden (view full) ---

37 * POSSIBILITY OF SUCH DAMAGE.
38 */
39
40#include <stdio.h>
41#include <stdlib.h>
42#include <string.h>
43#include <sys/types.h>
44#include <fcntl.h>
45#include <sys/ioctl.h>
46#include <unistd.h>
47#include <err.h>
48#include <ctype.h>
49#include <errno.h>
50#include <usbhid.h>
45#include <unistd.h>
46#include <err.h>
47#include <ctype.h>
48#include <errno.h>
49#include <usbhid.h>
51#include <dev/usb/usb.h>
52#include <dev/usb/usbhid.h>
50#include <dev/usb2/include/usb2_hid.h>
53
54int verbose = 0;
55int all = 0;
56int noname = 0;
57int hexdump = 0;
58static int reportid;
59
60char **names;

--- 141 unchanged lines hidden (view full) ---

202
203void
204dumpdata(int f, report_desc_t rd, int loop)
205{
206 struct hid_data *d;
207 struct hid_item h, *hids, *n;
208 int r, dlen;
209 u_char *dbuf;
51
52int verbose = 0;
53int all = 0;
54int noname = 0;
55int hexdump = 0;
56static int reportid;
57
58char **names;

--- 141 unchanged lines hidden (view full) ---

200
201void
202dumpdata(int f, report_desc_t rd, int loop)
203{
204 struct hid_data *d;
205 struct hid_item h, *hids, *n;
206 int r, dlen;
207 u_char *dbuf;
210 static int one = 1;
211 u_int32_t colls[100];
212 int sp = 0;
213 char namebuf[10000], *namep;
214
215 hids = 0;
216 for (d = hid_start_parse(rd, 1<<hid_input, reportid);
217 hid_get_item(d, &h); ) {
218 if (h.kind == hid_collection)

--- 7 unchanged lines hidden (view full) ---

226 hids = malloc(sizeof *hids);
227 *hids = h;
228 }
229 hid_end_parse(d);
230 rev(&hids);
231 dlen = hid_report_size(rd, hid_input, 0);
232 dbuf = malloc(dlen);
233 if (!loop)
208 u_int32_t colls[100];
209 int sp = 0;
210 char namebuf[10000], *namep;
211
212 hids = 0;
213 for (d = hid_start_parse(rd, 1<<hid_input, reportid);
214 hid_get_item(d, &h); ) {
215 if (h.kind == hid_collection)

--- 7 unchanged lines hidden (view full) ---

223 hids = malloc(sizeof *hids);
224 *hids = h;
225 }
226 hid_end_parse(d);
227 rev(&hids);
228 dlen = hid_report_size(rd, hid_input, 0);
229 dbuf = malloc(dlen);
230 if (!loop)
234 if (ioctl(f, USB_SET_IMMED, &one) < 0) {
231 if (hid_set_immed(f, 1) < 0) {
235 if (errno == EOPNOTSUPP)
236 warnx("device does not support immediate mode, only changes reported.");
237 else
238 err(1, "USB_SET_IMMED");
239 }
240 do {
241 r = read(f, dbuf, dlen);
242 if (r != dlen) {

--- 103 unchanged lines hidden ---
232 if (errno == EOPNOTSUPP)
233 warnx("device does not support immediate mode, only changes reported.");
234 else
235 err(1, "USB_SET_IMMED");
236 }
237 do {
238 r = read(f, dbuf, dlen);
239 if (r != dlen) {

--- 103 unchanged lines hidden ---