You are not logged in.

#1 2013-10-28 07:03:49

mityukov
Member
Registered: 2010-10-10
Posts: 66

How to downgrade selected USB port to v1 [SOLVED]

SOLUTION: https://bbs.archlinux.org/viewtopic.php … 3#p1342593


.. Or how to switch to this speed automatically, when recognizing specific device?

I've got an issue with my Android phone that it was not recognized when plugged in. dmesg displayed like this:

[ 3705.048601] usb 1-2: new high-speed USB device number 4 using ehci-pci
[ 3705.127596] ehci-pci 0000:00:12.2: port 2 reset error -110
...
[ 3705.136788] hub 1-0:1.0: hub_port_status failed (err = -32)
...
...
[ 3708.739264] hub 1-0:1.0: Cannot enable port 2.  Maybe the USB cable is bad?
[ 3708.739312] hub 1-0:1.0: unable to enumerate USB device on port 2

The phone was not recognized on Windows machines too, but once I've got it workign on my college's notebook, which, as it turned out later, was not because of his notebook, but because he had USB v1 hub. So, the phone does not work via USB v2 for some reason.

Note: it's definitely not the phone's kernel/ROM issue, because it is not recognized in fasboot mode either (that's in bootloader). But it is recognized just well in all modes when connected via that magic hub.


So, I'd like to know if I can force Archlinux to treat any device as USB v1, even if it's not automatically detected as such. Or, alternatively, to put any USB port into v1 mode.

Last edited by mityukov (2013-11-09 11:30:54)

Offline

#2 2013-10-28 20:18:02

armin
Member
From: the Caribbean. Arrr...!!!
Registered: 2007-02-26
Posts: 46

Re: How to downgrade selected USB port to v1 [SOLVED]

mityukov wrote:

[ 3708.739264] hub 1-0:1.0: Cannot enable port 2.  Maybe the USB cable is bad?

I got to ask first: you did try this with different cables, right?

mityukov wrote:

So, I'd like to know if I can force Archlinux to treat any device as USB v1, even if it's not automatically detected as such. Or, alternatively, to put any USB port into v1 mode.

No and sort of. You'd have to attach your phone to a port on a bus that comes with a companion controller.

To list all available:

ls /sys/bus/usb/devices/usb*/../companion

If you haven't got one, you're out of luck, and you'd have to resort to blacklisting the ehci-pci module, which is probably not a good idea.

If you got a corresponding controller, identify a port that is attached to that bus (try plugging an usb device into all your available ports).

e.g.:

]$ ls /sys/bus/usb/devices/usb*/../companion
/sys/bus/usb/devices/usb1/../companion

]$ lsusb -t
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/10p, 480M
    |__ Port 9: Dev 8, If 0, Class=Communications, Driver=rndis_host, 480M
    |__ Port 9: Dev 8, If 1, Class=CDC Data, Driver=rndis_host, 480M

My phone is on bus 01 port 9, now to dial it down to USB 1.1:


(as root:)
]# echo 9 > /sys/bus/usb/devices/usb1/../companion

]$ lsusb -t
    |__ Port 9: Dev 6, If 0, Class=Communications, Driver=rndis_host, 12M
    |__ Port 9: Dev 6, If 1, Class=CDC Data, Driver=rndis_host, 12M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/10p, 480M

To set the port back to USB 2.0 speeds, prepend a - to the port parameter:

]# echo -9 > /sys/bus/usb/devices/usb1/../companion

]$ lsusb -t
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/10p, 480M
    |__ Port 9: Dev 8, If 0, Class=Communications, Driver=rndis_host, 480M
    |__ Port 9: Dev 8, If 1, Class=CDC Data, Driver=rndis_host, 480M

Edit: for reference: https://www.kernel.org/doc/Documentatio … s-ehci_hcd

Last edited by armin (2013-10-28 20:22:28)


I'm a Pastafari

Offline

#3 2013-10-29 14:05:31

mityukov
Member
Registered: 2010-10-10
Posts: 66

Re: How to downgrade selected USB port to v1 [SOLVED]

No and sort of. You'd have to attach your phone to a port on a bus that comes with a companion controller.

To list all available:

ls /sys/bus/usb/devices/usb*/../companion

It seems I have few:

$ ls /sys/bus/usb/devices/usb*/../companion
/sys/bus/usb/devices/usb1/../companion  /sys/bus/usb/devices/usb2/../companion  /sys/bus/usb/devices/usb3/../companion

If you got a corresponding controller, identify a port that is attached to that bus (try plugging an usb device into all your available ports).

This part I didn't get, I'm afraid. How do I tell to what bus/port am I inserting USB?

