[Xastir] Xastir with TNC-X

James Cameron vk2lqz at wia.org.au
Wed Dec 9 16:34:18 EST 2009


On Thu, Dec 10, 2009 at 07:31:46AM +1030, Tony Hunt wrote:
> If it get unplugged or plugged in somewhere different it will nearly
> allways get a different device name and you find yourself diving in to
> xastir config to change it each time you run xastir.

You will also often find an existing symbolic link to the device in
/dev/serial/by-path or /dev/serial/by-id ... and if you use these links
instead of /dev/ttyUSB0 then they will remain despite a renumbering.

These days applications are expected to receive events from the kernel
advising them of newly plugged devices.

The interfaces vary, but one popular one is D-Bus.

At minimum, an application (such as XASTIR) can subscribe to the event
stream and notice the plugging-in of known devices, in order to get the
name.  The name can then be presented in a hint next to the field, or as
a member of a drop-down list or option list.

At best, XASTIR could track the device as it is removed and reinserted,
by matching the known data it had about it.

You can also use shell commands to catch this stream, and this might be
a handy way to automate it for yourself if you don't want to have to
configure udev rules (e.g. on a live-cd or on someone else's computer).

% dbus-monitor --system

As an example, when I plugged in a USB to serial dongle just now, I got
this verbose stream of data, attached.  In it we find the product and
vendor identifiers, sometimes a serial number, but certainly the device
names that can be used to access it.

-- 
James Cameron
http://quozl.linux.org.au/
-------------- next part --------------
signal sender=:1.21 -> dest=(null destination) serial=31 path=/org/freedesktop/DeviceKit; interface=org.freedesktop.DeviceKit; member=DeviceEvent
   string "add"
   string "usb"
   string "/sys/devices/pci0000:00/0000:00:10.0/usb2/2-2"
   string "/dev/bus/usb/002/002"
   array [
      string "/dev/char/189:129"
   ]
   array [
      dict entry(
         string "UDEV_LOG"
         string "3"
      )
      dict entry(
         string "DEVICE"
         string "/proc/bus/usb/002/002"
      )
      dict entry(
         string "TYPE"
         string "0/0/0"
      )
      dict entry(
         string "DEVNAME"
         string "/dev/bus/usb/002/002"
      )
      dict entry(
         string "DEVTYPE"
         string "usb_device"
      )
      dict entry(
         string "BUSNUM"
         string "002"
      )
      dict entry(
         string "DEVPATH"
         string "/devices/pci0000:00/0000:00:10.0/usb2/2-2"
      )
      dict entry(
         string "ACTION"
         string "add"
      )
      dict entry(
         string "DEVNUM"
         string "002"
      )
      dict entry(
         string "PRODUCT"
         string "67b/2303/300"
      )
      dict entry(
         string "MAJOR"
         string "189"
      )
      dict entry(
         string "SEQNUM"
         string "1087"
      )
      dict entry(
         string "DEVLINKS"
         string "/dev/char/189:129"
      )
      dict entry(
         string "MINOR"
         string "129"
      )
      dict entry(
         string "SUBSYSTEM"
         string "usb"
      )
   ]
signal sender=:1.1 -> dest=(null destination) serial=224 path=/org/freedesktop/Hal/Manager; interface=org.freedesktop.Hal.Manager; member=DeviceAdded
   string "/org/freedesktop/Hal/devices/usb_device_67b_2303_noserial"
signal sender=:1.21 -> dest=(null destination) serial=32 path=/org/freedesktop/DeviceKit; interface=org.freedesktop.DeviceKit; member=DeviceEvent
   string "add"
   string "module"
   string "/sys/module/pl2303"
   string ""
   array [
   ]
   array [
      dict entry(
         string "UDEV_LOG"
         string "3"
      )
      dict entry(
         string "SUBSYSTEM"
         string "module"
      )
      dict entry(
         string "ACTION"
         string "add"
      )
      dict entry(
         string "DEVPATH"
         string "/module/pl2303"
      )
      dict entry(
         string "SEQNUM"
         string "1089"
      )
   ]
signal sender=:1.21 -> dest=(null destination) serial=33 path=/org/freedesktop/DeviceKit; interface=org.freedesktop.DeviceKit; member=DeviceEvent
   string "add"
   string "drivers"
   string "/sys/bus/usb-serial/drivers/pl2303"
   string ""
   array [
   ]
   array [
      dict entry(
         string "UDEV_LOG"
         string "3"
      )
      dict entry(
         string "SUBSYSTEM"
         string "drivers"
      )
      dict entry(
         string "ACTION"
         string "add"
      )
      dict entry(
         string "DEVPATH"
         string "/bus/usb-serial/drivers/pl2303"
      )
      dict entry(
         string "SEQNUM"
         string "1090"
      )
   ]
signal sender=:1.21 -> dest=(null destination) serial=34 path=/org/freedesktop/DeviceKit; interface=org.freedesktop.DeviceKit; member=DeviceEvent
   string "add"
   string "usb"
   string "/sys/devices/pci0000:00/0000:00:10.0/usb2/2-2/2-2:1.0"
   string ""
   array [
   ]
   array [
      dict entry(
         string "INTERFACE"
         string "255/0/0"
      )
      dict entry(
         string "UDEV_LOG"
         string "3"
      )
      dict entry(
         string "DEVICE"
         string "/proc/bus/usb/002/002"
      )
      dict entry(
         string "TYPE"
         string "0/0/0"
      )
      dict entry(
         string "DEVTYPE"
         string "usb_interface"
      )
      dict entry(
         string "SEQNUM"
         string "1088"
      )
      dict entry(
         string "PRODUCT"
         string "67b/2303/300"
      )
      dict entry(
         string "ACTION"
         string "add"
      )
      dict entry(
         string "DEVPATH"
         string "/devices/pci0000:00/0000:00:10.0/usb2/2-2/2-2:1.0"
      )
      dict entry(
         string "SUBSYSTEM"
         string "usb"
      )
      dict entry(
         string "MODALIAS"
         string "usb:v067Bp2303d0300dc00dsc00dp00icFFisc00ip00"
      )
   ]
signal sender=:1.1 -> dest=(null destination) serial=230 path=/org/freedesktop/Hal/Manager; interface=org.freedesktop.Hal.Manager; member=DeviceAdded
   string "/org/freedesktop/Hal/devices/usb_device_67b_2303_noserial_if0"
signal sender=:1.21 -> dest=(null destination) serial=35 path=/org/freedesktop/DeviceKit; interface=org.freedesktop.DeviceKit; member=DeviceEvent
   string "add"
   string "usb-serial"
   string "/sys/devices/pci0000:00/0000:00:10.0/usb2/2-2/2-2:1.0/ttyUSB0"
   string ""
   array [
   ]
   array [
      dict entry(
         string "UDEV_LOG"
         string "3"
      )
      dict entry(
         string "SUBSYSTEM"
         string "usb-serial"
      )
      dict entry(
         string "ACTION"
         string "add"
      )
      dict entry(
         string "DEVPATH"
         string "/devices/pci0000:00/0000:00:10.0/usb2/2-2/2-2:1.0/ttyUSB0"
      )
      dict entry(
         string "SEQNUM"
         string "1091"
      )
   ]
signal sender=:1.21 -> dest=(null destination) serial=36 path=/org/freedesktop/DeviceKit; interface=org.freedesktop.DeviceKit; member=DeviceEvent
   string "add"
   string "drivers"
   string "/sys/bus/usb/drivers/pl2303"
   string ""
   array [
   ]
   array [
      dict entry(
         string "UDEV_LOG"
         string "3"
      )
      dict entry(
         string "SUBSYSTEM"
         string "drivers"
      )
      dict entry(
         string "ACTION"
         string "add"
      )
      dict entry(
         string "DEVPATH"
         string "/bus/usb/drivers/pl2303"
      )
      dict entry(
         string "SEQNUM"
         string "1093"
      )
   ]
signal sender=:1.21 -> dest=(null destination) serial=37 path=/org/freedesktop/DeviceKit; interface=org.freedesktop.DeviceKit; member=DeviceEvent
   string "add"
   string "tty"
   string "/sys/devices/pci0000:00/0000:00:10.0/usb2/2-2/2-2:1.0/ttyUSB0/tty/ttyUSB0"
   string "/dev/ttyUSB0"
   array [
      string "/dev/char/188:0"
      string "/dev/serial/by-path/pci-0000:00:10.0-usb-0:2:1.0-port0"
      string "/dev/serial/by-id/usb-Prolific_Technology_Inc._USB-Serial_Controller-if00-port0"
   ]
   array [
      dict entry(
         string "ID_IFACE"
         string "00"
      )
      dict entry(
         string "ID_VENDOR_ENC"
         string "Prolific\x20Technology\x20Inc."
      )
      dict entry(
         string "ID_VENDOR_ID"
         string "067b"
      )
      dict entry(
         string "ID_SERIAL"
         string "Prolific_Technology_Inc._USB-Serial_Controller"
      )
      dict entry(
         string "UDEV_LOG"
         string "3"
      )
      dict entry(
         string "ID_MODEL"
         string "USB-Serial_Controller"
      )
      dict entry(
         string "ID_TYPE"
         string "generic"
      )
      dict entry(
         string "ID_USB_DRIVER"
         string "pl2303"
      )
      dict entry(
         string "ID_VENDOR"
         string "Prolific_Technology_Inc."
      )
      dict entry(
         string "ID_PATH"
         string "pci-0000:00:10.0-usb-0:2:1.0"
      )
      dict entry(
         string "DEVNAME"
         string "/dev/ttyUSB0"
      )
      dict entry(
         string "SEQNUM"
         string "1092"
      )
      dict entry(
         string "ACTION"
         string "add"
      )
      dict entry(
         string "DEVPATH"
         string "/devices/pci0000:00/0000:00:10.0/usb2/2-2/2-2:1.0/ttyUSB0/tty/ttyUSB0"
      )
      dict entry(
         string "ID_MODEL_ENC"
         string "USB-Serial\x20Controller"
      )
      dict entry(
         string "MAJOR"
         string "188"
      )
      dict entry(
         string "ID_BUS"
         string "usb"
      )
      dict entry(
         string "ID_REVISION"
         string "0300"
      )
      dict entry(
         string "ID_MODEL_ID"
         string "2303"
      )
      dict entry(
         string "ID_PORT"
         string "0"
      )
      dict entry(
         string "SUBSYSTEM"
         string "tty"
      )
      dict entry(
         string "ID_USB_INTERFACES"
         string ":ff0000:"
      )
      dict entry(
         string "ID_USB_INTERFACE_NUM"
         string "00"
      )
      dict entry(
         string "DEVLINKS"
         string "/dev/char/188:0 /dev/serial/by-path/pci-0000:00:10.0-usb-0:2:1.0-port0 /dev/serial/by-id/usb-Prolific_Technology_Inc._USB-Serial_Controller-if00-port0"
      )
      dict entry(
         string "MINOR"
         string "0"
      )
   ]


More information about the Xastir mailing list