Results 1 to 2 of 2
|
Enjoy an ad free experience by logging in. Not a member yet? Register.
|
|
-
05-01-2010 #1
- Join Date
- May 2010
- Posts
- 3
Reading from a USB Keyboard device
I am running Debian off a CF on a SBC board (TS-7200). I am connecting via serial ttyAM0. It has a 2.4.26 Kernel running a Sarge distro of Debian.
I am using a terminal in windows to work on the device via serial. (Tera Term)
I am trying to read the input from a keyboard usb device. However, I want to eventually be able to read from any HID device. I currently have a Dell keyboard plugged into usb.
lsusb gives:
Bus 001 Device 001: ID 0000:0000
Bus 001 Device 002: ID 413c:1003 Dell Computer Corp.
Bus 001 Device 003: ID 413c:2010 Dell Computer Corp.
I tried:
insmod pcipool.o
insmod usbcore.o
insmod usb-ohci.o
insmod usb-ohci-ep93xx.o
insmod input.o
insmod hid.o
insmod keybdev.o
and it says they are all installed under that name and gave the lib location.
So I believe my device is working correctly. If there is further verification, let me know.
Whats strange is under /dev/usb/ and /dev/input/ the keyboard is not there.
So I go to the /proc/bus/usb/ directory.
cat /proc/bus/usb/drivers
usbdevfs
hub
zd1211
hid
cat /proc/bus/usb/devices
T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 3
B: Alloc= 41/900 us ( 5%), #Int= 3, #Iso= 0
D: Ver= 1.10 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=0000 ProdID=0000 Rev= 0.00
S: Product=USB OHCI Root Hub
S: SerialNumber=e0020000
C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr= 0mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 2 Ivl=255ms
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 3
D: Ver= 1.10 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=413c ProdID=1003 Rev= 2.00
S: Manufacturer=Dell
S: Product=Dell USB Keyboard Hub
C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 1 Ivl=24ms
T: Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=413c ProdID=2010 Rev= 2.00
S: Manufacturer=Dell
S: Product=Dell USB Keyboard
C:* #Ifs= 2 Cfg#= 1 Atr=a0 MxPwr= 50mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=01 Driver=hid
E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=10ms
I: If#= 1 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver=hid
E: Ad=82(I) Atr=03(Int.) MxPS= 4 Ivl=255ms
Also under the /proc/bus/usb/ dir is the 001/ dir, which I believe is my device obviously. Under /proc/bus/usb/001/ there are 3 files 001, 002, 003 corresponding to my usb keyboard device. I am thinking that this is the datastream files? So I want to read the input of the device so I wrote the program below to read from the keyboard input but I have had no luck:
int main(int argc, char * argv[]){
while(1){
FILE *fp;
fp = fopen("/proc/bus/usb/001/003", "r");
char buff[100];
while(fscanf(fp, "%s", buff) != EOF){
printf("%s\n", buff);
}
fclose(fp);
}
return 0;
}
What is wrong? I am no Linux expert at all so I could use any help. If you need me to provide you with more information let me know.
Thanks.
-
05-01-2010 #2
- Join Date
- May 2010
- Posts
- 3
when I run that, I get a spam of "! "
I thought by holding a key would change the output. but while holding any key, I get the same output.