Page 1 of 1

Scan for Phidget sensors attached?

Posted: Tue Jun 21, 2022 1:53 am
by jxwhitmore
Running on Linux and writing in Python and wondering what's the best way to scan for attached Phidget sensors and retrieve their serial numbers.

There can be a number of sensors attached and they are managed by a number of different programs executing on the system. So if I have sensors A, B and C, of which Sensor A is being monitored by program_A and sensor B is being monitored by program_B, but C is not currently being used by any Program, can I scan the environment for Sensor C or alternatively for all three sensors and find in the results that C is free.

I know there's the attach and detach handlers and that's what I'm currently using. Just executing a short Python program which runs the attach handler and prints any results, but I'm not sure that's a reliable method as yet, early days. If C is already attached to the Computer when I run the attached scan will I get it, or is that even only intended to trigger when the sensor is physically attached to the computer?

Been searching for a better solution but so far haven't found a winner. Thanks for any advice.

Re: Scan for Phidget sensors attached?

Posted: Mon Jun 27, 2022 10:03 am
by jdecoux
Sounds like you're looking for the Phidget Manager. It will detect any Phidgets that are connected and disconnected from your PC (and network, if configured).

https://www.phidgets.com/docs/Phidget_Manager

You can check the Hello World examples from the Code Samples page for an example of how to use it.

https://www.phidgets.com/?view=code_samples

- The manager won't directly tell you if a Phidget is in use, just that it is present on your machine. You would still have to try opening it to see if it is actually available.

Re: Scan for Phidget sensors attached?

Posted: Sat May 13, 2023 4:40 pm
by jasongand
jdecoux wrote: Mon Jun 27, 2022 10:03 am Sounds like you're looking for the Phidget Manager. It will detect any Phidgets that are connected and disconnected from your PC (and network, if configured).

https://www.phidgets.com/docs/Phidget_Manager

You can check the Hello World examples from the Code Samples page for an example of how to use it.

https://www.phidgets.com/?view=code_samples

- The manager won't directly tell you if a Phidget is in use, just that it is present on your machine. You would still have to try opening it to see if it is actually available.
hello,
if the manager doesn't tell you if a phidget is in use, then how can I tell if it's in use?

Re: Scan for Phidget sensors attached?

Posted: Mon May 15, 2023 9:14 am
by fraser
I believe you can check the "IsOpen" property from the channel in question in the Manager, which should tell you whether or not Open has been called on it

Re: Scan for Phidget sensors attached?

Posted: Mon May 15, 2023 1:16 pm
by Patrick
You need to try opening a channel to see whether it's in use by another program - in which case open will time out.

The IsOpen property tells you whether a channel you created is open (open() was called on it).

-Patrick

Re: Scan for Phidget sensors attached?

Posted: Mon May 15, 2023 2:24 pm
by fraser
The IsOpen property tells you whether a channel you created is open (open() was called on it).
Interesting, didn't know that distinction