Scan for Phidget sensors attached?

Comments & issues
Post Reply
jxwhitmore
Fresh meat
Posts: 1
Joined: Tue Jun 21, 2022 1:43 am
Contact:

Scan for Phidget sensors attached?

Post 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.
jdecoux
Labview Developer
Posts: 161
Joined: Mon Nov 13, 2017 10:20 am
Contact:

Re: Scan for Phidget sensors attached?

Post 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.
jasongand
Fresh meat
Posts: 1
Joined: Sat May 13, 2023 4:38 pm
Contact:

Re: Scan for Phidget sensors attached?

Post 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?
fraser
Engineering
Posts: 324
Joined: Thu Nov 19, 2009 4:41 pm
Contact:

Re: Scan for Phidget sensors attached?

Post 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
User avatar
Patrick
Lead Developer
Posts: 3403
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Scan for Phidget sensors attached?

Post 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
fraser
Engineering
Posts: 324
Joined: Thu Nov 19, 2009 4:41 pm
Contact:

Re: Scan for Phidget sensors attached?

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests