How to use serial or usb-ports in linux

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How to use serial or usb-ports in linux

P. vanderWal
Hello all,
 
I wrote a program to control a hobby milling machine.(Profiler, see Elektor-forum). The programm is written in fpc-pascal and using synaser in the windows version for control of the serial port(s).
Now I want to use the program in Debian 8... and or Ubuntu 15... Compiling and running the present version gives "no permission" for the serial/usb ports.
Please advise how to get the program running with these ports. (lazarus 1.2.4 fpc 2.6.4).
 
Piet, PE0PWA (ham radio call). 

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: How to use serial or usb-ports in linux

Sven Barth-2

Am 06.09.2015 12:34 schrieb "P. vanderWal" <[hidden email]>:
>
> Hello all,
>  
> I wrote a program to control a hobby milling machine.(Profiler, see Elektor-forum). The programm is written in fpc-pascal and using synaser in the windows version for control of the serial port(s).
> Now I want to use the program in Debian 8... and or Ubuntu 15... Compiling and running the present version gives "no permission" for the serial/usb ports.
> Please advise how to get the program running with these ports. (lazarus 1.2.4 fpc 2.6.4).

You need to run your program either as root or ensure that the user you run as is allowed to use the ports.
You can check that by doing a "ls -l /dev/tty*", which will list the user and group of the ttys as well as the permissions. With "groups" you should be able to list what groups your user is part of and whether one of those matches the group of the ports you try to access.

Regards,
Sven


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: How to use serial or usb-ports in linux

Christo Crause
On Sun, 2015-09-06 at 12:40 +0200, Sven Barth wrote:

> Am 06.09.2015 12:34 schrieb "P. vanderWal" <[hidden email]>:
> >
> > Hello all,
> >  
> > I wrote a program to control a hobby milling machine.(Profiler, see
> Elektor-forum). The programm is written in fpc-pascal and using
> synaser in the windows version for control of the serial port(s).
> > Now I want to use the program in Debian 8... and or Ubuntu 15...
> Compiling and running the present version gives "no permission" for
> the serial/usb ports.
> > Please advise how to get the program running with these ports.
> (lazarus 1.2.4 fpc 2.6.4).
>
> You need to run your program either as root or ensure that the user
> you run as is allowed to use the ports.
> You can check that by doing a "ls -l /dev/tty*", which will list the
> user and group of the ttys as well as the permissions. With "groups"
> you should be able to list what groups your user is part of and
> whether one of those matches the group of the ports you try to access.
>
> Regards,
> Sven
>

A different flavour of what Sven recommended is to write a udev rule
which adds the permissions to any (or according to some filter rules)
usb device on the fly.  This is particularly useful if the kernel
assigns different names to different devices.  I have the following rule
in /etc/udev/rules.d/50-permissions-on-unclaimed-usb-devices.rules:

 SUBSYSTEM=="usb", ATTRS{bDeviceClass}=="ff", ACTION=="add",
GROUP="groupname", MODE="0664"

Regards,
Christo

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: How to use serial or usb-ports in linux

Henry Vermaak
In reply to this post by P. vanderWal
On Sun, Sep 06, 2015 at 12:16:31PM +0200, P. vanderWal wrote:
> Hello all,
>
> I wrote a program to control a hobby milling machine.(Profiler, see
> Elektor-forum). The programm is written in fpc-pascal and using
> synaser in the windows version for control of the serial port(s).  Now
> I want to use the program in Debian 8... and or Ubuntu 15... Compiling
> and running the present version gives "no permission" for the
> serial/usb ports.  Please advise how to get the program running with
> these ports. (lazarus 1.2.4 fpc 2.6.4).

For Debian you usually have to be part of the "dialout" group to have
access to the serial ports.

Henry
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: How to use serial or usb-ports in linux

Mark Morgan Lloyd-5
Henry Vermaak wrote:

> On Sun, Sep 06, 2015 at 12:16:31PM +0200, P. vanderWal wrote:
>> Hello all,
>>
>> I wrote a program to control a hobby milling machine.(Profiler, see
>> Elektor-forum). The programm is written in fpc-pascal and using
>> synaser in the windows version for control of the serial port(s).  Now
>> I want to use the program in Debian 8... and or Ubuntu 15... Compiling
>> and running the present version gives "no permission" for the
>> serial/usb ports.  Please advise how to get the program running with
>> these ports. (lazarus 1.2.4 fpc 2.6.4).
>
> For Debian you usually have to be part of the "dialout" group to have
> access to the serial ports.

Same for Slackware and possibly others. Always catches me out, despite
doing quite a lot of this sort of stuff.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal