All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] sixaxis: Improved support for DualShock 3 clones
@ 2015-06-15 18:28 Szymon Janc
  2015-06-15 18:28 ` [PATCH 1/5] sixaxis: Fix PID for Navigation Controller Szymon Janc
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Szymon Janc @ 2015-06-15 18:28 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Veseli Veseljko, Alex Gal, Laurence Brown, Szymon Janc

Hi,

This is improved version of sixaxis patches. Comparing to RFCv2 this
doesn't regress with Navigation Controller and DS4.

Sixaxis specific code needs to be left in input code for DS4 support.

If people report that this works for them I'll push those patches.


>From RFCv2 cover letter:
Some DualShock3 clones (eg ShanWan) were reported to not provide valid SDP
record required by HID profile. Due to this those failed to work with
current BlueZ sixaxis code (ie no input device were created).

This small serie is an attempt to extend DS3 support also with those
misbehaving clones. Idea is that we can provide fixed SDP recrod for devices
that use valid PID/VID and skip SDP search.

In this version SDP is kept in sixaxis plugin and provided via
btd_device_set_record instead of SDP search. Nice addition is that
sixaxis specific code is no longer needed in input server.

This makes code similar to how original Fedora sixaxis plugin worked
as suggested in previous review round.

I tested this with genuine DS3 and it seems to work OK. Testing with
clones is stil required though.


Szymon Janc (5):
  sixaxis: Fix PID for Navigation Controller
  core/device: Add support for setting SDP record
  sixaxis: Provide DualShock 3 SDP record while adding new device
  profiles/input: Remove not needed sixaxis checks
  sixaxis: Fix multi-line comments style

 Makefile.plugins        |   1 +
 plugins/sixaxis.c       | 195 ++++++++++++++++++++++++++++++++++++++++++++++--
 profiles/input/server.c |   8 --
 src/device.c            |  31 ++++++++
 src/device.h            |   3 +
 5 files changed, 224 insertions(+), 14 deletions(-)

-- 
2.1.4


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/5] sixaxis: Fix PID for Navigation Controller
  2015-06-15 18:28 [PATCH 0/5] sixaxis: Improved support for DualShock 3 clones Szymon Janc
@ 2015-06-15 18:28 ` Szymon Janc
  2015-06-15 18:45   ` simon
  2015-06-15 18:28 ` [PATCH 2/5] core/device: Add support for setting SDP record Szymon Janc
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 12+ messages in thread
From: Szymon Janc @ 2015-06-15 18:28 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Veseli Veseljko, Alex Gal, Laurence Brown, Szymon Janc

Navigation Controller is using PID 0x042f over USB but PID 0x0268
(same as Dualshock 3) over BT.
---
 plugins/sixaxis.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c
