====== Step by Step ir-serial mit ir-keytable ====== Die hier beschriebene Konfiguration ist inzwischen in das Setup übernommen worden. ===== Liste der devices anzeigen ===== BVDR> ir-keytable Found /sys/class/rc/rc0/ (/dev/input/event14) with: Driver cx88xx, table rc-tevii-nec Supported protocols: lirc Enabled protocols: lirc Name: cx88 IR (TeVii S464 DVB-S/S2) bus: 1, vendor/product: d464:9022, version: 0x0001 Repeat delay = 500 ms, repeat period = 125 ms hier sieht man nur das device der DVB Karte - dieses soll allerdings nicht genutzt werden. ==== device anlegen ==== Da serial nicht automatisch erkannt werden kann muss es manuel getriggert werden: festlegen an welchem COM Port es angeschloßen ist(hier com1) setserial /dev/ttyS0 uart none nun die Treiber laden: modprobe serial-ir dmesg sagt nun: [ 3689.460620] serial_ir serial_ir.0: auto-detected active low receiver [ 3689.483767] Registered IR keymap rc-rc6-mce [ 3689.484744] IR RC6 protocol handler initialized [ 3689.506815] rc rc1: Serial IR type home-brew as /devices/platform/serial_ir.0/rc/rc1 [ 3689.506875] input: Serial IR type home-brew as /devices/platform/serial_ir.0/rc/rc1/input18 [ 3689.507978] ir-keytable[3573] [ 3689.516070] rc rc1: lirc_dev: driver serial_ir registered at minor = 1 ==== Device Liste überprüfen ==== nun überprüfen wir die Device List BVDR> ir-keytable Found /sys/class/rc/rc1/ (/dev/input/event15) with: Driver serial_ir, table rc-rc6-mce Supported protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp Enabled protocols: lirc rc-6 Name: Serial IR type home-brew bus: 25, vendor/product: 0001:0001, version: 0x0100 Repeat delay = 500 ms, repeat period = 125 ms Found /sys/class/rc/rc0/ (/dev/input/event14) with: Driver cx88xx, table rc-tevii-nec Supported protocols: lirc rc-6 Enabled protocols: lirc Name: cx88 IR (TeVii S464 DVB-S/S2) bus: 1, vendor/product: d464:9022, version: 0x0001 Repeat delay = 500 ms, repeat period = 125 ms BVDR> das Device rc1 ist nun vorhanden aber es empfängt noch keine Daten, da das Protokol falsch ist. ==== device test mit evtest ==== BVDR> evtest No device specified, trying to scan all of /dev/input/event* Available devices: ... /dev/input/event14: cx88 IR (TeVii S464 DVB-S/S2) /dev/input/event15: Serial IR type home-brew Select the device event number [0-15]: event15 ist unser Empfänger er hat aber noch kein passendes Protokoll evtest /dev/input/event15 liefert noch keine TASTEN beim drücken. === Protokoll ermitteln === zwei möglichkeiten. == Protokolle einzeln laden == BVDR> ir-keytable -s rc1 -p NEC Protocols changed to nec NEC ersetzen durch den Namen des zu testenden Protokolls in unserem Fall sagt ir-keytable: Supported protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp nun mit evtest Testen: BVDR> evtest /dev/input/event15 Input driver version is 1.0.1 Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100 Input device name: "Serial IR type home-brew" Supported events: Event type 0 (EV_SYN) Event type 1 (EV_KEY) Event code 28 (KEY_ENTER) Event code 103 (KEY_UP) Event code 105 (KEY_LEFT) Event code 106 (KEY_RIGHT) Event code 108 (KEY_DOWN) Event code 111 (KEY_DELETE) Event code 113 (KEY_MUTE) Event code 114 (KEY_VOLUMEDOWN) Event code 115 (KEY_VOLUMEUP) Event code 119 (KEY_PAUSE) Event code 128 (KEY_STOP) Event code 142 (KEY_SLEEP) Event code 161 (KEY_EJECTCD) Event code 164 (KEY_PLAYPAUSE) Event code 167 (KEY_RECORD) Event code 168 (KEY_REWIND) Event code 174 (KEY_EXIT) Event code 207 (KEY_PLAY) Event code 208 (KEY_FASTFORWARD) Event code 210 (KEY_PRINT) Event code 212 (KEY_CAMERA) Event code 224 (KEY_BRIGHTNESSDOWN) Event code 225 (KEY_BRIGHTNESSUP) Event code 226 (KEY_MEDIA) Event code 352 (KEY_OK) Event code 356 (KEY_POWER2) Event code 358 (KEY_INFO) Event code 365 (KEY_EPG) Event code 366 (KEY_PVR) Event code 368 (KEY_LANGUAGE) Event code 369 (KEY_TITLE) Event code 370 (KEY_SUBTITLE) Event code 372 (KEY_ZOOM) Event code 373 (KEY_MODE) Event code 377 (KEY_TV) Event code 385 (KEY_RADIO) Event code 386 (KEY_TUNER) Event code 387 (KEY_PLAYER) Event code 389 (KEY_DVD) Event code 392 (KEY_AUDIO) Event code 393 (KEY_VIDEO) Event code 398 (KEY_RED) Event code 399 (KEY_GREEN) Event code 400 (KEY_YELLOW) Event code 401 (KEY_BLUE) Event code 402 (KEY_CHANNELUP) Event code 403 (KEY_CHANNELDOWN) Event code 407 (KEY_NEXT) Event code 412 (KEY_PREVIOUS) Event code 425 (KEY_PRESENTATION) Event code 430 (KEY_MESSENGER) Event code 512 (KEY_NUMERIC_0) Event code 513 (KEY_NUMERIC_1) Event code 514 (KEY_NUMERIC_2) Event code 515 (KEY_NUMERIC_3) Event code 516 (KEY_NUMERIC_4) Event code 517 (KEY_NUMERIC_5) Event code 518 (KEY_NUMERIC_6) Event code 519 (KEY_NUMERIC_7) Event code 520 (KEY_NUMERIC_8) Event code 521 (KEY_NUMERIC_9) Event code 522 (KEY_NUMERIC_STAR) Event code 523 (KEY_NUMERIC_POUND) Event type 4 (EV_MSC) Event code 4 (MSC_SCAN) Key repeat handling: Repeat type 20 (EV_REP) Repeat code 0 (REP_DELAY) Value 500 Repeat code 1 (REP_PERIOD) Value 125 Properties: Testing ... (interrupt to exit) Event: time 1523714087.984388, type 4 (EV_MSC), code 4 (MSC_SCAN), value 1f Event: time 1523714087.984388, -------------- SYN_REPORT ------------ Event: time 1523714088.117117, type 4 (EV_MSC), code 4 (MSC_SCAN), value 1f Event: time 1523714088.117117, -------------- SYN_REPORT ------------ Event: time 1523714088.746571, type 4 (EV_MSC), code 4 (MSC_SCAN), value 00 Event: time 1523714088.746571, -------------- SYN_REPORT ------------ Event: time 1523714088.877285, type 4 (EV_MSC), code 4 (MSC_SCAN), value 00 Event: time 1523714088.877285, -------------- SYN_REPORT ------------ Es sieht gut aus - wir haben scan codes ABER noch keine Zuweißung. == EINFACH ALLE Protokolle laden == Man lädt einfach mit -p alle Protokolle die laut ir-keytable unterstützt werden aufeinmal rein: BVDR> ir-keytable -s rc1 -p lirc -p rc-5 -p rc-5-sz -p jvc -p sony -p nec -p sanyo -p mce_kbd -p rc-6 -p sharp -p x mp Protocols changed to lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp Damit sollten aufjedenfall wieder keycodes funktionieren! BVDR> evtest /dev/input/event15 Input driver version is 1.0.1 Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100 Input device name: "Serial IR type home-brew" Supported events: Event type 0 (EV_SYN) Event type 1 (EV_KEY) Event code 28 (KEY_ENTER) Event code 103 (KEY_UP) Event code 105 (KEY_LEFT) Event code 106 (KEY_RIGHT) Event code 108 (KEY_DOWN) Event code 111 (KEY_DELETE) Event code 113 (KEY_MUTE) Event code 114 (KEY_VOLUMEDOWN) Event code 115 (KEY_VOLUMEUP) Event code 119 (KEY_PAUSE) Event code 128 (KEY_STOP) Event code 142 (KEY_SLEEP) Event code 161 (KEY_EJECTCD) Event code 164 (KEY_PLAYPAUSE) Event code 167 (KEY_RECORD) Event code 168 (KEY_REWIND) Event code 174 (KEY_EXIT) Event code 207 (KEY_PLAY) Event code 208 (KEY_FASTFORWARD) Event code 210 (KEY_PRINT) Event code 212 (KEY_CAMERA) Event code 224 (KEY_BRIGHTNESSDOWN) Event code 225 (KEY_BRIGHTNESSUP) Event code 226 (KEY_MEDIA) Event code 352 (KEY_OK) Event code 356 (KEY_POWER2) Event code 358 (KEY_INFO) Event code 365 (KEY_EPG) Event code 366 (KEY_PVR) Event code 368 (KEY_LANGUAGE) Event code 369 (KEY_TITLE) Event code 370 (KEY_SUBTITLE) Event code 372 (KEY_ZOOM) Event code 373 (KEY_MODE) Event code 377 (KEY_TV) Event code 385 (KEY_RADIO) Event code 386 (KEY_TUNER) Event code 387 (KEY_PLAYER) Event code 389 (KEY_DVD) Event code 392 (KEY_AUDIO) Event code 393 (KEY_VIDEO) Event code 398 (KEY_RED) Event code 399 (KEY_GREEN) Event code 400 (KEY_YELLOW) Event code 401 (KEY_BLUE) Event code 402 (KEY_CHANNELUP) Event code 403 (KEY_CHANNELDOWN) Event code 407 (KEY_NEXT) Event code 412 (KEY_PREVIOUS) Event code 425 (KEY_PRESENTATION) Event code 430 (KEY_MESSENGER) Event code 512 (KEY_NUMERIC_0) Event code 513 (KEY_NUMERIC_1) Event code 514 (KEY_NUMERIC_2) Event code 515 (KEY_NUMERIC_3) Event code 516 (KEY_NUMERIC_4) Event code 517 (KEY_NUMERIC_5) Event code 518 (KEY_NUMERIC_6) Event code 519 (KEY_NUMERIC_7) Event code 520 (KEY_NUMERIC_8) Event code 521 (KEY_NUMERIC_9) Event code 522 (KEY_NUMERIC_STAR) Event code 523 (KEY_NUMERIC_POUND) Event type 4 (EV_MSC) Event code 4 (MSC_SCAN) Key repeat handling: Repeat type 20 (EV_REP) Repeat code 0 (REP_DELAY) Value 500 Repeat code 1 (REP_PERIOD) Value 125 Properties: Testing ... (interrupt to exit) Event: time 1523714338.384568, type 4 (EV_MSC), code 4 (MSC_SCAN), value 11 Event: time 1523714338.384568, -------------- SYN_REPORT ------------ Event: time 1523714339.225618, type 4 (EV_MSC), code 4 (MSC_SCAN), value 12 Event: time 1523714339.225618, -------------- SYN_REPORT ------------ Event: time 1523714339.360765, type 4 (EV_MSC), code 4 (MSC_SCAN), value 12 Event: time 1523714339.360765, -------------- SYN_REPORT ------------ Event: time 1523714339.918255, type 4 (EV_MSC), code 4 (MSC_SCAN), value 15 Event: time 1523714339.918255, -------------- SYN_REPORT ------------ Event: time 1523714340.048912, type 4 (EV_MSC), code 4 (MSC_SCAN), value 15 Event: time 1523714340.048912, -------------- SYN_REPORT ------------ Wie auf bei Möglichkeit eins muss man diese nun einem Key zuweißen oder man hat bereits eine map datei und lädt diese. ===== scan codes einem Key zuweisen ===== nun haben wir scan codes also weisen wir diese nun den Tasten zu: Beispiel mit Taste 1. Bei Taste 1 kommt folgende evtest Ausgabe: Event: time 1523714338.384568, type 4 (EV_MSC), code 4 (MSC_SCAN), value 11 Event: time 1523714338.384568, -------------- SYN_REPORT der scan code ist somit 11 und dieser muss nun Key_1 zugewiesen werden. dazuerstellt man eine Datei in /etc/rc_keymaps/name_der_remote und füllt diese mit folgender Syntax: 0x[SCANCODE] LEERZEICHEN [KEY] also für uns Beispiel: 0x11 KEY_1 Speichern fertig! ===== scan codes Key zuweisung testen ===== Nun testen wir diese zuweißung indem wir die map auch mit laden -w. ir-keytable -s rc1 -c -p NEC -w /etc/rc_keymaps/rc-test-nec Old keytable cleared Wrote 1 keycode(s) to driver Protocols changed to nec es wurde ein keycode geladen (klar wir haben nur einen hinzugefügt). Dabei habe ich bewusst das richtige Protokoll eingefügt. ir-keytable sieht nun so aus: ir-keytable Found /sys/class/rc/rc1/ (/dev/input/event15) with: Driver serial_ir, table rc-rc6-mce Supported protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp Enabled protocols: lirc nec Name: Serial IR type home-brew bus: 25, vendor/product: 0001:0001, version: 0x0100 Repeat delay = 500 ms, repeat period = 125 ms evtest sagt nun: evtest /dev/input/event15 Input driver version is 1.0.1 Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100 Input device name: "Serial IR type home-brew" Supported events: Event type 0 (EV_SYN) Event type 1 (EV_KEY) Event code 2 (KEY_1) Event type 4 (EV_MSC) Event code 4 (MSC_SCAN) Key repeat handling: Repeat type 20 (EV_REP) Repeat code 0 (REP_DELAY) Value 500 Repeat code 1 (REP_PERIOD) Value 125 Properties: Testing ... (interrupt to exit) es kann schon KEY_1 Event code 2 (KEY_1) das testen wir natürlich sofort in dem wir auf der Fernbedienung Taste 1 drücken: Testing ... (interrupt to exit) Event: time 1523715061.010631, type 4 (EV_MSC), code 4 (MSC_SCAN), value 11 Event: time 1523715061.010631, type 1 (EV_KEY), code 2 (KEY_1), value 1 Event: time 1523715061.010631, -------------- SYN_REPORT ------------ Event: time 1523715061.145434, type 4 (EV_MSC), code 4 (MSC_SCAN), value 11 Event: time 1523715061.145434, -------------- SYN_REPORT ------------ Event: time 1523715061.402358, type 1 (EV_KEY), code 2 (KEY_1), value 0 Event: time 1523715061.402358, -------------- SYN_REPORT ------------ alles wie gewollt. So geht man nun weiter vor, bis man alle Tasten angelernt hat, oder man lädt eine bereits enthaltene datei aus /etc/rc_keymaps oder /lib/udev/rc_keymaps ====== Anpassungen für den RPi ====== In der Datei /boot/config.txt muss jetzt "dtoverlay=lirc-rpi" geändert werden in: dtoverlay=gpio-ir,rc-map-name=rc-hauppauge Weiterhin ist in der /etc/rc_maps.cfg die Zeile "ir-kbd-i2c rc-hauppauge /etc/rc_keymaps/rc-hauppauge" wie folgt auszutauschen: gpio_ir_recv rc-hauppauge /etc/rc_keymaps/rc-hauppauge Nachfolgend der Inhalt für die Datei /etc/rc_keymaps/rc-hauppauge für eine Harmony mit dem Profil KLS 1.6: # table hauppauge, type: RC5, KLS1.6 0xb4c KEY_SELECT 0xb0c KEY_POWER2 0xb70 KEY_TV 0xb71 KEY_VIDEO 0xb72 KEY_AUDIO 0xb73 KEY_CAMERA 0xb4b KEY_EPG 0x130 KEY_RADIO 0xb44 KEY_UP 0xb45 KEY_DOWN 0xb46 KEY_LEFT 0xb47 KEY_RIGHT 0xb48 KEY_OK 0xb4a KEY_ESC 0xb49 KEY_MENU 0xb10 KEY_VOLUMEUP 0xb11 KEY_VOLUMEDOWN 0xb22 KEY_PREVIOUS 0xb0d KEY_MUTE 0xb20 KEY_CHANNELUP 0xb21 KEY_CHANNELDOWN 0xb37 KEY_RECORD 0xb36 KEY_STOP 0xb32 KEY_REWIND 0xb35 KEY_PLAY 0xb34 KEY_FASTFORWARD 0xb30 KEY_PREVIOUSSONG 0xb33 KEY_PAUSE 0xb31 KEY_NEXTSONG 0xb01 KEY_1 0xb02 KEY_2 0xb03 KEY_3 0xb04 KEY_4 0xb05 KEY_5 0xb06 KEY_6 0xb07 KEY_7 0xb08 KEY_8 0xb09 KEY_9 0xb08 KEY_TEXT 0xb00 KEY_0 0xb78 KEY_SUBTITLE 0xb40 KEY_RED 0xb41 KEY_GREEN 0xb42 KEY_YELLOW 0xb43 KEY_BLUE Der Inhalt stammt aus mehreren Forumsbeiträgen zu diesem Thema [[http://www.minidvblinux.de/forum/index.php/topic,9090.0.html|u.a. diesem Beitrag]]