ts-7000
[Top] [All Lists]

Re: [ts-7000] libusb

To:
Subject: Re: [ts-7000] libusb
From: Dino Sbrocca <>
Date: Thu, 6 Jul 2006 09:17:50 -0400 (EDT)
Anand,

Attached you will find the source for the test program.  Here is the output that I get when I run it on the TS7260 with the 1_Wire USB interface plugged in:

$ /usr/bin/loadUSBModules.sh
Using /lib/modules/2.4.26-ts9/kernel/drivers/usb/usbcore.o
Using /lib/modules/2.4.26-ts9/kernel/arch/arm/common/pcipool.o
Using /lib/modules/2.4.26-ts9/kernel/drivers/usb/host/usb-ohci.o
Using /lib/modules/2.4.26-ts9/kernel/drivers/usb/host/usb-ohci-ep93xx.o
Using /lib/modules/2.4.26-ts9/kernel/drivers/scsi/scsi_mod.o
Using /lib/modules/2.4.26-ts9/kernel/drivers/scsi/sd_mod.o
Using /lib/modules/2.4.26-ts9/kernel/drivers/usb/storage/usb-storage.o
$ mount -t usbdevfs none /proc/bus/usb
$ ./tstusb
Initializing USB subsystem
Finding buses
Finding devices
bus/device  idVendor/idProduct
001/001     0000/0000
001/002     04FA/2490
Found DS2490 device #1 at 001/002
*** END ***

Anand S Madhusoodanan <> wrote:
Hi,

I would really appreciate it if you could send me some source code. I shall try out what you said and chances are it is not going to work the first time for me. So I shall get back to you with doubts that I am sure to come up with.

Thanks a lot for this information. It has really helpded me a lot.

Regards
Anand S Madhusoodanan

Dino Sbrocca <> wrote:
I use libusb to communicate with a USB interface chip to a 1-Wire network.  I'm certainly not a linux expert but, the following may help.

To install libusb on the TS7260 I downloaded the source to libusb to a host linux machine and cross compiled it using the following commands:

CC=arm-linux-gcc ./configure --prefix=/usr/local/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux --program-prefix=arm-linux- --host=arm-pc-linux-gnu
make
make install

I then ftp'ed the .so file to the TS7260 and set the proper authorities.

To run a test program, I first load the USB modules on the TS7260 with TS's /usr/bin/loadUSBModules.sh script and then mount the USB file system with the following command:

mount -t usbdevfs none /proc/bus/usb

The test program was cross compiled on the host and then ftp'ed to the TS7260.  The test program just reads through the buses and devices recognized by the kernal and dumps them to the console.  It's a reasonably good test that you've loaded all the software properly.  Send me an e-mail if you want the source.

Dino





  

Anand S Madhusoodanan <> wrote:
Hi,

Has anyone used libusb on the TS7260? Any comments on how to go about using that package on the board would be greatly appreciated.

Regards
Anand S Madhusoodanan
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com



How low will we go? Check out Yahoo! Messenger?s low PC-to-Phone call rates.

__._,_.___


SPONSORED LINKS
Linux os Hardware Arms
Computer internet Computer security Computer hardware security


YAHOO! GROUPS LINKS




__,_._,___
#include <usb.h>
#include <stdio.h>
#include <stdlib.h>

#ifndef MAX_PORTNUM
   #define MAX_PORTNUM    16
#endif

int main(int argc, char **argv)
{
   struct usb_dev_handle *usb_dev_handle_list[MAX_PORTNUM];
   struct usb_device *usb_dev_list[MAX_PORTNUM];
   int usb_num_devices = -1;

   struct usb_bus *bus;
   struct usb_bus *busses;
   struct usb_device *dev;

        printf("Initializing USB subsystem\n");
        usb_init();
        // printf("Seting debug\n");
        // usb_set_debug(0);
        printf("Finding buses\n");
        usb_find_busses();
        busses = usb_get_busses();
        
        printf("Finding devices\n");
        usb_find_devices();
        
        printf("bus/device  idVendor/idProduct\n");
        for (bus = busses; bus; bus = bus->next) {
                for (dev = bus->devices; dev; dev = dev->next) {
                        printf("%s/%s     %04X/%04X\n", bus->dirname, 
dev->filename,
                                        dev->descriptor.idVendor, 
dev->descriptor.idProduct);
                        if (dev->descriptor.idVendor == 0x04FA &&
                                        dev->descriptor.idProduct == 0x2490) {
                                printf("Found DS2490 device #%d at %s/%s\n", 
++usb_num_devices + 1,
                                                bus->dirname, dev->filename);
                                usb_dev_list[usb_num_devices] = dev;
                        }
                }
        }

        printf("*** END ***\n");

}

<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