Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
locks on serial port
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
cloc3
Advocate
Advocate


Joined: 13 Jan 2004
Posts: 4787
Location: http://www.gentoo-users.org/user/cloc3/

PostPosted: Thu Feb 06, 2014 12:45 pm    Post subject: locks on serial port Reply with quote

I'm plaiyng from a short time with an arduino uno board.

On my system, when two different processes (for example two istances of cat /dev/arduino, from the same owner) read from the arduino serial port, the second one hangs, waiting for the first process. No error is shown on the terminal.
On a independent ubuntu envinronment, instead, both processes work together (more slowly, off course).

How may I switch between these different behaviours?
_________________
vu vu vu
gentù
mi piaci tu
Back to top
View user's profile Send private message
tomtom69
Apprentice
Apprentice


Joined: 09 Nov 2010
Posts: 245
Location: Bavaria

PostPosted: Thu Feb 06, 2014 4:29 pm    Post subject: Reply with quote

look at "man setserial", the options ^session_lockout and ^pgrp_lockout could be the thing you are looking for.
Try to modify /etc/serial.conf or use setserial directly.
Back to top
View user's profile Send private message
cloc3
Advocate
Advocate


Joined: 13 Jan 2004
Posts: 4787
Location: http://www.gentoo-users.org/user/cloc3/

PostPosted: Fri Feb 07, 2014 2:53 pm    Post subject: Reply with quote

thanks.
setserial was not installed on my systems.

anyway, adding it, I have this output:
Code:

cloc3@dell ~ $ setserial -a /dev/arduino
/dev/arduino, Line 0, UART: unknown, Port: 0x0000, IRQ: 0
        Baud_base: 115200, close_delay: 50, divisor: 0
        closing_wait: 3000
        Flags: spd_normal low_latency


The only difference between ubuntu are: closing_wait and close_delay parameters (750 and 12 on ubuntu).
Appling this values has no effect.

session_lockout and pgrp_lockout status is not reported by setserial ouput and setting them seems not usefull.
_________________
vu vu vu
gentù
mi piaci tu
Back to top
View user's profile Send private message
tomtom69
Apprentice
Apprentice


Joined: 09 Nov 2010
Posts: 245
Location: Bavaria

PostPosted: Sat Feb 08, 2014 4:33 pm    Post subject: Reply with quote

From setserial output I assume the port to be a virtual one (USB serial)?
You are writing that two cat /dev/arduino processes work at one time on ubuntu. Is the output really duplicated, i.e. both cat processes show the same data?
The only thing I can imagine that there is some difference in file permissions for /dev/arduino (or if it is a symlink, the dev file symlinked to) or permissions of /var/lock.
However I have never seen that data from a serial port is duplicated if two programs open the same port...
Back to top
View user's profile Send private message
cloc3
Advocate
Advocate


Joined: 13 Jan 2004
Posts: 4787
Location: http://www.gentoo-users.org/user/cloc3/

PostPosted: Sat Feb 08, 2014 6:08 pm    Post subject: Reply with quote

this is a video on ubuntu.
this is what happens on /proc filesystem:
Code:

wiildos@ubuntu ~ $ ps axu|grep arduino
wiildos   5949  0.0  0.0   4224   284 pts/0    S+   19:57   0:00 cat /dev/arduino
wiildos   5950  0.0  0.0   4224   284 pts/4    S+   19:57   0:00 cat /dev/arduino
wiildos   6166  0.0  0.0   4408   828 pts/1    S+   20:01   0:00 grep --colour=auto arduino
wiildos@ubuntu ~ $ ls -l /proc/5949/fd/
totale 0
lrwx------ 1 wiildos wiildos 64 feb  8 20:01 0 -> /dev/pts/0
lrwx------ 1 wiildos wiildos 64 feb  8 20:01 1 -> /dev/pts/0
lrwx------ 1 wiildos wiildos 64 feb  8 20:01 2 -> /dev/pts/0
lr-x------ 1 wiildos wiildos 64 feb  8 20:01 3 -> /dev/ttyACM0
wiildos@ubuntu ~ $ ls -l /proc/5950/fd/
totale 0
lrwx------ 1 wiildos wiildos 64 feb  8 20:02 0 -> /dev/pts/4
lrwx------ 1 wiildos wiildos 64 feb  8 20:02 1 -> /dev/pts/4
lrwx------ 1 wiildos wiildos 64 feb  8 20:01 2 -> /dev/pts/4
lr-x------ 1 wiildos wiildos 64 feb  8 20:02 3 -> /dev/ttyACM0

