On Sunday, September 18, 2011 07:54:00 AM Greg KH did opine: > On Sun, Sep 18, 2011 at 01:01:59AM -0400, gene heskett wrote: > > Hi all; > > > > I just had to reboot in order to get my usb stuff properly enumerated > > again, a power bump that killed an unprotected hub for 2 seconds > > caused everthing on that hub to be lost. And when I replugged the > > cables in order to trigger new discovery, the ttyUSB# changed from 1 > > to 2, which in turn killed 2 of my scripts. > > > > So 3 questions: > > > > 1. will we ever, what, 13 years after usb is everywhere, have a > > consistent discovery & enumeration process? > > No, that's not how it is designed. If you are assuming that it somehow > is consistent, then your assumption is completly wrong. > > Heck, PCI isn't consistent, how could USB ever be? > > > 2. Is there some way I can rewrite my scripts to find the device > > regardless of its being assigned /dev/ttyUSB1 or /dev/ttyUSB2, and > > can the same technique reliably find an Epson NX515 and Brother > > HL2140 printers? > > Yes, use the proper tools that give you this information. > > For ttyUSB devices, use /dev/serial/ links that udev creates. I see: [gene@coyote ~]$ ls -l /dev/serial/by-path total 0 lrwxrwxrwx 1 root root 13 Sep 18 00:23 pci-0000:00:02.1- usb-0:1.1.4.4.3:1.0-port0 -> ../../ttyUSB1 lrwxrwxrwx 1 root root 13 Sep 18 00:23 pci-0000:00:02.1-usb-0:1.3:1.0-port0 -> ../../ttyUSB0 and: [gene@coyote ~]$ ls -l /dev/serial/by-id total 0 lrwxrwxrwx 1 root root 13 Sep 18 00:23 usb- FTDI_USB_FAST_SERIAL_ADAPTER_FTOOS09N-if00-port0 -> ../../ttyUSB0 lrwxrwxrwx 1 root root 13 Sep 18 00:23 usb- FTDI_USB_HS_SERIAL_CONVERTER_FTDHG43V-if00-port0 -> ../../ttyUSB1 (this is after the reboot, so the enumeration is now correct) Either of those would appear to link the device plugged in, to a fixed usb bus address or name, right? That I can try. Thanks. > For your USB printers, use the usb printer symlinks that udev creates, > or that CUPS can create manually for you. And those don't seem to make sense as there are only 2 printers: lrwxrwxrwx 1 root root 7 Sep 18 00:23 usblp2 -> usb/lp2 lrwxrwxrwx 1 root root 7 Sep 18 00:23 usblp3 -> usb/lp3 [gene@coyote ~]$ ls -l /dev/usb total 0 crw------- 1 root root 180, 0 Sep 18 00:23 hiddev0 crw------- 1 root root 180, 1 Sep 18 00:23 hiddev1 crw-rw----+ 1 lp sys 180, 2 Sep 18 00:23 lp2 crw-rw----+ 1 lp sys 180, 3 Sep 18 00:23 lp3 Using a distro's kernel, parport is enabled, which is not physically used but the /dev listing includes lp0 and lp1, I assume because the parport and parport_pc has created them. I'll see if I can blacklist parport. > > 3. Is there a way to do a cold 'restart' the USB subsystem, to make it > > do the equ of a reboot, without having to reboot the whole machine? > > I have enough custom scripts running here that a full restart takes > > at least an extra 10-15 minutes for the stuff that can't be put in > > rc.local because X isn't running when that file is sourced. > > Unload the usb host controller drivers and then reload them. > > Note, there are some well-known bugs when unloading some usb host > controller drivers that can cause oopses if data is flowing at the > moment, so you might not want to rely on this all that much. > As I found some time back when I tried that. Locked things up & had to use the hdwe reset button to reboot anyway. Keyboard & rodent are wireless- >usb port so any successful method would have to be scripted. Sigh. > good luck, > > greg k-h Thanks Greg. Cheers, gene -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) A cynic is a person searching for an honest man, with a stolen lantern. -- Edgar A. Shoaff -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html