介绍

今天在Ubuntu22.04上插入RS485 USB模块(CH341),发现驱动居然没有识别USB设备

img

但检索了一下驱动模块的目录,发现ch341.ko和usbserial.ko都是系统自带的

1
2
/lib/modules/6.8.0-78-generic/kernel/drivers/usb/serial/ch341.ko
/lib/modules/6.8.0-78-generic/kernel/drivers/usb/serial/usbserial.ko

内核日志表面:USB Serial驱动已经加载了,显然CH341的驱动没有Probe,看来是被系统故意隔离了(黑名单)

img

黑名单

配置文件:/etc/modprobe.d/blacklist.conf,可以很清楚地看到当前Ubuntu系统哪些设备驱动是加入了黑名单的

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
hywing@moore:~$ cat /etc/modprobe.d/blacklist.conf
# This file lists those modules which we don't want to be loaded by
# alias expansion, usually so some other driver will be loaded for the
# device instead.

# evbug is a debug tool that should be loaded explicitly
blacklist evbug

# these drivers are very simple, the HID drivers are usually preferred
blacklist usbmouse
blacklist usbkbd

# replaced by e100
blacklist eepro100

# replaced by tulip
blacklist de4x5

# causes no end of confusion by creating unexpected network interfaces
blacklist eth1394

# snd_intel8x0m can interfere with snd_intel8x0, doesn't seem to support much
# hardware on its own (Ubuntu bug #2011, #6810)
blacklist snd_intel8x0m

# Conflicts with dvb driver (which is better for handling this device)
blacklist snd_aw2

# replaced by p54pci
blacklist prism54

# replaced by b43 and ssb.
blacklist bcm43xx

# most apps now use garmin usb driver directly (Ubuntu: #114565)
blacklist garmin_gps

# replaced by asus-laptop (Ubuntu: #184721)
blacklist asus_acpi

# low-quality, just noise when being used for sound playback, causes
# hangs at desktop session start (Ubuntu: #246969)
blacklist snd_pcsp

# ugly and loud noise, getting on everyone's nerves; this should be done by a
# nice pulseaudio bing (Ubuntu: #77010)
blacklist pcspkr

# EDAC driver for amd76x clashes with the agp driver preventing the aperture
# from being initialised (Ubuntu: #297750). Blacklist so that the driver
# continues to build and is installable for the few cases where its
# really needed.
blacklist amd76x_edac
blacklist pl2303
blacklist ch341
blacklist ftdi_sio
install pl2303 /bin/true
install ch341 /bin/true
install ftdi_sio /bin/true

你可以选择注释掉相关的黑名单列表(但不推荐这么做,Ubuntu官方这么做肯定有它的理由)

1
2
3
4
# blacklist pl2303
# blacklist ch341
# install pl2303 /bin/true
# install ch341 /bin/true

blacklist关键字:阻止驱动自动加载

install关键字:阻止设备probe对应的驱动

显式加载

当黑名单有屏蔽你的设备时,发现/lib/modules/$(uname -r)/kernel目录又有对应驱动,你可以手动加载

1
2
3
4
5
# 推荐
sudo modprobe ch341
# 或者
insmod /lib/modules/6.8.0-78-generic/kernel/drivers/usb/serial/usbserial.ko
insmod /lib/modules/6.8.0-78-generic/kernel/drivers/usb/serial/ch341.ko

下里巴人
海纳百川,文以载道
hywing技术自留地
总访问 113701 次 | 本页访问 326