03-27-2019 06:20 AM
The issue is that the generic serial USB devices are not correctly recognized and cannot be used within a docker.
The issue comes from CAF during USB device detection - in the "usb_device_access.pyc" module of CAF.
Tested 3 different devices from a different manufacturer and they exhibit exactly the same behavior.
Gest-OS detects them as USB serial device and correclty assign them to /dev/ttyACM0 of /dev/ttyUSB0.
A native program in the Guest-OS can use them correctly.
Diagnosis:
CAF detect them as serial device (through the scan of /dev/tty*), but when it tries to detect if they are generic devices, it fails and does not set the "is_generic" attributes to True and hence cannot be assign to docker application.
Debug Logs:
2019-03-27 10:07:52,767 [pdservices:DEBUG] [Thread-4]
[usb_device_access.py:34 - usbdev_hotplug_handler()]
usbdev_hotplug_handler action add dev_node /dev/bus/usb/002/003, usb_device
2019-03-27 10:07:52,785 [pdservices:DEBUG] [Thread-4]
[usb_device_access.py:49 - usbdev_hotplug_handler()] .... event: add -
/dev/bus/usb/002/003 under usb2
2019-03-27 10:07:52,786 [pdservices:DEBUG] [Thread-4]
[usb_device_access.py:512 - add_device()] add_device method ...
2019-03-27 10:07:52,874 [pdservices:DEBUG] [Thread-4]
[usb_device_access.py:539 - add_device()] First time USB insertion,
waiting 5 seconds for fs detection
2019-03-27 10:07:57,907 [pdservices:DEBUG] [Thread-4]
[usb_device_access.py:560 - add_device()] ttydevices detected:
[Device(u'/sys/devices/pci0000:00/0000:00:0a.0/usb2/2-1/2-1:1.0/tty/ttyACM0')]
2019-03-27 10:07:57,909 [pdservices:DEBUG] [Thread-4]
[usb_device_access.py:564 - add_device()] ....hot-adding device
/dev/bus/usb/002/003 vid 0483, pid 5740 to port usb2
2019-03-27 10:07:57,910 [pdservices:INFO] [Thread-4]
[usb_device_access.py:226 - discover_other_interfaces()] discover other
interfaces()
2019-03-27 10:07:57,911 [pdservices:INFO] [Thread-4]
[usb_device_access.py:229 - discover_other_interfaces()] discover other
interfaces(2), /sys/devices/pci0000:00/0000:00:0a.0/usb2/2-1
2019-03-27 10:07:57,912 [pdservices:INFO] [Thread-4]
[usb_device_access.py:235 - discover_other_interfaces()] discover other
interfaces(3), with len: 1
2019-03-27 10:07:57,914 [pdservices:DEBUG] [Thread-4]
[usb_device_access.py:242 - discover_other_interfaces()] discover other
interfaces(4),
Device(u'/sys/devices/pci0000:00/0000:00:0a.0/usb2/2-1/2-1:1.0/tty/ttyACM0'),
/sys/devices/pci0000:00/0000:00:0a.0/usb2/2-1,
/devices/pci0000:00/0000:00:0a.0/usb2/2-1/2-1:1.0/tty/ttyACM0
2019-03-27 10:07:57,915 [pdservices:DEBUG] [Thread-4]
[usb_device_access.py:243 - discover_other_interfaces()] discover other
(5), /sys/devices/pci0000:00/0000:00:0a.0/usb2/2-1/2-1:1.0/tty/ttyACM0
2019-03-27 10:07:57,916 [pdservices:INFO] [Thread-4]
[usb_device_access.py:255 - discover_other_interfaces()] The device
/sys/devices/pci0000:00/0000:00:0a.0/usb2/2-1 has serial interface.
Updated details..
2019-03-27 10:07:57,917 [pdservices:INFO] [Thread-4]
[usb_device_access.py:256 - discover_other_interfaces()] USB generic
Parameters : {}
IOX Client listing the device as;
"usbdev": [
{
"available": true,
"bus": "2",
"dev": "3",
"device_class": "02\n",
"device_id": "/dev/bus/usb/002/003",
"device_name": null,
"device_path": "/sys/devices/pci0000:00/0000:00:0a.0/usb2/2-1",
"generic_params": {},
"is_generic": false,
"is_storage": false,
"pid": "5740",
"port": null,
"storage_params": null,
"support_fstype": [
"vfat"
],
"type": "usbdev",
"used_by": null,
"vid": "0483"
}
],
If we look into the caf py code, we see that the "is_generic" attribute is set only if 'ID_MODEL' attributes contains the 'serial' string. In our case, 'ID_MODEL' are: FT232R_USB_UART or Dual_RS232-HS or RisingHF_LoRaWAN_Modem Either CAF has an updated version that is much more tolerant to detect serial device, either we need to patch it if possible. A good condition
would be to use "ID_TYPE" and check if it is 'generic'.
Code from here:
detail code of the detection function:
def discover_other_interfaces(self, ttydevices):
log.info('discover other interfaces()')
if not self.is_storage:
log.info('discover other interfaces(2), %s', self.device_path)
if not ttydevices:
return
log.info('discover other interfaces(3), with len: %s',
len(ttydevices))
if self.generic_params is None:
self.generic_params = dict()
usb_details = dict()
for usd in ttydevices:
log.debug('discover other interfaces(4), %s, %s, %s',
usd, self.device_path, usd.get('DEVPATH'))
log.debug('discover other (5), %s', usd.sys_path)
if self.device_path in usd.sys_path and 'serial' in
usd.get('ID_MODEL').lower():
self.is_generic = True
usb_details['device_path'] = usd.get('DEVPATH')
usb_details['device_name'] = usd.get('DEVNAME')
usb_details['vendor'] = usd.get('ID_VENDOR')
usb_details['model'] = usd.get('ID_MODEL')
self.generic_params = usb_details
self.device_name = usd.get('DEVNAME')
log.info('The device %s has serial interface. Updated
details..', self.device_path)
log.info('USB generic Parameters : %s',
str(self.generic_params))
return
show version:
#show version
Cisco IOS Software, ir800 Software (ir800-UNIVERSALK9-M), Version 15.7(3)M2, RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2018 by Cisco Systems, Inc.
Compiled Wed 28-Mar-18 05:07 by prod_rel_team
ROM: Bootstrap program is IR800
Cisco829 uptime is 1 day, 3 hours, 10 minutes
System returned to ROM by CLI initiated reload at 10:28:56 UTC Tue Mar 26 2019
System image file is "flash:/ir800-universalk9-mz.SPA.157-3.M2"
Last reload reason: Reload Command
This product contains cryptographic features and is subject to United
States and local country laws governing import, export, transfer and
use. Delivery of Cisco cryptographic products does not imply
third-party authority to import, export, distribute or use encryption.
Importers, exporters, distributors and users are responsible for
compliance with U.S. and local country laws. By using this product you
agree to comply with applicable laws and regulations. If you are unable
to comply with U.S. and local laws, return this product immediately.
A summary of U.S. laws governing Cisco cryptographic products may be found at:
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html
If you require further assistance please contact us by sending email to
export@cisco.com.
Cisco IR829GW-LTE-GA-EK9 (revision 2.0) with 365568K/60416K bytes of memory.
Processor board ID FGL202123AQ
Last reset from CLI initiated reload
FPGA version: 2.7.0
BIOS: version 18 Production
BIOS: date[YYYY/MM/DD] :[2018/3/23]
MCU Bootloader : 28
MCU Application: 33
2 Serial(sync/async) interfaces
7 Gigabit Ethernet interfaces
9 terminal lines
2 Cellular interfaces
1 cisco Embedded AP (s)
DRAM configuration is 72 bits wide with parity disabled.
256K bytes of non-volatile configuration memory.
976562K bytes of ATA System Flash (Read/Write)
250000K bytes of ATA Bootstrap Flash (Read/Write)
License Info:
License UDI:
-------------------------------------------------
Device# PID SN
-------------------------------------------------
*1 IR829GW-LTE-GA-EK9 FGL202123AQ
Suite License Information for Module:'ir800'
--------------------------------------------------------------------------------
Suite Suite Current Type Suite Next reboot
--------------------------------------------------------------------------------
Technology Package License Information for Module:'ir800'
--------------------------------------------------------------------------------
Suite Suite Current Type Suite Next reboot
--------------------------------------------------------------------------------
Technology Package License Information for Module:'ir800'
------------------------------------------------------------------------
Technology Technology-package Technology-package
Current Type Next reboot
------------------------------------------------------------------------
ipbase ipbasek9 Permanent ipbasek9
security securityk9 Permanent securityk9
data datak9 Permanent datak9
Configuration register is 0x102
show iox host list detail
#show iox host list detail
IOX Server is running. Process ID: 330
Count of hosts registered: 1
Host registered:
===============
IOX Server Address: FE80::2C8:8BFF:FE2F:11AC; Port: 22222
Link Local Address of Host: FE80::1FF:FE90:8B05
IPV4 Address of Host: 192.168.2.6
IPV6 Address of Host: fe80::1ff:fe90:8b05
Client Version: 0.4
Session ID: 1
OS Nodename: Cisco829-GOS-1
Host Hardware Vendor: Cisco Systems, Inc.
Host Hardware Version: 1.0
Host Card Type: not implemented
Host OS Version: 1.6.3.1
OS status: RUNNING
Interface Hardware Vendor: None
Interface Hardware Version: None
Interface Card Type: None
Services:
===============
Service Name: Secure Storage Service
Service Status: RUNNING
Session ID: 2
Service Name: Host Device Management Service
Service Status: DISABLED
Session ID: 0
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide