On Thu, 4 May 2017, Andreas Hartmann wrote: > Am 04.05.2017 um 20:01 schrieb Alan Stern: > > On Thu, 4 May 2017, Andreas Hartmann wrote: > [...] > >> echo 1 > /sys/block/sdh/device/delete removes the device from the list > >> of available devices. You have to replug the device again to see the > >> initial entry again. > > > > How would that work with the card reader? You can't replug it because > > it's built in. > > It's the sdcard, which is replugged - not the card reader itself. Actually /sys/block/sdh/device refers to a logical device corresponding to the card reader. > I'm just doing this sequence - nothing more: > > plug in the sdcard: > > May 04 22:01:03 notebook2 kernel: usb 1-1.1: new high-speed USB device number 16 using ehci-pci > May 04 22:01:03 notebook2 kernel: usb 1-1.1: New USB device found, idVendor=0cf2, idProduct=6250 > May 04 22:01:03 notebook2 kernel: usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=4 > May 04 22:01:03 notebook2 kernel: usb 1-1.1: Product: UB6250 > May 04 22:01:03 notebook2 kernel: usb 1-1.1: Manufacturer: ENE Flash > May 04 22:01:03 notebook2 kernel: usb 1-1.1: SerialNumber: 606569746801 > May 04 22:01:03 notebook2 kernel: ums_eneub6250 1-1.1:1.0: USB Mass Storage device detected > May 04 22:01:03 notebook2 kernel: scsi host6: usb-storage 1-1.1:1.0 > May 04 22:01:03 notebook2 mtp-probe[7021]: checking bus 1, device 16: "/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1" > May 04 22:01:03 notebook2 mtp-probe[7021]: bus: 1, device: 16 was not an MTP device > May 04 22:01:04 notebook2 kernel: usb 1-1.1: direct-loading ene-ub6250/sd_init1.bin > May 04 22:01:04 notebook2 kernel: usb 1-1.1: direct-loading ene-ub6250/sd_init2.bin > May 04 22:01:04 notebook2 kernel: scsi 6:0:0:0: Direct-Access USB2.0 CardReader 0100 PQ: 0 ANSI: 2 > May 04 22:01:04 notebook2 kernel: sd 6:0:0:0: [sdb] 3985408 512-byte logical blocks: (2.04 GB/1.90 GiB) > May 04 22:01:04 notebook2 kernel: sd 6:0:0:0: Attached scsi generic sg2 type 0 > May 04 22:01:04 notebook2 kernel: sd 6:0:0:0: [sdb] Write Protect is off > May 04 22:01:04 notebook2 kernel: sd 6:0:0:0: [sdb] Mode Sense: 0b 00 00 08 > May 04 22:01:04 notebook2 kernel: sd 6:0:0:0: [sdb] No Caching mode page found > May 04 22:01:04 notebook2 kernel: sd 6:0:0:0: [sdb] Assuming drive cache: write through > May 04 22:01:04 notebook2 kernel: usb 1-1.1: direct-loading ene-ub6250/sd_rdwr.bin > May 04 22:01:04 notebook2 kernel: sdb: sdb1 > May 04 22:01:04 notebook2 kernel: sd 6:0:0:0: [sdb] Attached SCSI removable disk > > Afterward do nothing - no mount. The GUI device manager tells, > that there is one device with one partition, that could be mounted. But I don't do it. > > Then: > echo 1 > /sys/block/sdb/device/delete > > -> The device entry in the device manager is removed - the device manger > is empty again. No log entry in /var/log/messages can be seen so far. > > Next action is to remove the sdcard out of the slot. This action > produces this message in /var/log/messages: > > May 04 22:01:33 notebook2 kernel: usb 1-1.1: USB disconnect, device number 16 Ah, I see. The card reader disconnects itself from the USB bus when there is no card inserted. This means you shouldn't even need to write to /sys/block/sdb/device/delete; after unmounting all you have to do is remove the card. Then the device manager should see that it is gone. > If you replug the sdcard, things start again as shown with the first logentry above: > > May 04 22:01:03 notebook2 kernel: usb 1-1.1: new high-speed USB device number 16 using ehci-pci > ... Right; the card reader reconnects to the USB bus. > >> Iow: the echo 1 > /sys/block/sdh/device/delete is missing or gets > >> "overwritten" by the rescan. > > > > It probably is not missing. > > > > I don't know what causes the rescan to happen. But then, I also don't > > know how your system would normally tell when a new card was inserted > > after writing to /sys/block/sdh/device/delete. Maybe the GUI writes to > > /sys/class/scsi_host/hostN/scan, with the appropriate value for N. > > I don't think so. There have been no GUI interaction taken place > during the test I described above - the GUI even was disabled completely. > And this part has always been working perfectly :-) It still must be true that when you click on the Remove button, something causes the card reader to be rescanned. But if you don't click that button, and just remove the card, then everything should work fine. Alan Stern > >>> Bear in mind that the eneub6250 driver does not detect card removal > >>> correctly. If you want to change cards, the best approach would be to > >>> do a "safely remove hardware" and then unplug the reader from the > >>> computer and replug it with the new card inserted. > >> > >> That's not possible as it is a build in reader. And there wasn't any > >> problem before these changes. > > > > It is possible to deconfigure the card reader and then reconfigure it: > > > > (first do the unmount) > > echo 0 >/sys/bus/usb/devices/1-1.1/bConfigurationValue > > (remove the card and insert a new one) > > echo 1 >/sys/bus/usb/devices/1-1.1/bConfigurationValue > > > > Probably this issue could be fixed by changing the way the driver > > implements TEST UNIT READY. But since I don't know how the card reader > > works, I don't know how to make the necessary changes. Maybe the > > person who originally wrote this driver can help. > > It's not necessary to do these actions after a delete > has taken place as I described above. > > > Thanks, > kind regards, > Andreas -- 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