cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
19235
Views
0
Helpful
13
Replies

App Activation error: Device association is missing with a USB device.

arun1587
Level 1
Level 1

Hello,

I get this error while trying to activate a docker app on iox. The app basically tries to communicate to the serial USB device connected to the router. I followed the instructions from https://developer.cisco.com/docs/iox/#!sample/universal-serial-bus-usb-usage-in-the-app

info about my setup:

os version: 1.6.3


<<<<<< package.yaml file >>>>>


app:

  cpuarch: "x86_64"

  type: docker

  resources:

    profile: c1.large


    network:

      -

        interface-name: eth0


    devices:

      - 

        type: usbdev

        label: HOST_DEV1

        function: serial

        vendorID: "0483"

        productID: "5740"

        mandatory: True


<<<<<< lsusb from the container console >>>>


# lsusb

Bus 002 Device 003: ID 0483:5740

Bus 001 Device 001: ID 1d6b:0002

Bus 002 Device 001: ID 1d6b:0001


<<<<< dmesg output from the container console >>>>

usb 2-1: new full-speed USB device number 3 using ohci-pci

cdc_acm 2-1:1.0: ttyACM0: USB ACM device




<<< ioxclient platform device list  snippet >>>>

"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"

  }



<<<<<<</dev from the container>>>>>>>>


# ls -lrt /dev/

total 0

crw-rw-rw-    1 root root        1, 5 Jun 14 14:21 zero

crw-rw-rw-    1 root root        1, 9 Jun 14 14:21 urandom

lrwxrwxrwx    1 root root            10 Jun 14 14:21 tty1 -> /dev/pts/0

crw-rw-rw-    1 root root        5, 0 Jun 14 14:21 tty

lrwxrwxrwx    1 root root            15 Jun 14 14:21 stdout -> /proc/self/fd/1

lrwxrwxrwx    1 root root            15 Jun 14 14:21 stdin -> /proc/self/fd/0

lrwxrwxrwx    1 root root            15 Jun 14 14:21 stderr -> /proc/self/fd/2

crw-rw-rw-    1 root root        1, 8 Jun 14 14:21 random

drwxr-xr-x    2 root root             0 Jun 14 14:21 pts

crw-rw-rw-    1 root root        5, 2 Jun 14 14:21 ptmx

crw-rw-rw-    1 root root        1, 3 Jun 14 14:21 null

drwxr-xr-x    2 nobody nobody          60 Jun 14 14:21 net

crw-rw-rw-    1 root root        1, 7 Jun 14 14:21 full

lrwxrwxrwx    1 root root            13 Jun 14 14:21 fd -> /proc/self/fd

lrwxrwxrwx    1 root root            10 Jun 14 14:21 console -> /dev/pts/0

/ #


the app ran locally on my PC fine with the following command;

docker run -t -i --device=/dev/ttyACM0 test-app"

could you please let me know what is still missing?

thanks,

13 Replies 13

Geevarghese Cheria
Cisco Employee
Cisco Employee

Hi Arun,

Please check these related urls

Thanks and Regards,

Geevarghese

Hi Geevarghese,

I followed both the links that you pasted and I shared the error along with my configurations and output.

It would be great if you can help me looking at those configuration and output and let me know if there is something missing?

The USB device is also not listed by the localmanager.

thanks,

Arun

Please refer to https://developer.cisco.com/docs/iox/#!usb-device-usage/universal-serial-bus-usb and https://developer.cisco.com/docs/iox/#!sample.

And please note only USB storage and serial devices are supported for Cisco IOx.

Hello Steve,
I followed the link that you have shared.  I've shared my package file and other outputs at the beginning of the thread. 

Yes, I used a lorawan modem that can be enumerated as usb serial device.

I couldn't notice any obvious thing that is wrong in my configuration.

could you please let me know what can make a usb_serial device not to be listed by the localmanager? May be this could help further debugging the issue.

thanks,

I remember I have similar problem to use USB long time ago, don't remember what exactly was the error.

I remember I have to change one or two of following in yaml file, either product id , vendor id or device id or the combination of them.

Just FYI, don't if it helps.

    devices:

      -

        type: usbdev

        label: HOST_DEV

        usage: Needs usb storage device to persist data

        function: storage

        mandatory: True

        mount-point: /extra/storage/

        device-directory-to-mount: /home/root/testUSB

        vendorID: "067b"

        productID: "2517"   

  "devices": [{"type": "usbdev", "label": "HOST_DEV", "device-id": "/dev/bus/usb/001/006", "vid":"067b", "pid":"2517"}]

    }

I use the values of vid, pid of the device from the output of "ioxclient platform device list" and also I'm using the device as serial usb device.

I still see the USB device as undefined in ioxLocalManager.

output of "ioxclient platform device list" >>>>

