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)); } @@ -1072,6 +1077,7 @@ static ssize_t usblp_show_ieee1284_id(struct de static DEVICE_ATTR(ieee1284_id, S_IRUGO, usblp_show_ieee1284_id, NUL + static int usblp_probe(struct usb_interface *intf, const struct usb_device_id *id) { @@ -1079,6 +1085,8 @@ static int usblp_probe(struct usb_interface *in struct usblp *usblp; int protocol; int retval; + //dev->children[0]->dev.type=&printer_type; + //dev->dev.type=&printer_type; /* Malloc and start initializing usblp structure so we can us * directly. */注:注释的那两条是测试的过但是不成功的方法。
原文:http://blog.csdn.net/kangear/article/details/19047057