index fcc93bc..50db6c1 100644
--- a/plugins/sixaxis.c
+++ b/plugins/sixaxis.c
@@ -54,6 +54,7 @@ static const struct {
 	uint16_t vid;
 	uint16_t pid;
 	uint16_t version;
+	uint16_t bt_pid;
 } devices[] = {
 	{
 		.name = "PLAYSTATION(R)3 Controller",
@@ -68,6 +69,7 @@ static const struct {
 		.vid = 0x054c,
 		.pid = 0x042f,
 		.version = 0x0000,
+		.bt_pid = 0x0268,
 	},
 };
 
@@ -300,8 +302,19 @@ static bool setup_device(int fd, int index, struct btd_adapter *adapter)
 	info("sixaxis: setting up new device");
 
 	btd_device_device_set_name(device, devices[index].name);
-	btd_device_set_pnpid(device, devices[index].source, devices[index].vid,
-				devices[index].pid, devices[index].version);
+
+	/* if device reports different pid/vid on BT prefer those over USB */
+	if (devices[index].bt_pid)
+		btd_device_set_pnpid(device, devices[index].source,
+					devices[index].vid,
+					devices[index].bt_pid,
+					devices[index].version);
+	else
+		btd_device_set_pnpid(device, devices[index].source,
+					devices[index].vid,
+					devices[index].pid,
+					devices[index].version);
+
 	btd_device_set_temporary(device, false);
 
 	return true;
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/5] core/device: Add support for setting SDP record
  2015-06-15 18:28 [PATCH 0/5] sixaxis: Improved support for DualShock 3 clones Szymon Janc
  2015-06-15 18:28 ` [PATCH 1/5] sixaxis: Fix PID for Navigation Controller Szymon Janc
@ 2015-06-15 18:28 ` Szymon Janc
  2015-06-15 18:28 ` [PATCH 3/5] sixaxis: Provide DualShock 3 SDP record while adding new device Szymon Janc
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Szymon Janc @ 2015-06-15 18:28 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Veseli Veseljko, Alex Gal, Laurence Brown, Szymon Janc

This allows to set SDP record for device without resolving services
over SDP. After SDP is provided profiles are probed.
---
 src/device.c | 31 +++++++++++++++++++++++++++++++
 src/device.h |  3 +++
 2 files changed, 34 insertions(+)

diff --git a/src/device.c b/src/device.c
index 3ef0340..859aa3c 100644
--- a/src/device.c
+++ b/src/device.c
@@ -5542,6 +5542,37 @@ static sdp_list_t *read_device_records(struct btd_device *device)
 	return recs;
 }
 
+void btd_device_set_record(struct btd_device *device, const char *uuid,
+							sdp_record_t *rec)
+{
+	/* This API is only used for BR/EDR */
+	struct bearer_state *state = &device->bredr_state;
+	struct browse_req *req;
+	sdp_list_t *recs = NULL;
+
+	if (!rec)
+		return;
+
+	req = browse_request_new(device, NULL);
+	if (!req)
+		return;
+
+	recs = sdp_list_append(recs, rec);
+	update_bredr_services(req, recs);
+	sdp_list_free(recs, NULL);
+
+	device->svc_refreshed = true;
+	state->svc_resolved = true;
+
+	device_probe_profiles(device, req->profiles_added);
+
+	/* Propagate services changes */
+	g_dbus_emit_property_changed(dbus_conn, req->device->path,
+						DEVICE_INTERFACE, "UUIDs");
+
+	device_svc_resolved(device, device->bdaddr_type, 0);
+}
+
 const sdp_record_t *btd_device_get_record(struct btd_device *device,
 							const char *uuid)
 {
diff --git a/src/device.h b/src/device.h
index 1955f54..aee677a 100644
--- a/src/device.h
+++ b/src/device.h
@@ -62,6 +62,9 @@ struct device_addr_type {
 int device_addr_type_cmp(gconstpointer a, gconstpointer b);
 GSList *btd_device_get_uuids(struct btd_device *device);
 void device_probe_profiles(struct btd_device *device, GSList *profiles);
+
+void btd_device_set_record(struct btd_device *device, const char *uuid,
+							sdp_record_t *rec);
 const sdp_record_t *btd_device_get_record(struct btd_device *device,
 						const char *uuid);
 struct gatt_primary *btd_device_get_primary(struct btd_device *device,
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/5] sixaxis: Provide DualShock 3 SDP record while adding new device
  2015-06-15 18:28 [PATCH 0/5] sixaxis: Improved support for DualShock 3 clones Szymon Janc
  2015-06-15 18:28 ` [PATCH 1/5] sixaxis: Fix PID for Navigation Controller Szymon Janc
  2015-06-15 18:28 ` [PATCH 2/5] core/device: Add support for setting SDP record Szymon Janc
@ 2015-06-15 18:28 ` Szymon Janc
  2015-06-15 18:28 ` [PATCH 4/5] profiles/input: Remove not needed sixaxis checks Szymon Janc
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Szymon Janc @ 2015-06-15 18:28 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Veseli Veseljko, Alex Gal, Laurence Brown, Szymon Janc

This allows to skip SDP search for DualShock 3 devices. Since some
DS3 clones were reported to not provide any SDP record this should
allow to operate them.
---
 Makefile.plugins  |   1 +
 plugins/sixaxis.c | 166 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 167 insertions(+)

diff --git a/Makefile.plugins b/Makefile.plugins
index cae43d9..2c2385d 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
@@ -118,4 +118,5 @@ plugins_sixaxis_la_SOURCES = plugins/sixaxis.c
 plugins_sixaxis_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \
 						-no-undefined @UDEV_LIBS@
 plugins_sixaxis_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden @UDEV_CFLAGS@
+plugins_sixaxis_la_LIBADD = lib/libbluetooth-internal.la
 endif
diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c
index 50db6c1..782a89f 100644
--- a/plugins/sixaxis.c
+++ b/plugins/sixaxis.c
@@ -40,6 +40,7 @@
 
 #include "lib/bluetooth.h"
 #include "lib/sdp.h"
+#include "lib/sdp_lib.h"
 #include "lib/uuid.h"
 
 #include "src/adapter.h"
@@ -257,6 +258,170 @@ out:
 	return FALSE;
 }
 
+static sdp_record_t *get_sdp_record(void)
+{
+	sdp_record_t *record;
+	uint16_t hid_release, hid_parser, version, timeout;
+	uint8_t sdp_disable, battery, remote_wakeup, norm_connect, boot_device;
+	uint8_t subclass, country, virtual_cable, reconnect;
+	sdp_list_t *svclass_id, *pfseq, *apseq, *root;
+	uuid_t root_uuid, hidkb_uuid, l2cap_uuid, hidp_uuid;
+	sdp_profile_desc_t profile;
+	sdp_list_t *aproto, *proto[3];
+	sdp_data_t *psm, *lang_lst, *lang_lst2, *hid_spec_lst, *hid_spec_lst2;
+	uint8_t dtd = SDP_UINT16;
+	uint8_t dtd2 = SDP_UINT8;
+	uint8_t dtd_data = SDP_TEXT_STR8;
+	void *dtds[2];
+	void *values[2];
+	void *dtds2[2];
+	void *values2[2];
+	int leng[2];
+	uint8_t hid_spec_type = 0x22;
+	uint16_t hid_attr_lang[] = { 0x409, 0x100 };
+	static const uint16_t ctrl = 0x11;
+	static const uint16_t intr = 0x13;
+	uint8_t hid_spec[] = {
+		0x05, 0x01, 0x09, 0x04, 0xa1, 0x01, 0xa1, 0x02, 0x85, 0x01,
+		0x75, 0x08, 0x95, 0x01, 0x15, 0x00, 0x26, 0xff, 0x00, 0x81,
+		0x03, 0x75, 0x01, 0x95, 0x13, 0x15, 0x00, 0x25, 0x01, 0x35,
+		0x00, 0x45, 0x01, 0x05, 0x09, 0x19, 0x01, 0x29, 0x13, 0x81,
+		0x02, 0x75, 0x01, 0x95, 0x0d, 0x06, 0x00, 0xff, 0x81, 0x03,
+		0x15, 0x00, 0x26, 0xff, 0x00, 0x05, 0x01, 0x09, 0x01, 0xa1,
+		0x00, 0x75, 0x08, 0x95, 0x04, 0x35, 0x00, 0x46, 0xff, 0x00,
+		0x09, 0x30, 0x09, 0x31, 0x09, 0x32, 0x09, 0x35, 0x81, 0x02,
+		0xc0, 0x05, 0x01, 0x75, 0x08, 0x95, 0x27, 0x09, 0x01, 0x81,
+		0x02, 0x75, 0x08, 0x95, 0x30, 0x09, 0x01, 0x91, 0x02, 0x75,
+		0x08, 0x95, 0x30, 0x09, 0x01, 0xb1, 0x02, 0xc0, 0xa1, 0x02,
+		0x85, 0x02, 0x75, 0x08, 0x95, 0x30, 0x09, 0x01, 0xb1, 0x02,
+		0xc0, 0xa1, 0x02, 0x85, 0xee, 0x75, 0x08, 0x95, 0x30, 0x09,
+		0x01, 0xb1, 0x02, 0xc0, 0xa1, 0x02, 0x85, 0xef, 0x75, 0x08,
+		0x95, 0x30, 0x09, 0x01, 0xb1, 0x02, 0xc0, 0xc0, 0x00
+	};
+
+	record = sdp_record_alloc();
+	if (!record)
+		return NULL;
+
+	sdp_uuid16_create(&root_uuid, PUBLIC_BROWSE_GROUP);
+	root = sdp_list_append(0, &root_uuid);
+	sdp_set_browse_groups(record, root);
+
+	sdp_add_lang_attr(record);
+
+	sdp_uuid16_create(&hidkb_uuid, HID_SVCLASS_ID);
+	svclass_id = sdp_list_append(0, &hidkb_uuid);
+	sdp_set_service_classes(record, svclass_id);
+
+	sdp_uuid16_create(&profile.uuid, HID_PROFILE_ID);
+	profile.version = 0x0100;
+	pfseq = sdp_list_append(0, &profile);
+	sdp_set_profile_descs(record, pfseq);
+
+	/* protocols */
+	sdp_uuid16_create(&l2cap_uuid, L2CAP_UUID);
+	proto[1] = sdp_list_append(0, &l2cap_uuid);
+	psm = sdp_data_alloc(SDP_UINT16, &ctrl);
+	proto[1] = sdp_list_append(proto[1], psm);
+	apseq = sdp_list_append(0, proto[1]);
+
+	sdp_uuid16_create(&hidp_uuid, HIDP_UUID);
+	proto[2] = sdp_list_append(0, &hidp_uuid);
+	apseq = sdp_list_append(apseq, proto[2]);
+
+	aproto = sdp_list_append(0, apseq);
+	sdp_set_access_protos(record, aproto);
+
+	/* additional protocols */
+	proto[1] = sdp_list_append(0, &l2cap_uuid);
+	psm = sdp_data_alloc(SDP_UINT16, &intr);
+	proto[1] = sdp_list_append(proto[1], psm);
+	apseq = sdp_list_append(0, proto[1]);
+
+	sdp_uuid16_create(&hidp_uuid, HIDP_UUID);
+	proto[2] = sdp_list_append(0, &hidp_uuid);
+	apseq = sdp_list_append(apseq, proto[2]);
+
+	aproto = sdp_list_append(0, apseq);
+	sdp_set_add_access_protos(record, aproto);
+
+	sdp_set_info_attr(record, "Wireless Controller",
+						"Sony Computer Entertainment",
+						"Wireless Controller");
+
+	hid_release = 0x0100;
+	sdp_attr_add_new(record, SDP_ATTR_HID_DEVICE_RELEASE_NUMBER, SDP_UINT16,
+								&hid_release);
+
+	hid_parser = 0x0100;
+	sdp_attr_add_new(record, SDP_ATTR_HID_PARSER_VERSION, SDP_UINT16,
+								&hid_parser);
+
+	subclass = 0x00;
+	sdp_attr_add_new(record, SDP_ATTR_HID_DEVICE_SUBCLASS, SDP_UINT8,
+								&subclass);
+
+	country = 0x21;
+	sdp_attr_add_new(record, SDP_ATTR_HID_COUNTRY_CODE, SDP_UINT8,
+								&country);
+
+	virtual_cable = 0x01;
+	sdp_attr_add_new(record, SDP_ATTR_HID_VIRTUAL_CABLE, SDP_BOOL,
+								&virtual_cable);
+
+	reconnect = 0x01;
+	sdp_attr_add_new(record, SDP_ATTR_HID_RECONNECT_INITIATE, SDP_BOOL,
+								&reconnect);
+
+	dtds[0] = &dtd2;
+	values[0] = &hid_spec_type;
+	dtds[1] = &dtd_data;
+	values[1] = hid_spec;
+	leng[0] = 0;
+	leng[1] = sizeof(hid_spec);
+	hid_spec_lst = sdp_seq_alloc_with_length(dtds, values, leng, 2);
+	hid_spec_lst2 = sdp_data_alloc(SDP_SEQ8, hid_spec_lst);
+	sdp_attr_add(record, SDP_ATTR_HID_DESCRIPTOR_LIST, hid_spec_lst2);
+
+	dtds2[0] = &dtd;
+	values2[0] = &hid_attr_lang[0];
+	dtds2[1] = &dtd;
+	values2[1] = &hid_attr_lang[1];
+	lang_lst = sdp_seq_alloc(dtds2, values2, sizeof(hid_attr_lang) / 2);
+	lang_lst2 = sdp_data_alloc(SDP_SEQ8, lang_lst);
+	sdp_attr_add(record, SDP_ATTR_HID_LANG_ID_BASE_LIST, lang_lst2);
+
+	sdp_disable = 0x00;
+	sdp_attr_add_new(record, SDP_ATTR_HID_SDP_DISABLE, SDP_BOOL,
+								&sdp_disable);
+
+	battery = 0x01;
+	sdp_attr_add_new(record, SDP_ATTR_HID_BATTERY_POWER, SDP_BOOL,
+								&battery);
+
+	remote_wakeup = 0x01;
+	sdp_attr_add_new(record, SDP_ATTR_HID_REMOTE_WAKEUP, SDP_BOOL,
+								&remote_wakeup);
+
+	version = 0x0100;
+	sdp_attr_add_new(record, SDP_ATTR_HID_PROFILE_VERSION, SDP_UINT16,
+								&version);
+
+	timeout = 0x3e80;
+	sdp_attr_add_new(record, SDP_ATTR_HID_SUPERVISION_TIMEOUT, SDP_UINT16,
+								&timeout);
+
+	norm_connect = 0x00;
+	sdp_attr_add_new(record, SDP_ATTR_HID_NORMALLY_CONNECTABLE, SDP_BOOL,
+								&norm_connect);
+
+	boot_device = 0x00;
+	sdp_attr_add_new(record, SDP_ATTR_HID_BOOT_DEVICE, SDP_BOOL,
+								&boot_device);
+
+	return record;
+}
+
 static bool setup_device(int fd, int index, struct btd_adapter *adapter)
 {
 	char device_addr[18], master_addr[18], adapter_addr[18];
@@ -316,6 +481,7 @@ static bool setup_device(int fd, int index, struct btd_adapter *adapter)
 					devices[index].version);
 
 	btd_device_set_temporary(device, false);
+	btd_device_set_record(device, HID_UUID, get_sdp_record());
 
 	return true;
 }
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 4/5] profiles/input: Remove not needed sixaxis checks
  2015-06-15 18:28 [PATCH 0/5] sixaxis: Improved support for DualShock 3 clones Szymon Janc
                   ` (2 preceding siblings ...)
  2015-06-15 18:28 ` [PATCH 3/5] sixaxis: Provide DualShock 3 SDP record while adding new device Szymon Janc
@ 2015-06-15 18:28 ` Szymon Janc
  2015-06-15 18:28 ` [PATCH 5/5] sixaxis: Fix multi-line comments style Szymon Janc
  2015-06-21  6:25 ` [PATCH 0/5] sixaxis: Improved support for DualShock 3 clones Laurence Brown
  5 siblings, 0 replies; 12+ messages in thread
