anzevi
September 20th, 2010, 03:52 PM
hi everybody,
this is a short walk-thru guide for anyone that need to get serial remote IR receiver working with internal PCI card with 2 serial ports on it. This is the typical case if you would like to have serial IR receiver installed on newer machines that doesn't have serial ports.
In this scenario I have bought ST Lab PCI controller card, model l-390 (PCI 2S serial card).
This is how I got it working for my MythTV at home:
1) After you plug in serial port PCI card, check if your hardware is detected and print the configuration out:
lspci -v | grep -A4 Serial
04:05.0 Serial controller: NetMos Technology PCI 9865 Multi-I/O Controller (prog-if 02)
Subsystem: Device a000:1000
Flags: medium devsel, IRQ 17
I/O ports at cce0 [size=8]
Memory at dbefa000 (32-bit, non-prefetchable) [size=4K]
--
04:05.1 Serial controller: NetMos Technology PCI 9865 Multi-I/O Controller (prog-if 02)
Subsystem: Device a000:1000
Flags: medium devsel, IRQ 18
I/O ports at cce8 [size=8]
Memory at dbefc000 (32-bit, non-prefetchable) [size=4K]
As you can see, I have two serial ports (com1 and com2) with irq 17 and 18 and addresses 0xcce0 and 0xcce8. You will need this information later to put it in your lirc config file.
2) Install and buils LIRC modules:
apt-get install lirc lirc-modules-source module-assistant
m-a update,prepare
m-a clean lirc
m-a a-i -f lirc
dpkg-reconfigure lirc-modules-source
At this point you should have your lirc modules built.
3) Update your settings in /etc/modprobe.d/lirc-serial.conf:
#COM1 equivalent, /dev/ttyS0
options lirc_serial irq=17 io=0xcce0
#COM2 equivalent, /dev/ttyS1
options lirc_serial irq=18 io=0xcce8
alias char-major-61 lirc_serial
options lirc_serial share_irq=1
Make sure you have the right parameters for IRQs and com port addresses. Also, note that you need to have "share_irq=1" parameter otherwise it will not work and you will be seeing errors like this in your syslog file:
Sep 19 16:42:15 sataras lircd-0.8.6[2628]: lircd(default) ready, using /var/run/lirc/lircd
Sep 19 16:42:17 sataras lircd-0.8.6[2628]: accepted new client on /var/run/lirc/lircd
Sep 19 16:42:17 sataras lircd-0.8.6[2628]: could not open /dev/lirc0
Sep 19 16:42:17 sataras lircd-0.8.6[2628]: default_init(): Device or resource busy
Sep 19 16:42:17 sataras lircd-0.8.6[2628]: Failed to initialize hardware
Sep 19 16:42:17 sataras kernel: [ 1333.890444] lirc_serial: IRQ 17 busy
4) Update your settings in /etc/lirc/hardware.conf. It should look something like this:
LIRCD_ARGS=""
#Don't start lircmd even if there seems to be a good config file
#START_LIRCMD=false
#Try to load appropriate kernel modules
LOAD_MODULES=true
# Run "lircd --driver=help" for a list of supported drivers.
DRIVER=""
# If DEVICE is set to /dev/lirc and devfs is in use /dev/lirc/0 will be
# automatically used instead
DEVICE="/dev/lirc0"
MODULES="lirc_dev lirc_serial"
# Default configuration files for your hardware if any
#LIRCD_CONF="/etc/lirc/lircd.conf"
LIRCMD_CONF=""
#REMOTE="Home-brew (16x50 UART compatible serial port)"
REMOTE_MODULES="lirc_dev lirc_serial"
REMOTE_DRIVER=""
REMOTE_DEVICE="/dev/lirc0"
REMOTE_LIRCD_CONF=""
REMOTE_LIRCD_ARGS=""
TRANSMITTER="Custom"
TRANSMITTER_MODULES=""
TRANSMITTER_DRIVER=""
TRANSMITTER_DEVICE=""
TRANSMITTER_LIRCD_CONF=""
TRANSMITTER_LIRCD_ARGS=""
START_LIRCD="true"
START_LIRCMD=""
FORCE_NONINTERACTIVE_RECONFIGURATION="false"
REMOTE_SOCKET=""
TRANSMITTER_SOCKET=""
5) Start lirc service and you should be good to go:
/etc/init.d/lirc restart
If everything is ok, you should see soething like this in /var/log/syslog:
Sep 19 17:08:27 sataras lircd-0.8.6[17298]: lircd(default) ready, using /var/run/lirc/lircd
Sep 19 17:08:28 sataras lircd-0.8.6[17298]: accepted new client on /var/run/lirc/lircd
Sep 19 17:08:28 sataras kernel: [ 2904.888110] IRQ 18/lirc_serial: IRQF_DISABLED is not guaranteed on shared IRQs
Sep 19 17:08:36 sataras lircd-0.8.6[17298]: accepted new client on /var/run/lirc/lircd
This is it. Enjoy.
this is a short walk-thru guide for anyone that need to get serial remote IR receiver working with internal PCI card with 2 serial ports on it. This is the typical case if you would like to have serial IR receiver installed on newer machines that doesn't have serial ports.
In this scenario I have bought ST Lab PCI controller card, model l-390 (PCI 2S serial card).
This is how I got it working for my MythTV at home:
1) After you plug in serial port PCI card, check if your hardware is detected and print the configuration out:
lspci -v | grep -A4 Serial
04:05.0 Serial controller: NetMos Technology PCI 9865 Multi-I/O Controller (prog-if 02)
Subsystem: Device a000:1000
Flags: medium devsel, IRQ 17
I/O ports at cce0 [size=8]
Memory at dbefa000 (32-bit, non-prefetchable) [size=4K]
--
04:05.1 Serial controller: NetMos Technology PCI 9865 Multi-I/O Controller (prog-if 02)
Subsystem: Device a000:1000
Flags: medium devsel, IRQ 18
I/O ports at cce8 [size=8]
Memory at dbefc000 (32-bit, non-prefetchable) [size=4K]
As you can see, I have two serial ports (com1 and com2) with irq 17 and 18 and addresses 0xcce0 and 0xcce8. You will need this information later to put it in your lirc config file.
2) Install and buils LIRC modules:
apt-get install lirc lirc-modules-source module-assistant
m-a update,prepare
m-a clean lirc
m-a a-i -f lirc
dpkg-reconfigure lirc-modules-source
At this point you should have your lirc modules built.
3) Update your settings in /etc/modprobe.d/lirc-serial.conf:
#COM1 equivalent, /dev/ttyS0
options lirc_serial irq=17 io=0xcce0
#COM2 equivalent, /dev/ttyS1
options lirc_serial irq=18 io=0xcce8
alias char-major-61 lirc_serial
options lirc_serial share_irq=1
Make sure you have the right parameters for IRQs and com port addresses. Also, note that you need to have "share_irq=1" parameter otherwise it will not work and you will be seeing errors like this in your syslog file:
Sep 19 16:42:15 sataras lircd-0.8.6[2628]: lircd(default) ready, using /var/run/lirc/lircd
Sep 19 16:42:17 sataras lircd-0.8.6[2628]: accepted new client on /var/run/lirc/lircd
Sep 19 16:42:17 sataras lircd-0.8.6[2628]: could not open /dev/lirc0
Sep 19 16:42:17 sataras lircd-0.8.6[2628]: default_init(): Device or resource busy
Sep 19 16:42:17 sataras lircd-0.8.6[2628]: Failed to initialize hardware
Sep 19 16:42:17 sataras kernel: [ 1333.890444] lirc_serial: IRQ 17 busy
4) Update your settings in /etc/lirc/hardware.conf. It should look something like this:
LIRCD_ARGS=""
#Don't start lircmd even if there seems to be a good config file
#START_LIRCMD=false
#Try to load appropriate kernel modules
LOAD_MODULES=true
# Run "lircd --driver=help" for a list of supported drivers.
DRIVER=""
# If DEVICE is set to /dev/lirc and devfs is in use /dev/lirc/0 will be
# automatically used instead
DEVICE="/dev/lirc0"
MODULES="lirc_dev lirc_serial"
# Default configuration files for your hardware if any
#LIRCD_CONF="/etc/lirc/lircd.conf"
LIRCMD_CONF=""
#REMOTE="Home-brew (16x50 UART compatible serial port)"
REMOTE_MODULES="lirc_dev lirc_serial"
REMOTE_DRIVER=""
REMOTE_DEVICE="/dev/lirc0"
REMOTE_LIRCD_CONF=""
REMOTE_LIRCD_ARGS=""
TRANSMITTER="Custom"
TRANSMITTER_MODULES=""
TRANSMITTER_DRIVER=""
TRANSMITTER_DEVICE=""
TRANSMITTER_LIRCD_CONF=""
TRANSMITTER_LIRCD_ARGS=""
START_LIRCD="true"
START_LIRCMD=""
FORCE_NONINTERACTIVE_RECONFIGURATION="false"
REMOTE_SOCKET=""
TRANSMITTER_SOCKET=""
5) Start lirc service and you should be good to go:
/etc/init.d/lirc restart
If everything is ok, you should see soething like this in /var/log/syslog:
Sep 19 17:08:27 sataras lircd-0.8.6[17298]: lircd(default) ready, using /var/run/lirc/lircd
Sep 19 17:08:28 sataras lircd-0.8.6[17298]: accepted new client on /var/run/lirc/lircd
Sep 19 17:08:28 sataras kernel: [ 2904.888110] IRQ 18/lirc_serial: IRQF_DISABLED is not guaranteed on shared IRQs
Sep 19 17:08:36 sataras lircd-0.8.6[17298]: accepted new client on /var/run/lirc/lircd
This is it. Enjoy.