dotnet7 not supported?

Supporting Visual Studio on Windows
Post Reply
esbeeen
Fresh meat
Posts: 2
Joined: Fri Sep 08, 2023 5:26 am
Contact:

dotnet7 not supported?

Post by esbeeen »

I'm attempting to control a relay (https://www.phidgets.com/?&prodid=722) with a VINT Hub (https://www.phidgets.com/?tier=3&catid= ... rodid=1202) using C# on linux.

The relay is connected on port 0 on the hub, which is connected with USB to my pc.

The following simple code produces a

Code: Select all

PhidgetException 0x03 (Timed Out)

Code: Select all

using Phidget22;

Console.WriteLine("Hello, World!");
DigitalOutput digitalOutput0 = new DigitalOutput();

digitalOutput0.IsHubPortDevice = true;
digitalOutput0.HubPort = 0;

digitalOutput0.Open(1000);
Console.WriteLine("Connected!");
I can confirm that the

Code: Select all

libphidget22
is installed, and the Hello World examples for both C and Python both work.
The

Code: Select all

Phidget22 . NET
nuget package is also installed in the given example.

Is only Mono supported for using C# with Phidgets?
User avatar
Patrick
Lead Developer
Posts: 616
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: dotnet7 not supported?

Post by Patrick »

Hi,

On Linux, you'll either have to run your program as root (sudo), or install the udev rule to allow access to Phidgets as a regular user.

You could try running as root just to confirm whether you can open the Phidget. If you are still having issues, enable logging in the library and see if there are any errors.

-Patrick
esbeeen
Fresh meat
Posts: 2
Joined: Fri Sep 08, 2023 5:26 am
Contact:

Re: dotnet7 not supported?

Post by esbeeen »

I have the following udev rule installed in /etc/udev/rules.d/99-libphidget22.rules:

Code: Select all

#All current and future Phidgets - Vendor = 0x06c2, Product = 0x0030 - 0x00a 
SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="06c2", ATTRS{idProduct}=="00[3-a][0-f]", MODE="666"
This comes from the documentation at https://www.phidgets.com/docs/OS_-_Linux

Running this bit of code

Code: Select all

using Phidget22;

Console.WriteLine("Hello, World!");
DigitalOutput digitalOutput0 = new DigitalOutput();


digitalOutput0.IsHubPortDevice = true;
digitalOutput0.HubPort = 4;

digitalOutput0.Open(1000);
Console.WriteLine("Connected!");
produces this output, whether i run it as root nor not:

Code: Select all

Hello, World!
Unhandled exception. Phidget22.PhidgetException: PhidgetException 0x03 (Timed Out)
No matching devices were found to open. Make sure your device is attached, and that your addressing parameters are specified correctly. If your Phidget has a plug or terminal block for external power, ensure it is plugged in and powered.
   at Phidget22.Phidget.Open(Int32 timeout)
   at Program.<Main>$(String[] args) in /home/esbeeen/Documents/phidgetstest/Program.cs:line 11
Aborted (core dumped)
If I unplug the phidget from USB, i get

Code: Select all

Hello, World!
Unhandled exception. Phidget22.PhidgetException: PhidgetException 0x03 (Timed Out)
No Phidgets were detected at all. Make sure your device is attached.
   at Phidget22.Phidget.Open(Int32 timeout)
   at Program.<Main>$(String[] args) in /home/esbeeen/Documents/phidgetstest/Program.cs:line 11
Aborted (core dumped)
libphidget22 is installed via packagemanager (dnf)
User avatar
Patrick
Lead Developer
Posts: 616
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: dotnet7 not supported?

Post by Patrick »

Can you post the output of lsusb?

Try increasing the open timeout?

Enable logging in the library and post the output?

-Patrick
Post Reply

Who is online

Users browsing this forum: No registered users and 36 guests