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@xxxxxxxxxxxxx> 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