Re: libusb_control_transfer returns LIBUSB_ERROR_IO and GetLastError()=1186 (Win7)
"Denis K." <[email protected]> Mon, 10 Aug 2015 17:38:23 +0300
| Newsgroups | gmane.comp.lib.libusb.devel.windows |
|---|---|
| Organization | oDesk Freelancer |
| Message-ID | <[email protected]> |
Hi Xiaofan, I need to detect usb hardware keylogger, by measuring time with and without it plugged into USB keyboard port. The best way to do this is to send output report with LED and wait for ACK packet. How to replace driver with WinUSB please? -- Regards Denis mailto:[email protected] > On Wed, Aug 5, 2015 at 10:56 PM, licedey <[email protected]> wrote: >> Thank you for the reply. I've tried hidapi library, looks like it works, but >> hid_write() call return "Invalid Parameter" error. However I am using >> sources from test project from their site. >> How to fix please? Maybe it my USB keyboard error, because of no lib can >> read/write to it. I've tried with libusb, Windows HID API, hidapi library. >> No success everywhere. >> >> memset(buf,0,sizeof(buf)); >> >> // Toggle LED (cmd 0x80). The first byte is the report number (0x1). >> buf[0] = 0x1; >> buf[1] = 0x81; >> res = hid_write(handle, buf, 17); >> if (res < 0) { // returns -1 >> printf("Unable to write()\n"); >> printf("Error: %ls\n", hid_error(handle)); >> } > No you can not use HIDAPI or libusb HID backend to talk to > a real USB keyboard under Windows. Both HIDAPI and > libusb HID backend are based on Windows HIDAPI which > is not meant for USB keyboard and mouse. > Why do you want to do that? For learning? Then keyboard > or USB drive are not good for learning. Buy a USB development > kit and use that. > If you really want to use the keyboard, then you may have to > replace the keyboard driver with WinUSB and you can > use libusb-1.0 API to talk to it (not HIDAPI). ------------------------------------------------------------------------------ _______________________________________________ Libusb-win32-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel