ZK-ID6USB infrared has been successfully used in Linux
Source: Internet
Author: User
Article title: ZK-ID6USB infrared has been successfully used in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Compared with the infrared transmitters integrated in the notebooks of major manufacturers, this independent USB port transmitter is difficult to drive in Linux, but it is still successful. The following describes how the IRDA subsystem works:
1) First of all, this infrared transceiver, though using USB, does not belong to the type specified in the USB device category, and thus cannot use a USB universal driver. On Windows, we can see that it belongs to the serial port type. The model is MA-620.
2) the transceiver is actually a USB-to-serial port line with the model of PL2303. Therefore, it can be recognized by the latest kernel after being inserted into the computer and mapped to the USB serial port/dev/ttyUSB0.
3) after the counterfeit serial port, a real infrared transceiver is followed. The real type of the transceiver is MA-600. Therefore, a general-purpose MA-600 driver can be used.
4) Therefore, the USB infrared driver is actually installed on the tty layer on the USB serial port, and then the IRDA protocol stack is installed on it. The figure below shows:
Ircomm and other application layer protocols Linux-irda-stack
|
Sir-dev
|
Irtty-sir [ma600-sir]
|
Tty-layer
|
Usbserial [pl2303]
|
Usb_hcd [ehci/ohci/uhci]
The modules used are as follows: Module Size Used
Ma600_sir 3328 1
Irtty_sir 7424 2
Sir_dev 17452 2 ma600_sir, irtty_sir
Irda 129468 2 ma600_sir, sir_dev
Pl2303 16644 1
Usbserial 27812 3 pl2303
Uhci_hcd 30736 0
5) However, the actual situation is always not as good as the analysis. The preceding solution has the following restrictions:
First of all, running tty on USB to serial port has a serious problem on any 2.4 version of kernel, and occasionally deadlocks will occur.
Secondly, the pl2303 driver has a bug before kernel 2.6.3, which will cause the DMA transmission to overwrite the stack. At the same time, the ma600 driver before this version cannot correctly handle errors and cannot be recovered from the error status.
Third, until the latest version, the ma600 will not be able to process the speed conversion request of the ma620, and an error will occur at the first speed. Therefore, we can only use the default 9600 speed. At the same time, do not try rmmod pl2303. kernel versions earlier than 2.6.7 will cause oops
Finally, you must use the latest irda-utils package 0.9.17-pre3 or later. the old version will crash under certain circumstances.
6) OK. The following is the script for enabling the infrared function:
Start:
#! /Bin/sh
#
# Minimal stuff required to get the MA620 usb irda dongle recognized
# The kernel.
#! /Bin/sh
#
# Minimal stuff required to stop the MA620 usb irda dongle
Killall irattach kIrDAd
Modprobe-r ircomm-tty
Modprobe-r ma600
Modprobe-r ma600-sir
Modprobe-r irtty-sir
# Not removing pl2303 since it causes a kernel oops
Exit 0
Save the above two scripts as files, run start to enable irda, and stop to disable. After the device is started, align the infrared device with your transceiver and enter the irdadump command. if the device is found, it indicates that the infrared device is up. You can access the infrared serial port analog protocol by accessing/dev/ircomm0. if this device supports it, you can even initiate a minicom to read and write the analog serial port. Enter cat/proc/net/irda/discovery and you will be able to see the name of your device in it.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.