usb detect - USB Device Detection

Checks whether the specific USB device has been detected and enumerated by PLT.

PLT repeatedly scans the USB bus until a matching device is seen or timeout elapses, logging each device it observes (including devices that appear, disappear, or re-appear during the scan). This makes usb detect useful both for confirming a device is already present and for waiting on a device to enumerate after it is plugged in, powered on, or reset.

Usage:

- command: usb detect
  [id: <usbDeviceID>]
  [path: <usbDevicePath>]
  [retry: <retryCount>]
  [timeout: <duration>]
  [with:
    - <filterKey> <value>
    - <langid>:<index> "<stringValue>"
  ]

Argument

Description

usbDeviceID

Optional: USB device identifiers: VID:PID, each in hex (for example 1366:0101 or 0x1366:0x0101). If set, only devices matching this VID:PID are considered.

usbDevicePath

Optional: USB device path: port. ... .port (see USB Device Paths). If set, only the device at this exact path is considered.

retryCount

Optional: Number of times to retry the test step.

timeout

Optional: Maximum duration to wait for detection (for example 5s). If omitted, PLT performs a single scan of the currently enumerated devices rather than waiting/polling for a device to appear.

with

Optional: One or more exact-match string filters. All specified filters must match. usbDeviceID and/or usbDevicePath may still be combined with with: to further narrow the candidate device(s).

Supported keys:

  • manufacturer <value> — exact match against the device’s iManufacturer string.

  • product <value> — exact match against the device’s iProduct string.

  • serial <value> — exact match against the device’s iSerialNumber string.

  • <langid>:<index> "<stringValue>" — exact match of the string descriptor at the given language ID (for example 0x0409 for US English) and descriptor index, useful for descriptors not exposed by the keys above.

Values may optionally be wrapped in double or single quotes; matching is exact (case-sensitive), not a substring or glob match.

Added in version pltOS: v2.3.28 Support for string matching filters using the with: section.

Note

If neither usbDeviceID nor usbDevicePath is set, path: “1” (The DUT USB-C Port) is used.

Examples

Minimal device check:

- command: usb detect
  id: "6666:8001"
  fail: "SBC not detected (USB)"

Match multiple strings:

- command: usb detect
  id: "1366:0101"
  with:
    - manufacturer "SEGGER"
    - product "J-Link"
    - serial "000609300812"

Added in version pltOS: v2.3.28 Support for manufacturer, product, and serial string matching.

Exact descriptor index:

- command: usb detect
  id: "0525:a4a8"
  with:
    - 0x0409:1 "QR Scanner"

Added in version pltOS: v2.3.28 Support for exact descriptor string matching by language ID and index.