IOCTL() convert to libusb
Hello,
i want to access the LEDs from the logitech mice MX610 inside a windows application.
I use Google and i found ONLY the following Linux code snippet:
Code:
unsigned char command[6]={ 0x01, 0x80, 0x52, 0x06, 0x00, 0x00 };
struct hiddev_usage_ref usage_ref;
for (int alv = 0; alv < 6; ++alv)
{
usage_ref.report_type = HID_REPORT_TYPE_OUTPUT;
usage_ref.report_id = 0x10;
usage_ref.field_index = 0;
usage_ref.usage_code = 0xff000001;
usage_ref.usage_index = alv;
usage_ref.value = (unsigned char) command[alv];
int ret = ioctl(fd, HIDIOCSUSAGE, &usage_ref);
usage_ref.usage_index++;
}
from:
http://www.kdedevelopers.org/node/1847
http://www.kdedevelopers.org/node/2029
but unfortunately i have no idea how to convert this code to a call to the libusb filter (usb_control_msg or usb_bulk_write )
http://libusb.sourceforge.net/
http://libusb-win32.sourceforge.net/
I have to try to study this ioctl(fd, HIDIOCSUSAGE, &usage_ref); inside the linux sources, but no luck.
regards
Peter
Re: IOCTL() convert to libusb
You can access a HID using the Win32 API. It can be a bit tricky to find the device driver key name. However once found, you can access the device using simple functions such as CreateFile, ReadFile, etc.
Take a look at Jan Axelson's page on HID programming using the Win32 API and study the codes under the link for usbhidio_vc6. The code could do with some improvements in style. However the code does show all of the hard to find function calls.
Here is the link: http://www.lvr.com/hidpage.htm
Sincerely, Chris.
Re: IOCTL() convert to libusb
Hello,
thanks for you answer,
but unfortunately, maybe i am totaly wrong, Win2000/WinXP block directly access to mouse devices, so i can use only functions for "Raw Input" (for example WM_INPUT,GetRawInputData ). But within "Raw Input", i found no function for output something to the device.
Therefore i thought to used this universial filter driver "libusb" could be an idea.
Peter
Re: IOCTL() convert to libusb
Peter,
I know that you can read from most HID mice using the Win32 API.
I have never written to them.
If Win2000 / XP blocks the calls to the driver, then you can not access them from the Win32 API.
Good luck.
Sincerely, Chris.