winebus.sys: Query manufacturer string on device creation.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e4f0b4ab8a
commit
9d4b70473c
|
@ -193,9 +193,6 @@ static NTSTATUS iohid_device_get_string(struct unix_device *iface, DWORD index,
|
|||
case HID_STRING_ID_IPRODUCT:
|
||||
str = IOHIDDeviceGetProperty(private->device, CFSTR(kIOHIDProductKey));
|
||||
break;
|
||||
case HID_STRING_ID_IMANUFACTURER:
|
||||
str = IOHIDDeviceGetProperty(private->device, CFSTR(kIOHIDManufacturerKey));
|
||||
break;
|
||||
case HID_STRING_ID_ISERIALNUMBER:
|
||||
str = IOHIDDeviceGetProperty(private->device, CFSTR(kIOHIDSerialNumberKey));
|
||||
break;
|
||||
|
@ -313,6 +310,9 @@ static void handle_DeviceMatchingCallback(void *context, IOReturn result, void *
|
|||
}
|
||||
IOHIDDeviceScheduleWithRunLoop(IOHIDDevice, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
|
||||
|
||||
str = IOHIDDeviceGetProperty(IOHIDDevice, CFSTR(kIOHIDManufacturerKey));
|
||||
if (str) lstrcpynA(desc.manufacturer, str, sizeof(desc.manufacturer));
|
||||
|
||||
if (IOHIDDeviceConformsTo(IOHIDDevice, kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad) ||
|
||||
IOHIDDeviceConformsTo(IOHIDDevice, kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick))
|
||||
{
|
||||
|
|
|
@ -528,9 +528,6 @@ static NTSTATUS sdl_device_get_string(struct unix_device *iface, DWORD index, WC
|
|||
else
|
||||
str = pSDL_JoystickName(ext->sdl_joystick);
|
||||
break;
|
||||
case HID_STRING_ID_IMANUFACTURER:
|
||||
str = "SDL";
|
||||
break;
|
||||
case HID_STRING_ID_ISERIALNUMBER:
|
||||
str = "000000";
|
||||
break;
|
||||
|
@ -739,6 +736,7 @@ static void sdl_add_device(unsigned int index)
|
|||
.busid = sdl_busidW,
|
||||
.input = -1,
|
||||
.serial = {'0','0','0','0',0},
|
||||
.manufacturer = {"SDL"},
|
||||
};
|
||||
struct platform_private *private;
|
||||
char guid_str[34];
|
||||
|
|
|
@ -677,9 +677,6 @@ static NTSTATUS hidraw_device_get_string(struct unix_device *iface, DWORD index,
|
|||
case HID_STRING_ID_IPRODUCT:
|
||||
str = get_sysattr_string(usbdev, "product");
|
||||
break;
|
||||
case HID_STRING_ID_IMANUFACTURER:
|
||||
str = get_sysattr_string(usbdev, "manufacturer");
|
||||
break;
|
||||
case HID_STRING_ID_ISERIALNUMBER:
|
||||
str = get_sysattr_string(usbdev, "serial");
|
||||
break;
|
||||
|
@ -702,8 +699,6 @@ static NTSTATUS hidraw_device_get_string(struct unix_device *iface, DWORD index,
|
|||
str = strdupAtoW(buf);
|
||||
break;
|
||||
}
|
||||
case HID_STRING_ID_IMANUFACTURER:
|
||||
break;
|
||||
case HID_STRING_ID_ISERIALNUMBER:
|
||||
break;
|
||||
default:
|
||||
|
@ -969,9 +964,6 @@ static NTSTATUS lnxev_device_get_string(struct unix_device *iface, DWORD index,
|
|||
case HID_STRING_ID_IPRODUCT:
|
||||
ioctl(ext->base.device_fd, EVIOCGNAME(sizeof(str)), str);
|
||||
break;
|
||||
case HID_STRING_ID_IMANUFACTURER:
|
||||
strcpy(str,"evdev");
|
||||
break;
|
||||
case HID_STRING_ID_ISERIALNUMBER:
|
||||
ioctl(ext->base.device_fd, EVIOCGUNIQ(sizeof(str)), str);
|
||||
break;
|
||||
|
@ -1088,6 +1080,9 @@ static void get_device_subsystem_info(struct udev_device *dev, char const *subsy
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!desc->manufacturer[0] && (tmp = udev_device_get_sysattr_value(dev, "manufacturer")))
|
||||
lstrcpynA(desc->manufacturer, tmp, sizeof(desc->manufacturer));
|
||||
}
|
||||
|
||||
static void udev_add_device(struct udev_device *dev)
|
||||
|
@ -1133,6 +1128,7 @@ static void udev_add_device(struct udev_device *dev)
|
|||
if (!strcmp(subsystem, "hidraw"))
|
||||
{
|
||||
desc.busid = hidraw_busidW;
|
||||
if (!desc.manufacturer[0]) strcpy(desc.manufacturer, "hidraw");
|
||||
}
|
||||
#ifdef HAS_PROPER_INPUT_HEADER
|
||||
else if (!strcmp(subsystem, "input"))
|
||||
|
@ -1154,6 +1150,8 @@ static void udev_add_device(struct udev_device *dev)
|
|||
device_uid[0] = 0;
|
||||
if (ioctl(fd, EVIOCGUNIQ(254), device_uid) >= 0 && device_uid[0])
|
||||
MultiByteToWideChar(CP_UNIXCP, 0, device_uid, -1, desc.serial, ARRAY_SIZE(desc.serial));
|
||||
|
||||
if (!desc.manufacturer[0]) strcpy(desc.manufacturer, "evdev");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -111,6 +111,8 @@ struct device_extension
|
|||
struct device_desc desc;
|
||||
DWORD index;
|
||||
|
||||
WCHAR manufacturer[MAX_PATH];
|
||||
|
||||
BYTE *last_report;
|
||||
DWORD last_report_size;
|
||||
BOOL last_report_read;
|
||||
|
@ -364,6 +366,8 @@ static DEVICE_OBJECT *bus_create_hid_device(struct device_desc *desc, struct uni
|
|||
ext->buffer_size = 0;
|
||||
ext->unix_device = unix_device;
|
||||
|
||||
MultiByteToWideChar(CP_UNIXCP, 0, ext->desc.manufacturer, -1, ext->manufacturer, MAX_PATH);
|
||||
|
||||
InitializeListHead(&ext->irp_queue);
|
||||
InitializeCriticalSection(&ext->cs);
|
||||
ext->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": cs");
|
||||
|
@ -815,6 +819,23 @@ static NTSTATUS deliver_last_report(struct device_extension *ext, DWORD buffer_l
|
|||
}
|
||||
}
|
||||
|
||||
static NTSTATUS hid_get_device_string(DEVICE_OBJECT *device, DWORD index, WCHAR *buffer, DWORD buffer_len)
|
||||
{
|
||||
struct device_extension *ext = (struct device_extension *)device->DeviceExtension;
|
||||
DWORD len;
|
||||
|
||||
switch (index)
|
||||
{
|
||||
case HID_STRING_ID_IMANUFACTURER:
|
||||
len = (strlenW(ext->manufacturer) + 1) * sizeof(WCHAR);
|
||||
if (len > buffer_len) return STATUS_BUFFER_TOO_SMALL;
|
||||
else memcpy(buffer, ext->manufacturer, len);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp)
|
||||
{
|
||||
IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation(irp);
|
||||
|
@ -906,7 +927,9 @@ static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp)
|
|||
DWORD index = (ULONG_PTR)irpsp->Parameters.DeviceIoControl.Type3InputBuffer;
|
||||
TRACE("IOCTL_HID_GET_STRING[%08x]\n", index);
|
||||
|
||||
irp->IoStatus.Status = unix_device_get_string(device, index, (WCHAR *)irp->UserBuffer, buffer_len / sizeof(WCHAR));
|
||||
irp->IoStatus.Status = hid_get_device_string(device, index, (WCHAR *)irp->UserBuffer, buffer_len);
|
||||
if (irp->IoStatus.Status != STATUS_SUCCESS)
|
||||
irp->IoStatus.Status = unix_device_get_string(device, index, (WCHAR *)irp->UserBuffer, buffer_len / sizeof(WCHAR));
|
||||
if (irp->IoStatus.Status == STATUS_SUCCESS)
|
||||
irp->IoStatus.Information = (strlenW((WCHAR *)irp->UserBuffer) + 1) * sizeof(WCHAR);
|
||||
break;
|
||||
|
|
|
@ -119,6 +119,7 @@ static const struct device_desc mouse_device_desc =
|
|||
.busid = mouse_bus_id,
|
||||
.input = -1,
|
||||
.serial = {'0','0','0','0',0},
|
||||
.manufacturer = {"The Wine Project"},
|
||||
};
|
||||
static struct unix_device mouse_device = {.vtbl = &mouse_vtbl};
|
||||
|
||||
|
@ -212,6 +213,7 @@ static const struct device_desc keyboard_device_desc =
|
|||
.busid = keyboard_bus_id,
|
||||
.input = -1,
|
||||
.serial = {'0','0','0','0',0},
|
||||
.manufacturer = {"The Wine Project"},
|
||||
};
|
||||
static struct unix_device keyboard_device = {.vtbl = &keyboard_vtbl};
|
||||
|
||||
|
|
|
@ -42,6 +42,8 @@ struct device_desc
|
|||
DWORD uid;
|
||||
WCHAR serial[256];
|
||||
BOOL is_gamepad;
|
||||
|
||||
char manufacturer[MAX_PATH];
|
||||
};
|
||||
|
||||
struct sdl_bus_options
|
||||
|
|
Loading…
Reference in New Issue