Template:PT3 CSHARP LNX DOTNET: Difference between revisions
From Phidgets Support
No edit summary |
No edit summary |
||
Line 11: | Line 11: | ||
<div class="phd-panel phd-flex-column-align-left phd-flex-column-justify-top"> | <div class="phd-panel phd-flex-column-align-left phd-flex-column-justify-top"> | ||
<p>Welcome to using Phidgets with C#! By using C#, you will have access to the complete Phidget22 API, including events.</p> | <p>Welcome to using Phidgets with C#! By using C#, you will have access to the complete Phidget22 API, including events.</p> | ||
<p>The dotnet command-line interface is the quickest way to start programming in C# | <p>The dotnet command-line interface is the quickest way to start programming in C#.</p> | ||
</div> | </div> | ||
</div> | </div> | ||
Line 17: | Line 17: | ||
<div class="phd-slide"> | <div class="phd-slide"> | ||
<h2> | <h2>Setting UDev Rules</h2> | ||
<p> | <p> | ||
By default, Linux will not allow regular users to access physical hardware, as a security feature. This means that you must grant yourself root privileges via | |||
sudo to run Phidgets code. | |||
</p> | </p> | ||
< | <div class="phd-command-line"><code>sudo dotnet run</code></div> | ||
<p> | <p> | ||
To avoid having to use sudo every time, you can set up a rules file to allow it automatically using the vendor code for Phidget USB devices. Create a text file | |||
called <b>99-libphidget22.rules</b> containing the following line: | |||
</p> | |||
<div class="phd-command-line"><code>SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="06c2", ATTRS{idProduct}=="00[3-a][0-f]", MODE="666"</code></div> | |||
< | <p> | ||
Mode 666 means every user has permission to read and write to the specified devices. Next, move this file to <b>/etc/udev/rules.d</b>. Now you can run code that | |||
uses Phidgets as a regular user without sudo. | |||
</p> | |||
</div> | </div> | ||
Line 40: | Line 48: | ||
<p>Usually, this will involve adding Microsoft packages to your repository and then installing dotnet via apt-get.</p> | <p>Usually, this will involve adding Microsoft packages to your repository and then installing dotnet via apt-get.</p> | ||
<p>If you are a Visual Studio Code user, you can get the '.NET Install Tool' extension instead of installing manually.</p> | |||
</div> | </div> | ||