个人工具

UbuntuHelp:Lirc USB-UIRT

来自Ubuntu中文

跳转至: 导航, 搜索

Lirc and the USB-UIRT

The USB-UIRT is a usb serial InfraRed device. Support for it is built-in to the kernel via the ftdi_sio driver and usb-serial. In order to make use of it, however, you need to install lirc. To do so, you will need to have universe, and multiverse enabled. See Ubuntu documentation for more information on enabling|these repositories.

Install Lirc

$ sudo apt-get install lirc

Verify the USB-UIRT is detected

Plug the usb-uirt device into an available usb port. Check dmesg to make sure it was detected and that the tty was created.:

$ dmesg | grep -i usb

You should see some output that looks like the following.:

[    8.376358] usb 1-2: new full speed USB device using uhci_hcd and address 3
[    8.558634] usb 1-2: configuration #1 chosen from 1 choice
[   14.943365] usbcore: registered new interface driver usbserial
[   14.943374] drivers/usb/serial/usb-serial.c: USB Serial support registered fo
r generic
[   15.043231] usbcore: registered new interface driver usbserial_generic
[   15.043234] drivers/usb/serial/usb-serial.c: USB Serial Driver core
[   15.045761] drivers/usb/serial/usb-serial.c: USB Serial support registered fo
r FTDI USB Serial Device
[   15.045790] ftdi_sio 1-2:1.0: FTDI USB Serial Device converter detected
[   15.045793] drivers/usb/serial/ftdi_sio.c: Detected FT232BM
[   15.045911] usb 1-2: FTDI USB Serial Device converter now attached to ttyUSB0
[   15.045916] usbcore: registered new interface driver ftdi_sio
[   15.045918] drivers/usb/serial/ftdi_sio.c: v1.4.3:USB FTDI Serial Converters Driver

Note the tty that was created. You will use this in the next section. In the above example, it is ttyUSB0, which appears at /dev/ttyUSB0.

Configure Lirc hardware.conf

We need to edit the /etc/lirc/hardware.conf file, specifically, the LIRCD_ARGS, LOAD_MODULES and DRIVER variables. Set the LIRCD_ARGS to tell lircd where to find the serial device to use (you should know from the dmesg command in the previous step), set LOAD_MODULES to false and set the DRIVER to uirt2_raw. Like so:

# /etc/lirc/hardware.conf
#
# Arguments which will be used when launching lircd
LIRCD_ARGS="-d /dev/ttyUSB0"

#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=false

# Run "lircd --driver=help" for a list of supported drivers.
DRIVER="uirt2_raw"
# If DEVICE is set to /dev/lirc and devfs is in use /dev/lirc/0 will be
# automatically used instead
DEVICE=""
MODULES=""

# Default configuration files for your hardware if any
LIRCD_CONF=""
LIRCMD_CONF=""

Start lircd

Now all you need to do is start lircd and configure remotes in the /etc/lirc/lircd.conf and /etc/lirc/lircrc files.

$ sudo /etc/init.d/lirc start

Don't forget to make sure lirc starts at boot, too. This configuration allows you to both receive and transmit codes. Refer to the other LIRC documentation for instructions on how to test receiving with irw and transmitting with irsend.

Newer USB-UIRT Models

It has not been confirmed but some newer USB-UIRT Models may need the usb_uirt_raw driver instead of the uirt2_raw driver

# /etc/lirc/hardware.conf
#
# Arguments which will be used when launching lircd
LIRCD_ARGS="-d /dev/ttyUSB0"

#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=false

# Run "lircd --driver=help" for a list of supported drivers.
DRIVER="usb_uirt_raw"
# If DEVICE is set to /dev/lirc and devfs is in use /dev/lirc/0 will be
# automatically used instead
DEVICE=""
MODULES=""

# Default configuration files for your hardware if any
LIRCD_CONF=""
LIRCMD_CONF=""