public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Douglas Gilbert <dgilbert@interlog.com>
To: linux-usb@vger.kernel.org
Subject: [Announce] lsucpd release 0.91 utility for USB Type-C
Date: Fri, 8 Dec 2023 01:36:02 -0500	[thread overview]
Message-ID: <5f74a231-e0c2-4be6-ab90-6592f7cfa8df@interlog.com> (raw)

lsucpd is a command line utility for listing USB Type-C ports, partners
and any associated PD objects. It is essentially data-mining the
/sys/class/typec and /sys/class/usb_power_delivery directories. So
lsucpd performs no magic and root permissions are not required.

lsucpd was originally announced in this post on 28 August 2023:
   https://marc.info/?l=linux-usb&m=169325926403279&w=2
That code has been tagged as 'r0.89'. There is also a 'r0.90' tag
but it was not announced. This release is tagged as 'r0.91'. The
code is available at this git mirror at:
     https://github.com/doug-gilbert/lsucpd

Changelog since 0.89 [20230827] [svn: r9]
   - add the first stage of JSON support
   - add --pdo-snk= and --pdo-src= options to decode PDOs
   - add --rdo= option to decode RDOs
   - make preparations for PD revision 3.2

The last one is a bit optimistic as the kernel PD stack can't yet handle
the additions in PD 3.1 (e.g. fixed 28, 36 and 48 Volts, plus AVS from
15 to 48 Volts). Recently PD 3.1 dropped all support for 3.3 to < 5 Volts.
PD 3.2 splits AVS (Adjustable Voltage Supply) into SPR (Standard Power
Range [<= 21 Volts]) and EPR (Extended ...) variants. SPR AVS is the new
one going from 9 to 20 Volts. What is the difference between AVS and PPS
(Programmable PS)? Answer: PPS does current limiting, AVS doesn't ***.


Note: USB TypeC/PD standards have been in place for almost 10 years
and now almost all new mobile devices use TypeC/PD . However visibility
of TypeC/PD to host operating systems is relatively new and immature.
Previously mobile devices handled TypeC/PD in their BIOS or Embedded
Controllers and left the host OS "in the dark".
Please keep this in mind if reporting issues.

Here is a debian binary package built on Ubuntu 23.10 :
     https://doug-gilbert.github.io/p/lsucpd_0.91-0.1_amd64.deb

Here is a rpm built on Fedora 39 :
     https://doug-gilbert.github.io/p/lsucpd-0.91-1.x86_64.rpm

Doug Gilbert


*** "current limiting" as defined by PPS. AVS (and PPS) still does
      OCP (Over Current Protection) but that is pretty brutal (i.e.
      the source removes power for a few hundred milliseconds to
      let the sink cool off)


Examples from a Thinkpad X13 Gen 3, U 23.10 lk 6.7.0-rc1
   [port0-partner: is an alternate mode DP dongle,
    port1-partner: is a PD power adapter (source)]

$ lsucpd
  port0 [pd0]  ====>>  partner [pd3]
  port1 [pd1]  <<====  partner [pd2]

$ lsucpd -c
  port0 [pd0]  ====>>  partner [pd3]
  port1 [pd1]  <<====  partner [pd2]

 > pd0: has NO source-capabilities
 >  pd0: sink-capabilities:
    >> 1:fixed_supply; fixed: 5.00 Volts, 3.00 Amps (op)
    >> 2:variable_supply; variable: 5.00 to 20.00 Volts, 3.25 Amps (op)
    >> 3:battery; battery: 5.00 to 20.00 Volts, 65.00 Watts (op)
 > pd1: source-capabilities:
   >> 1:fixed_supply; fixed: 0.00 Volts, 7.21 Amps (max)
 >  pd1: sink-capabilities:
    >> 1:fixed_supply; fixed: 5.00 Volts, 3.00 Amps (op)
    >> 2:variable_supply; variable: 5.00 to 20.00 Volts, 3.25 Amps (op)
    >> 3:battery; battery: 5.00 to 20.00 Volts, 65.00 Watts (op)
 > pd2: source-capabilities:
   >> 1:fixed_supply; fixed: 5.00 Volts, 3.00 Amps (max)
   >> 2:fixed_supply; fixed: 9.00 Volts, 3.00 Amps (max)
   >> 3:fixed_supply; fixed: 12.00 Volts, 3.00 Amps (max)
   >> 4:fixed_supply; fixed: 15.00 Volts, 3.00 Amps (max)
   >> 5:fixed_supply; fixed: 20.00 Volts, 3.00 Amps (max)
 >  pd2: has NO sink-capabilities
 > pd3: has NO source-capabilities
 >  pd3: has NO sink-capabilities

$ lsucpd -ll
  port0 [pd0]  ====>>  partner [pd3]
  port1 [pd1]  <<====  partner [pd2]

 > port0  [pd0]:
       data_role='[host] device'
       power_operation_mode='usb_power_delivery'
       power_role='[source] sink'
       preferred_role=''
       supported_accessory_modes='none'
       usb_power_delivery_revision='2.0'
       usb_typec_revision='1.0'
       vconn_source='no'
       waiting_for_supplier='0'
    port0-partner  [pd3]:
       accessory_mode='none'
       number_of_alternate_modes='1'
       supports_usb_power_delivery='yes'
       usb_power_delivery_revision='0.0'
       Alternate mode: /sys/class/typec/port0-partner/port0-partner.0
         active='yes'
         description='DisplayPort'
         mode='1'
         svid='ff01'
         vdo='0x00001085'
 > port1  [pd1]:
       data_role='host [device]'
       power_operation_mode='usb_power_delivery'
       power_role='source [sink]'
       preferred_role=''
       supported_accessory_modes='none'
       usb_power_delivery_revision='2.0'
       usb_typec_revision='1.0'
       vconn_source='no'
       waiting_for_supplier='0'
    port1-partner  [pd2]:
       accessory_mode='none'
       supports_usb_power_delivery='yes'
       usb_power_delivery_revision='0.0'


Note: not all that output is believable (e.g. '0.00 Volts, 7.21 Amps (max)')
so some common sense is required interpreting the output from lsucpd .


             reply	other threads:[~2023-12-08  6:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-08  6:36 Douglas Gilbert [this message]
2023-12-08  7:16 ` [Announce] lsucpd release 0.91 utility for USB Type-C Greg KH
2023-12-08 21:14   ` Douglas Gilbert
2023-12-11 15:07 ` Alexander Stein
2023-12-12  5:44   ` Douglas Gilbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5f74a231-e0c2-4be6-ab90-6592f7cfa8df@interlog.com \
    --to=dgilbert@interlog.com \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox