tvtimelirc实现电视遥控内容摘要:

r Return to top For the receiver, few parts are needed: a connector to the serial port (Dsub9), one remote receiver (I got the Siemens SFH 5110, 36kHz type), one diode, one resistor and one voltage regulator. You can check on the LIRC serial page for more details. Since I needed to have the IR detector in the living room, I got a 10m serial cable with Dsub9 connectors on both ends. Again, I cut off the connector on one end. I decided to just solder all ponents onto eachother, so not use any pcb or so, and directly connect it to the 3 wires of the serial cable. (Note: I got the serial cable so that at some later point, I might still get an LCD...) The assembled receiver looks as follows (front and side shot), and just to show the size, I put a centimeter ruler and a 1 euro coin next to it. The black part most to the right is the IR eye, the other part sticking out is the voltage regulator. As you can see, I used some shrinkwrap to cover most of the parts (the resistor, capacitor and diode)。 before putting that on, I put some isolation between the various 39。 legs39。 of the ponents, so that squeezing the receiver would not shortcircuit things. Before connecting to the serial port, I verified with an impedance meter that the relevant pins on the Dsub9 connector were not shorted. My server only has 2 serial ports, and I wasn39。 t going to lose one of those due to some silly bad soldering.... afterwards I had a talk with some colleagues and they assured me that you really need to connect some voltages higher than 12V to actually destroy a serial port, but anyway, better safe than sorry. On the whole, I can say I was quite pleased with the end result it is very small and thanks to the shrinkwrap quite professional looking too. On to testing the thing! Setup of LIRC Return to top The next step was to setup LIRC, naturally after connecting the serial port IR receiver. I did, as root: urpmi lirc lircremotes which installed the lirc rpm (included in the download edition cds) and the lircremotes package, which is in the contrib repository and got downloaded from the web. I found I didn39。 t need the lircremotes because my remote wasn39。 t included, but if yours is it saves you some time. (Note that since Mandriva this should be: urpmi lirc lircremotes dkmslirc because the lirc kernel modules have been split off for some reason.) Configuration of lircd Return to top I did: vi /etc/sysconfig/lircd and made it look as follows: (I left out most of the lines that are mented out with a hash) Customized settings for lirc daemon The hardware driver to use, run lircd driver=? for a list DRIVER=default Hardware driver module to load HWMOD=lirc_serial DEVICE=/dev/lirc0 Serial port for the receiver (for serial driver) COM_PORT=/dev/ttyS0 DRIVER_OPTS=irq=4 io=0x3f8 I knew that I was connecting the serial connector to the first port, which is /dev/ttyS0. (This was logical as there were 4 COM ports indicated in the file.) I didn39。 t change anything of the DRIVER_OPTS since I had no clue what else to put, and actually I figured that they would put reasonable defaults. Which I found to be true. Be aware that dependent on which version of the lirc module you use (different distribution or different release of Mandriva), the device may be /dev/lirc/0 or /dev/lirc/lirc0 or so. On my Mandriva desktop with WinTVFM card, the remote device is actually /dev/lirc/0. Make sure you adapt the above file accordingly. Next I entered the following mand: chkconfig list | grep lircd to verify that the lircd daemon would be started automatically at boot time, on my server I use runlevel 3 (init 3), and the response to the previous mand confirmed that all was well: lircd 0:off 1:off 2:on 3:on 4:on 5:on 6:off If the above had shown 39。 off39。 for any relevant runlevel, the above setup can be had by doing: chkconfig level 2345 lircd on Next, I did: modprobe lirc_serial Note: instead of the chkconfigmand, I could have done: Mandriva Control Center, System, Services, and selected 39。 start on boot39。 for lircd if it wasn39。 t selected yet. It should be set to start on boot after installation of this service. After that last mand, I could tell the device got properly created (which should normally happen whenever you load the correct module for the device): [root@paris root] ls l /dev/lirc0 showed me the device node: crwrw 1 root root 61, 0 Feb 5 2020 /dev/lirc0 so all seemed well from the device side. Note that on the LIRC website, there are indications that you have to do: ln s /tmp/.lircd /dev/lircd if you use Mandrake。 my guess is that this is true only if you are piling from source which is definitely not necessary in this case. That being said, it won39。 t harm your system either. I then verified (this you may execute as a regular user too) that the device was functional with: mode2 d /dev/lirc0 which gives no output, until you start pressing the remote buttons. A lot of codes flash by for each keypress if all is well. (Note that once the deamon lircd is running, you can no longer do this.) Then I did, as root (as most mands here): service lircd start (You can also do: /etc/) to which the system responded with: Starting Linux Infrared Remote Control daemon: [ OK ] Setup of Return to top If there is a lircremotes configuration file for your remote (it can be that your remote behaves the same as another one from the same factory): just copy the file for your remote control from the directory /usr/share/lircremotes/ cp /usr/share/lircremotes/[yourremotehere] /etc/ If it asks whether you want to overwrite the file /etc/ you naturally have to confirm. Note that only root can do this. In case your remote is not included in the directory /usr/share/lircremotes/ you are going to have to do what I did: t。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。