LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 01-05-2004, 10:48 AM   #1
ectech
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");
exit(1);
}

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)
rep_info.id = 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, 07:24 AM   #2
Imyourdaddy
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...
cheers
 
  


Reply


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 10:27 AM
Talking to USB HID ectech Programming 0 12-30-2003 11:50 AM
USB hid.o hijacking my USB Printer Relativity Linux - Hardware 0 12-09-2003 09:56 PM
Usb-hid RanmaPhreak79 Linux - Hardware 1 07-18-2003 09:32 PM
Usb + Hid vexer Slackware 4 05-28-2003 10:46 PM


All times are GMT -5. The time now is 06:28 PM.

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