DeviceDetector

class sitchlib.DeviceDetector[source]

Interrogate all USB TTY ports.

gsm_radios

list – This is a list of GSM radios, represented in dict type objects.

gps_devices

list – This is a list of GPS devices. Just strings like ‘/dev/ttyUSB0’.

classmethod find_gps_radios(usbtty_ports)[source]

Interrogate USB TTY ports, return a list of GPS devices.

classmethod find_gsm_radios(usbtty_ports)[source]

Interrogate USB TTY ports, return GSM radios.

classmethod get_devices_by_subsys(subsys_type)[source]

Get devices from udev, by type.

classmethod get_gsm_modem_info(port)[source]

Get modem information.

Parameters:port (str) – Device/port to interrogate.
Returns:
metadata describing modem manufacturer, model, revision,
and serial.
Return type:dict
classmethod interrogate_gsm_modem(port, command)[source]

Issue command on port, return output.

Parameters:
  • port (str) – Port/device to interrogate.
  • commmand (str) – Command to be issued.
Returns:

Response from device, if any. If none, returns an empty

string.

Return type:

str

classmethod interrogator(match_list, port, test_command=None)[source]

Interrogate serial port, and attempt to match output.

Parameters:
  • match_list (list) – List of strings that positively identify a device of a specific type.
  • port (str) – Port to be interrogated.
  • test_command (str) – Command to trigger output to match against match_list.
Returns:

True if the device is a positive match, False if not.

Return type:

bool

classmethod interrogator_matcher(matchers, line)[source]

Attempt to match output against known identifing strings.

Parameters:
  • matchers (list) – List of strings which represent positive matches.
  • line (str) – Output from USB TTY device.
Returns:

True if it’s a match, False if not.

Return type:

bool

classmethod is_a_gps(port)[source]

Wrap interrogator for determining when a GPS is discovered.

classmethod is_a_gsm_modem(port)[source]

Wrap interrogator for determining when a GSM modem is discovered.