I am attempting to use libusb in order to work with a usb device (an
Ocean Optics HR2000 Spectrometer) on a TS-7260 board. I have some
code that should initialize the usb busses and find the correct device
but it does not work in the TS-Linux. The following is that code:
/* test the usb bus structure using libusb */
#include<stdio.h>
#include<usb.h>
main (int argc, char *argv) {
struct usb_bus *bus;
int c, i, a;
struct usb_bus *busses;
usb_init();
usb_find_busses();
printf("number of devices = %d\n",usb_find_devices());
busses = usb_get_busses();
for (bus = busses; bus; bus = bus->next) {
struct usb_device *dev;
for (dev = bus->devices; dev; dev = dev->next) {
printf("device vendor id = 0x%x\n",
dev->descriptor.idVendor);
printf("device product id = 0x%x\n",
dev->descriptor.idProduct);
}
}
}
This code, however, always returns:
number of devices = 0
I run this after running the loadUSBModules.sh which loads
insmod usbcore
insmod pcipool
insmod usb-ohci
insmod usb-ohci-ep93xx
insmod scsi_mod
insmod sd_mod
insmod usb-storage;
and it still finds no usb devices.
However after running the loadUSB.sh which contains:
mount /dev/scsi/host0/bus0/target0/lun0/part1 /mnt/cf
mount -t devfs devfs /mnt/cf/dev
chroot /mnt/cf /etc/init.d/rcS.USB
for I in /proc/[0-9]*; do
ls -al $I/root;
done | grep '/mnt/cf' | cut -d'/' -f3 | xargs kill -9
umount /mnt/cf/proc/bus/usb /mnt/cf/dev/pts /mnt/cf/proc /mnt/cf/dev
/mnt/cf
/etc/init.d/network start
which I guess changes root over to the usb drive, I can then run the
code from there and it will correctly find the usb devices:
number of devices = 3
device vendor id = 0x0
device product id = 0x0
device vendor id = 0x2457
device product id = 0x1002
device vendor id = 0x13fe
device product id = 0x1d00
Sorry for the lengthy message, but does anyone have any clue about
what is going on, or how I might go about figuring out what is going
on? Bear with me if I do or have done anything stupid, as I am quite
new with ARM boards (and Linux in general). Any help is greatly
appreciated.
Thanks,
Zach
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/
|