Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 01-05-2004, 09:48 AM   #1
LQ Newbie
Registered: Dec 2003
Location: Illinois
Distribution: RH9
Posts: 3

Rep: Reputation: 0
Talking to USB-HID

Talking to USB HID

Sorry about the repost, but Christmas Day was not a good time for me to post questions.

I need to send to and read from a USB device. So far, the hid driver seems to be the choice.

This is what I need to send and receive:
USHORT Buffer[9];

I have the file descriptor from:
if ((fd=open("dev/usb/hiddev0", O_RDONLY)) < 0)
{ perror("hiddev open");

I can get the report information from:

struct hiddev_report_info
{ unsigned report_type;
unsigned report_id;
unsigned num_fields;

struct hiddev_usage_ref
{ unsigned report_type:
unsigned report_id;
unsigned field_index;
unsigned usage_index;
unsigned usage_code:
_s32 value:

struct hiddev_usage_ref usage_ref;
struct hiddev_report_info rep_info;

calling ioctl(fd, HIDIOCGREPORTINFO, &rep_info) and reading the struct
gives me rep_info.report_type = 1 (or 2 or 3) = 0
rep_info.num_fields = 1

How do I fill in the structures rep_info and usage_ref to handle the nine element buffer? I assume I use:

ioctl(fd, HIDIOCSUSAGE, &usage_ref) and
ioctl(fd, HIDIOCSREPORT, &rep_info)

to send the buffer contents to the device, and

ioctl(fd, HIDIOCGREPORT, rep_info)

to read the device????????????
Old 10-24-2005, 06:24 AM   #2
LQ Newbie
Registered: Oct 2005
Location: Vienna
Distribution: suse 9.3, debian
Posts: 3

Rep: Reputation: 0
solving this problem?

Hey, how did you managed to talk with the HID-device? I have the same questions like you...


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 2.0 without root?? deebuv Linux - Hardware 0 06-23-2004 09:27 AM
Talking to USB HID ectech Programming 0 12-30-2003 10:50 AM
USB hid.o hijacking my USB Printer Relativity Linux - Hardware 0 12-09-2003 08:56 PM
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 06:39 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