From: Szymon Janc @ 2015-06-15 18:28 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Veseli Veseljko, Alex Gal, Laurence Brown, Szymon Janc

This check is now needed only for DualShock 4.
---
 profiles/input/server.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/profiles/input/server.c b/profiles/input/server.c
index eb3fcf8..101108b 100644
--- a/profiles/input/server.c
+++ b/profiles/input/server.c
@@ -131,18 +131,10 @@ 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);
 
-	/* DualShock 3 */
-	if (vid == 0x054c && pid == 0x0268)
-		return true;
-
 	/* DualShock 4 */
 	if (vid == 0x054c && pid == 0x05c4)
 		return true;
 
-	/* Navigation Controller */
-	if (vid == 0x054c && pid == 0x042f)
-		return true;
-
 	return false;
 }
 
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 5/5] sixaxis: Fix multi-line comments style
  2015-06-15 18:28 [PATCH 0/5] sixaxis: Improved support for DualShock 3 clones Szymon Janc
                   ` (3 preceding siblings ...)
  2015-06-15 18:28 ` [PATCH 4/5] profiles/input: Remove not needed sixaxis checks Szymon Janc
@ 2015-06-15 18:28 ` Szymon Janc
  2015-06-21  6:25 ` [PATCH 0/5] sixaxis: Improved support for DualShock 3 clones Laurence Brown
  5 siblings, 0 replies; 12+ messages in thread
