# USB subsystem reset



## YuryG (Sep 3, 2016)

I have a long lasting USB devices problem on my AMD 760G (780L)/SB710 chipset motherboard (ASUS M5A78L-M/USB3, also was the same with other AMD chipset motherboards) (even left some PRs in bugs system on that problem). That is, I have an old phone that when charged or otherwise connected via USB cable, did not manage to disconnect gracefully. It leaves (zombie?) devices in /dev/da*. After that happened when I insert some flash stick on the attempt of mounting it the system says: 
	
	



```
mount_msdosfs: /dev/da2s1: Device not configured
```
 (Note, it has number 2 hanging after the stick, as 0 and 1 are left after the disconnected phone internal memory and memory card.) The same also sometimes happen with some Kingston sticks trying to mount them for the second time (after unmounting and disconnecting previously) even without the phone previously connected.
Even no messages appear on inserting flash sticks. So, I can't use USB sticks after that. Hopefully, USB mouse still works.

So, the question is: can I somehow reset USB subsystem not rebooting the whole system? (Because I am not hoping to have that bug fixed in the nearest future being open for years.)


----------



## Juha Nurmela (Sep 3, 2016)

You must know about `usbconfig reset` and `camcontrol reset`, but if not ...

Juha


----------



## YuryG (Sep 4, 2016)

Well, probably I have known this. But `usbconfig reset` just hangs (luckily could be interrupted by Ctrl+C), and `camcontrol devlist` doesn't list any USB devices, only my SATA discs. That is why I do not remember about these commands.


----------



## Juha Nurmela (Sep 4, 2016)

That's funny... I do see usb disks via cam.

```
# camcontrol devlist
<INTEL SSDSA2CW080G3 4PC10302>  at scbus0 target 0 lun 0 (ada0,pass0)
<hp DVDRAM GT30L mP04>  at scbus1 target 0 lun 0 (pass1,cd0)
<AHCI SGPIO Enclosure 1.00 0001>  at scbus3 target 0 lun 0 (pass2)
<PNY USB 2.0 FD 1100>  at scbus4 target 0 lun 0 (da0,pass3)
```
 Last one is a memory stick. On 32bit 10.3 i386.

Juha


----------



## YuryG (Sep 8, 2016)

Juha Nurmela said:


> That's funny... I do see usb disks via cam.


Well, yes, you are right. When they are real devices, and not hanging and disconnected ones, they are listed in `camcontrol devlist`. For example (notice the numbering, there's no da0, da1, da2, also pass6, pass7, pass8): 
	
	



```
<ST3160813AS CC2H>  at scbus0 target 0 lun 0 (pass0,ada0)
<ST3160813AS CC2H>  at scbus1 target 0 lun 0 (pass1,ada1)
<WDC WD5000AADS-00S9B0 01.00A01>  at scbus2 target 0 lun 0 (pass2,ada2)
<WDC WD10EZRX-00L4HB0 01.01A01>  at scbus3 target 0 lun 0 (pass3,ada3)
<WDC WD30EZRZ-00Z5HB0 80.00A80>  at scbus4 target 0 lun 0 (pass4,ada4)
<Optiarc DVD RW AD-7200S 1.0A>  at scbus5 target 0 lun 0 (pass5,cd0,sg0)
<JetFlash TS1GJFV60 8.07>  at scbus9 target 0 lun 0 (sg4,da3,pass9)
```
. Also I've noted that USB outlets are not dying simultaneously always. At first it it the one used, then the second used… That is how I could insert that third USB flash stick in the not used before USB outlet.


----------



## YuryG (Sep 18, 2016)

Found my long lasting PR 192375. Not too much changed...


----------



## Snurg (Sep 18, 2016)

Kingston stuff should be better avoided imho. See a typical story about them: https://www.bunniestudios.com/blog/?page_id=1022

You might get the stick work using quirks in the boot hints. See here for example.


----------



## YuryG (Sep 19, 2016)

Well, now (and two years earlier) I know that it's good to avoid Kingston sticks. And even these two sticks were given me at work… (by the way, their DDR memory is rather good, its cheap and even recommended by motherboard makers). Quirks are too difficult for me for now. Too few explanation and I'm not sure what to probe.

But anyway, FreeBSD's USB subsystem shouldn't die, despite the quality of devices connected to it.


----------



## Snurg (Sep 19, 2016)

YuryG said:


> by the way, their DDR memory is rather good, its cheap and even recommended by motherboard makers


I had very mixed experiences with Kingston DRAMs. I believe this depends.
These ones equipped with manufacturer-labeled chips were good.
However those covered (by fancy "coolers") or Kingston-labeled chips were usually of inferior quality.
Bit error rate sometimes quite high if the SPD data does not get overridden by reducing the memory clock.  (This can be achieved either by adding more modules or by BIOS settings, if the BIOS allows this)

As it is usually impossible to predict whether one gets modules equipped with genuine A-quality chips or modules with B-quality chips that the manufacturers only sell unbranded or OEM-branded because they don't want to damage their reputation, I refrained from ordering Kingston modules a long time ago already.



YuryG said:


> Quirks are too difficult for me for now. Too few explanation and I'm not sure what to probe.
> But anyway, FreeBSD's USB subsystem shouldn't die, despite the quality of devices connected to it.


I fully agree with you. It should not be necessary to dive into kludgy things like quirks to prevent (partial) kernel hangs caused by simple memsticks.


----------



## YuryG (Sep 22, 2016)

Also, I can mention that it's not solely Kingston bug. But it is in connection with AMD chipset. That is, on old Asus P5GD2 motherboard with ancient Intel ICH6R chipset on FreeBSD 10.3-STABLE i386 I have no problem with detaching the stick.


----------



## YuryG (Dec 24, 2016)

UPD. No, “old Asus P5GD2 motherboard” has bad behaviour too. After SmartBuy flash stick or my oldy “bad” Philips phone put in USB outlet, it not only hangs USB subsystem, but also make PS/2 keyboard unresponsive. Only mouse stays. Bad, bad behaviour.


----------

