Add role for serial ir receivers

TODO: test role for serial_device=ttyS0 and serial_device=ttyS1
This commit is contained in:
Alexander Grothe 2019-01-01 23:48:31 +01:00
parent 21710fc62b
commit 326c7d3119
8 changed files with 717 additions and 509 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1669,6 +1669,9 @@ budget_ci rc-tt-1500 /lib/udev/rc_keymaps/rc-tt-1501
ite-cir rc-rc6-mce /lib/udev/rc_keymaps/rc-rc6-mce
nuvoton-cir rc-rc6-mce /lib/udev/rc_keymaps/rc-rc6-mce
# serial ir (e.g. Atric V5)
serial_ir rc-rc6-mce /lib/udev/rc_keymaps/rc-rc6-mce
# mceusb
mceusb rc-rc6-mce /lib/udev/rc_keymaps/HOPLOrc6
@ -5712,6 +5715,65 @@ dependencies:
state: present
when: '"1209:4444" in usb or "16c0:27d9" in usb'
#+END_SRC
** Serial IR Receivers
This role preconfigures the system for serial "homebrew" receivers. Newer kernel versions provide ~serial_ir~ which acts as a rc-core driver, so we don't need lircd (it works with eventircd OOTB).
As configured in the role yavdr-remote ([[*create /etc/rc_maps.cfg][/etc/rc_maps.cfg]]) a keytable for a RC-6 MCE remote is loaded by default. You can choose a different keymap which may use another ir-protocol.
*** defaults
#+BEGIN_SRC yaml :tangle roles/serial-ir/defaults/main.yml
---
serial_device: ttyS0
#+END_SRC
*** tasks
#+BEGIN_SRC yaml :tangle roles/serial-ir/tasks/main.yml
---
- name: apt | install setserial
apt:
name: setserial
- name: load serial_ir on startup
template:
src: roles/serial-ir/modules-load.d/serial_ir.conf.j2
dest: /etc/modules-load.d/serial_ir.conf
- name: serial_ir module options
template:
src: roles/serial-ir/modprobe.d/serial_ir.conf.j2
src: /etc/modprobe.d/serial_ir.conf
- name: setserial options
template:
src: roles/serial-ir/serial.conf.j2
dest: /etc/serial.conf
#+END_SRC
*** templates
**** load serial_ir on startup
#+BEGIN_SRC conf :tangle roles/serial-ir/templates/modules-load.d/serial_ir.conf.j2
serial_ir
#+END_SRC
**** serial_ir module options
#+BEGIN_SRC jinja2 :tangle roles/serial-ir/templates/modprobe.d/serial_ir.conf.j2
#COM1 equivalent, /dev/ttyS0
{% if serial_device == "ttyS0" %}
options serial_ir irq=4 io=0x3f8
{% elif serial_device == "ttyS1" %}
#COM2 equivalent, /dev/ttyS1
options serial_ir irq=3 io=0x2f8
{% endif %}
install serial_ir setserial /dev/{{serial_device}} uart none; /sbin/modprobe --ignore-install serial_ir
#+END_SRC
**** setserial options
#+BEGIN_SRC jinja2 :tangle roles/serial-ir/templates/serial.conf.j2
{% if serial_device == "ttyS0" %}
#COM1 equivalent, /dev/ttyS0
/dev/ttyS0 uart none
{% elif serial_device == "ttyS1" %}
#COM2 equivalent, /dev/ttyS1
/dev/ttyS1 uart none
{% endif %}
#+END_SRC
** kodi
:PROPERTIES:
:ID: a0f42636-e0ec-4904-a6f9-48f714a2052b

View File

@ -0,0 +1,2 @@
---
serial_device: ttyS0

View File

@ -0,0 +1,20 @@
---
- name: apt | install setserial
apt:
name: setserial
- name: load serial_ir on startup
template:
src: roles/serial-ir/modules-load.d/serial_ir.conf.j2
dest: /etc/modules-load.d/serial_ir.conf
- name: serial_ir module options
template:
src: roles/serial-ir/modprobe.d/serial_ir.conf.j2
src: /etc/modprobe.d/serial_ir.conf
- name: setserial options
template:
src: roles/serial-ir/serial.conf.j2
dest: /etc/serial.conf

View File

@ -0,0 +1,8 @@
#COM1 equivalent, /dev/ttyS0
{% if serial_device == "ttyS0" %}
options serial_ir irq=4 io=0x3f8
{% elif serial_device == "ttyS1" %}
#COM2 equivalent, /dev/ttyS1
options serial_ir irq=3 io=0x2f8
{% endif %}
install serial_ir setserial /dev/{{serial_device}} uart none; /sbin/modprobe --ignore-install serial_ir

View File

@ -0,0 +1 @@
serial_ir

View File

@ -0,0 +1,7 @@
{% if serial_device == "ttyS0" %}
#COM1 equivalent, /dev/ttyS0
/dev/ttyS0 uart none
{% elif serial_device == "ttyS1" %}
#COM2 equivalent, /dev/ttyS1
/dev/ttyS1 uart none
{% endif %}

View File

@ -171,6 +171,9 @@ budget_ci rc-tt-1500 /lib/udev/rc_keymaps/rc-tt-1501
ite-cir rc-rc6-mce /lib/udev/rc_keymaps/rc-rc6-mce
nuvoton-cir rc-rc6-mce /lib/udev/rc_keymaps/rc-rc6-mce
# serial ir (e.g. Atric V5)
serial_ir rc-rc6-mce /lib/udev/rc_keymaps/rc-rc6-mce
# mceusb
mceusb rc-rc6-mce /lib/udev/rc_keymaps/HOPLOrc6