0

I've have been looking for a while and though a lot of Exchange Q&A's have helped, I haven't exactly received the answer I'm looking for.

Going off the question asked here: How can I detect a USB port being used for charging in Linux?

I felt as if it needed it's own question. I have a USB Powered Hub for charging smart phones and I wish to control the power (On/Off only) to each of the ports individually.

Using a USB charging cable, Linux cannot detect that a device is plugged in, so using a USB data cable might be more useful to this scenario.

Essentially, I want Linux to be able to detect when a device is plugged in, however I do not want any data transmission to occur between the device and Linux. Simply only power. By detecting the device being plugged in, I want to be able to control whether power will flow to the device or not, but no data transmission.

I'm currently testing with uhubctl, however when enabling/disabling the port, unfortunately it controls both power/data where I wish to cut off data entirely and only allow power to the device.

Is it possible to using a USB Data Cable detect a device plugged in, then essentially disable the phone talking to the computer entirely, but still allow power to flow to the device?

If not, the other option I was thinking is if there is a USB Power Hub out there that can tell Linux if a new device has been plugged in or not and I can tell it whether to charge or not?

Any input would be greatly appreciated.

Tim
  • 176
  • 1
  • 15
  • don't some cables only support passing power, and not data? But please read [help] and [mcve] before posting more Qs here. Good luck. – shellter Oct 04 '18 at 01:53
  • 2
    USB port can have few so called features, e.g. POWER, CONNECT, ENABLE, HISPEED, LOWSPEED, etc. Some of these features can be enabled or disabled. E.g. [uhubctl](https://github.com/mvp/uhubctl) works by enabling/disabling POWER feature (I am uhubctl author). Unfortunately, some of these features are set implicitly, and cannot be controlled by software, e.g. CONNECT feature. I believe if you were able to revoke CONNECT but retain POWER, it would do what you want. But, I don't think this is possible. – mvp Oct 04 '18 at 07:52
  • Hi @MVP, thanks for your response. I'm using your tool, it's really cool. What you've mentioned in regards to the "Features" is interesting and I'll investigate further, that's great. – Tim Oct 05 '18 at 02:18
  • Hi @shellter; Yes there are cables that only provide power. However, the issue is that the USB Hub/Linux cannot detect a device plugged in using the power only cables. And the tools in Linux for example lsusb -v and whatnot, though they provide some form of milliamp, it doesn't actually show the draw of power from the USB port, if it did, problem solved. Unfortunately, that is not the case. – Tim Oct 05 '18 at 02:21

0 Answers0