Use the new usb_ioctl to get the logical device name for publishing devfs entries in usb_raw.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18516 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -32,10 +32,6 @@ raw_device *gDeviceList = NULL;
|
|||||||
uint32 gDeviceCount = 0;
|
uint32 gDeviceCount = 0;
|
||||||
benaphore gDeviceListLock;
|
benaphore gDeviceListLock;
|
||||||
|
|
||||||
// ToDo: replace with proper device name getter (ioctl to bus manager)
|
|
||||||
uint8 gDeviceLevel;
|
|
||||||
uint8 gDeviceCounters[7];
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
usb_raw_device_added(const usb_device *newDevice, void **cookie)
|
usb_raw_device_added(const usb_device *newDevice, void **cookie)
|
||||||
{
|
{
|
||||||
@@ -55,30 +51,12 @@ usb_raw_device_added(const usb_device *newDevice, void **cookie)
|
|||||||
return B_NO_MORE_SEMS;
|
return B_NO_MORE_SEMS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToDo: replace with proper device name getter (ioctl to bus manager)
|
char deviceName[32];
|
||||||
char devicePathString[32];
|
memcpy(deviceName, &newDevice, sizeof(usb_device *));
|
||||||
char *devicePath = &devicePathString[0];
|
if (gUSBModule->usb_ioctl('DNAM', deviceName, sizeof(deviceName)) >= B_OK) {
|
||||||
memset(devicePath, 0, sizeof(devicePath));
|
sprintf(device->name, "bus/usb/%s", deviceName);
|
||||||
|
|
||||||
const usb_device_descriptor *deviceDescriptor =
|
|
||||||
gUSBModule->get_device_descriptor(newDevice);
|
|
||||||
if (deviceDescriptor->device_class == 0x09
|
|
||||||
&& deviceDescriptor->vendor_id == 0x0000
|
|
||||||
&& deviceDescriptor->product_id == 0x000) {
|
|
||||||
// root hub
|
|
||||||
memset(gDeviceCounters + 1, 0, sizeof(gDeviceCounters) - 1);
|
|
||||||
gDeviceLevel = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (uint8 i = 0; i <= gDeviceLevel; i++)
|
|
||||||
devicePath += sprintf(devicePath, "/%d", gDeviceCounters[i]);
|
|
||||||
|
|
||||||
gDeviceCounters[gDeviceLevel]++;
|
|
||||||
if (deviceDescriptor->device_class == 0x09) {
|
|
||||||
sprintf(device->name, "bus/usb%s/hub", devicePathString);
|
|
||||||
gDeviceLevel++;
|
|
||||||
} else {
|
} else {
|
||||||
sprintf(device->name, "bus/usb%s", devicePathString);
|
sprintf(device->name, "bus/usb/%08x", newDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
device->device = newDevice;
|
device->device = newDevice;
|
||||||
@@ -583,9 +561,6 @@ init_driver()
|
|||||||
&usb_raw_device_removed
|
&usb_raw_device_removed
|
||||||
};
|
};
|
||||||
|
|
||||||
gDeviceLevel = 0;
|
|
||||||
memset(gDeviceCounters, 0, sizeof(gDeviceCounters));
|
|
||||||
|
|
||||||
gDeviceList = NULL;
|
gDeviceList = NULL;
|
||||||
gDeviceCount = 0;
|
gDeviceCount = 0;
|
||||||
status_t result = benaphore_init(&gDeviceListLock, "usb_raw device list lock");
|
status_t result = benaphore_init(&gDeviceListLock, "usb_raw device list lock");
|
||||||
|
|||||||
Reference in New Issue
Block a user