开云体育

Serial PTT not functioning after exit


 

Good morning guys, Tim (Kd9DBG) with the high school telemetry car project,?


Here is my current question...


?How does one "cleanly" shutdown Direwolf?

Here is the behavior after launching direwolf on a Raspberry Pi with the command


direwolf -c dw-tracker.conf


Direwolf functions flawlessly. The serial PTT functions without issue.


Shutting down direwolf with either a:


[Ctrl] + c

or?

kill -HUP (direwolf process number)


both stop direwolf as expected. However when restarting direwolf with the same command as before I get the following error message:


ERROR can't open device /dev/PTT for channel 0 PTT control.

Device or resource busy


the error message disappears when restarting direwolf with sudo.


There has to be a better solution than elevating to root.?


What are your thoughts?


Tim ...



Apostolos Kefalas
 

Hello Tim,

This is a permission problem and not a direwolf exiting problem.

give us the output of the below commands:

$ who

$ groups

$ ls -al /dev/PTT


73 de SV1LJJ


On Κυρ, 2017-02-26 at 15:15 +0000, overrocking@...
[direwolf_packet] wrote:

Good morning guys, Tim (Kd9DBG) with the high school telemetry car
project,


Here is my current question...


How does one "cleanly" shutdown Direwolf?

Here is the behavior after launching direwolf on a Raspberry Pi with
the command


direwolf -c dw-tracker.conf


Direwolf functions flawlessly. The serial PTT functions without issue.


Shutting down direwolf with either a:


[Ctrl] + c

or

kill -HUP (direwolf process number)


both stop direwolf as expected. However when restarting direwolf with
the same command as before I get the following error message:


ERROR can't open device /dev/PTT for channel 0 PTT control.

Device or resource busy



the error message disappears when restarting direwolf with sudo.


There has to be a better solution than elevating to root.


What are your thoughts?


Tim ...



 

I'm always game for learning more, thanks for diving in with some help.?
Here are the results of the commands:

kd9dcs@bluetracker:~ $ who
kd9dcs ? :0 ? ? ? ? ? 2017-02-26 17:51 (:0)
kd9dcs ? pts/0 ? ? ? ?2017-02-27 05:34 (192.168.2.10)

kd9dcs@bluetracker:~ $ groups
pi adm dialout cdrom sudo audio video plugdev games users input netdev gpio i2c spi

kd9dcs@bluetracker:~ $ ls -al /dev/PTT
lrwxrwxrwx 1 root root 7 Feb 26 17:51 /dev/PTT -> ttyUSB0

Thanks again for looking at this

Tim ...



 

开云体育

Hope you don't mind if I join in with this Tim as I'm watching this with interest. I have similar problems trying to get GPIO PTT and DCD working with the correct permissions. Despite being able to write to GPIO as my normal user, Direwolf always wants a sudo password.

I haven't tried USB serial PTT yet but I may well do and see if I get a similar result to you.

Nick.


On 27/02/2017 11:41, overrocking@... [direwolf_packet] wrote:

?

I'm always game for learning more, thanks for diving in with some help.?

Here are the results of the commands:

kd9dcs@bluetracker:~ $ who
kd9dcs ? :0 ? ? ? ? ? 2017-02-26 17:51 (:0)
kd9dcs ? pts/0 ? ? ? ?2017-02-27 05:34 (192.168.2.10)

kd9dcs@bluetracker:~ $ groups
pi adm dialout cdrom sudo audio video plugdev games users input netdev gpio i2c spi

kd9dcs@bluetracker:~ $ ls -al /dev/PTT
lrwxrwxrwx 1 root root 7 Feb 26 17:51 /dev/PTT -> ttyUSB0

Thanks again for looking at this

Tim ...




Apostolos Kefalas
 

OK lets see the permissions of ttyUSB0

$ ls -al /dev/ttyUSB0




On Δευ, 2017-02-27 at 17:37 +0000, 'Nick B.' nick@...
[direwolf_packet] wrote:

Hope you don't mind if I join in with this Tim as I'm watching this
with interest. I have similar problems trying to get GPIO PTT and DCD
working with the correct permissions. Despite being able to write to
GPIO as my normal user, Direwolf always wants a sudo password.

I haven't tried USB serial PTT yet but I may well do and see if I get
a similar result to you.

