public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* Test USB Type-C port?
@ 2023-11-20 23:30 Paul Menzel
  2023-11-21 13:59 ` Heikki Krogerus
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Menzel @ 2023-11-20 23:30 UTC (permalink / raw)
  To: Heikki Krogerus; +Cc: linux-usb

Dear Linux folks,


To test a USB Type-C port for conformance to the specification, is it 
possible to connect two Linux devices using a USB Type-C cable, and run 
some programs on each?US

(I started using a Dell XPS 13 9360 from 2016, and sometimes experience 
troubles with USB Type-C adapters/port replicators and want to verify 
that the USB Type-C port works according to the specification.)


Kind regards,

Paul

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Test USB Type-C port?
  2023-11-20 23:30 Test USB Type-C port? Paul Menzel
@ 2023-11-21 13:59 ` Heikki Krogerus
  2023-12-12  4:33   ` Paul Menzel
  0 siblings, 1 reply; 5+ messages in thread
From: Heikki Krogerus @ 2023-11-21 13:59 UTC (permalink / raw)
  To: Paul Menzel; +Cc: linux-usb

Hi Paul,

On Tue, Nov 21, 2023 at 12:30:34AM +0100, Paul Menzel wrote:
> To test a USB Type-C port for conformance to the specification, is it
> possible to connect two Linux devices using a USB Type-C cable, and run some
> programs on each?US
> 
> (I started using a Dell XPS 13 9360 from 2016, and sometimes experience
> troubles with USB Type-C adapters/port replicators and want to verify that
> the USB Type-C port works according to the specification.)

Unfortunatly USB Type-C is handled in firmware on those computers. We
can only query the status of some basic things using an interface
called UCSI, but most details are completely hidden from the
operatings system.

There have been a lot of problems with the UCSI interface on older XPS
13 and Latitude systems. Some of those problems have a workaround in
the driver, but not everything.

Br,

-- 
heikki

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Test USB Type-C port?
  2023-11-21 13:59 ` Heikki Krogerus
@ 2023-12-12  4:33   ` Paul Menzel
  2023-12-12  5:24     ` Rajaram R
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Menzel @ 2023-12-12  4:33 UTC (permalink / raw)
  To: Heikki Krogerus; +Cc: linux-usb

Dear Heikki,


Thank you for your reply.

Am 21.11.23 um 14:59 schrieb Heikki Krogerus:

> On Tue, Nov 21, 2023 at 12:30:34AM +0100, Paul Menzel wrote:
>> To test a USB Type-C port for conformance to the specification, is it
>> possible to connect two Linux devices using a USB Type-C cable, and run some
>> programs on each?US
>>
>> (I started using a Dell XPS 13 9360 from 2016, and sometimes experience
>> troubles with USB Type-C adapters/port replicators and want to verify that
>> the USB Type-C port works according to the specification.)
> 
> Unfortunately USB Type-C is handled in firmware on those computers. We
> can only query the status of some basic things using an interface
> called UCSI, but most details are completely hidden from the
> operating system.

Interesting. Although now not necessary Linux kernel related, there 
should be such test frameworks to test such a port “for compliance”. Can 
you recommend the one you or Intel are using?

> There have been a lot of problems with the UCSI interface on older XPS
> 13 and Latitude systems. Some of those problems have a workaround in
> the driver, but not everything.

Do you know, how Microsoft Windows handles these problems? Also with quirks?


Kind regards,

Paul

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Test USB Type-C port?
  2023-12-12  4:33   ` Paul Menzel
@ 2023-12-12  5:24     ` Rajaram R
  2023-12-12 11:51       ` Heikki Krogerus
  0 siblings, 1 reply; 5+ messages in thread
From: Rajaram R @ 2023-12-12  5:24 UTC (permalink / raw)
  To: Paul Menzel; +Cc: Heikki Krogerus, linux-usb

On Tue, Dec 12, 2023 at 10:03 AM Paul Menzel <pmenzel@molgen.mpg.de> wrote:
>
> Dear Heikki,
>
>
> Thank you for your reply.
>
> Am 21.11.23 um 14:59 schrieb Heikki Krogerus:
>
> > On Tue, Nov 21, 2023 at 12:30:34AM +0100, Paul Menzel wrote:
> >> To test a USB Type-C port for conformance to the specification, is it
> >> possible to connect two Linux devices using a USB Type-C cable, and run some
> >> programs on each?US
> >>
> >> (I started using a Dell XPS 13 9360 from 2016, and sometimes experience
> >> troubles with USB Type-C adapters/port replicators and want to verify that
> >> the USB Type-C port works according to the specification.)
> >
> > Unfortunately USB Type-C is handled in firmware on those computers. We
> > can only query the status of some basic things using an interface
> > called UCSI, but most details are completely hidden from the
> > operating system.
>
> Interesting. Although now not necessary Linux kernel related, there
> should be such test frameworks to test such a port “for compliance”. Can
> you recommend the one you or Intel are using?
>

You could use this debugfs infra to test PD Controller flows between
two systems: https://www.spinics.net/lists/linux-usb/msg244979.html
We also have a wrapper for this debugfs here :
https://github.com/Rajaram-Regupathy/libtypec/commit/ac3e1d07e3bae338fdb73e2bfd3151f5a9a09a57



> > There have been a lot of problems with the UCSI interface on older XPS
> > 13 and Latitude systems. Some of those problems have a workaround in
> > the driver, but not everything.
>
> Do you know, how Microsoft Windows handles these problems? Also with quirks?


>
>
> Kind regards,
>
> Paul
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Test USB Type-C port?
  2023-12-12  5:24     ` Rajaram R
