HID: sony: Use DS3 MAC address as unique identifier on USB
authorRoderick Colenbrander <roderick.colenbrander@sony.com>
Fri, 24 Mar 2017 22:17:45 +0000 (15:17 -0700)
committerJiri Kosina <jkosina@suse.cz>
Thu, 6 Apr 2017 12:41:16 +0000 (14:41 +0200)
The DS3 MAC address is reported as a unique identified when
using Bluetooth. For USB there is no unique identifier reported
yet, so use the MAC address.

Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-sony.c

index 5eb5ac922c09087c26f9efb4ed33dffe5afdce0c..38674f51be8e1bdd61c4dd601ad319c63ebe1f87 100644 (file)
@@ -2400,6 +2400,12 @@ static int sony_check_add(struct sony_sc *sc)
                 */
                for (n = 0; n < 6; n++)
                        sc->mac_address[5-n] = buf[4+n];
+
+               snprintf(sc->hdev->uniq, sizeof(sc->hdev->uniq),
+                       "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
+                       sc->mac_address[5], sc->mac_address[4],
+                       sc->mac_address[3], sc->mac_address[2],
+                       sc->mac_address[1], sc->mac_address[0]);
        } else {
                return 0;
        }