_________________
vu vu vu
gentù
mi piaci tu
Back to top
View user's profile Send private message
tomtom69
Apprentice
Apprentice


Joined: 09 Nov 2010
Posts: 245
Location: Bavaria

PostPosted: Mon Feb 10, 2014 6:46 pm    Post subject: Reply with quote

This looks like the data is spread (randomly) between the two instances of "cat". Is this really a desired behaviour?
Normally file locking prevents such a behaviour. I would assume that the data sharing is only the effect of a non-functional file locking in ubuntu.
Back to top
View user's profile Send private message
cloc3
Advocate
Advocate


Joined: 13 Jan 2004
Posts: 4787
Location: http://www.gentoo-users.org/user/cloc3/

PostPosted: Tue Feb 11, 2014 2:50 pm    Post subject: Reply with quote

tomtom69 wrote:
Is this really a desired behaviour?

I don't know.
My wish is to switch between both behaviours.
:)

Sometime, the ubuntu behaviour may it be useful. How may I investigate about it?
_________________
vu vu vu
gentù
mi piaci tu
Back to top
View user's profile Send private message
tomtom69
Apprentice
Apprentice


Joined: 09 Nov 2010
Posts: 245
Location: Bavaria

PostPosted: Thu Feb 13, 2014 8:26 pm    Post subject: Reply with quote

The only I know to share a dev file is via access control
http://www.makelinux.net/ldd3/chp-6-sect-6
But this needs to be done by the client, in your case "cat".
Someone here who has an idea how to achieve this using "cat" or set this as a default behaviour?
Back to top
View user's profile Send private message
cloc3
Advocate
Advocate


Joined: 13 Jan 2004
Posts: 4787
Location: http://www.gentoo-users.org/user/cloc3/

PostPosted: Tue Feb 25, 2014 12:56 pm    Post subject: Reply with quote

tomtom69 wrote:

But this needs to be done by the client, in your case "cat".

thanks a lot.

anyway, the problem is in the kernel.
forcing ubuntu to boot with gentoo kernel, the behaviour turns back to gentoo.
_________________
vu vu vu
gentù
mi piaci tu
Back to top
View user's profile Send private message
tomtom69
Apprentice
Apprentice


Joined: 09 Nov 2010
Posts: 245
Location: Bavaria

PostPosted: Tue Feb 25, 2014 8:19 pm    Post subject: Reply with quote

I could not find any suspicious config option that could enable this behaviour.
Does your Ubuntu kernel contain a .config file that can be compared to your Gentoo's kernel .config file?
Or can you compile a gentoo kernel identical to the Ubuntu one with the same .config file?
Back to top
View user's profile Send private message
cloc3
Advocate
Advocate


Joined: 13 Jan 2004
Posts: 4787
Location: http://www.gentoo-users.org/user/cloc3/

PostPosted: Thu Feb 27, 2014 9:35 pm    Post subject: Reply with quote

tomtom69 wrote:

Does your Ubuntu kernel contain a .config file that can be compared to your Gentoo's kernel .config file?
Or can you compile a gentoo kernel identical to the Ubuntu one with the same .config file?

thanks again.

unlikeley, your hint needs a lot of time.
surely, gentoo and ubuntu .config file are not completly identical.
_________________
vu vu vu
gentù
mi piaci tu
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum