# USB device still remains connected when unplugged

## _michael

Hi all

Recently after update I noticed that notifications disppeared for my USB HDD when I'm unplugging it from a laptop. I looked at dmesg output and noticed that this is because my system still thinks that device is plugged into USB port.

Here is dmesg output with my comments after I inserted device, then unplugged and then inserted again after several seconds delay.

```

/**********here is output after insert:  ******/

[165484.079191] usb 4-1: USB disconnect, device number 12

[165484.164779] usb 4-1: Set SEL for device-initiated U1 failed.

[165484.164783] usb 4-1: Set SEL for device-initiated U2 failed.

[165484.383708] usb 4-1: new SuperSpeed USB device number 13 using xhci_hcd

[165488.283393] usb 4-1: New USB device found, idVendor=174c, idProduct=5106

[165488.283404] usb 4-1: New USB device strings: Mfr=2, Product=3, SerialNumber=1

[165488.283410] usb 4-1: Product: StoreJet Transcend

[165488.283415] usb 4-1: Manufacturer: StoreJet Transcend

[165488.283420] usb 4-1: SerialNumber: S2S6J9BC703914      

[165488.284700] scsi21 : usb-storage 4-1:1.0

[165489.291949] scsi 21:0:0:0: Direct-Access     StoreJet Transcend        2AR1 PQ: 0 ANSI: 2 CCS

[165489.294063] sd 21:0:0:0: [sdb] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB)

[165489.294343] sd 21:0:0:0: [sdb] Write Protect is off

[165489.294355] sd 21:0:0:0: [sdb] Mode Sense: 23 00 00 00

[165489.294622] sd 21:0:0:0: [sdb] No Caching mode page present

[165489.294627] sd 21:0:0:0: [sdb] Assuming drive cache: write through

[165489.298542] sd 21:0:0:0: [sdb] No Caching mode page present

[165489.298550] sd 21:0:0:0: [sdb] Assuming drive cache: write through

[165489.330636]  sdb: sdb1 sdb2 sdb3 sdb4

[165489.333084] sd 21:0:0:0: [sdb] No Caching mode page present

[165489.333093] sd 21:0:0:0: [sdb] Assuming drive cache: write through

[165489.333100] sd 21:0:0:0: [sdb] Attached SCSI disk

[165490.109638] EXT4-fs (sdb2): warning: maximal mount count reached, running e2fsck is recommended

[165490.110040] EXT4-fs (sdb2): recovery complete

[165490.110046] EXT4-fs (sdb2): mounted filesystem with ordered data mode. Opts: (null)

[165490.896337] FAT-fs (sdb1): utf8 is not a recommended IO charset for FAT filesystems, filesystem will be case sensitive!

/**********here I had unplugged a device. No new messaged by dmesg  ******/

/**********here are new messages appeared after I'd inserted device again  ******/

[165562.992488] usb 4-1: USB disconnect, device number 13     /**** only here system realizes that device is disconnected ****/

[165563.061720] usb 4-1: Set SEL for device-initiated U1 failed.

[165563.061725] usb 4-1: Set SEL for device-initiated U2 failed.

[165563.288174] usb 4-1: new SuperSpeed USB device number 14 using xhci_hcd /*** and trying to recognize attached device **//

[165567.207362] usb 4-1: New USB device found, idVendor=174c, idProduct=5106

[165567.207373] usb 4-1: New USB device strings: Mfr=2, Product=3, SerialNumber=1

[165567.207380] usb 4-1: Product: StoreJet Transcend

[165567.207385] usb 4-1: Manufacturer: StoreJet Transcend

[165567.207389] usb 4-1: SerialNumber: S2S6J9BC703914      

[165567.208319] scsi22 : usb-storage 4-1:1.0

[165568.215241] scsi 22:0:0:0: Direct-Access     StoreJet Transcend        2AR1 PQ: 0 ANSI: 2 CCS

[165568.216308] sd 22:0:0:0: [sdb] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB)

[165568.216580] sd 22:0:0:0: [sdb] Write Protect is off

[165568.216584] sd 22:0:0:0: [sdb] Mode Sense: 23 00 00 00

[165568.216830] sd 22:0:0:0: [sdb] No Caching mode page present

[165568.216837] sd 22:0:0:0: [sdb] Assuming drive cache: write through

[165568.219412] sd 22:0:0:0: [sdb] No Caching mode page present

[165568.219419] sd 22:0:0:0: [sdb] Assuming drive cache: write through

[165568.249611]  sdb: sdb1 sdb2 sdb3 sdb4

[165568.251074] sd 22:0:0:0: [sdb] No Caching mode page present

[165568.251082] sd 22:0:0:0: [sdb] Assuming drive cache: write through

[165568.251088] sd 22:0:0:0: [sdb] Attached SCSI disk

[165570.101114] FAT-fs (sdb1): utf8 is not a recommended IO charset for FAT filesystems, filesystem will be case sensitive!

[165570.159427] EXT4-fs (sdb2): warning: maximal mount count reached, running e2fsck is recommended

[165570.159739] EXT4-fs (sdb2): recovery complete

[165570.159743] EXT4-fs (sdb2): mounted filesystem with ordered data mode. Opts: (null)

/**** here I disconnected device again and nothing happened ****/

```

So it seems the issue is with USB driver, but I don't know how to fix it. So any help will be appreciated. Also the issue appears only with my USB 3.0 HDD. When I'm connecting and disconnecting my USB 2.0 flash drive it is working fine and dmesg reports it correctly. Also here is my .config: 

```
http://codepad.org/mJxQQxSN
```

----------

## avx

Never seen that before, but just to be sure, you did properly unmount the drive before pulling the plug?

----------

## _michael

Thanks for response.

Actually I'm never doing this, because udisks is mounting my flash drives with sync option, and as I understand that means I can safely unplug the devices, because data is synced and no unsaved data exists. And previously that was working fine, but after update things got broken.

----------

