Ticket #35261: patch-src-common-port-hid_port.cpp.diff
File patch-src-common-port-hid_port.cpp.diff, 851 bytes (added by alexgrach, 12 years ago) |
---|
-
hid_port.cpp
old new 14 14 # include <sys/stat.h> 15 15 # include <sys/ioctl.h> 16 16 # include <fcntl.h> 17 # include <linux/hiddev.h>17 //# include <linux/hiddev.h> 18 18 # include <errno.h> 19 19 # include <unistd.h> 20 20 #endif … … 38 38 39 39 bool Port::HID::getDeviceIds(uint index, uint& vendorId, uint& productId) 40 40 { 41 #ifdef Q_OS_UNIX42 const QString path = devicePath(index);43 const int fd = ::open(path.latin1(), O_RDONLY);44 if (fd < 0) {45 return false;46 }47 hiddev_devinfo info;48 const bool ok = (ioctl(fd, HIDIOCGDEVINFO, &info) >= 0);49 if (ok) {50 vendorId = info.vendor;51 productId = info.product;52 }53 ::close(fd);54 return ok;55 #else56 41 return false; 57 #endif58 42 } 59 43 60 44 QStringList Port::HID::probedDeviceList()