From 844fd35c0ce66c5db1fae4cbf271ac00a5dd0edf Mon Sep 17 00:00:00 2001 From: Alan Ott Date: Sat, 10 Jul 2010 21:48:24 -0400 Subject: [PATCH] Set/Get Feature Support for Linux. --- linux/hid.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/linux/hid.c b/linux/hid.c index 58c7122..992bdee 100644 --- a/linux/hid.c +++ b/linux/hid.c @@ -516,6 +516,7 @@ int HID_API_EXPORT hid_set_nonblocking(int device, int nonblock) int HID_API_EXPORT hid_send_feature_report(int device, const unsigned char *data, size_t length) { struct Device *dev = NULL; + int res; // Get the handle if (device < 0 || device >= MAX_DEVICES) @@ -524,12 +525,17 @@ int HID_API_EXPORT hid_send_feature_report(int device, const unsigned char *data return -1; dev = &devices[device]; - return -1; + res = ioctl(dev->device_handle, HIDIOCSFEATURE(length), data); + if (res < 0) + perror("ioctl (SFEATURE)"); + + return res; } int HID_API_EXPORT hid_get_feature_report(int device, unsigned char *data, size_t length) { struct Device *dev = NULL; + int res; // Get the handle if (device < 0 || device >= MAX_DEVICES) @@ -538,7 +544,12 @@ int HID_API_EXPORT hid_get_feature_report(int device, unsigned char *data, size_ return -1; dev = &devices[device]; - return -1; + res = ioctl(dev->device_handle, HIDIOCGFEATURE(length), data); + if (res < 0) + perror("ioctl (GFEATURE)"); + + + return res; }