plestylib.traffic.usb_utils#

Functions#

usb_address_to_decimal(→ str)

Convert a VISA USB resource address to decimal format for pyvisa.

reset_usb_device(→ None)

Reset the underlying USB device before opening a VISA session.

Module Contents#

plestylib.traffic.usb_utils.usb_address_to_decimal(address: str) str#

Convert a VISA USB resource address to decimal format for pyvisa. Example: “USB0::0x1313::0x8078::INSTR” -> “1313:8078”

Parameters:

address (str)

Return type:

str

plestylib.traffic.usb_utils.reset_usb_device(device_id: str) None#

Reset the underlying USB device before opening a VISA session. Why? The device’s USBTMC firmware sometimes leaves the USB bulk endpoint in a halted state after failed communication attempts. That might cause subsequent VISA sessions to stall indefinitely on write operations.

Expected VISA resource format: USB…::0xVVVV::0xPPPP::…::INSTR

Parameters:

device_id (str)

Return type:

None