16 using namespace mx::app;
24 int usbDevice::setupConfig( mx::app::appConfigurator & config )
26 config.add(
"usb.idVendor",
"",
"usb.idVendor", argType::Required,
"usb",
"idVendor",
false,
"string",
"USB vendor id, 4 digits");
27 config.add(
"usb.idProduct",
"",
"usb.idProduct", argType::Required,
"usb",
"idProduct",
false,
"string",
"USB product id, 4 digits");
28 config.add(
"usb.serial",
"",
"usb.serial", argType::Required,
"usb",
"serial",
false,
"string",
"USB serial number");
29 config.add(
"usb.baud",
"",
"usb.baud", argType::Required,
"usb",
"baud",
false,
"real",
"USB tty baud rate (i.e. 9600)");
34 int usbDevice::loadConfig( mx::app::appConfigurator & config )
36 config(m_idVendor,
"usb.idVendor");
37 config(m_idProduct,
"usb.idProduct");
38 config(m_serial,
"usb.serial");
43 config(baud,
"usb.baud");
45 switch((
int)(baud*10))
100 return getDeviceName();
103 int usbDevice::getDeviceName()
105 return ttyUSBDevName( m_deviceName, m_idVendor, m_idProduct, m_serial );
108 int usbDevice::connect()
112 ::close(m_fileDescrip);
116 return ttyOpenRaw( m_fileDescrip, m_deviceName, m_baudRate );
int ttyUSBDevName(std::string &devName, const std::string &vendor, const std::string &product, const std::string &serial)
Get the ttyUSB device name for a specific device.
int ttyOpenRaw(int &fileDescrip, std::string &deviceName, speed_t speed)
Open a file as a raw-mode tty device.
Error numbers for the tty utilities.
#define TTY_E_BADBAUDRATE
Utilities for i/o on a file descriptor pointing to a tty device.
Find the details for USB serial devices.
Manage a USB TTY device in the MagAOXApp context.