Re: Unable to safely detach external HDD on USB 3.0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08.06.2016 16:47, Mathias Nyman wrote:
On 06.06.2016 21:31, Alan Stern wrote:
On Sat, 4 Jun 2016, Marco Chiappero wrote:

On 31/05/2016 16:34, Alan Stern wrote:
On Tue, 31 May 2016, Mathias Nyman wrote:


xhci specs say that port will move from Disconnected (PLS = RX_DETECT) to
Polling if "SuperSpeed far-end receiver terminations are detected"

   From power-off state (PP=0) the connect status changes are only reported
if OCA is set so it seems that is not an option.

I'm looking at the capture log and if I understand it correcty, in frame
49 SET FEATURE, PLS = ss.disabled   (xhci will write PORT_PED bit)
59 SET FEATURE, PLS = RxDetect      (xhci will set pls=RxDetect)
.. get_port_status, nothing set, no changes reported (several of these)
73 SET FEATURE -> Port remote wake mask
.. get_port status reports Connected, enabled and port status change event

Could it be that setting the port remote wake mask somehow triggers the
connect status change event? It's the first time we write to PORTSC for
this port after setting link state to rx.detect

It's possible, but I doubt it.  More likely it just takes a few hundred
ms for the RxDetect link training to realize there is a connection.

Marco, you can check whether this is true by doing (as root):

    echo on >/sys/bus/usb/devices/usb4/power/control

before starting your test.

Alan Stern

Hi,

Sorry for my late reply but I've been very busy this week.

You can find the new captures in the same directory. Or just use the
following direct links:
https://drive.google.com/open?id=0B2tgr9hETOtgTEU1Qmc2eWNIYlE
https://drive.google.com/open?id=0B2tgr9hETOtgZUV2TkZRRGJjMWs

I could not notice any difference though. Anyway I'm happy to test
patches if you want to try changes.

The new capture proves my earlier point.  It shows the same sequence of
link-state changes as before (DISABLED -> RX_DETECT -> CONNECTED), but
the port's remote wakeup mask was not set.

As far as I can tell, USB-3 does not have any link state that will
avoid negotiating a connection with a plugged-in cable but will signal
the host when the cable is unplugged.  Perhaps the best we can do is
put the link into U3 with remote wakeup disabled on the device.

Mathias, what do you think?


I found a device that I can reproduce this with, I also tried on windows and the
analyzer shows "safely remove hardware" puts it into U3

So U3 makes sense, but hub_usb3_port_disable() is used in several places in usb core,
and I'm not sure if U3 fits all of them.

Right now I'm even suspecting that the drives that auto-remount are the ones that are
working better according to the specs.


Tried a quick hack that sets link state in hub_usb3_port_disable() to U3 and return,
instead of SS_DISABLED -> RX_DETECT.

Seems to work, the mass storage no longer re-mounts after "udisks --detach"
Analyzer also shows that after unplugging the cable while device is in U3 the
device (upstream port) goes SS.Disabled, and downstream port (root hub) goes to RX_DETECT,
and new is detected again if cable is conneted back in.

-Mathias
--
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



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux