How to auto-load kernel module when peripheral
Hi, I want my usb-serial converter can be automatically ready to use after it plugged into an USB port. Currently I have to manually do 'modprobe ftdi_sio' before use it, otherwise, no module will be loaded and there is no a /dev/ttyUSB0 appearing. I am using mdev instead of udev in this embedded system, and full pathname of mdev had already put in /proc/sys/kernel/hotplug file. I also already added a line into my mdev.conf: ttyUSB* root:tty 660 To make it clear, the problem is when I inserted the convert, I did not see /dev/ttyUSB0 was created and 'lsmod' also not list the 'ftdi_sio' module. If I check the kernel message at the time of inserting the device, I can see: [ 43.425000] usb 1-1: new full speed USB device number 2 using s3c2416-ohci [ 43.585000] usb 1-1: New USB device found, idVendor=0403, idProduct=6001 [ 43.585000] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 43.585000] usb 1-1: Product: FT232R USB UART [ 43.585000] usb 1-1: Manufacturer: FTDI [ 43.585000] usb 1-1: SerialNumber: A900aMbV How do I do? Thanks in advance! -- Life is the only flaw in an otherwise perfect nonexistence -- Schopenhauer woody public key at http://subkeys.pgp.net:11371 (narkewoody@gmail.com)
On Tue, Mar 31, 2015 at 12:27:50PM +0800, Woody Wu wrote:
Hi,
I want my usb-serial converter can be automatically ready to use after it plugged into an USB port. Currently I have to manually do 'modprobe ftdi_sio' before use it, otherwise, no module will be loaded and there is no a /dev/ttyUSB0 appearing.
I am using mdev instead of udev in this embedded system, and full pathname of mdev had already put in /proc/sys/kernel/hotplug file. I also already added a line into my mdev.conf: ttyUSB* root:tty 660
To make it clear, the problem is when I inserted the convert, I did not see /dev/ttyUSB0 was created and 'lsmod' also not list the 'ftdi_sio' module. If I check the kernel message at the time of inserting the device, I can see:
[ 43.425000] usb 1-1: new full speed USB device number 2 using s3c2416-ohci [ 43.585000] usb 1-1: New USB device found, idVendor=0403, idProduct=6001 [ 43.585000] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 43.585000] usb 1-1: Product: FT232R USB UART [ 43.585000] usb 1-1: Manufacturer: FTDI [ 43.585000] usb 1-1: SerialNumber: A900aMbV
How do I do? Thanks in advance!
https://wiki.gentoo.org/wiki/Mdev#Notes "mdev unlike udev does not support auto-modules loading thus you will need to use /etc/conf.d/modules(depends on your distro) and put there all the modules like you used to load." -- Adam Lee http://adam8157.info
On 31 March 2015 at 13:04, Adam Lee <adam8157@gmail.com> wrote:
On Tue, Mar 31, 2015 at 12:27:50PM +0800, Woody Wu wrote:
Hi,
I want my usb-serial converter can be automatically ready to use after it plugged into an USB port. Currently I have to manually do 'modprobe ftdi_sio' before use it, otherwise, no module will be loaded and there is no a /dev/ttyUSB0 appearing.
I am using mdev instead of udev in this embedded system, and full pathname of mdev had already put in /proc/sys/kernel/hotplug file. I also already added a line into my mdev.conf: ttyUSB* root:tty 660
To make it clear, the problem is when I inserted the convert, I did not see /dev/ttyUSB0 was created and 'lsmod' also not list the 'ftdi_sio' module. If I check the kernel message at the time of inserting the device, I can see:
[ 43.425000] usb 1-1: new full speed USB device number 2 using s3c2416-ohci [ 43.585000] usb 1-1: New USB device found, idVendor=0403, idProduct=6001 [ 43.585000] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 43.585000] usb 1-1: Product: FT232R USB UART [ 43.585000] usb 1-1: Manufacturer: FTDI [ 43.585000] usb 1-1: SerialNumber: A900aMbV
How do I do? Thanks in advance!
https://wiki.gentoo.org/wiki/Mdev#Notes
"mdev unlike udev does not support auto-modules loading thus you will need to use /etc/conf.d/modules(depends on your distro) and put there all the modules like you used to load."
Many thanks for the hint. But then I find my mdev actually support this feature, which is a BusyBox version of mdev. The source of of its mdev.c has something blow: * $envvar=regex format is useful for loading modules for hot-plugged devices * which do not have driver loaded yet. In this case /sys/class/.../dev * does not exist, but $MODALIAS is set to needed module's name * (actually, an alias to it) by kernel. This rule instructs mdev * to load the module and exit: * $MODALIAS=.* 0:0 660 @modprobe "$MODALIAS" * The kernel will generate another hotplug event when /sys/class/.../dev * file appears. Then I just tried with success! Thanks you anyway! -woody
participants (2)
-
Adam Lee -
Woody Wu