Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Rasheed__Umer
Beginner
86 Views

NCS Device in Use

Hi 

I am trying to use NCS in multiple ROS nodes and was wondering if there is any way to check via OpenVino if NCS device is already in use. Thanks.

Umer

0 Kudos
1 Reply
Eugene_S_Intel
Employee
86 Views

Currently OpenVINO API does not provide any kind of query capabilities with respect to backend devices. However you can do it if you have access to Xlink API via ncsdk https://github.com/movidius/ncsdk. For example you might use XLinkGetDeviceName() function and further do parsing of returned device name, or just parsing lsusb output. Booted device, has a different VID-PID pair, than unbooted one, and if device is booted there is a high chance that is is being used, in some cases device also might be stalled.  

    for (int i = 0; ; i++) {
        char name[256];
        auto err = XLinkGetDeviceName(i, name, sizeof(name), 0);
        if (err != X_LINK_SUCCESS) {
            break;
        }
        name[sizeof(name)-1] = 0;
        std::string device = name;
        auto pos = device.find("-");
        if (pos != string::npos && pos + 1 != device.size()) {
            cout<<"unbooted: " << device.substr(pos + 1) << "\n";
        } else {
            cout<<"booted\n";
        }
    }

 

Reply