Read keystrokes from LIRC dongle

This forum is for supported devices using an ARMv7 Freescale SoC.

Read keystrokes from LIRC dongle

Postby phibon » Tue Apr 28, 2015 4:29 pm

Hello,

I've posted this question on the Arch Linux forums but I guess this is a better forum for my question. I'm working with a Wandboard Quad with Arch Linux installed.

Newbe here so be gentle.
I want to capture keystrokes send out by the LIRC dongle. I made a script file which runs correctly when I run it from the command line. But it doesn't seem to work when ir runs as a service.
Basically, what I've done is this:

$this->bbcode_second_pass_code('', '
#!/bin/bash
while true
do
read -n 1 ir_code

case $ir_code in
"W")
echo "... inschakelen"
echo 1 > /sys/class/gpio/gpio200/value
sleep 2
echo 1 > /sys/class/gpio/gpio91/value
;;
"Z")
echo "Uitschakelen ..."
echo 0 > /sys/class/gpio/gpio91/value
sleep 2
echo 0 > /sys/class/gpio/gpio200/value
;;
esac

done
')

Is there a reason why this won't work as a service?
phibon
 
Posts: 6
Joined: Tue Apr 28, 2015 4:24 pm

Re: Read keystrokes from LIRC dongle

Postby WarheadsSE » Tue Apr 28, 2015 5:17 pm

What user is the service running as? Does it have the appropriate rights?

systemd service? What do you have set for the Type=?
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: Read keystrokes from LIRC dongle

Postby phibon » Tue Apr 28, 2015 5:34 pm

$this->bbcode_second_pass_quote('', 'W')hat user is the service running as? Does it have the appropriate rights?

systemd service? What do you have set for the Type=?


It is running as root so I guess it should have the rights (?)
The Type=idle. Is that ok?

Thanks for your help.
phibon
 
Posts: 6
Joined: Tue Apr 28, 2015 4:24 pm

Re: Read keystrokes from LIRC dongle

Postby WarheadsSE » Tue Apr 28, 2015 5:35 pm

Type=simple
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: Read keystrokes from LIRC dongle

Postby phibon » Tue Apr 28, 2015 5:44 pm

$this->bbcode_second_pass_quote('', 'T')ype=simple


Made the change to Type=simple but still no luck.
Anything else I can try?
phibon
 
Posts: 6
Joined: Tue Apr 28, 2015 4:24 pm

Re: Read keystrokes from LIRC dongle

Postby WarheadsSE » Tue Apr 28, 2015 5:48 pm

Can you post your service file?
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: Read keystrokes from LIRC dongle

Postby phibon » Tue Apr 28, 2015 5:51 pm

Sure, here it is (name is irswitch.service:

$this->bbcode_second_pass_code('', '
[Unit]
Description=IR Switch - Switch relais on / off


[Service]
ExecStart=/usr/bin/irswitch
Type=simple

[Install]
WantedBy=multi-user.target
')

I can see the 'irswitch' script in the 'top' list when active. But the script doesn't react to the key presses (of the LIRC dongle).
phibon
 
Posts: 6
Joined: Tue Apr 28, 2015 4:24 pm

Re: Read keystrokes from LIRC dongle

Postby WarheadsSE » Tue Apr 28, 2015 6:19 pm

Does it ever get them at all, from the `read` call?
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: Read keystrokes from LIRC dongle

Postby phibon » Tue Apr 28, 2015 6:25 pm

$this->bbcode_second_pass_quote('', 'D')oes it ever get them at all, from the `read` call?


Well, it works fine when I run the script from the command prompt.
I'm starting to think that the keyboard buffer is not available to services... but then again, I'm just guessing.
phibon
 
Posts: 6
Joined: Tue Apr 28, 2015 4:24 pm
Top

Re: Read keystrokes from LIRC dongle

Postby WarheadsSE » Tue Apr 28, 2015 7:20 pm

Yes, obivously it does when not running as a service.
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Next

Return to Freescale

Who is online

Users browsing this forum: No registered users and 12 guests