usb package

usb.USB_server module

Provides direct access to USB-enabled hardware.

class usb.USB_server.USBServer

Bases: HardwareInterfaceServer

Provides direct access to USB-enabled hardware.

baud_rate(c, baud_rate=None)

baudrate(self, c, baud_rate=None)

Sets or gets the baudrate

Parameters:
  • c – The LabRAD context

  • baud_rate (int, optional) – The baud rate to set. Defaults to None, in which case the baud rate is not set.

Returns:

The current baud rate

Return type:

(int)

name = '%LABRADNODE%_usb'
query(self, c, data)

Make a USB query, a write followed by a read.

This query is atomic. No other communication to the device will occur while the query is in progress.

Parameters:
  • c – The LabRAD context

  • data (string) – The string to be written to the USB bus

read(self, c, n_bytes=None)

Read from the USB bus.

Parameters:
  • c – The LabRAD context

  • n_bytes (int, optional) – If specified, reads only the given number of bytes.

  • Otherwise

  • None. (reads until the device stops sending. Defaults to) –

Returns:

The bytes returned from the device, with leading and trailing whitespace stripped

Return type:

string

refresh_available_interfaces()

Fill self.interfaces with available connections using Python VISA

termination(self, c, write=None, read=None)

Sets or gets the read or write terminations.

Parameters:
  • c – The LabRAD context

  • write (str, optional) – The write termination to set. Defaults to None, in which case the write termination is not set.

  • read (str, optional) – The read termination to set. Defaults to None, in which case the write termination is not set.

Returns:

A tuple containing the write and read terminations.

Return type:

(str, str)

timeout(self, c, timeout=None)

Sets the timeout associated with the interface

Parameters:
  • c – The LabRAD context

  • timeout (numeric, optional) – The timeout for the interface in seconds. Defaults to None.

Returns:

The timeout in milliseconds

write(self, c, data)

Write a string to the USB bus.

Parameters:
  • c – The LabRAD context

  • data (string) – The string to be written to the USB bus