Programming on a hid
OK i have a device and its firmware sets it up to use the HID driver built into linux. Now I am responsible for communicating with the device and making it useable for our project. I have been told by the manufacturer that I must use the ioctl() interface. the problem is that the ioctl() interface isn't documented well enough for me to glean the information that I need.
SO I am asking you, neigh begging you please someone help me!! I need to send the device a two byte string containing 0x06 0x81 then all the following commands and responses I send and receive are to be 64 bytes in length. I have figure out that one of the defined HIDIOxxxxxxx things have something to do with the sending and receiving. I also know that I have to package my information into the hiddev_report_info structure. So can someone show me how this is done with the two byte initalization command and an example of the following 64 byte commands, please. Also, am I shooting myself in the foot here by not sending some already builtin init function, type, command or something. I have seen that one of the HIDIOxxxxxx enumerations is HIDIOINIT. Does this have to be the first thing that I send it? I have asked this device for its version number and application, so I know that it is working. (I was able to do this because I found a weblink to some examples, but that was the only HIDIOxxxx that they talked about, and they didn't show what the hiddev_report_info struct needed to look like. Please anyone with any ideas on this, just give me anything that you have got! Many thanks! Nightbird |
Is hid the only driver in our case?
Hi,
We are working for the same project so you can give me your adress email I would like to read and write informations (just some bytes) with USB. (For information my device is a pic which works in low speed in interrupt transfer .) That works properly under windows... And now reading from device is succeful under linus-2.4.20. First, I 'd like to know if hid is the only driver for my device? Secondly how do I use the libusb? where can I find it? I use the file /dev/usb/hiddev0. Here is your program: typedef struct { unsigned hid; signed int value; } hiddev_event; main(){ ssize_t bytesread; int FILEDES; hiddev_event *buffer; buffer=(hiddev_event *)malloc(sizeof(hiddev_event)); FILEDES=open("/dev/usb/hiddev0",O_RDONLY); bytesread=1; while(bytesread>0){ bytesread=read(FILEDES,buffer,sizeof(hiddev_event)); if(bytesread!=sizeof(hiddev_event)){ exit(1); } printf("Unknown event bytes=%d hid=%d value=%d\n", bytesread,buffer->hid,buffer->value); } } When I try to write in fd (in order to write to the device) errno return me the value 22(EINVAL) although I open fd in O_WRONLY or O_RDWR... Please help me. B.GIRAUD<bastgiraud@wanadoo.fr> |
All times are GMT -5. The time now is 04:15 AM. |