Skip to content

Commit

Permalink
Log when a device is disconnected
Browse files Browse the repository at this point in the history
  • Loading branch information
xerpi committed Oct 16, 2023
1 parent c3e0b0e commit 213a86b
Showing 1 changed file with 7 additions and 35 deletions.
42 changes: 7 additions & 35 deletions source/usb_hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,9 @@ static void handle_device_change_reply(int host_fd, areply *reply)

/* Oops, it got disconnected */
if (!found) {
DEBUG("Device with VID: 0x%04x, PID: 0x%04x, dev_id: 0x%x got disconnected\n",
device->vid, device->pid, device->dev_id);

if (device->driver->disconnect)
ret = device->driver->disconnect(device);
/* Tell the fake Wiimote manager we got an input device removal */
Expand All @@ -396,15 +399,15 @@ static void handle_device_change_reply(int host_fd, areply *reply)
dev_id = device_change_devices[i].device_id;
DEBUG("[%d] VID: 0x%04x, PID: 0x%04x, dev_id: 0x%x\n", i, vid, pid, dev_id);

/* Check if we already have that device (same dev_id) connected */
if (is_usb_device_connected(dev_id))
continue;

/* Find if we have a driver for that VID/PID */
driver = get_usb_device_driver_for(vid, pid);
if (!driver)
continue;

/* Check if we already have that device (same dev_id) connected */
if (is_usb_device_connected(dev_id))
continue;

/* Get an empty device slot */
device = get_free_usb_device_slot();
if (!device)
Expand Down Expand Up @@ -529,34 +532,3 @@ int usb_hid_init(void)

return 0;
}































0 comments on commit 213a86b

Please sign in to comment.