Open isomer opened 1 year ago
Fixed pls confirm
(sorry for the delay, but I've finally got a spare evening to tinker)
Without a cable:
$ ./typecstatus --ro
USB-C Power Status
==================
Number of USB-C port(s): 2
======================
No Power Contract on port 0
No Power Contract on port 1
Detected 0 BB device(s)
=======================
In (only) the rearmost port (the port I use for charging):
$ ./typecstatus --ro
USB-C Power Status
==================
Number of USB-C port(s): 2
======================
No Power Contract on port 0
USB-C power contract Operating Power 15 W, with Max Power 65 W
Charging System with TDP 191 W, with boost power requirement of 64 W
Detected 0 BB device(s)
=======================
Cable in (only) the foremost port (the "other" port):
USB-C Power Status
==================
Number of USB-C port(s): 2
======================
USB-C power contract Operating Power 15 W, with Max Power 65 W
Charging System with TDP 196 W, with boost power requirement of 64 W
USB-C power contract Operating Power 15 W, with Max Power 65 W
Charging System with TDP 196 W, with boost power requirement of 64 W
Detected 0 BB device(s)
=======================
I'm not sure why it's duplicating the results when it's in the foremost ("other") port, but it's definitely an improvement!
The duplicate result could be due to residue of previous connected in the sysfs path. Possible gap in the typec class driver of Linux. Could you please confirm "ls /sys/class/typec" when you see duplicate results ?
I don't think that's it.
No cable:
$ ./typecstatus --ro
USB-C Power Status
==================
Number of USB-C port(s): 2
======================
No Power Contract on port 0
No Power Contract on port 1
Detected 0 BB device(s)
=======================
$ grep . /sys/class/typec/*/* 2>/dev/null
/sys/class/typec/port0/data_role:host [device]
/sys/class/typec/port0/power_operation_mode:default
/sys/class/typec/port0/power_role:source [sink]
/sys/class/typec/port0/supported_accessory_modes:none
/sys/class/typec/port0/uevent:DEVTYPE=typec_port
/sys/class/typec/port0/uevent:TYPEC_PORT=port0
/sys/class/typec/port0/usb_power_delivery_revision:2.0
/sys/class/typec/port0/usb_typec_revision:1.0
/sys/class/typec/port0/vconn_source:no
/sys/class/typec/port0/waiting_for_supplier:0
/sys/class/typec/port1/data_role:host [device]
/sys/class/typec/port1/power_operation_mode:default
/sys/class/typec/port1/power_role:source [sink]
/sys/class/typec/port1/supported_accessory_modes:none
/sys/class/typec/port1/uevent:DEVTYPE=typec_port
/sys/class/typec/port1/uevent:TYPEC_PORT=port1
/sys/class/typec/port1/usb_power_delivery_revision:2.0
/sys/class/typec/port1/usb_typec_revision:1.0
/sys/class/typec/port1/vconn_source:no
/sys/class/typec/port1/waiting_for_supplier:0
Rear port:
$ ./typecstatus --ro
USB-C Power Status
==================
Number of USB-C port(s): 2
======================
No Power Contract on port 0
USB-C power contract Operating Power 15 W, with Max Power 65 W
Charging System with TDP 200 W, with boost power requirement of 64 W
Detected 0 BB device(s)
=======================
$ grep . /sys/class/typec/*/* 2>/dev/null
/sys/class/typec/port0/data_role:host [device]
/sys/class/typec/port0/power_operation_mode:default
/sys/class/typec/port0/power_role:source [sink]
/sys/class/typec/port0/supported_accessory_modes:none
/sys/class/typec/port0/uevent:DEVTYPE=typec_port
/sys/class/typec/port0/uevent:TYPEC_PORT=port0
/sys/class/typec/port0/usb_power_delivery_revision:2.0
/sys/class/typec/port0/usb_typec_revision:1.0
/sys/class/typec/port0/vconn_source:no
/sys/class/typec/port0/waiting_for_supplier:0
/sys/class/typec/port1/data_role:host [device]
/sys/class/typec/port1-partner/accessory_mode:none
/sys/class/typec/port1-partner/supports_usb_power_delivery:yes
/sys/class/typec/port1-partner/uevent:DEVTYPE=typec_partner
/sys/class/typec/port1-partner/usb_power_delivery_revision:0.0
/sys/class/typec/port1/power_operation_mode:usb_power_delivery
/sys/class/typec/port1/power_role:source [sink]
/sys/class/typec/port1/supported_accessory_modes:none
/sys/class/typec/port1/uevent:DEVTYPE=typec_port
/sys/class/typec/port1/uevent:TYPEC_PORT=port1
/sys/class/typec/port1/usb_power_delivery_revision:2.0
/sys/class/typec/port1/usb_typec_revision:1.0
/sys/class/typec/port1/vconn_source:no
/sys/class/typec/port1/waiting_for_supplier:0
No cable (again - showing no stale state):
$ ./typecstatus --ro
USB-C Power Status
==================
Number of USB-C port(s): 2
======================
No Power Contract on port 0
No Power Contract on port 1
Detected 0 BB device(s)
=======================
$ grep . /sys/class/typec/*/* 2>/dev/null
/sys/class/typec/port0/data_role:host [device]
/sys/class/typec/port0/power_operation_mode:default
/sys/class/typec/port0/power_role:source [sink]
/sys/class/typec/port0/supported_accessory_modes:none
/sys/class/typec/port0/uevent:DEVTYPE=typec_port
/sys/class/typec/port0/uevent:TYPEC_PORT=port0
/sys/class/typec/port0/usb_power_delivery_revision:2.0
/sys/class/typec/port0/usb_typec_revision:1.0
/sys/class/typec/port0/vconn_source:no
/sys/class/typec/port0/waiting_for_supplier:0
/sys/class/typec/port1/data_role:host [device]
/sys/class/typec/port1/power_operation_mode:default
/sys/class/typec/port1/power_role:source [sink]
/sys/class/typec/port1/supported_accessory_modes:none
/sys/class/typec/port1/uevent:DEVTYPE=typec_port
/sys/class/typec/port1/uevent:TYPEC_PORT=port1
/sys/class/typec/port1/usb_power_delivery_revision:2.0
/sys/class/typec/port1/usb_typec_revision:1.0
/sys/class/typec/port1/vconn_source:no
/sys/class/typec/port1/waiting_for_supplier:0
Foremost port:
$ ./typecstatus --ro
USB-C Power Status
==================
Number of USB-C port(s): 2
======================
USB-C power contract Operating Power 15 W, with Max Power 65 W
Charging System with TDP 200 W, with boost power requirement of 64 W
USB-C power contract Operating Power 15 W, with Max Power 65 W
Charging System with TDP 200 W, with boost power requirement of 64 W
Detected 0 BB device(s)
=======================
$ grep . /sys/class/typec/*/* 2>/dev/null
/sys/class/typec/port0/data_role:host [device]
/sys/class/typec/port0-partner/accessory_mode:none
/sys/class/typec/port0-partner/supports_usb_power_delivery:yes
/sys/class/typec/port0-partner/uevent:DEVTYPE=typec_partner
/sys/class/typec/port0-partner/usb_power_delivery_revision:0.0
/sys/class/typec/port0/power_operation_mode:usb_power_delivery
/sys/class/typec/port0/power_role:source [sink]
/sys/class/typec/port0/supported_accessory_modes:none
/sys/class/typec/port0/uevent:DEVTYPE=typec_port
/sys/class/typec/port0/uevent:TYPEC_PORT=port0
/sys/class/typec/port0/usb_power_delivery_revision:2.0
/sys/class/typec/port0/usb_typec_revision:1.0
/sys/class/typec/port0/vconn_source:no
/sys/class/typec/port0/waiting_for_supplier:0
/sys/class/typec/port1/data_role:host [device]
/sys/class/typec/port1/power_operation_mode:default
/sys/class/typec/port1/power_role:source [sink]
/sys/class/typec/port1/supported_accessory_modes:none
/sys/class/typec/port1/uevent:DEVTYPE=typec_port
/sys/class/typec/port1/uevent:TYPEC_PORT=port1
/sys/class/typec/port1/usb_power_delivery_revision:2.0
/sys/class/typec/port1/usb_typec_revision:1.0
/sys/class/typec/port1/vconn_source:no
/sys/class/typec/port1/waiting_for_supplier:0
I have a Thinkpad T15 Gen 1 laptop, and typecstatus doesn't seem to detect the usb port correctly.
When plugging into the port used for charging there is no output:
When plugged into the "other" USB-C port:
lstypec says:
stracing typecstatus shows:
This shows it probing
/sys/class/typec/port0/port0-partner
, but it doesn't seem to probe/sys/class/typec/port1/port1-partner
despite it existing. (ie, the "main" power port on this laptop appears to be port1, not port0).The code seems to suggest that port 0 is hard coded in the binary.
I would expect to see information about the usb-c port that is used for charging when running "typecstatus --all", at the moment I see no information at all.