Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 07-23-2004, 12:53 AM   #1
LQ Newbie
Registered: May 2004
Posts: 7

Rep: Reputation: 0
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!
Old 08-17-2004, 03:26 AM   #2
LQ Newbie
Registered: Jul 2004
Posts: 2

Rep: Reputation: 0
Is hid the only driver in our case?

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;

ssize_t bytesread;
hiddev_event *buffer;

buffer=(hiddev_event *)malloc(sizeof(hiddev_event));



printf("Unknown event bytes=%d hid=%d value=%d\n",

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.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Talking to USB-HID ectech Programming 1 10-24-2005 06:24 AM
HID compliant gamepad bobbens Linux - Hardware 6 10-27-2004 11:04 AM
Talking to USB HID ectech Programming 0 12-30-2003 10:50 AM
Usb-hid RanmaPhreak79 Linux - Hardware 1 07-18-2003 08:32 PM
Usb + Hid vexer Slackware 4 05-28-2003 09:46 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:03 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration