|
发表于 2015-1-13 14:48:00
只看该作者
沙发
Android init process will ignore usb uevent, so please modified ~/$proj/system/core/init/device.c
...
if (!strncmp(uevent->subsystem, "usb", 3)) {
if (!strcmp(uevent->subsystem, "usb")) {
if (uevent->device_name) {
/*
* create device node provided by kernel if present
* see drivers/base/core.c
*/
char *p = devpath;
snprintf(devpath, sizeof(devpath), "/dev/%s", uevent->device_name);
/* skip leading /dev/ */
p += 5;
/* build directories */
while (*p) {
if (*p == '/') {
*p = 0;
make_dir(devpath, 0755);
*p = '/';
}
p++;
}
}
else {
/* This imitates the file system that would be created
* if we were using devfs instead.
* Minors are broken up into groups of 128, starting at "001"
*/
int bus_id = uevent->minor / 128 + 1;
int device_id = uevent->minor % 128 + 1;
/* build directories */
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 {
/* ignore other USB events */
if(!strncmp(name, "flv",3)){
base = "/dev/";
}
else
return;
}
... |
|