gnupic: Re: [gnupic] USB code, PICDEM FS USB and Linux
Subject:
RE: [gnupic] USB code, PICDEM FS USB and Linux
From:
"Chen Xiao Fan" ####@####.####
Date:
16 Feb 2006 00:59:33 +0000
Message-Id: <7D4AB72251D4D949AB2732ABEABDA54F13006D@PFSG-MX1.ap.p-f.biz>
> -----Original Message-----
> From: Ben Dugan ####@####.####
> Sent: Thursday, February 16, 2006 5:47 AM
> To: ####@####.####
>
> > I've added support for vendor requests (attached). now you can use
> > libusb/usb_control_msg to send minimal data to the device using
> > the index and value field. It can be useful for small application.
>
> So: the vendor requests won't work if the device is, for example, and
> HID keyboard, right? Because, if its an HID keyboard, the operating
> system claims it and this precludes us from claiming it. Or am I wrong
> about that?
>
The kernel HID driver will claim any HID device not blacklisted.
However you can detach the kernel HID driver if you want under
Linux. For example, the following is the code under Linux used
in pk2 for PICkit 2 Linux support.
#ifdef LINUX
int retval;
char dname[32] = {0};
retval = usb_get_driver_np(d, 0, dname, 31);
if (!retval)
usb_detach_kernel_driver_np(d, 0);
#endif
Once you detach the kernel HID driver, you can claim the device
with libusb based program.
But if you want the keyboard or mouse function (here the
input layer is functional) and then add some more customized
function, maybe the situation will become more complex. Maybe
the user space libusb based program will not work. One possibility
is to use file system access (hiddev) to access the device.
The other possibility is to write your own kernel driver.
I am not so clear about this myself. Maybe Bradley Minch can
explain this much better. He is the true expert here.
PS: I just saw Brad's answer. So one can still send control
message to HID device.
Regards,
Xiaofan