Re: Has anyone used libusb for accessing usb devices here?

2008-07-23 Thread Tijl Coosemans
On Wednesday 23 July 2008 06:20:09 Andrew Falanga wrote:
 On Tuesday 22 July 2008 08:38:58 Lowell Gilbert wrote:
 Andrew Falanga [EMAIL PROTECTED] writes:
 I'd like to know if anyone here on the list has ever used libusb
 (http://libusb.sourceforge.net) for accessing usb devices.  I
 successfully compiled and installed it on my FreeBSD 7 laptop but
 when I run a test program no USB HUBs are found.  The same test on
 a Fedora box works fine.  I was wondering what the magic is for
 FreeBSD since the web site claims the package works on FreeBSD.

 libusb is in ports, and a number of other ports use it.
 (See make search key=libusb.)
 That should provide a variety of working examples.
 
 Ok, I've installed from the ports collection this time (at home now
 on my 6.2p11 box) and I'm seeing busses in my computer.  However,
 when I plug in my USB thumb drive, a Sandisk Cruizer Micro that the
 kernel does see as da0 (verified in /var/log/messages), I don't get
 any devices shown.

I'm not entirely sure, but it's possible it only shows ugen devices.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Has anyone used libusb for accessing usb devices here?

2008-07-22 Thread Andrew Falanga
Hi,

I'd like to know if anyone here on the list has ever used libusb
(http://libusb.sourceforge.net) for accessing usb devices.  I
successfully compiled and installed it on my FreeBSD 7 laptop but when
I run a test program no USB HUBs are found.  The same test on a Fedora
box works fine.  I was wondering what the magic is for FreeBSD since
the web site claims the package works on FreeBSD.

Thanks,
Andy

-- 
 A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Has anyone used libusb for accessing usb devices here?

2008-07-22 Thread Lowell Gilbert
Andrew Falanga [EMAIL PROTECTED] writes:

 I'd like to know if anyone here on the list has ever used libusb
 (http://libusb.sourceforge.net) for accessing usb devices.  I
 successfully compiled and installed it on my FreeBSD 7 laptop but when
 I run a test program no USB HUBs are found.  The same test on a Fedora
 box works fine.  I was wondering what the magic is for FreeBSD since
 the web site claims the package works on FreeBSD.

libusb is in ports, and a number of other ports use it.
(See make search key=libusb.)
That should provide a variety of working examples.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Has anyone used libusb for accessing usb devices here?

2008-07-22 Thread Andrew Falanga
On Tue, Jul 22, 2008 at 8:38 AM, Lowell Gilbert
[EMAIL PROTECTED] wrote:
 Andrew Falanga [EMAIL PROTECTED] writes:

 I'd like to know if anyone here on the list has ever used libusb
 (http://libusb.sourceforge.net) for accessing usb devices.  I
 successfully compiled and installed it on my FreeBSD 7 laptop but when
 I run a test program no USB HUBs are found.  The same test on a Fedora
 box works fine.  I was wondering what the magic is for FreeBSD since
 the web site claims the package works on FreeBSD.

 libusb is in ports, and a number of other ports use it.
 (See make search key=libusb.)
 That should provide a variety of working examples.


Well, I feel like a total bafoon.  I searched yesterday for it at
freshports.org and turned up nothing.  The reason: I was searching for
usblib rather than libusb.  How incredibly frustrating.

Thanks,
Andy

-- 
 A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Has anyone used libusb for accessing usb devices here?

2008-07-22 Thread Andrew Falanga
On Tuesday 22 July 2008 08:38:58 Lowell Gilbert wrote:
 Andrew Falanga [EMAIL PROTECTED] writes:
  I'd like to know if anyone here on the list has ever used libusb
  (http://libusb.sourceforge.net) for accessing usb devices.  I
  successfully compiled and installed it on my FreeBSD 7 laptop but when
  I run a test program no USB HUBs are found.  The same test on a Fedora
  box works fine.  I was wondering what the magic is for FreeBSD since
  the web site claims the package works on FreeBSD.

 libusb is in ports, and a number of other ports use it.
 (See make search key=libusb.)
 That should provide a variety of working examples.

Ok, I've installed from the ports collection this time (at home now on my 
6.2p11 box) and I'm seeing busses in my computer.  However, when I plug in my 
USB thumb drive, a Sandisk Cruizer Micro that the kernel does see as da0 
(verified in /var/log/messages), I don't get any devices shown.  Below is the 
code to the program I'm using.  It's a hack of the basic example on the 
libusb.sourceforge.net website docs.

#include iostream


#include usb.h

int main(void) {
   usb_init();

   struct usb_bus *busses;

   usb_init();
   usb_find_busses();
   usb_find_devices();

   busses = usb_get_busses();
   if(busses)
  std::cout  we found some busses  std::endl;
   else
  std::cout  no busses were found  std::endl;

   struct usb_bus *bus;
   int c, i, a, bussCount(0);

   /* ... */

   for (bus = busses; bus; bus = bus-next) {
  std::cout  enumerating buss:   ++bussCount  std::endl;
  struct usb_device *dev;

  // loop through each device and display its vid pid
  for (dev = bus-devices; dev; dev = dev-next) {
 struct usb_device_descriptor* pUsbDev = dev-descriptor;

 if(pUsbDev-bDeviceClass == 0x09)
std::cout  Device is a HUB\n;
 if(pUsbDev-bDeviceClass == 0x07)
std::cout  Device is a printer:\n;
 if(pUsbDev-bDeviceClass == 0x08)
 std::cout  Device is a mass storage device:\n;
 std::cout  Device Class: 
(int)pUsbDev-bDeviceClass  std::endl;
 std::cout  VID: 
std::dec  pUsbDev-idVendor   
std::hex  pUsbDev-idVendor  std::endl;
 std::cout  PID: 
std::dec  pUsbDev-idProduct   
std::hex  pUsbDev-idProduct   std::endl;

 if(dev-num_children  0) {
struct usb_device* pChild = *(dev-children);
while(pChild) {
   std::cout  Childs device class: 
  std::dec  pChild-descriptor.bDeviceClass
   
  std::hex  pChild-descriptor.bDeviceClass
  std::endl;

   pChild = pChild-next;
}
 }
  }
   }

   return 0;
}

Any ideas why I'm not seeing any devices?

Andy
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]