ueventd in Android
ueventd in Android
ueventd
To receive uevent message from the kernel so that the device node(/dev/xxx) can be created or removed.- creates and pool netlink socket. ueventd_main in core/init/ueventd.c.
- read event messages from kernel then parse and handle it. handle_device_event in core/init/devices.c .
- device_changed in core/init/init.c.
- queue_device_triggers in core/init/init_parser.c . queue_device_triggers will search the action list to know how to do about the received event. Action's name to be searched is device-addeded or removed-[device_node]. [device_node] is from the variable DEVPATH in the uevent message.
- action list is declared in core/init/init_parser.c .
- built-in actions. Added by queue_builtin_action in core/init/init_parser.c .
- imported actions via script. Added by parse_action in core/init/init_parser.c .
#define LOG_UEVENTS 1 /* log uevent messages if 1. verbose */
Crash due to the Android device is not registered
The platform code for USB OTG is not currently installed in
our build, but USB OTG and Android Gadget support is configured. During the init() call Android USB gadget will install the sysfs entries: functions, enable, and state
If the probe() function fails or the probe function is not called missing platform device definition, the sysfs entry points will still be instantiated.
Later on init.rc will write one to /sys/class/android_usb/android0/ enable which will cause a NULL pointer dereference due to the fact pdev private data is not initialized (in enable_store).
If the probe() function fails or the probe function is not called missing platform device definition, the sysfs entry points will still be instantiated.
Later on init.rc will write one to /sys/class/android_usb/android0/ enable which will cause a NULL pointer dereference due to the fact pdev private data is not initialized (in enable_store).
The sysfs entries should be instantiated only if the probe occurs successfully and if probe fails cleanup should occur for any sysfs entries that were added.
留言