@ 2023-12-12 11:51       ` Heikki Krogerus
  0 siblings, 0 replies; 5+ messages in thread
From: Heikki Krogerus @ 2023-12-12 11:51 UTC (permalink / raw)
  To: Rajaram R; +Cc: Paul Menzel, linux-usb

On Tue, Dec 12, 2023 at 10:54:14AM +0530, Rajaram R wrote:
> On Tue, Dec 12, 2023 at 10:03 AM Paul Menzel <pmenzel@molgen.mpg.de> wrote:
> >
> > Dear Heikki,
> >
> >
> > Thank you for your reply.
> >
> > Am 21.11.23 um 14:59 schrieb Heikki Krogerus:
> >
> > > On Tue, Nov 21, 2023 at 12:30:34AM +0100, Paul Menzel wrote:
> > >> To test a USB Type-C port for conformance to the specification, is it
> > >> possible to connect two Linux devices using a USB Type-C cable, and run some
> > >> programs on each?US
> > >>
> > >> (I started using a Dell XPS 13 9360 from 2016, and sometimes experience
> > >> troubles with USB Type-C adapters/port replicators and want to verify that
> > >> the USB Type-C port works according to the specification.)
> > >
> > > Unfortunately USB Type-C is handled in firmware on those computers. We
> > > can only query the status of some basic things using an interface
> > > called UCSI, but most details are completely hidden from the
> > > operating system.
> >
> > Interesting. Although now not necessary Linux kernel related, there
> > should be such test frameworks to test such a port “for compliance”. Can
> > you recommend the one you or Intel are using?
> >
> 
> You could use this debugfs infra to test PD Controller flows between
> two systems: https://www.spinics.net/lists/linux-usb/msg244979.html
> We also have a wrapper for this debugfs here :
> https://github.com/Rajaram-Regupathy/libtypec/commit/ac3e1d07e3bae338fdb73e2bfd3151f5a9a09a57

So that is for UCSI.

USB Type-C and USB PD compliance can be tested using oscilloscopes and
analysers that supply some kind of USB Type-C/PD compliance test suite
software, and there are also dedicated USB Type-C/PD tester systems.
These just as an example:

https://cdn.teledynelecroy.com/files/pdf/grl-usb-pd-lecroy-datasheet.pdf
https://www.graniteriverlabs.com/en-us/test-solutions/protocol-power-test-solutions/usb-pd-c2
https://www.keysight.com/us/en/lib/software-detail/computer-software/s94usbcb-usb-type-c-interconnects-compliance-test-software.html

If you were wondering is there something like a command verifier tool
that can be used to test the USB Power Delivery specification
compliance (like what we have for USB - USB2CV and USB3CV) then there
is no such thing. We can not tap into the actual communication in the
operating system using UCSI. You will need an external analyser if you
want to do compliance testing I'm afraid.

> > > There have been a lot of problems with the UCSI interface on older XPS
> > > 13 and Latitude systems. Some of those problems have a workaround in
> > > the driver, but not everything.
> >
> > Do you know, how Microsoft Windows handles these problems? Also with quirks?

I don't know...

I know some of the issues did not affect Microsoft Windows at least in
the past, because the problematic UCSI commands were quite simply not
required/used in Windows. But for example the issue where the firmware
generates UCSI event before making the data available, that I really
would have assumed affects also Windows. Maybe there is some delay in
the Windows driver (that is not in the specification) that hides this
and many other issues (I'm only guessing).

There are also issues that are caused because the UCSI firmware side
is implemented so that it just passes validation tests without paying
attention on the actual features. So for example, some laptops will
report the port alternate modes correctly, but not the partner
alternate modes. The validation test suite in Windows most likely only
checks the port alternate modes, so test passed.

thanks,

-- 
heikki

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-12-12 11:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-20 23:30 Test USB Type-C port? Paul Menzel
2023-11-21 13:59 ` Heikki Krogerus
2023-12-12  4:33   ` Paul Menzel
2023-12-12  5:24     ` Rajaram R
2023-12-12 11:51       ` Heikki Krogerus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox