diff options
Diffstat (limited to 'src/hid_linux.c')
-rw-r--r-- | src/hid_linux.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/hid_linux.c b/src/hid_linux.c index c7cabc9..99c5afb 100644 --- a/src/hid_linux.c +++ b/src/hid_linux.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <libudev.h> | 13 | #include <libudev.h> |
14 | #include <string.h> | 14 | #include <string.h> |
15 | #include <unistd.h> | 15 | #include <unistd.h> |
16 | #include <errno.h> | ||
16 | 17 | ||
17 | #include "fido.h" | 18 | #include "fido.h" |
18 | 19 | ||
@@ -98,7 +99,6 @@ get_usage_info(const struct hidraw_report_descriptor *hrd, uint32_t *usage_page, | |||
98 | static int | 99 | static int |
99 | get_report_descriptor(const char *path, struct hidraw_report_descriptor *hrd) | 100 | get_report_descriptor(const char *path, struct hidraw_report_descriptor *hrd) |
100 | { | 101 | { |
101 | int r; | ||
102 | int s = -1; | 102 | int s = -1; |
103 | int fd; | 103 | int fd; |
104 | int ok = -1; | 104 | int ok = -1; |
@@ -108,7 +108,7 @@ get_report_descriptor(const char *path, struct hidraw_report_descriptor *hrd) | |||
108 | return (-1); | 108 | return (-1); |
109 | } | 109 | } |
110 | 110 | ||
111 | if ((r = ioctl(fd, HIDIOCGRDESCSIZE, &s)) < 0 || s < 0 || | 111 | if (ioctl(fd, HIDIOCGRDESCSIZE, &s) < 0 || s < 0 || |
112 | (unsigned)s > HID_MAX_DESCRIPTOR_SIZE) { | 112 | (unsigned)s > HID_MAX_DESCRIPTOR_SIZE) { |
113 | fido_log_debug("%s: ioctl HIDIOCGRDESCSIZE", __func__); | 113 | fido_log_debug("%s: ioctl HIDIOCGRDESCSIZE", __func__); |
114 | goto fail; | 114 | goto fail; |
@@ -116,7 +116,7 @@ get_report_descriptor(const char *path, struct hidraw_report_descriptor *hrd) | |||
116 | 116 | ||
117 | hrd->size = s; | 117 | hrd->size = s; |
118 | 118 | ||
119 | if ((r = ioctl(fd, HIDIOCGRDESC, hrd)) < 0) { | 119 | if (ioctl(fd, HIDIOCGRDESC, hrd) < 0) { |
120 | fido_log_debug("%s: ioctl HIDIOCGRDESC", __func__); | 120 | fido_log_debug("%s: ioctl HIDIOCGRDESC", __func__); |
121 | goto fail; | 121 | goto fail; |
122 | } | 122 | } |
@@ -240,7 +240,7 @@ fail: | |||
240 | } | 240 | } |
241 | 241 | ||
242 | int | 242 | int |
243 | fido_dev_info_manifest(fido_dev_info_t *devlist, size_t ilen, size_t *olen) | 243 | fido_hid_manifest(fido_dev_info_t *devlist, size_t ilen, size_t *olen) |
244 | { | 244 | { |
245 | struct udev *udev = NULL; | 245 | struct udev *udev = NULL; |
246 | struct udev_enumerate *udev_enum = NULL; | 246 | struct udev_enumerate *udev_enum = NULL; |
@@ -267,6 +267,12 @@ fido_dev_info_manifest(fido_dev_info_t *devlist, size_t ilen, size_t *olen) | |||
267 | 267 | ||
268 | udev_list_entry_foreach(udev_entry, udev_list) { | 268 | udev_list_entry_foreach(udev_entry, udev_list) { |
269 | if (copy_info(&devlist[*olen], udev, udev_entry) == 0) { | 269 | if (copy_info(&devlist[*olen], udev, udev_entry) == 0) { |
270 | devlist[*olen].io = (fido_dev_io_t) { | ||
271 | fido_hid_open, | ||
272 | fido_hid_close, | ||
273 | fido_hid_read, | ||
274 | fido_hid_write, | ||
275 | }; | ||
270 | if (++(*olen) == ilen) | 276 | if (++(*olen) == ilen) |
271 | break; | 277 | break; |
272 | } | 278 | } |