Detect cable being plugged but not powered #97

Open
opened 2026-04-20 12:45:53 +02:00 by Benjamin_Loison · 2 comments
Owner

DuckDuckGo and Google search Linux check if a cable with no power is plugged.

I have read the Stack Overflow question 16443522 thread.

I have read the Electronics Stack Exchange answer 95578 and its question.

DuckDuckGo and Google search *Linux check if a cable with no power is plugged*. I have read [the Stack Overflow question 16443522](https://stackoverflow.com/q/16443522) thread. I have read [the Electronics Stack Exchange answer 95578](https://electronics.stackexchange.com/a/95578) and its question.
Author
Owner
https://chat.mistral.ai/chat/2b817982-eb68-4279-bf23-34c01ecaee15
Author
Owner

I am not much interested in Ethernet. My usage is whether I forgot to enable the Wikipedia: AC power plugs and sockets#Multisocket adaptors (135014307).

https://chatgpt.com/share/69e629d8-7a04-83eb-b248-38b01cf0c331

ls -lha --time-style=+'' /sys/class/typec/
Output:
total 0
drwxr-xr-x  2 root root 0  .
drwxr-xr-x 88 root root 0  ..

while my Linux Mint 22.3 Cinnamon Framework 13 is charging with USB-C.

On Linux Mint 22.3 Cinnamon Framework 13 can I detect a USB-C cable being plugged even if it does not deliver any electricity?

Mistral:

On Linux Mint 22.3 Cinnamon (or any Linux distribution), detecting a USB-C cable that is physically plugged in but not delivering any power (i.e., no data or power negotiation) is generally not straightforward. Here’s what you need to know:

  • USB-C Physical Detection: The Linux kernel can detect the presence of a USB-C connector if it is part of a USB device (like a hub, storage, or other peripheral) and if the device is recognized by the system. However, if the cable is just a passive connection (no data lines connected, only the physical plug), the system may not register it at all, as there is no electrical or data signal to detect.

  • Power Delivery (PD) Negotiation: If the cable is supposed to support USB Power Delivery but is not delivering power, the system may still detect the connection if the cable or device is recognized as a USB device. You can check kernel logs (dmesg or journalctl -k) for messages related to USB-C or UCSI (USB Type-C Connector System Software Interface) events. For example, some systems log messages like ucsi_acpi USBC000:00: UCSI_GET_PDOS returned 0 bytes when a USB-C device is plugged in, even if power delivery fails.

  • No Power, No Data: If the cable is truly passive (no data lines, no power delivery, and no device on the other end), the system will not detect it, as there is no electrical signal to trigger a detection event.

Practical Steps to Check:

  1. Run dmesg | grep -i usb or journalctl -k | grep -i usb after plugging in the cable. Look for any new entries that might indicate the system noticed a connection.
  2. Check lsusb to see if a new USB device appears when the cable is plugged in.
  3. Monitor UCSI events (if your hardware supports it) with journalctl -k | grep -i ucsi.

Summary:
If the USB-C cable is passive and not connected to a device or power source, Linux Mint (or any OS) will not detect it. If it is connected to a device (even if not delivering power), you may see logs or a new USB device entry, but this depends on the cable and device. For power delivery issues, kernel logs are your best bet for troubleshooting.

Would you like help interpreting your system logs for USB-C events?

Even with sudo, dmesg does not return anything new if unplug or replug while the cable is charging.

journalctl --help | grep -e '-k '
  -k --dmesg                 Show kernel message log from the current boot
journalctl --dmesg | tail

even with sudo, it seems experimentally identical to dmesg.

lsusb does not change, even with sudo.

I am not much interested in Ethernet. My usage is whether I forgot to enable the [Wikipedia: AC power plugs and sockets#Multisocket adaptors (135014307)](https://en.wikipedia.org/w/index.php?title=AC_power_plugs_and_sockets&oldid=1350143077#Multisocket_adaptors). https://chatgpt.com/share/69e629d8-7a04-83eb-b248-38b01cf0c331 ```bash ls -lha --time-style=+'' /sys/class/typec/ ``` <details> <summary>Output:</summary> ``` total 0 drwxr-xr-x 2 root root 0 . drwxr-xr-x 88 root root 0 .. ``` </details> while my Linux Mint 22.3 Cinnamon Framework 13 is charging with USB-C. > On Linux Mint 22.3 Cinnamon Framework 13 can I detect a USB-C cable being plugged even if it does not deliver any electricity? <details> <summary><a href="https://chat.mistral.ai/chat/c86843ff-3c6c-481c-901f-d194457b01c5">Mistral</a>:</summary> On Linux Mint 22.3 Cinnamon (or any Linux distribution), detecting a USB-C cable that is physically plugged in but not delivering any power (i.e., no data or power negotiation) is generally not straightforward. Here’s what you need to know: - **USB-C Physical Detection:** The Linux kernel can detect the presence of a USB-C connector if it is part of a USB device (like a hub, storage, or other peripheral) and if the device is recognized by the system. However, if the cable is just a passive connection (no data lines connected, only the physical plug), the system may not register it at all, as there is no electrical or data signal to detect. - **Power Delivery (PD) Negotiation:** If the cable is supposed to support USB Power Delivery but is not delivering power, the system may still detect the connection if the cable or device is recognized as a USB device. You can check kernel logs (`dmesg` or `journalctl -k`) for messages related to USB-C or UCSI (USB Type-C Connector System Software Interface) events. For example, some systems log messages like `ucsi_acpi USBC000:00: UCSI_GET_PDOS returned 0 bytes` when a USB-C device is plugged in, even if power delivery fails. - **No Power, No Data:** If the cable is truly passive (no data lines, no power delivery, and no device on the other end), the system will not detect it, as there is no electrical signal to trigger a detection event. **Practical Steps to Check:** 1. **Run `dmesg | grep -i usb` or `journalctl -k | grep -i usb`** after plugging in the cable. Look for any new entries that might indicate the system noticed a connection. 2. **Check `lsusb`** to see if a new USB device appears when the cable is plugged in. 3. **Monitor UCSI events** (if your hardware supports it) with `journalctl -k | grep -i ucsi`. **Summary:** If the USB-C cable is passive and not connected to a device or power source, Linux Mint (or any OS) will not detect it. If it is connected to a device (even if not delivering power), you may see logs or a new USB device entry, but this depends on the cable and device. For power delivery issues, kernel logs are your best bet for troubleshooting. Would you like help interpreting your system logs for USB-C events? </details> Even with `sudo`, `dmesg` does not return anything new if unplug or replug while the cable is charging. ```bash journalctl --help | grep -e '-k ' ``` ``` -k --dmesg Show kernel message log from the current boot ``` ```bash journalctl --dmesg | tail ``` even with `sudo`, it seems experimentally identical to `dmesg`. `lsusb` does not change, even with `sudo`.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Benjamin_Loison/linux#97