Consumer IR/en: различия между версиями

Нет описания правки
(Новая страница: «=== Technical details === Mini-jack 3.5 mm Pinout on Wiren Board 5 : * Tip (left audio channel) - 5V power/IR transmission. * Ring (right audio channel) - IR…»)
 
(не показано 15 промежуточных версий этого же участника)
Строка 19: Строка 19:


=== Technical details ===
=== Technical details ===
Mini-jack 3.5 mm Pinout on [[Wiren Board 5]] :
Mini-jack 3.5 mm Pinout on [[Wiren Board 5/en|Wiren Board 5]] :
* Tip (left audio channel) - 5V power/IR transmission.
* Tip (left audio channel) - 5V power/IR transmission.
* Ring (right audio channel) - IR reception
* Ring (right audio channel) - IR reception
Строка 27: Строка 27:




== Программная часть ==
== Hardware ==


На уровне ядра за работу с ИК на [[Wiren Board 5]] отвечает драйвер '''lirc-pwm'''. Он предоставляет устройство /dev/lirc1.
At the kernel level for the work with IR to [[Wiren Board 5/en| Wiren Board 5]] the driver meets the '''lirc-pwm'''. It provides the / dev/lirc1 device.


С этим устройством взаимодействует демон '''lircd''' из состава пакета [http://www.lirc.org/ LIRC], осуществляющий декодирование последовательностей импульсов в события нажатых на пульте кнопок согласно файлам конфигурации пультов. Также этот демон способен осуществлять обратное преобразование для передачи сигналов нажатия кнопок управляемым устройствам.  
This device interacts with daemon '''lircd''' from package [http://www.lirc.org/ LIRC] that provides decoding of the pulse sequence in the event pressed on the remote control buttons according to the configuration files, remotes. This daemon is also capable of performing a reverse conversion to transmit button push signals to controlled devices.  


Наконец, трансляцию событий от '''lircd''' в сообщения [[MQTT]] и обратно осуществляет демон '''wb-mqtt-lirc'''
Finally, the stream of events from '''lircd''' in message [[MQTT/en| MQTT]] and back runs the demon '''wb-mqtt-lirc'''


=== Установка и настройка ===
=== Installation and configuration ===
Необходимые пакеты ( wb-mqtt-lirc, lirc-scripts, wb-mqtt-lirc), а так же правильный конфиг-файл /etc/lirc/hardware.conf установлены в стандартном образе, начиная с версии 201512070633.
Required packages (wb-mqtt-lirc, lirc-scripts, wb-mqtt-lirc), as well as the correct config file /etc/lirc/hardware.conf is installed in a standard image starting from version 201512070633.
* Скачать или сгенерировать файл конфигурации пульта и положить его в '''/etc/lirc/lircd.conf.d/'''.
* Download or generate the remote configuration file and put it in '''/etc/lirc/lircd.conf.d/'''.


==== Скачивание существующего конфига пульта ====
====Download ready remote config  ====
<pre>
<pre>
root@wirenboard:~# irdb-get update
root@wirenboard:~# irdb-get update
Строка 49: Строка 49:
</pre>
</pre>


==== Создание нового конфига пульта ====
====Creating a new remote config ====
''TODO: описать как пользоваться irrecord''


После завершения конфигурации, следует перезапустить службы '''lirc''' и '''wb-mqtt-lirc'''
After completing configuration, restart the service '''lirc''' and '''wb-mqtt-lirc'''
<pre>
<pre>
root@wirenboard:~# service lirc restart && service wb-mqtt-lirc restart
root@wirenboard:~# service lirc restart && service wb-mqtt-lirc restart
</pre>
</pre>


=== MQTT-интерфейс ===
=== MQTT interface ===


'''wb-mqtt-lirc''' создает устройство ''/devices/wb-lirc/'', принятые нажатия публикуются в топике ''/devices/wb-lirc/controls/Key'' в формате '''<название_пульта>:<название_кнопки>:<повтор>'''. После отпускания кнопки в этом топике публикуется сообщение с пустым телом.
'''wb-mqtt-lirc''' creates a device "/devices/wb-lirc/", accepted clicks are published in the topic "/devices/wb-lirc/controls/Key" in the format '''<switch_name>:<button_name>:<repeat>'''. After releasing the button, a message with an empty body is published in this topic.


Пример:
Example:
<pre>
<pre>
root@wirenboard:~# mosquitto_sub -v -t '/devices/wb-lirc/#'
root@wirenboard:~# mosquitto_sub -v -t '/devices/wb-lirc/#'
Строка 74: Строка 73:
</pre>
</pre>


Для отправки нажатия кнопки следует опубликовать сообщение в формате '''<название_пульта>:<название_кнопки>''' в топике ''/devices/wb-lirc/controls/Key/on''
To send a button press, you should publish the message in the format '''<button name>:<button name>''' in the topic "/devices/wb-lirc/controls/Key/on"


== Устранение неисправностей ==
== Troubleshooting ==
=== Не работает прием ===
= = = = Not working reception ===
* Убедиться что драйвер "видит" импульсы от приемника.
* Make sure the driver "sees" pulses from the receiver.
** Остановить сервис '''lirc''' (командой ''service lirc stop'')
** Stop service '''lirc''' (command "service lirc stop")
** <pre>root@wirenboard:~# mode2 -d /dev/lirc1</pre>
** <pre>root@wirenboard:~# mode2 -d /dev/lirc1</pre>
**: Должны бежать цифры при нажатии кнопок на пульте, если нет - проблема в "железе" или в несоответствии несущей пульта и приемника. Следует попробовать использовать другой приемник.
**: The numbers should run when you press the buttons on the remote, if not - the problem is in the "hardware" or in the mismatch of the carrier of the remote and the receiver. You should try using a different receiver.
* Убедиться что '''lirc''' может декодировать последовательности импульсов согласно конфигу пульта:
* Make sure that '''lirc''' can decode pulse sequences according to the configuration of the remote control:
** Запустить обратно '''lirc''' (''service lirc start'')
** Run back '''lirc''' ('service lirc start')
** <pre>root@wirenboard:~# irw</pre>
** <pre>root@wirenboard:~# irw</pre>
**: Должные бежать строчки при нажатии кнопок на пульте. Если '''mode2''' работает, а '''irw''' - нет, то проблема с конфигом пульта. Стоит попробовать использовать другой конфиг, либо создать новый.
**: Due to run lines when you press the buttons on the remote. If '''mode2''' works and '''irw''' doesn't, there is a problem with the remote config. It is worth trying to use another config, or create a new one.


=== Не работает передача ===
=== Transmission is not working ===
* Попробовать передавать обращаясь к LIRC напрямую:
* Try to transmit referring to LIRC directly:
<pre>
<pre>
root@wirenboard:~# irsend SEND_START Sony_RM-687C KEY_3
root@wirenboard:~# irsend SEND_START Sony_RM-687C KEY_3
Строка 94: Строка 93:
root@wirenboard:~# irsend SEND_STOP Sony_RM-687C KEY_3
root@wirenboard:~# irsend SEND_STOP Sony_RM-687C KEY_3
</pre>
</pre>
(названия пульта и кнопки должны соответствовать используемому конфигу).
(the name of the remote and buttons should correspond to the configuration used).
* Убедиться что аппаратная часть работает - например, можно посмотреть на ИК-светодиод через камеру смартфона (светодиод должен мигать при передаче)
* Make sure that the hardware is working - for example, you can look at the IR led through the smartphone camera (the led should blink when transmitting)
12 063

правки