Nick.



On 27/02/2017 11:41, overrocking@... [direwolf_packet] wrote:


I'm always game for learning more, thanks for diving in with some
help.

Here are the results of the commands:

kd9dcs@bluetracker:~ $ who
kd9dcs :0 2017-02-26 17:51 (:0)
kd9dcs pts/0 2017-02-27 05:34 (192.168.2.10)


kd9dcs@bluetracker:~ $ groups
pi adm dialout cdrom sudo audio video plugdev games users input
netdev gpio i2c spi


kd9dcs@bluetracker:~ $ ls -al /dev/PTT
lrwxrwxrwx 1 root root 7 Feb 26 17:51 /dev/PTT -> ttyUSB0


Thanks again for looking at this


Tim ...





--
Κεφ?λα? Απ?στολο? - SV1LJJ

τηλ: +30 6979 976 039
Echolink id: 309275
skype: apostolis.kef
sip:apkefalas@...
PGP: 0xA3C19DA0


 

Thanks for the reply,?

here is the results:

kd9dcs@bluetracker:/dev $ ls -al /dev/ttyUSB0?
crw-rw---- 1 root dialout 188, 0 Feb 27 15:26 /dev/ttyUSB0


as an added bonus here is the udev rule I wrote to create the link:

ATTRS{product}=="CP2104 USB to UART Bridge Controller", SYMLINK+="PTT", GROUP="dialout", MODE="0660"

Tim ...



David Ranch
 

开云体育


As for GPIO access, the running user needs to be apart of the "gpio" group.? Quick example is:

--
??????? b. Add this new user into the following unix groups:
????????????? - "audio" (allow users to access the soundcard)
????????????? - "dialout" (allow serial port access - if needed)
????????????? - "gpio" (allow access to the GPIO pins)
????????????? - "sudo" (allow root access)
????????????? - "video" group (allow diagnostic permissions to the GPU)

???????????????? sudo usermod -G audio,dialout,gpio,sudo,video
--

As far as killing direwolf, control-c should be fine as well as using "kill" but don't use the -HUP signal.?

When you kill Direwolf and the serial port is no longer available, try running "ps aux | grep modem" and tell us if NetworkManager's "modem-manager" is running.

--David
KI6ZHD


On 02/27/2017 09:37 AM, 'Nick B.' nick@... [direwolf_packet] wrote:

?

Hope you don't mind if I join in with this Tim as I'm watching this with interest. I have similar problems trying to get GPIO PTT and DCD working with the correct permissions. Despite being able to write to GPIO as my normal user, Direwolf always wants a sudo password.

I haven't tried USB serial PTT yet but I may well do and see if I get a similar result to you.

Nick.


On 27/02/2017 11:41, overrocking@... [direwolf_packet] wrote:
?

I'm always game for learning more, thanks for diving in with some help.?

Here are the results of the commands:

kd9dcs@bluetracker:~ $ who
kd9dcs ? :0 ? ? ? ? ? 2017-02-26 17:51 (:0)
kd9dcs ? pts/0 ? ? ? ?2017-02-27 05:34 (192.168.2.10)

kd9dcs@bluetracker:~ $ groups
pi adm dialout cdrom sudo audio video plugdev games users input netdev gpio i2c spi

kd9dcs@bluetracker:~ $ ls -al /dev/PTT
lrwxrwxrwx 1 root root 7 Feb 26 17:51 /dev/PTT -> ttyUSB0

Thanks again for looking at this

Tim ...





 

开云体育

Hi David, thanks for your reply.

I've been exploring the sudo issue for a few days now and here's what I've found.

- Works perfectly on the default pi user on Rpi. This is because pi is set up for sudo access without password. Can be verified by examining the sudoers file with visudo.

- Direwolf calls chmod go+rw on the gpio direction and value irrespective of whether the permissions are set correctly. Can be verified by examining the system logs -? # journalctl | grep gpio.

All my user permissions are set up for gpio as you recommended below. I can create gpio devices, change direction and write to value as a normal user with gpio group membership.

gpio devices are created by udev rules with root:gpio 0770 permissions. This is set in /etc/udev/rules.d/99-com.rules. Also worth noting that when a gpio device is created under /sys/class/gpio it's actually a symlink to /sys/device/platform/soc//3f200000.gpio/gpio.

