Signed-off-by: Corentin Rossignon corossig@gmail.com --- dlls/dinput/joystick_linuxinput.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c index 86f12d0..3f9c241 100644 --- a/dlls/dinput/joystick_linuxinput.c +++ b/dlls/dinput/joystick_linuxinput.c @@ -96,6 +96,7 @@ struct JoyDev { char *device; char *name; GUID guid; + GUID guid_product;
BOOL has_ff; int num_effects; @@ -293,11 +294,32 @@ static void find_joydevs(void) }
if (ioctl(fd, EVIOCGID, &device_id) == -1) + { WARN("ioctl(EVIOCGID) failed: %d %s\n", errno, strerror(errno)); + joydev.guid_product = DInput_Wine_Joystick_Base_GUID; + } else { joydev.vendor_id = device_id.vendor; joydev.product_id = device_id.product; + + /* Construct the GUID in the same way of Windows doing this. + Data1 is concatenation of productid and vendorid. + Data2 and Data3 are NULL. + Data4 seems to be a constant. */ + joydev.guid_product.Data1 = (device_id.product << 16) + device_id.vendor; + + joydev.guid_product.Data2 = 0x0000; + joydev.guid_product.Data3 = 0x0000; + + joydev.guid_product.Data4[0] = 0x00; + joydev.guid_product.Data4[1] = 0x00; + joydev.guid_product.Data4[2] = 0x50; + joydev.guid_product.Data4[3] = 0x49; + joydev.guid_product.Data4[4] = 0x44; + joydev.guid_product.Data4[5] = 0x56; + joydev.guid_product.Data4[6] = 0x49; + joydev.guid_product.Data4[7] = 0x44; }
if (!have_joydevs) @@ -327,7 +349,7 @@ static void fill_joystick_dideviceinstanceA(LPDIDEVICEINSTANCEA lpddi, DWORD ver
lpddi->dwSize = dwSize; lpddi->guidInstance = joydevs[id].guid; - lpddi->guidProduct = DInput_Wine_Joystick_Base_GUID; + lpddi->guidProduct = joydevs[id].guid_product; lpddi->guidFFDriver = GUID_NULL;
if (version >= 0x0800) @@ -348,7 +370,7 @@ static void fill_joystick_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, DWORD ver
lpddi->dwSize = dwSize; lpddi->guidInstance = joydevs[id].guid; - lpddi->guidProduct = DInput_Wine_Joystick_Base_GUID; + lpddi->guidProduct = joydevs[id].guid_product; lpddi->guidFFDriver = GUID_NULL;
if (version >= 0x0800)
On Fri, Jul 22, 2016 at 3:31 AM, Corentin Rossignon corossig@gmail.com wrote:
Signed-off-by: Corentin Rossignon corossig@gmail.com
dlls/dinput/joystick_linuxinput.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
Hi, I just tested in Windows and indeed what you intend seems correct. The PID/VID matches with what Windows uses:
//Windows guidProduct : {68750603-0000-0000-0000-504944564944} --- Generic HID gamepad guidProduct : {0268054C-0000-0000-0000-504944564944} --- PS2 gamepad + usb adapter
//Wine guidProduct : {9E573ED9-7734-11D2-8D4A-23903FB6BDF7} guidProduct : {9E573ED9-7734-11D2-8D4A-23903FB6BDF7}
But this patch does not work for me, my joysticks are detected in joystick_linux.c not joystick_linuxinput.c. I believe the change is correct but I can't confirm it, a similar patch for joystick_linux.c would be needed.
diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c index 86f12d0..3f9c241 100644 --- a/dlls/dinput/joystick_linuxinput.c +++ b/dlls/dinput/joystick_linuxinput.c @@ -96,6 +96,7 @@ struct JoyDev { char *device; char *name; GUID guid;
GUID guid_product; BOOL has_ff; int num_effects;
@@ -293,11 +294,32 @@ static void find_joydevs(void) }
if (ioctl(fd, EVIOCGID, &device_id) == -1)
{ WARN("ioctl(EVIOCGID) failed: %d %s\n", errno, strerror(errno));
joydev.guid_product = DInput_Wine_Joystick_Base_GUID;
} else { joydev.vendor_id = device_id.vendor; joydev.product_id = device_id.product;
/* Construct the GUID in the same way of Windows doing this.
Data1 is concatenation of productid and vendorid.
Data2 and Data3 are NULL.
Data4 seems to be a constant. */
joydev.guid_product.Data1 = (device_id.product << 16) + device_id.vendor;
joydev.guid_product.Data2 = 0x0000;
joydev.guid_product.Data3 = 0x0000;
joydev.guid_product.Data4[0] = 0x00;
joydev.guid_product.Data4[1] = 0x00;
joydev.guid_product.Data4[2] = 0x50;
joydev.guid_product.Data4[3] = 0x49;
joydev.guid_product.Data4[4] = 0x44;
joydev.guid_product.Data4[5] = 0x56;
joydev.guid_product.Data4[6] = 0x49;
joydev.guid_product.Data4[7] = 0x44; }
I believe it is better to use a local escope static const char and memcpy instead of setting byte per byte. Or in global escope static const char near the definition of DInput_Wine_Joystick_Base_GUID (line 157).
Best regards, Bruno
You're right, I need to do the same for JS device. I submitted a set of two patches, the first one for getting device_id and product_id with JS device, the second one for using these ids to make the product GUID. I also put the constant part in a global GUID and I used MAKELONG for aggregating device_id and product_id.
Regards, Corentin.
On 07/23/2016 01:30 AM, Bruno Jesus wrote:
On Fri, Jul 22, 2016 at 3:31 AM, Corentin Rossignon corossig@gmail.com wrote:
Signed-off-by: Corentin Rossignon corossig@gmail.com
dlls/dinput/joystick_linuxinput.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
Hi, I just tested in Windows and indeed what you intend seems correct. The PID/VID matches with what Windows uses:
//Windows guidProduct : {68750603-0000-0000-0000-504944564944} --- Generic HID gamepad guidProduct : {0268054C-0000-0000-0000-504944564944} --- PS2 gamepad + usb adapter
//Wine guidProduct : {9E573ED9-7734-11D2-8D4A-23903FB6BDF7} guidProduct : {9E573ED9-7734-11D2-8D4A-23903FB6BDF7}
But this patch does not work for me, my joysticks are detected in joystick_linux.c not joystick_linuxinput.c. I believe the change is correct but I can't confirm it, a similar patch for joystick_linux.c would be needed.
diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c index 86f12d0..3f9c241 100644 --- a/dlls/dinput/joystick_linuxinput.c +++ b/dlls/dinput/joystick_linuxinput.c @@ -96,6 +96,7 @@ struct JoyDev { char *device; char *name; GUID guid;
GUID guid_product; BOOL has_ff; int num_effects;
@@ -293,11 +294,32 @@ static void find_joydevs(void) }
if (ioctl(fd, EVIOCGID, &device_id) == -1)
{ WARN("ioctl(EVIOCGID) failed: %d %s\n", errno, strerror(errno));
joydev.guid_product = DInput_Wine_Joystick_Base_GUID;
} else { joydev.vendor_id = device_id.vendor; joydev.product_id = device_id.product;
/* Construct the GUID in the same way of Windows doing this.
Data1 is concatenation of productid and vendorid.
Data2 and Data3 are NULL.
Data4 seems to be a constant. */
joydev.guid_product.Data1 = (device_id.product << 16) + device_id.vendor;
joydev.guid_product.Data2 = 0x0000;
joydev.guid_product.Data3 = 0x0000;
joydev.guid_product.Data4[0] = 0x00;
joydev.guid_product.Data4[1] = 0x00;
joydev.guid_product.Data4[2] = 0x50;
joydev.guid_product.Data4[3] = 0x49;
joydev.guid_product.Data4[4] = 0x44;
joydev.guid_product.Data4[5] = 0x56;
joydev.guid_product.Data4[6] = 0x49;
joydev.guid_product.Data4[7] = 0x44; }
I believe it is better to use a local escope static const char and memcpy instead of setting byte per byte. Or in global escope static const char near the definition of DInput_Wine_Joystick_Base_GUID (line 157).
Best regards, Bruno