Skip to content

Commit

Permalink
HID: sony: Use DS4 MAC address as unique identifier on USB
Browse files Browse the repository at this point in the history
The DS4 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>
  • Loading branch information
Roderick Colenbrander authored and Jiri Kosina committed Dec 19, 2016
1 parent 2b6579d commit c70d5f7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/hid/hid-sony.c
Original file line number Diff line number Diff line change
Expand Up @@ -2390,6 +2390,12 @@ static int sony_check_add(struct sony_sc *sc)
}

memcpy(sc->mac_address, &buf[1], sizeof(sc->mac_address));

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 if ((sc->quirks & SIXAXIS_CONTROLLER_USB) ||
(sc->quirks & NAVIGATION_CONTROLLER_USB)) {
buf = kmalloc(SIXAXIS_REPORT_0xF2_SIZE, GFP_KERNEL);
Expand Down

0 comments on commit c70d5f7

Please sign in to comment.