usb: dump port name for usb device state update
This would help to differentiate ports in host mode. Bug: 377782468 Test: manual test Flag: EXEMPT bug fix Change-Id: I209bf7bc4a48146b0bef5fd6cd8b59252a3706ac
This commit is contained in:
parent
7a3202c0ef
commit
2d2a42e3ee
2 changed files with 7 additions and 2 deletions
|
@ -145,14 +145,17 @@ UsbDataSessionMonitor::UsbDataSessionMonitor(
|
|||
* and driver architecture. It's ok for addEpollFile to fail here, the file
|
||||
* will be monitored later when its presence is detected by uevent.
|
||||
*/
|
||||
mDeviceState.name = "udc";
|
||||
mDeviceState.filePath = deviceStatePath;
|
||||
mDeviceState.ueventRegex = deviceUeventRegex;
|
||||
addEpollFile(epollFd.get(), mDeviceState.filePath, mDeviceState.fd);
|
||||
|
||||
mHost1State.name = "host1";
|
||||
mHost1State.filePath = host1StatePath;
|
||||
mHost1State.ueventRegex = host1UeventRegex;
|
||||
addEpollFile(epollFd.get(), mHost1State.filePath, mHost1State.fd);
|
||||
|
||||
mHost2State.name = "host2";
|
||||
mHost2State.filePath = host2StatePath;
|
||||
mHost2State.ueventRegex = host2UeventRegex;
|
||||
addEpollFile(epollFd.get(), mHost2State.filePath, mHost2State.fd);
|
||||
|
@ -322,11 +325,11 @@ void UsbDataSessionMonitor::handleDeviceStateEvent(struct usbDeviceState *device
|
|||
n = read(deviceState->fd.get(), &state, USB_STATE_MAX_LEN);
|
||||
|
||||
if (kValidStates.find(state) == kValidStates.end()) {
|
||||
ALOGE("Invalid state %s", state);
|
||||
ALOGE("Invalid state %s: %s", deviceState->name.c_str(), state);
|
||||
return;
|
||||
}
|
||||
|
||||
ALOGI("Update USB device state: %s", state);
|
||||
ALOGI("Update device state %s: %s", deviceState->name.c_str(), state);
|
||||
|
||||
deviceState->states.push_back(state);
|
||||
deviceState->timestamps.push_back(boot_clock::now());
|
||||
|
|
|
@ -64,6 +64,8 @@ class UsbDataSessionMonitor {
|
|||
|
||||
private:
|
||||
struct usbDeviceState {
|
||||
// The name of the usb device, e.g. udc, host1, host2.
|
||||
std::string name;
|
||||
unique_fd fd;
|
||||
std::string filePath;
|
||||
std::string ueventRegex;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue