ts-7000
[Top] [All Lists]

[ts-7000] Re: Reading Generic HID device in TS7800 from "C"

To:
Subject: [ts-7000] Re: Reading Generic HID device in TS7800 from "C"
From: "wildpossum928" <>
Date: Mon, 03 Jan 2011 05:40:01 -0000



--- In  "tommessum" <> wrote:
>
> 
> I have a HID compliant Wi_Spy USB plug-in stick module. However I cannot 
> manage to read the device HID reports from my C program whatever I try. I 
> have written software for this device using Windows before, so I suspect the 
> problem lies mainly in the linux setting up. 
>  
> Here are some of the steps I tried, I am sure I must be missing something, 
> any ideas?  (The target is running the standard Debian off-the-peg TS7800 
> installation)   
> 
> (1) With the stick plugged in, entering 'lsusb' on the console returns:
> 
> Bus 002 Device 002: ID 1781:083e
> Bus 002 Device 001: ID 0000:0000
> Bus 001 Device 001: ID 0000:0000 
> 
> Which tells me the stick is present and working. 
> 
> 
> (2) entering "cat /proc/bus/usb/devices" also tells me the stick is present 
> and working as I can get all sort of details about it. 
> 
> 
> (3) Then I entered  "mknod /dev/usb/hid/hiddev0 c 180 96"  as suggested by 
> various web articles (all the way to "hiddev15 c 180 111" ) 
> 
> (4) From what I understand from the app notes, opening one of the  above 
> files e.g. "hiddev0" and calling ioctl functions with arguments such as 
> HIDIOCGDEVINFO should return information about the stick, plus actual data 
> reports. I am familiar with this side of HID from my Windows programming.
> 
> (5) However, I cannot open file "/dev/usb/hid/hiddev0" at all, I get a -1 
> error (or any of the others: hiddev0-15) 
> 
> 
> (6) Doing a console "file" on hiddev0 returns "hiddev0: character special 
> (180/96)" So something exists! 
> 
> (7) Having said all that, I can programmatically open file 
> "/dev/bus/usb/001/002" and even call ioclt() on it, but the report contents I 
> get back are meaningless
> 
> Any ideas what I may be doing wrong?
>



Have a look at how your kernel sees the USB stick by using command
"sudo tail -n 50 /var/log/syslog | grep [Uu][Ss][Bb]" and you should get
something like follows:

kernel: [  314.990070] usb 2-2: new high speed USB device using ehci_hcd
and address 3
kernel: [  315.225681] Initializing USB Mass Storage driver...
kernel: [  315.225987] scsi11 : usb-storage 2-2:1.0
kernel: [  315.226235] usbcore: registered new interface driver
usb-storage
kernel: [  315.226242] USB Mass Storage support registered.
kernel: [  316.222163] scsi 11:0:0:0: Direct-Access     Easy     Disk
2.00 PQ: 0 ANSI: 2
kernel: [  316.223151] sd 11:0:0:0: Attached scsi generic sg4 type 0
kernel: [  317.290376] ready
kernel: [  317.291013] sd 11:0:0:0: [sdd] 2048000 512-byte logical
blocks: (1.04 GB/1000 MiB)
kernel: [  317.291754] sd 11:0:0:0: [sdd] Write Protect is off
kernel: [  317.296389]  sdd: sdd1
kernel: [  317.300629] sd 11:0:0:0: [sdd] Attached SCSI removable disk g


Now we know the kernel sees the USB stick as device /dev/sdd.

You need to:

1> Add a supported partition type to the USB stick.
"sudo fdisk /dev/sdd" and partition appropriately

2> Add a supported File System to on that partition via using
mkfs - build a Linux file system (see the man page).
say if you want e2fs, "sudo mkfs.ext2 /dev/sdd"

3> have your usb stick mounted;
i.e.: as root  "mount -t ext2 /dev/sdd1 /media/mystick" where mystick is
what ever directory name you want the stick mounted to.

Now, once your done this, you should have no problem running your C
program. Of course, you only need to do action <3> ever after unless to
change the usb stick partition or the file system format.

Hope this assists.
Cheers.



------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU