I have been thinking of a better question. The question is just the first reality. After continuous debugging, it is another problem. I want to name another name, such as "add DEVTYPE to the hot swapping event in the printer driver". But I finally thought it would be better to go back to the beginning. Symptoms: NativeDaemonConnector. java (view vold tag) 02-10 01:21:02. 340: E/VoldConnector (11051): got-1 reading with start = 002-10 01:21:02. 340: E/VoldConnector (11051): closing stream for vold02-10 01:21:02. 340: E/VoldConnector (11051): Communications error: java. io. IOException: No such file or directory02-10 01:21:02. 340: E/VoldConnector (11051): Error in NativeDaemonConnector: java. io. IOException: No s Uch file or directory analysis: without any program modifications, it is no problem to insert a USB wireless Nic. Currently, no information is reported for both the printer and wireless network adapter, which eliminates the cause of message reporting. Currently, the difference is DEVTYPE. The former is none, while the latter is. The problem is found when you view all the errors: NetlinkEvent: FindParam (): Parameter 'devtype' not found. The previous hypothesis is true,Problems Occurred When obtaining DEVTYPE.
The following figure shows how to add DEVTYPE to the kernel usb printer driver. It takes less than one afternoon to add the diff file:
diff --git a/kernel/drivers/usb/class/usblp.c b/kernel/drivers/usb/clindex 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. */
Note:
The two annotated methods are tested but fail..
Thanks to the Linux driver group.
LinuxDrvGroup owner. Step by step. For example: