[rk3288][android-5.1]打印机支持 (dev/usb/lp*)

说明:

有客户反馈使用usb外接打印机时无法正常使用,查找资料发现需要进行相关配置以生成对应节点方可正常使用,整理如下

1.内核config配置:

CONFIG_USB_PRINTER=y

2. 节点创建

文件位置:/system/core/init/device.c

static void handle_generic_device_event(struct uevent *uevent){
    
    ...
    
		make_dir("/dev/bus", 0755);
		make_dir("/dev/bus/usb", 0755);
		snprintf(devpath, sizeof(devpath), "/dev/bus/usb/%03d", bus_id);
		make_dir(devpath, 0755);
		snprintf(devpath, sizeof(devpath), "/dev/bus/usb/%03d/%03d", bus_id, device_id);
		}
- 	} 
+	} else if (!strncmp(uevent->subsystem, "usbmisc", 7)) {  
+			if (!strncmp(uevent->device_name, "usb/lp", 6)){
+			base = "/dev/usb/"; 
+			mkdir(base, 0755);
+		}
+	}

    ...

    //创建/dev/usb/lp0设备路径
    if (!devpath[0])
     snprintf(devpath, sizeof(devpath), "%s%s", base, name);
    //执行mknod节点
    handle_device(uevent->action, devpath, uevent->path, 0,
         uevent->major, uevent->minor, links);
}

3.添加权限

文件位置:device/qcom/common/rootdir/etc/ueventd.qcom.rc

/dev/qcom-gpio         0666   system     system
/dev/ttyXRM*           0666   system     system

+/dev/usb/lp*           0666   system     system

你可能感兴趣的:(rk平台调试记录)