|
-
July 2nd, 2006, 07:08 AM
#1
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
-
July 2nd, 2006, 02:05 PM
#2
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.
Last edited by dude_1967; July 2nd, 2006 at 02:06 PM.
Reason: Improved clarity
You're gonna go blind staring into that box all day.
-
July 2nd, 2006, 06:37 PM
#3
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
-
July 3rd, 2006, 09:52 AM
#4
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.
You're gonna go blind staring into that box all day.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|