Use a flag to cancel issuing new transfers instead of relying on a B_CANCELED. This should ensure that the hid driver does not use the device after the remove hook completes. Untested...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21748 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
9821c5c4e1
commit
63218bfd3f
@ -339,6 +339,7 @@ create_device(const usb_device *dev, const usb_interface_info *ii,
|
||||
device->open = 0;
|
||||
device->open_fds = NULL;
|
||||
device->active = true;
|
||||
device->unplugged = false;
|
||||
device->insns = NULL;
|
||||
device->num_insns = 0;
|
||||
device->flags = 0;
|
||||
@ -584,7 +585,7 @@ usb_callback(void *cookie, uint32 busStatus,
|
||||
hid_device_info *device = cookie;
|
||||
status_t status;
|
||||
|
||||
if (device == NULL)
|
||||
if (device == NULL || device->unplugged)
|
||||
return;
|
||||
|
||||
acquire_sem(device->sem_lock);
|
||||
@ -849,6 +850,8 @@ hid_device_removed(void *cookie)
|
||||
assert (cookie != NULL);
|
||||
|
||||
DPRINTF_INFO((MY_ID "device_removed(%s)\n", device->name));
|
||||
|
||||
device->unplugged = true;
|
||||
usb->cancel_queued_transfers (device->ept->handle);
|
||||
remove_device_info(device);
|
||||
|
||||
|
@ -68,6 +68,7 @@ typedef struct hid_device_info {
|
||||
struct ring_buffer *rbuf;
|
||||
|
||||
bool active;
|
||||
bool unplugged;
|
||||
int open;
|
||||
struct driver_cookie *open_fds;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user