summaryrefslogtreecommitdiff
path: root/profiles/input
diff options
context:
space:
mode:
authorSzymon Janc <szymon.janc@codecoup.pl>2021-02-11 16:39:13 +0100
committerSzymon Janc <szymon.janc@codecoup.pl>2021-02-22 09:22:59 +0100
commit61745d2bb8b5f534278db49faf8e2cdb7e894529 (patch)
treec5d77b7c3301864c66d27917bbcdb787a362b57e /profiles/input
parentdc7a726aa71b21fa1b279bd635df367c8fb716ce (diff)
downloadbluez-61745d2bb8b5f534278db49faf8e2cdb7e894529.tar.gz
sixaxis: Fix Bluetooth PS3 clone joypad being named like the original
When cable pairing a PS3 clone device, we should try and keep the USB device name to create a new btd_device so that the joypad is named after its USB name when connecting through Bluetooth. If that isn't done, "Shanwan" clone joypads are named like the genuine joypads, and kernel Bluetooth quirks aren't applied. gh-issue: https://github.com/bluez/bluez/issues/46
Diffstat (limited to 'profiles/input')
-rw-r--r--profiles/input/server.c2
-rw-r--r--profiles/input/sixaxis.h13
2 files changed, 13 insertions, 2 deletions
diff --git a/profiles/input/server.c b/profiles/input/server.c
index d8b413744..79cf08a66 100644
--- a/profiles/input/server.c
+++ b/profiles/input/server.c
@@ -120,7 +120,7 @@ static bool dev_is_sixaxis(const bdaddr_t *src, const bdaddr_t *dst)
vid = btd_device_get_vendor(device);
pid = btd_device_get_product(device);
- cp = get_pairing(vid, pid);
+ cp = get_pairing(vid, pid, NULL);
if (cp && (cp->type == CABLE_PAIRING_SIXAXIS ||
cp->type == CABLE_PAIRING_DS4))
return true;
diff --git a/profiles/input/sixaxis.h b/profiles/input/sixaxis.h
index a3cda70e4..ab8831995 100644
--- a/profiles/input/sixaxis.h
+++ b/profiles/input/sixaxis.h
@@ -29,7 +29,7 @@ struct cable_pairing {
};
static inline const struct cable_pairing *
-get_pairing(uint16_t vid, uint16_t pid)
+get_pairing(uint16_t vid, uint16_t pid, const char *name)
{
static const struct cable_pairing devices[] = {
{
@@ -41,6 +41,14 @@ get_pairing(uint16_t vid, uint16_t pid)
.type = CABLE_PAIRING_SIXAXIS,
},
{
+ .name = "SHANWAN PS3 GamePad",
+ .source = 0x0002,
+ .vid = 0x054c,
+ .pid = 0x0268,
+ .version = 0x0000,
+ .type = CABLE_PAIRING_SIXAXIS,
+ },
+ {
.name = "Navigation Controller",
.source = 0x0002,
.vid = 0x054c,
@@ -73,6 +81,9 @@ get_pairing(uint16_t vid, uint16_t pid)
if (devices[i].pid != pid)
continue;
+ if (name && strcmp(name, devices[i].name))
+ continue;
+
return &devices[i];
}