Is there a way to communicate with a kernel and say, "Ignore that 1 usb port because it's damaged"

I have three USB ports out of which one of the ports is damaged.
I think it’s better for this distro to completely ignore that port. Cut off the current supply in that port (if possible), or just let the kernel know it’s a dead piece of sh*t.

But is it possible? Is there such a command which can do this?

Here is the output of sudo dmesg -k | grep usb
image
That is the screenshot of GNOME-logs.

In Ubuntu 21.04, I was having the suspend problem due to this USB issue (I think). And it might create the same problem here in Fedora 34.

2 Likes

You can often disable USB devices from the system BIOS. See if there are any options in there.

1 Like

I don’t there is any such option as u can see all BIOS options here.

It looks like that you have two bad ports (2-7 and 2-8)…
AFAIK you cannot disconnect power from the pins to the USB device. You can ‘unbind’ the device to prevent it from starting up and drawing more than a few mA. something like…

echo '2-8' |sudo tee /sys/bus/usb/drivers/usb/unbind

A udev rule could possibility catch devices plugged into the port and to trigger action like preventing binding.

The command you recommand says, there is no such device.
Screenshot from 2021-05-22 17-57-45

It looks like that you have two bad ports.

But I have only 1 USB which doesn’t respond. :shushing_face:

There is nothing to unbind until you connect something to the port. You probably need to write a udev rule to act when a device is connected (something containing SUBSYSTEMS==“usb” ATTRS{devpath}==“2.8”)

It might be simpler to put a piece of tape over the port to stop you plugging something in :sunglasses:

I inserted a pendrive in the damaged port. And tried to run your old commands and new commands (without understanding how should I use those command arguments), but it didn’t work.


Can you give me a full command which includes subsystem and attributes value? Because I’m a noob. ::

You would probably learn a lot more by figuring this out for yourself; however try this:

Create a udev rule, say /etc/udev/rules.d/99-disableUSBport.rule
containing

SUBSYSTEM=="usb", ATTRS{busnum}=="2", ATTRS{devpath}=="8", ATTR{authorized}="0"

reload udev rules…

udevadm control --reload-rules
1 Like

The last word in the command you mentioned says ATTR:

ATTR{authorized}="0"

I think this is a typing mistake right? I think it should be ATTRS.

And about the second command, you mentioned about reload-rules: Do I need to reload the rules when I restart the laptop? Doesn’t restarting the distro automatically apply the rules?

Edit:

I have added ATTRS instead of ATTR and reloaded the rules and restarted the distro to check whether the GNOME Logs still throw that the same error message saying, “USB port over-current condition”. It still does. This means the udev rule is not working.

What to do @vk2bea ? Any helps/tips/info would be nice.

I would be interested in that as well. I’ve found some documentation here:
https://man7.org/linux/man-pages/man7/udev.7.html
I assume that ATTR{authorized}="0" means: Disable the device? I’m not sure how this works.

I think that’s the original paper of the author of udev:
https://landley.net/kdocs/ols/2003/ols2003-pages-249-257.pdf, and here is the Wikipedia entry: Greg Kroah-Hartman - Wikipedia

@bond Welcome James. Do you want your Martini shaken or stirred?

$ cd /sys/bus/usb/drivers/usb/
$ ls
1-2 1-2.1 1-4 1-5 1-7 1-8 2-2 2-2.4 bind uevent unbind usb1 usb2

In the case I want to disable USB port 2-2.4, what command do I need to type? It seems to be bus 2, the rest is not very clear to me…

Please don’t post screenshots of text.

Reasoning can be found here: PSA: Please don't post images of text - Unix & Linux Meta Stack Exchange

Yes it’s ATTR as I had written it.
It sounds like the hardware is damaged and the overcurrent is occurring weather the device is plugged in or not. (have you looked at the port to see if there is physical damage?) If that is the case, you could try disabling the whole USB hub (but you would then lose use of all ports).

pranav@fedora /sys/bus/usb/devices> ls
1-0:1.0  1-1:1.0  2-5      2-5:1.1  2-6:1.0  usb1  usb3
1-1      2-0:1.0  2-5:1.0  2-6      3-0:1.0  usb2
pranav@fedora ~> lsusb
Bus 001 Device 002: ID 8087:8001 Intel Corp. Integrated Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 003: ID 04f3:2012 Elan Microelectronics Corp. Touchscreen
Bus 002 Device 002: ID 8087:07dc Intel Corp. Bluetooth wireless interface
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
pranav@fedora ~>

All about my USB are mentioned here. Trying to figure out how to implement udev rule.

@augenauf
ok. I will keep that in mind.

@vk2bea
So ATTR is actually correct. I will use it then.

It sounds like the hardware is damaged and the overcurrent is occurring weather the device is plugged in or not.

Any usb device inserted into the usb port (which is damaged for some reason) is useless since, the distro doesn’t recognize it. Error log is there whether I insert a pendrive on it or not.

try disabling the whole USB hub

Even though this idea is a bad idea because I will use 2 usable USB ports. But I was wondering if there Is any command to do this? Or do I have to write udev rules for this?

There has been an update on this issue.

KGN infotech is a repair shop that is right below my floor. I told him that one of the USB ports is not working. After his research, he found out that the port IC was a short circuit and damaged. From the other motherboard, he inserted a new (but used) IC after removing my damaged IC.

Now:

  1. When I put my data cable to connect my phone or wired mouse in that port, it does get the current and charge. But it only gets the charge, it doesn’t take any input. Why? He also can’t seem to figure it out.

  2. Unlike the previous situation when I didn’t go to the repair shop, I now don’t see kernel throwing this error message anymore, “USB USB<n>-port<n>: over-current condition”. But I do get to see 1 thing these days, “USB: port power management may be unreliable”. What does this mean? Is there something the KGN Infotech can do to sort it out? Please do let me know. So I can fully use that USB port.

It probably would be easier and more reliable to simply replace the motherboard. And less expensive unless the tech is doing the work for free.

If the replacement IC is not exactly the same as the original then the connections and control may be different.