Nel precedente articolo abbiamo provveduto ad installare su scheda micro sd una immagine Libreelec ed avviato il dispositivo con tale immagine
Immagine Libreelec per soc Amlogic
Il telecomando del Beelink Minimx III è basilare, per cui per avere più tasti si è pensato di associare un altro telecomando a Libreelec.
Si è scelto il seguente telecomando che ha più pulsanti in dotazione
In base al documento presente sul sito Amlogic, sebbene redatto in cinese, mediante l’utilizzo di traduttori online
Come cambiare i codici IR
si evince che il soc Amlogic gestisce nativamente il protocollo NEC per i telecomandi e che mediante il file remote.conf si possono associare il codice di un telecomando agli eventi di sistema Linux. La mappa dei codici degli eventi di sistema Linux è presente nel file header del kernel Linux
Input Event Codes
Come prima operazione ci si collega su Libreelec in ssh con root/libreelec. Copiare il file /etc/amremote/libreelec.conf in remote.conf nella cartella /storage/.config
|
cp /etc/amremote/libreelec.conf /storage/.config/remote.conf |
e modificarlo come segue
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
#********************************************************************************************************* #this file is configuration for each factory remote device # work_mode 0 :software mode 1 :hardware mode # repeat_enable 0 :disable repeat 1 :enable repeat # # factory_code each device has it's unique factory code. # pattern:custom_code(16bit)+index_code(16bit) # examble: 0xff000001 = 0xff00(custom cod) 0001 (index) # # release_delay unit:ms.release will report from kernel to user layer after this period of time # from press or repeat triggered. # # debug_enable 0 :debug disable 1 :debug disable # # SW MODE: # bit_count how many bits in each frame # tw_leader_act time window for leader active # tw_bit0 time window for bit0 time. # tw_bit1 time window for bit1 time # tw_repeat_leader time window for repeat leader # REG # reg_base_gen set value for PREG_IR_DEC_BASE_GEN # reg_control set value for PREG_IR_DEC_CONTROL # reg_leader_act set value for PREG_IR_DEC_LEADER_ACTIVE # reg_leader_idle set value for PREG_IR_DEC_LEADER_IDLE # reg_repeat_leader set value for PREG_IR_DEC_REPEAT_IDLE # reg_bit0_time set value for PREG_IR_DEC_BIT0_TIME #************************************************************************************************************* #amlogic NEC remote #factory_code = 0x00680001 work_mode = 0 repeat_enable = 1 release_delay = 150 debug_enable = 1 #reg_control = 0xfbe40 |
Caricare il nuovo file dei codici del telecomando mediante il comando
|
remotecfg /storage/.config/remote.conf |
Premere qualche tasto del nuovo telecomando ed eseguire
Perché il telecomando sia compatibile si devono vedere dei messaggi del tipo
|
remote: Wrong custom code is 0xae517f80 |
Il formato è il seguente: 0xAABBCCCC. Seguendo il documento Amlogic linkato sopra, Il codice del telecomando per un tasto specifico è 0xBB; mentre per definire il codice del telecomando si usa 0xCCCC0001. AA corrisponde all’inverso logico del comando, nell’esempio sopra elencato
BB=0x51. In binario=01010001. L’inverso logico in binario =10101110, che è proprio 0xAE.
AA=0xAE. In binario=10101110
Il codice AA non viene utilizzato per la nostra configurazione del telecomando.
Premere tutti i pulsanti del telecomando ed eseguire il comando dmesg -c . Nel nostro caso abbiamo i seguenti codici
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
[ 563.475708@0] remote: Wrong custom code is 0xae517f80 [ 564.273258@0] remote: Wrong custom code is 0xb24d7f80 [ 565.096453@0] remote: Wrong custom code is 0xf6097f80 [ 565.805424@0] remote: Wrong custom code is 0xee117f80 [ 566.450804@0] remote: Wrong custom code is 0xab547f80 [ 567.118602@0] remote: Wrong custom code is 0xb04f7f80 [ 567.963741@0] remote: Wrong custom code is 0xa9567f80 [ 568.631341@0] remote: Wrong custom code is 0x42bd7f80 [ 569.321289@0] remote: Wrong custom code is 0x44bb7f80 [ 570.077504@0] remote: Wrong custom code is 0xb14e7f80 [ 570.953170@0] remote: Wrong custom code is 0xac537f80 [ 571.665000@0] remote: Wrong custom code is 0xe41b7f80 [ 572.354812@0] remote: Wrong custom code is 0xd9267f80 [ 573.163774@0] remote: Wrong custom code is 0xda257f80 [ 573.853329@0] remote: Wrong custom code is 0xf20d7f80 [ 574.520600@0] remote: Wrong custom code is 0xd8277f80 [ 575.210029@0] remote: Wrong custom code is 0xd7287f80 [ 575.988176@0] remote: Wrong custom code is 0xb6497f80 [ 576.633419@0] remote: Wrong custom code is 0xad527f80 [ 577.189905@0] remote: Wrong custom code is 0xce317f80 [ 577.834915@0] remote: Wrong custom code is 0xcd327f80 [ 578.391382@0] remote: Wrong custom code is 0xcc337f80 [ 578.881274@0] remote: Wrong custom code is 0xcb347f80 [ 579.482089@0] remote: Wrong custom code is 0xca357f80 [ 580.060612@0] remote: Wrong custom code is 0xc9367f80 [ 580.550538@0] remote: Wrong custom code is 0xc8377f80 [ 581.195652@0] remote: Wrong custom code is 0xc7387f80 [ 581.730036@0] remote: Wrong custom code is 0xc6397f80 [ 582.242330@0] remote: Wrong custom code is 0xa7587f80 [ 582.865319@0] remote: Wrong custom code is 0xcf307f80 [ 583.554914@0] remote: Wrong custom code is 0xbb447f80 |
La mappatura del telecomando in kodi è presente in /usr/share/kodi/system/keymaps/remote.xml.
Si mappano i tasti del telecomando agli input events di Linux. Come esempio prendiamo in considerazione il tasto Power. Il codice del telecomando è
l’evento KEY_POWER nel file input-event-codes.h corrisponde a
Si crea pertanto una correlazione tra il codice del telecomando e l’evento in Linux nella sezione key_begin, key_end del file remote.conf
|
key_begin 0x51 116 #Poweroff KEY_POWER key_end |
Tra i due dati
inserire uno spazio, così come indicato nel documento Amlogic linkato sopra. Il file utilizzato nel caso specifico è disponibile al seguente link
Esempio remote.conf
Alla ripartenza del box viene letta la nuova configurazione presente in /storage/.config/remote.conf potendo così utilizzare il nuovo telecomando.