"usbdev": [

  {

   "available": true,

   "bus": "2",

   "dev": "4",

   "device_class": "02\n",

   "device_id": "/dev/bus/usb/002/004",

   "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"

  }

package.yaml >>>>

app:

  cpuarch: "x86_64"

  type: docker

  resources:

    profile: c1.large

    network:

      -

        interface-name: eth0

    devices:

      - 

        type: usbdev

        label: HOST_DEV1

        function: serial

        vendorID: "0483"

        productID: "5740"

        mandatory: True

Have you checked this doc see if the USB is recognized and mounted properly?

https://www.cisco.com/c/en/us/td/docs/routers/access/800/829/software/configuration/guide/b_IR800config/guestos.html#con…

I ioxclient platform output looks like this:

"usbdev": [

  {

   "available": true,

   "bus": "1",

   "dev": "2",

   "device_class": "00\n",

   "device_id": "/dev/bus/usb/001/002",

   "device_name": "/dev/sdc1",

   "device_path": "/sys/devices/pci0000:00/0000:00:09.0/usb1/1-1",

   "generic_params": null,

   "is_generic": false,

   "is_storage": true,

   "pid": "2517",

   "port": null,

   "storage_params": {

    "device_name": "/dev/sdc1",

    "fs_label": "CORSAIR",

    "fs_uuid": "1C2E-5359",

    "fstype": "vfat",

    "model": "USB_Mass_Storage_Device",

    "mount_point": null,

    "vendor": "Prolific_Technology_Inc."

   },

   "support_fstype": [

    "vfat"

   ],

   "type": "usbdev",

   "used_by": null,

   "vid": "067b"

  }

],

"usbport": [

  {

   "available": true,

   "device_id": "usb2",

   "device_name": "usb-serial",

   "ds_dids": [],

   "support_fstype": [

    "vfat"

   ],

   "type": "usbport",

   "used_by": null

  },

  {

   "available": true,

   "device_id": "usb1",

   "device_name": "usb-ports",

   "ds_dids": [

    "/dev/bus/usb/001/002"

   ],

   "pbus": "00",

   "pdomain": "0000",

   "pfunc": "0",

   "pslot": "09",

   "support_fstype": [

    "vfat"

   ],

   "type": "usbport",

   "used_by": null

  }

]

}

yep,  I could see it in lsusb and also in /dev

root@Cisco829-GOS-1:~# ls -lrt /dev/ttyACM0

crw-rw---- 1 root dialout 166, 0 Jul  6 09:21 /dev/ttyACM0

root@Cisco829-GOS-1:~# lsusb

Bus 002 Device 005: ID 0483:5740

Bus 001 Device 001: ID 1d6b:0002

Bus 002 Device 001: ID 1d6b:0001

root@Cisco829-GOS-1:~#

Have you tried to activate it from ioxclient ? (with debug)

yes, I tried it with ioxclient and wasn't a successful try.

I will post the logs from debug here, shortly. 

yes, I tried it with IOX client and wasn't a successful try.

I will post the logs from debug here, shortly. 

$ cat activation_storage.json
{
"resources": {
"profile": "c1.large",
"cpu": "600",
"memory": "256",
"disk": "20",
"network": [{"interface-name": "eth0", "network-name": "iox-bridge0"}],
"devices": [{"type": "usbdev", "label": "HOST_DEV1", "device-id": "/dev/bus/usb/002/004", "vid":"0483", "pid":"5740", "device-name":"lorawan"}]
}
}


ioxclient application activate 1 --payload activation_storage.json
\Currently active profile : tcp-app-test
Command Name: application-activate
Payload file : activation_storage.json. Will pass it as application/json in request body..
Saving current configuration
Payload file : activation_storage.json. Will pass it as application/json in request body..
Could not complete your command : Error. Server returned 500
{
"description": "App Activation error: USB device not available for application use, but app has a mandatory dependency",
"errorcode": -1021,
"message": "Error while changing app state"
}
acklio@acklio:~/workspace/src/bitbucket.org/acklio/tcp-app$

 "device-name" - I couldn't find any definition for this field in https://developer.cisco.com/docs/iox/#!usb-device-usage/universal-serial-bus-usb. but it seems to be  a mandatory field because without which I get the following error.

 

 

ioxclient application activate test --payload activation_storage.json
Currently active profile : tcp-app-test
Command Name: application-activate
Payload file : activation_storage.json. Will pass it as application/json in request body..
2018/07/26 10:08:03 POST /iox/api/v2/hosting/apps/test/state?action=activate HTTP/1.1
Host: 192.168.1.112:8443
Content-Type: application/json
X-Token-Id: dd55ab15-c593-4367-8129-5467c445e8fb

{
"resources": {
"profile": "c1.large",
"cpu": "600",
"memory": "256",
"disk": "20",
"network": [{"interface-name": "eth0", "network-name": "iox-bridge0"}],
"devices": [{"type": "usbdev", "label": "/dev/ttyACM0", "device-id": "/dev/bus/usb/002/002", "vid":"0483", "pid":"5740"}]
}
}


Error. Server returned 500
{
"description": "App Activation error: 'device-name'",
"errorcode": -1021,
"message": "Error while changing app state"
}