User:Tox2ik/Streamzap remote controller
From Gentoo Wiki
Jump to:navigation
Jump to:search
Streamzap remote controller
The aim of this page is to control programs like VLC with the remote controller or to trigger custom commands and scripts.
Overview over required steps
Assuming you posses the physical device, the next actions are these.
- plug in the receiver
- configure the kernel (if needed)
- load kernel modules
- install and configure lircd
- detect input or get feedback on button press
- configure irexec
- configure other programs
Kernel modules
You will need to enable the following modules / options in the kernel.
They can be found in this section:
Prompt: LIRC user interface Location: -> Device Drivers -> Remote Controller support --- Remote Controller support <*> Compile Remote Controller keymap modules [*] LIRC user interface [ ] Support for eBPF programs attached to lirc devices [ ] Remote controller decoders ---> [*] Remote Controller devices ---> <M> Streamzap PC Remote IR Receiver
and here:
Prompt: User level driver support Location: -> Device Drivers -> Input device support -> Generic input layer (needed for keyboard, mouse, ...) -> Miscellaneous devices <M> User level driver support
After plugging in the USB-receiver `dmesg` should report the presence of the device
[102186.881305] usb 1-5: new low-speed USB device number 15 using xhci_hcd [102187.012263] usb 1-5: New USB device found, idVendor=0e9c, idProduct=0000, bcdDevice= 1.00 [102187.012264] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [102187.012265] usb 1-5: Product: Streamzap Remote Control [102187.012266] usb 1-5: Manufacturer: Streamzap, Inc.
It should also appear in the list produced by `lsusb`
$ lsusb | grep -i stream Bus 001 Device 015: ID 0e9c:0000 Streamzap, Inc. Streamzap Remote Control
Install the receiver-reader daemon
root #
emerge --ask app-misc/lirc {{{1}}}
examples
controlling the volume (with alsa)
Create these two files.
begin
prog = irexec
button = KEY_VOLUMEUP
repeat = 1
config = dash -c 'vol_delta=1; . ~/.config/volume.sh; volume M; volume +'
end
begin
prog = irexec
button = KEY_VOLUMEDOWN
repeat = 1
config = dash -c 'vol_delta=1; . ~/.config/volume.sh; volume M; volume -'
end
begin
prog = irexec
button = KEY_MUTE
config = dash ~/.config/volume.sh m
config = dash ~/.config/volume.sh M'
end
This one will run under bash as well.
#!/bin/dash
volume() {
local v= delta=${vol_delta:-3}
percent() { grep -o '[0-9]\+%' | tr -d %; };
absolute() { awk 'END{ print $3}'; };
case $1 in
('') amixer sget Master | percent ;;
(A) amixer sget Master | absolute ;;
(p) amixer sset Master Playback $2 | tail -n1 ;;
([0-9]*) amixer sset Master $1% | tail -n1;;
(+) volume p $(( $delta + `volume A` )) | percent ;;
(-) volume p $(( `volume A` - $delta )) | percent ;;
(m) amixer sset Master mute >/dev/null ; echo muted;;
(M) amixer sset Master unmute >/dev/null ;;
(*) amixer scontrols | awk -F"'" '{ printf "%s\n", $2 }' | column;
echo; amixer sget Master
esac
}
volume $@
# vim: ft=sh
Run irexec and press the volume buttons and you should see the current volume level.
user $
irexec ~/.lirc/irexec.lircrc
59 64 59 55 50 55