So Direwolf appears to do some checks for permissions in ptt.c. I've not quite figured that part out yet but for whatever reason it still decides it needs elevated permissions to change the gpio direction and value even if it is correct. I've sent a bug report/query to John regarding this.

That aside, the decoding performance on HF is fantastic! I've had a Windows build running with 5@30 300 modems and it's decoding stuff I can barely hear on 10.1476MHz.

73
Nick G4IRX



On 28/02/2017 05:05, David Ranch dranch@... [direwolf_packet] wrote:

?


As for GPIO access, the running user needs to be apart of the "gpio" group.? Quick example is:

--
??????? b. Add this new user into the following unix groups:
????????????? - "audio" (allow users to access the soundcard)
????????????? - "dialout" (allow serial port access - if needed)
????????????? - "gpio" (allow access to the GPIO pins)
????????????? - "sudo" (allow root access)
????????????? - "video" group (allow diagnostic permissions to the GPU)

???????????????? sudo usermod -G audio,dialout,gpio,sudo,video
--

As far as killing direwolf, control-c should be fine as well as using "kill" but don't use the -HUP signal.?

When you kill Direwolf and the serial port is no longer available, try running "ps aux | grep modem" and tell us if NetworkManager's "modem-manager" is running.

--David
KI6ZHD


On 02/27/2017 09:37 AM, 'Nick B.' nick@... [direwolf_packet] wrote:
?

Hope you don't mind if I join in with this Tim as I'm watching this with interest. I have similar problems trying to get GPIO PTT and DCD working with the correct permissions. Despite being able to write to GPIO as my normal user, Direwolf always wants a sudo password.

I haven't tried USB serial PTT yet but I may well do and see if I get a similar result to you.

Nick.


On 27/02/2017 11:41, overrocking@... [direwolf_packet] wrote:
?

I'm always game for learning more, thanks for diving in with some help.?

Here are the results of the commands:

kd9dcs@bluetracker:~ $ who
kd9dcs ? :0 ? ? ? ? ? 2017-02-26 17:51 (:0)
kd9dcs ? pts/0 ? ? ? ?2017-02-27 05:34 (192.168.2.10)

kd9dcs@bluetracker:~ $ groups
pi adm dialout cdrom sudo audio video plugdev games users input netdev gpio i2c spi

kd9dcs@bluetracker:~ $ ls -al /dev/PTT
lrwxrwxrwx 1 root root 7 Feb 26 17:51 /dev/PTT -> ttyUSB0

Thanks again for looking at this

Tim ...






Apostolos Kefalas
 

As far as it concerns permissions, everything seems to be fine.

Something else is grabbing your serial port as soon as direwolf exits.

After stopping direwolf, try:

$ lsof | grep PTT

and

$ lsof | grep ttyUSB0



On Δευ, 2017-02-27 at 22:54 +0000, overrocking@...
[direwolf_packet] wrote:

Thanks for the reply,


here is the results:


kd9dcs@bluetracker:/dev $ ls -al /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 0 Feb 27 15:26 /dev/ttyUSB0




as an added bonus here is the udev rule I wrote to create the link:


ATTRS{product}=="CP2104 USB to UART Bridge Controller", SYMLINK
+="PTT", GROUP="dialout", MODE="0660"


Tim ...





 


Nick B. wrote:

> ? Despite being able to write to GPIO as my normal user,
> ? Direwolf always wants a sudo password.

Commit?58c2707f7d65b5b074b5e67e00c06a50fb968349, on the 'dev' branch, should fix this.

Raspbian Jessie has a new 'gpio' group which was not in Wheezy.
The logic for getting access to the GPIO pins has been rewritten to take advantage of that.



?


 

开云体育


On 05/03/2017 19:48, wb2osz@... [direwolf_packet] wrote:
?


Nick B. wrote:

> ? Despite being able to write to GPIO as my normal user,
> ? Direwolf always wants a sudo password.

Commit?58c2707f7d65b5b074b5e67e00c06a50fb968349, on the 'dev' branch, should fix this.

Raspbian Jessie has a new 'gpio' group which was not in Wheezy.
The logic for getting access to the GPIO pins has been rewritten to take advantage of that.


Just pulled and rebuilt from dev branch. That works for me (user is a gpio group member). Thanks!