这是一台打印机:
add@/devices/pci0000:00/0000:00:1d.7/usb1/1-2/1-2:1.0/usb/lp0
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:1d.7/usb1/1-2/1-2:1.0/usb/lp0
SUBSYSTEM=usb
MAJOR=180
MINOR=0
DEVNAME=usb/lp0
SEQNUM=1858
E=7/1/2
MODALIAS=usb:v03F0pB511d0100dc00dsc00dp00ic07isc01ip02
SEQNUM=1856
received 276 bytes
为什么没有DEVTYPE?
其他设备有它。
我需要它!
答案 0 :(得分:0)
自己解决。
diff --git a/kernel/drivers/usb/class/usblp.c b/kernel/drivers/usb/cl
index 9eca405..b528437 100755
--- a/kernel/drivers/usb/class/usblp.c
+++ b/kernel/drivers/usb/class/usblp.c
@@ -1046,8 +1046,13 @@ static const struct file_operations usblp_fops
.llseek = noop_llseek,
};
+static struct device_type printer_type = {
+ .name = "printer",
+};
+
static char *usblp_devnode(struct device *dev, mode_t *mode)
{
+ dev->type=&printer_type;
return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev));
}