`lsusb` does not change its output to whatever port I insert the phone.

Dmesg says the following:

[24448.566839] usb 1-2: new high-speed USB device number 3 using ehci-pci
[24448.645718] ehci-pci 0000:00:12.2: port 2 reset error -110
... many same lines ...
[24452.260485] hub 1-0:1.0: hub_port_status failed (err = -32)
[24452.260488] hub 1-0:1.0: Cannot enable port 2.  Maybe the USB cable is bad?
[24452.260501] hub 1-0:1.0: unable to enumerate USB device on port 2

Does it mean "USB Device #3 on Port #2 on Bus #1", or how to read these?

Offline

#4 2013-10-30 23:01:26

armin
Member
From: the Caribbean. Arrr...!!!
Registered: 2007-02-26
Posts: 46

Re: How to downgrade selected USB port to v1 [SOLVED]

mityukov wrote:

If you got a corresponding controller, identify a port that is attached to that bus (try plugging an usb device into all your available ports).

This part I didn't get, I'm afraid. How do I tell to what bus/port am I inserting USB?

`lsusb` does not change its output to whatever port I insert the phone.

To map your buses/ports, you must use something other than your phone, i.e. a device that works.

[24448.566839] usb 1-2: new high-speed USB device number 3 using ehci-pci

mityukov wrote:

Does it mean "USB Device #3 on Port #2 on Bus #1", or how to read these?

Yes.


I'm a Pastafari

Offline

#5 2013-11-09 11:30:08

mityukov
Member
Registered: 2010-10-10
Posts: 66

Re: How to downgrade selected USB port to v1 [SOLVED]

Seems to work, thank you.

R'amen!

Offline

#6 2014-03-12 17:31:00

mityukov
Member
Registered: 2010-10-10
Posts: 66

Re: How to downgrade selected USB port to v1 [SOLVED]

armin wrote:

To list all available:

ls /sys/bus/usb/devices/usb*/../companion

I'm a bit confused on how does this filesystem work??

For example:

$ ls -ll /sys/bus/usb/devices/usb1/../companion
-rw-r--r-- 1 root root 4096 мар 12 16:48 /sys/bus/usb/devices/usb1/../companion

-BUT-

$ ls -ll /sys/bus/usb/devices/companion
ls: cannot access /sys/bus/usb/devices/companion: No such file or directory

Isn't "/sys/bus/usb/devices/usb1/../companion" and "/sys/bus/usb/devices/companion" the same path? smile

Offline

#7 2014-03-13 15:53:39

braonm
Member
Registered: 2014-03-13
Posts: 2

Re: How to downgrade selected USB port to v1 [SOLVED]

I have the similar question as well.  I'm not able to echo a value to this file, but 'ls' and 'cat' both work.

B

Offline

#8 2014-03-13 16:42:18

progandy
Member
Registered: 2012-05-17
Posts: 5,262

Re: How to downgrade selected USB port to v1 [SOLVED]

mityukov wrote:

Isn't "/sys/bus/usb/devices/usb1/../companion" and "/sys/bus/usb/devices/companion" the same path? smile

No. Linux walks the path from left to right. If a component is a symlink it is resolved before the algorithm continues. This should be the same as "readlink -f"
See also path_resolution(7)

$ readlink -f /sys/bus/usb/devices/usb1/../companion
/sys/devices/pci0000:00/0000:00:1a.0/companion

@branom: You need to be root to echo in this file. As normal user you could try tee:

echo "$VALUE" | sudo tee "$PATH"

Last edited by progandy (2014-03-13 16:44:55)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#9 2014-03-13 18:07:27

braonm
Member
Registered: 2014-03-13
Posts: 2

Re: How to downgrade selected USB port to v1 [SOLVED]

My lsusb -t is

 /:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 5000M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/2p, 480M
    |__ Port 1: Dev 24, If 0, Class=hub, Driver=hub/8p, 480M
        |__ Port 2: Dev 25, If 0, Class=hub, Driver=hub/4p, 480M
        |__ Port 3: Dev 26, If 0, Class='bInterfaceClass 0xe0 not yet handled', Driver=btusb, 12M
        |__ Port 3: Dev 26, If 1, Class='bInterfaceClass 0xe0 not yet handled', Driver=btusb, 12M
        |__ Port 3: Dev 26, If 2, Class=vend., Driver=, 12M
        |__ Port 3: Dev 26, If 3, Class=app., Driver=, 12M
        |__ Port 4: Dev 27, If 0, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M
        |__ Port 4: Dev 27, If 1, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M
        |__ Port 5: Dev 28, If 0, Class=vend., Driver=i2400m_usb, 480M

