connection issue "device is in use"

Supporting Linux and other Unixes
Post Reply
blairjamieson
Fresh meat
Posts: 1
Joined: Thu Nov 30, 2023 5:09 pm
Contact:

connection issue "device is in use"

Post by blairjamieson »

I get the following error using python on ubuntu 22.04. There are no other programs running that are connected to the phidget? I tried disconnecting and reconnecting the USB cable to the VINT hub, but no luck.

>>> from Phidget22.Phidget import *
>>> from Phidget22.Devices.HumiditySensor import *
>>> ch_hum = HumiditySensor()
>>> ch_hum.setHubPort(5)
>>> ch_hum.setDeviceSerialNumber( 665275 )
>>> ch_hum.openWaitForAttachment(10000)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/photogrammetry/.local/lib/python3.10/site-packages/Phidget22/Phidget dot py", line 621, in openWaitForAttachment
raise PhidgetException(result)
Phidget22.PhidgetException.PhidgetException: PhidgetException 0x03 (Timed Out)
Local device: <HUM1001 (Humidity Phidget) v102 -> HUB0001 Port:5 S/N:665275> open failed because device is in use. Check that the Phidget is not already open in another program, such as the Phidget Control Panel, or another program you are developing.


Here is the output from phidget admin:

photogrammetry@supermicro:~/Downloads/HelloWorld_Example$ phidget22admin -d
(665275) 6-Port USB VINT Hub Phidget v114
(665275//0) VINT Hub
(665275/4) Spatial Phidget v212
(665275/4/0) 3-Axis Accelerometer
(665275/4/0) 3-Axis Gyroscope
(665275/4/0) 3-Axis Magnetometer
(665275/4/0) Spatial
(665275/5) Humidity Phidget v102
(665275/5/0) Humidity Sensor
(665275/5/0) Temperature Sensor
(665275/0) Hub Port - Digital Input Mode v100
(665275/0/0) Digital Input
(665275/1) Hub Port - Digital Input Mode v100
(665275/1/0) Digital Input
(665275/2) Hub Port - Digital Input Mode v100
(665275/2/0) Digital Input
(665275/3) Hub Port - Digital Input Mode v100
(665275/3/0) Digital Input
(665275/4) Hub Port - Digital Input Mode v100
(665275/4/0) Digital Input
(665275/0) Hub Port - Digital Output Mode v110
(665275/0/0) Digital Output
(665275/5) Hub Port - Digital Input Mode v100
(665275/5/0) Digital Input
(665275/1) Hub Port - Digital Output Mode v110
(665275/1/0) Digital Output
(665275/2) Hub Port - Digital Output Mode v110
(665275/2/0) Digital Output
(665275/3) Hub Port - Digital Output Mode v110
(665275/3/0) Digital Output
(665275/4) Hub Port - Digital Output Mode v110
(665275/4/0) Digital Output
(665275/5) Hub Port - Digital Output Mode v110
(665275/5/0) Digital Output
(665275/0) Hub Port - Voltage Input Mode v110
(665275/0/0) Voltage Input
(665275/1) Hub Port - Voltage Input Mode v110
(665275/1/0) Voltage Input
(665275/2) Hub Port - Voltage Input Mode v110
(665275/2/0) Voltage Input
(665275/3) Hub Port - Voltage Input Mode v110
(665275/3/0) Voltage Input
(665275/4) Hub Port - Voltage Input Mode v110
(665275/4/0) Voltage Input
(665275/5) Hub Port - Voltage Input Mode v110
(665275/5/0) Voltage Input
(665275/0) Hub Port - Voltage Ratio Mode v100
(665275/0/0) Voltage Ratio Input
(665275/1) Hub Port - Voltage Ratio Mode v100
(665275/1/0) Voltage Ratio Input
(665275/2) Hub Port - Voltage Ratio Mode v100
(665275/2/0) Voltage Ratio Input
(665275/3) Hub Port - Voltage Ratio Mode v100
(665275/3/0) Voltage Ratio Input
(665275/4) Hub Port - Voltage Ratio Mode v100
(665275/4/0) Voltage Ratio Input
(665275/5) Hub Port - Voltage Ratio Mode v100
(665275/5/0) Voltage Ratio Input

Is there any way to fix this?
Martin
Fresh meat
Posts: 1
Joined: Mon Feb 10, 2025 4:12 am
Contact:

Re: connection issue "device is in use"

Post by Martin »

I have exactly the same problem using a hub with an IMU and two stepper drivers. If I initialise my steppers first, I get an error when I initialise the IMU and vice versa.
Here is my error:
Local device: <STC1005 (4A Stepper Phidget) v100 -> HUB0001 Port:0 S/N:706713> open failed because device is in use. Check that the Phidget is not already open in another program, such as the Phidget Control Panel, or another program you are developing.
User avatar
Patrick
Lead Developer
Posts: 656
Joined: Mon Jun 20, 2005 8:46 am
Location: Calgary
Contact:

Re: connection issue "device is in use"

Post by Patrick »

The USB VINT Hub as a whole, and any devices plugged into it, can only be accessed from a single program. If you need to control individual VINT devices pluged into a hub from different programs, you need to use the Phidget Network Server locally and open remote.

-Patrick
Martin
Fresh meat
Posts: 1
Joined: Mon Feb 10, 2025 4:12 am
Contact:

Re: connection issue "device is in use"

Post by Martin »

Thank you for the answer but, in fact until now in my project, I used one python code to control the stepper drivers and another to control the imu. These two codes were then imported into a main program and everything worked even though the calls to the hub were made in different files.
I've had this error since I changed one of the two python codes for a C code (for reasons of filter complexity on the imu).

Anyway, I corrected my code with remote mode, and it's been working ever since, thanks again.
Last edited by Martin on Tue Feb 11, 2025 9:25 am, edited 3 times in total.
Post Reply

Who is online

Users browsing this forum: No registered users and 27 guests