Re: number of /dev/usb nodes



On Sun, Jun 08, 2008 at 10:16:26AM -0400, Chuck Robey wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bernd Walter wrote:
On Sat, Jun 07, 2008 at 01:18:41PM -0400, Chuck Robey wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I can't seem to find how many /dev/usbN bus devices there can be. I'm writing
some code that scans them all looking for anything that has my device, but I
while I know to start at usb0, just how high do I go? There seem to be 128
device minors, is that the number? (from dev/usb/usb.h)

There shouldn't be a limit anymore.
I can't see any definition of 128 in usb.h that limits the number of
busses.
The major/minor differenciation is long time ago.
You must be looking at old code.


I was trying to find a good way to do scanning, whjen I create the files like
/dev/usb0, how far to go in my loop? Does the lowest available device always
get created? That would imply that as soon as I began to get "No such device"
errors, I could stop iterating. If the rules for picking device filenames are
pretty loose, then I could (for instance) stop scanning, say, 4 numbers past the
first "No such device" returnee.

This wouldn't work if a USB controller is remove - e.g. a pulling a
cardbus card.

Any idea on this? I didn't see this i nthe code, but I just need some sane
limit on what filenames to scan about in. I look for item info, and if the usb
vendor and prodict look friendly, I just snag the filename involved, and use
that. Like, a scan of the usb1 bus might yield me a uhid0 which might be my
meat, whereupon I coulld drop the usb1 open, and replace it with a uhid0 open.
There's more than 1 place that my devices could show, depending on the user's
kernel devices. I just want to have some sane limit on how many usb buses I
open for my scanning.

I never had to deal with this, since writing a USB driver is simple and
as a driver you get informed for each new device.
No need to scan the busses yourself.
But I would say that the most reliable way is to just scan /dev/ for
usb...

--
B.Walter <bernd@xxxxxxx> http://www.bwct.de
Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: number of /dev/usb nodes
    ... Hash: SHA1 ... I can't seem to find how many /dev/usbN bus devices there can be. ... I'm writing ... There shouldn't be a limit anymore. ...
    (freebsd-hackers)
  • number of /dev/usb nodes
    ... Hash: SHA1 ... I can't seem to find how many /dev/usbN bus devices there can be. ... I'm writing ... Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org ...
    (freebsd-hackers)
  • dead USB devices after resume [mmotm 2009-02-10-16-35]
    ... when I resume from suspend, USB mouse and kbd are not responding anymore, no ... -PERCPU: Allocating 49152 bytes of per cpu data ... HDA Intel 0000:00:1b.0: setting latency timer to 64 ... writing 0x2900001) ...
    (Linux-Kernel)
  • libata: cdrw/dvdrom disabed after s2ram (2.6.24-rc2)
    ... USB Universal Host Controller Interface driver v3.0 ... Bluetooth: HCI device and connection manager initialized ... PM: Writing back config space on device 0000:00:1d.0 at offset f ...
    (Linux-Kernel)
  • Re: [opensuse] 10.1,10.2 usb drive, external harddisk: bad performancewith ext3 or reiser
    ... I have a problem getting the performance up when writing to an external harddisk, connected via usb 2.0. ... CASE 2, "default" writing to the usb hdd, one can replace dd with cp or tar at will, the figures ...
    (SuSE)