My issue was that I was echoing the device # instead of the port #.

When I target "Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/2p, 480M"
lsusb -t shows:

# lsusb -t
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 5000M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/2p, 480M

And no usb devices function on that port.

If I target bus 1 port 2 (downstream hub), the command completes (I can see "2" when I cat the companion file) But the lsusb -t is unchanged, and no dmesg outputs.

B

Offline

#10 2014-03-13 21:11:37

mityukov
Member
Registered: 2010-10-10
Posts: 66

Re: How to downgrade selected USB port to v1 [SOLVED]

progandy wrote:

No. Linux walks the path from left to right. If a component is a symlink it is resolved before the algorithm continues. This should be the same as "readlink -f"
See also path_resolution(7)

$ readlink -f /sys/bus/usb/devices/usb1/../companion
/sys/devices/pci0000:00/0000:00:1a.0/companion

Still don't get it..

$ readlink -f /sys/bus/usb/devices/usb1
/sys/devices/pci0000:00/0000:00:12.0/usb1

$ readlink -f /sys/bus/usb/devices/usb1/../companion
/sys/devices/pci0000:00/0000:00:12.0/companion

So, both "usb1" and "companion" should be available under the same path: /sys/devices/pci0000:00/0000:00:12.0/, right?

But there is no "companion" node under neither "/sys/bus/usb/devices/" nor under "/sys/devices/pci0000:00/0000:00:12.0/".

What a magical file? smile

Offline

#11 2014-10-11 20:20:48

Neymar87
Member
Registered: 2014-10-11
Posts: 1

Re: How to downgrade selected USB port to v1 [SOLVED]

I also cannot echo the value to the corresponding companion file, can anyone help me out?

nxr@nxr-desktop:~$ ls /sys/bus/usb/devices/usb*/../companion
/sys/bus/usb/devices/usb1/../companion  /sys/bus/usb/devices/usb2/../companion
nxr@nxr-desktop:~$ lsusb -t
2-1.7:1.0: No such file or directory
/:  Bus 06.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 5000M
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
    |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/8p, 480M
        |__ Port 7: Dev 14, If 0, Class=vend., Driver=usbfs, 480M
        |__ Port 8: Dev 3, If 0, Class=HID, Driver=usbhid, 12M
        |__ Port 8: Dev 3, If 1, Class=HID, Driver=usbhid, 12M
        |__ Port 8: Dev 3, If 2, Class=HID, Driver=usbhid, 12M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
    |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/6p, 480M
nxr@nxr-desktop:~$ sudo -s
[sudo] password for nxr: 
root@nxr-desktop:~# echo 7 > /sys/bus/usb/devices/usb2/../companion
bash: echo: write error: No such file or directory

Many thanks!!

Last edited by Neymar87 (2014-10-11 20:45:27)

Offline

#12 2018-11-25 19:45:41

Peter0
Member
Registered: 2018-11-25
Posts: 1

Re: How to downgrade selected USB port to v1 [SOLVED]

armin wrote:

If you got a corresponding controller, identify a port that is attached to that bus (try plugging an usb device into all your available ports).

I got a similar problem. So I found this thread. On my computer I found one (of three) USB port that is connected to a bus that's got a companion. The problem is: From the output of lsusb it seems that this isn't directly connected to the bus, but there is a hub (hardwired on the motherboard itself) between port and bus.

If I'm not wrong the companion controller can only be enabled for the whole tree on the topmost port (including the hub). After echoing to companion, the port seems to switch to Full Speed, but the hub isn't listed anymore.

I don't know if the hub can't handle non Hi-Speed port at all (as it is hardwired, it may not consider this case), therefore then I got no luck.
Or maybe it only can't handle the suddenly disabled non-companion, and the only thing that misses success is to plug out and again in the hub – what isn't possible, of course, because it is hardwired. So I'm looking for a way to simulate the plugging action. Something like a bus reset or power cycle by software. Is there a possiblity?

Note: After launching the echo with negative port no. in order to disable companion, the hub appears without any further action on lsusb output.

Thanks – Peter

PS: At the moment, I have no access to the very computer (it is a Dell Vostro 131V), so I only write this from my memory.

Offline

#13 2018-11-25 22:11:54

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,203

Re: How to downgrade selected USB port to v1 [SOLVED]

Please pay attention to the dates, and don't necrobump 4 year old solved topics, if you have a question open up your own with your own system's information and intentions of what you are intending to do.

https://wiki.archlinux.org/index.php/Co … bumping%22

Closing.

Offline

Board footer

Powered by FluxBB