From: Szymon Janc @ 2015-06-15 18:28 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Veseli Veseljko, Alex Gal, Laurence Brown, Szymon Janc

---
 plugins/sixaxis.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c
index 782a89f..9b6cad4 100644
--- a/plugins/sixaxis.c
+++ b/plugins/sixaxis.c
@@ -435,9 +435,11 @@ static bool setup_device(int fd, int index, struct btd_adapter *adapter)
 	if (get_master_bdaddr(fd, &master_bdaddr) < 0)
 		return false;
 
-	/* This can happen if controller was plugged while already connected
+	/*
+	 * This can happen if controller was plugged while already connected
 	 * eg. to charge up battery.
-	 * Don't set LEDs in that case, hence return false */
+	 * Don't set LEDs in that case, hence return false
+	 */
 	device = btd_adapter_find_device(adapter, &device_bdaddr,
 							BDADDR_BREDR);
 	if (device && btd_device_is_connected(device))
@@ -533,8 +535,10 @@ static int get_js_number(struct udev_device *udevice)
 		if (!input_parent)
 			goto next;
 
-		/* check if this is the joystick relative to the hidraw device
-		 * above */
+		/*
+		 * check if this is the joystick relative to the hidraw device
+		 * above
+		 */
 		input_id = udev_device_get_sysattr_value(input_parent, "uniq");
 
 		/*
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/5] sixaxis: Fix PID for Navigation Controller
  2015-06-15 18:28 ` [PATCH 1/5] sixaxis: Fix PID for Navigation Controller Szymon Janc
@ 2015-06-15 18:45   ` simon
  2015-06-15 19:47     ` Szymon Janc
  0 siblings, 1 reply; 12+ messages in thread
From: simon @ 2015-06-15 18:45 UTC (permalink / raw)
  To: Szymon Janc
  Cc: linux-bluetooth, Veseli Veseljko, Alex Gal, Laurence Brown, Szymon Janc

> Navigation Controller is using PID 0x042f over USB but PID 0x0268
> (same as Dualshock 3) over BT.

Hi,
I'm in the process of fixing the hid-sony driver to support the
Navigation, and I'm seeing that it connects with 0x042f over BT. I did see
at least once when it used the 0x0268, so it must be switching into an
emulation mode at some times.

I don't have a good way on initiating the pairing, instead used a
hacked-up 'psmovepair' from PSMoveAPI guys. Followed by some hand editing
of '/var/lib/bluetooth/<my-mac>/*' files.

Happy to share files/info with you,
Simon.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/5] sixaxis: Fix PID for Navigation Controller
  2015-06-15 18:45   ` simon
@ 2015-06-15 19:47     ` Szymon Janc
  2015-06-15 20:02       ` Szymon Janc
                         ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Szymon Janc @ 2015-06-15 19:47 UTC (permalink / raw)
  To: simon; +Cc: linux-bluetooth, Veseli Veseljko, Alex Gal, Laurence Brown

Hi Simon,

On Monday 15 June 2015 14:45:39 simon@mungewell.org wrote:
> > Navigation Controller is using PID 0x042f over USB but PID 0x0268
> > (same as Dualshock 3) over BT.
> 
> Hi,
> I'm in the process of fixing the hid-sony driver to support the
> Navigation, and I'm seeing that it connects with 0x042f over BT. I did see
> at least once when it used the 0x0268, so it must be switching into an
> emulation mode at some times.

I did some more testing and you are right, it seems to be connecting using 
both PIDs, but I couldn't figure out a pattern.
 
> I don't have a good way on initiating the pairing, instead used a
> hacked-up 'psmovepair' from PSMoveAPI guys. Followed by some hand editing
> of '/var/lib/bluetooth/<my-mac>/*' files.

Sixaxis plugin should work for setting up Navigation. 

> 
> Happy to share files/info with you,

So, I'm not sure how to handle this. At least for me it looks like Navigation 
works just fine if setup as 0x0268 even if connects as 0x042f. The opposite 
doesn't work.

Any thoughts?

-- 
Szymon K. Janc
szymon.janc@gmail.com

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/5] sixaxis: Fix PID for Navigation Controller
  2015-06-15 19:47     ` Szymon Janc
@ 2015-06-15 20:02       ` Szymon Janc
  2015-06-15 20:36       ` simon
  2015-06-17  3:30       ` simon
  2 siblings, 0 replies; 12+ messages in thread
From: Szymon Janc @ 2015-06-15 20:02 UTC (permalink / raw)
  To: simon; +Cc: linux-bluetooth, Veseli Veseljko, Alex Gal, Laurence Brown

Hi,

On Monday 15 June 2015 21:47:24 Szymon Janc wrote:
> Hi Simon,
> 
> On Monday 15 June 2015 14:45:39 simon@mungewell.org wrote:
> > > Navigation Controller is using PID 0x042f over USB but PID 0x0268
> > > (same as Dualshock 3) over BT.
> > 
> > Hi,
> > I'm in the process of fixing the hid-sony driver to support the
> > Navigation, and I'm seeing that it connects with 0x042f over BT. I did see
> > at least once when it used the 0x0268, so it must be switching into an
> > emulation mode at some times.
> 
> I did some more testing and you are right, it seems to be connecting using
> both PIDs, but I couldn't figure out a pattern.
> 
> > I don't have a good way on initiating the pairing, instead used a
> > hacked-up 'psmovepair' from PSMoveAPI guys. Followed by some hand editing
> > of '/var/lib/bluetooth/<my-mac>/*' files.
> 
> Sixaxis plugin should work for setting up Navigation.
> 
> > Happy to share files/info with you,
> 
> So, I'm not sure how to handle this. At least for me it looks like
> Navigation works just fine if setup as 0x0268 even if connects as 0x042f.
> The opposite doesn't work.
> 
> Any thoughts?

OK, so we could left this as is now and allow to query SDP for Navigation 
regardless of PID used over BT. This way it will always provide updated PNP 
info to a driver. And SDP record would be provided only for devices 
identifying as DS3 over USB.

That way Navigation should work in same way it is working now and DS3 clones 
without SDP would also work.

-- 
Szymon K. Janc
szymon.janc@gmail.com

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/5] sixaxis: Fix PID for Navigation Controller
  2015-06-15 19:47     ` Szymon Janc
  2015-06-15 20:02       ` Szymon Janc
@ 2015-06-15 20:36       ` simon
  2015-06-17  3:30       ` simon
  2 siblings, 0 replies; 12+ messages in thread
From: simon @ 2015-06-15 20:36 UTC (permalink / raw)
  To: Szymon Janc
  Cc: simon, linux-bluetooth, Veseli Veseljko, Alex Gal, Laurence Brown


>> I don't have a good way on initiating the pairing, instead used a
>> hacked-up 'psmovepair' from PSMoveAPI guys. Followed by some hand
>> editing
>> of '/var/lib/bluetooth/<my-mac>/*' files.
>
> Sixaxis plugin should work for setting up Navigation.

You make the assumption that I'm on a recent version of Bluez ;-), which
perhaps I should be... being on Xubuntu means that by default I'm at 4.101
- with the occasional dip to something newer (breaks package manager
horribly).

I'll give a recent Bluez a go during the week.

> So, I'm not sure how to handle this. At least for me it looks like
> Navigation
> works just fine if setup as 0x0268 even if connects as 0x042f. The
> opposite
> doesn't work.
>
> Any thoughts?

There's not really much difference in behaviour. For me the advantage of
having 0x042f is that I can identify correctly and only enable 1-LED and
no rumble. I also patch the HID descriptor so that unused/randomly
changing Axis are masked.

Simon


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/5] sixaxis: Fix PID for Navigation Controller
  2015-06-15 19:47     ` Szymon Janc
  2015-06-15 20:02       ` Szymon Janc
  2015-06-15 20:36       ` simon
@ 2015-06-17  3:30       ` simon
  2 siblings, 0 replies; 12+ messages in thread
From: simon @ 2015-06-17  3:30 UTC (permalink / raw)
  To: Szymon Janc
  Cc: simon, linux-bluetooth, Veseli Veseljko, Alex Gal, Laurence Brown


>> I don't have a good way on initiating the pairing, instead used a
>> hacked-up 'psmovepair' from PSMoveAPI guys. Followed by some hand
>> editing
>> of '/var/lib/bluetooth/<my-mac>/*' files.
>
> Sixaxis plugin should work for setting up Navigation.

Hi,
I tried with current Bluez git and can get a connection established, but
as you noted before it's connecting with PID 0x0268 (Sixaxis), rather than
it's native 0x042f.

Controller was told about PC with hacked version of sixpair (just changed
PID at start) whilst connected with USB.

--
[bluetooth]# agent on
Agent registered
[bluetooth]# default-agent
Default agent request successful
[NEW] Device 00:26:43:C9:C7:49 Navigation Controller
[CHG] Device 00:26:43:C9:C7:49 Class: 0x000508
[CHG] Device 00:26:43:C9:C7:49 Icon: input-gaming
[CHG] Device 00:26:43:C9:C7:49 Connected: yes
[CHG] Device 00:26:43:C9:C7:49 Modalias: usb:v054Cp0268d0100 <----- note
here!!!
[CHG] Device 00:26:43:C9:C7:49 UUIDs: 00001124-0000-1000-8000-00805f9b34fb
[CHG] Device 00:26:43:C9:C7:49 UUIDs: 00001200-0000-1000-8000-00805f9b34fb
[CHG] Device 00:26:43:C9:C7:49 Connected: no
[CHG] Device 00:26:43:C9:C7:49 Connected: yes
[CHG] Device 00:26:43:C9:C7:49 Connected: no
[CHG] Device 00:26:43:C9:C7:49 Connected: yes
[CHG] Device 00:26:43:C9:C7:49 Connected: no
[CHG] Device 00:26:43:C9:C7:49 Connected: yes
[CHG] Device 00:26:43:C9:C7:49 Connected: no
[CHG] Device 00:26:43:C9:C7:49 Connected: yes
[CHG] Device 00:26:43:C9:C7:49 Connected: no
[CHG] Device 00:26:43:C9:C7:49 Connected: yes
[CHG] Device 00:26:43:C9:C7:49 Connected: no
[CHG] Device 00:26:43:C9:C7:49 Connected: yes
[CHG] Device 00:26:43:C9:C7:49 Connected: no
[CHG] Device 00:26:43:C9:C7:49 Connected: yes
[CHG] Device 00:26:43:C9:C7:49 Connected: no
[CHG] Device 00:26:43:C9:C7:49 Connected: yes
[CHG] Device 00:26:43:C9:C7:49 Connected: no
[bluetooth]# trust 00:26:43:C9:C7:49
[CHG] Device 00:26:43:C9:C7:49 Trusted: yes
Changing 00:26:43:C9:C7:49 trust succeeded
[CHG] Device 00:26:43:C9:C7:49 Connected: yes
--
[bluetooth]# devices
Device 00:26:43:C9:C7:49 Navigation Controller
[bluetooth]# info 00:26:43:C9:C7:49
Device 00:26:43:C9:C7:49
	Name: Navigation Controller
	Alias: Navigation Controller
	Class: 0x000508
	Icon: input-gaming
	Paired: no
	Trusted: yes
	Blocked: no
	Connected: no
	LegacyPairing: no
	UUID: Human Interface Device... (00001124-0000-1000-8000-00805f9b34fb)
	UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
	Modalias: usb:v054Cp0268d0100
--

Is there something I have to do to change this behaviour?
Simon.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/5] sixaxis: Improved support for DualShock 3 clones
  2015-06-15 18:28 [PATCH 0/5] sixaxis: Improved support for DualShock 3 clones Szymon Janc
                   ` (4 preceding siblings ...)
  2015-06-15 18:28 ` [PATCH 5/5] sixaxis: Fix multi-line comments style Szymon Janc
@ 2015-06-21  6:25 ` Laurence Brown
  5 siblings, 0 replies; 12+ messages in thread
From: Laurence Brown @ 2015-06-21  6:25 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth, Veseli Veseljko, Alex Gal, Laurence Brown

I have tested this patch with ShanWan controller, seems to be working perfectly

On 15 June 2015 at 19:28, Szymon Janc <szymon.janc@gmail.com> wrote:
> Hi,
>
> This is improved version of sixaxis patches. Comparing to RFCv2 this
> doesn't regress with Navigation Controller and DS4.
>
> Sixaxis specific code needs to be left in input code for DS4 support.
>
> If people report that this works for them I'll push those patches.
>
>
> From RFCv2 cover letter:
> Some DualShock3 clones (eg ShanWan) were reported to not provide valid SDP
> record required by HID profile. Due to this those failed to work with
> current BlueZ sixaxis code (ie no input device were created).
>
> This small serie is an attempt to extend DS3 support also with those
> misbehaving clones. Idea is that we can provide fixed SDP recrod for devices
> that use valid PID/VID and skip SDP search.
>
> In this version SDP is kept in sixaxis plugin and provided via
> btd_device_set_record instead of SDP search. Nice addition is that
> sixaxis specific code is no longer needed in input server.
>
> This makes code similar to how original Fedora sixaxis plugin worked
> as suggested in previous review round.
>
> I tested this with genuine DS3 and it seems to work OK. Testing with
> clones is stil required though.
>
>
> Szymon Janc (5):
>   sixaxis: Fix PID for Navigation Controller
>   core/device: Add support for setting SDP record
>   sixaxis: Provide DualShock 3 SDP record while adding new device
>   profiles/input: Remove not needed sixaxis checks
>   sixaxis: Fix multi-line comments style
>
>  Makefile.plugins        |   1 +
>  plugins/sixaxis.c       | 195 ++++++++++++++++++++++++++++++++++++++++++++++--
>  profiles/input/server.c |   8 --
>  src/device.c            |  31 ++++++++
>  src/device.h            |   3 +
>  5 files changed, 224 insertions(+), 14 deletions(-)
>
> --
> 2.1.4
>
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-06-21  6:25 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-15 18:28 [PATCH 0/5] sixaxis: Improved support for DualShock 3 clones Szymon Janc
2015-06-15 18:28 ` [PATCH 1/5] sixaxis: Fix PID for Navigation Controller Szymon Janc
2015-06-15 18:45   ` simon
2015-06-15 19:47     ` Szymon Janc
2015-06-15 20:02       ` Szymon Janc
2015-06-15 20:36       ` simon
2015-06-17  3:30       ` simon
2015-06-15 18:28 ` [PATCH 2/5] core/device: Add support for setting SDP record Szymon Janc
2015-06-15 18:28 ` [PATCH 3/5] sixaxis: Provide DualShock 3 SDP record while adding new device Szymon Janc
2015-06-15 18:28 ` [PATCH 4/5] profiles/input: Remove not needed sixaxis checks Szymon Janc
2015-06-15 18:28 ` [PATCH 5/5] sixaxis: Fix multi-line comments style Szymon Janc
2015-06-21  6:25 ` [PATCH 0/5] sixaxis: Improved support for DualShock 3 clones Laurence Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.