public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v3 0/6] BLE-HID/Nintendo Switch 2 support
@ 2026-03-17 20:26 Martin BTS
  2026-03-17 20:26 ` [PATCH BlueZ v3 1/6] shared/gatt: Add skip_secondary option for GATT client Martin BTS
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Martin BTS @ 2026-03-17 20:26 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: hadess, luiz.dentz, vi, Martin BTS

Changes v3:
* Simplified config setting approach.
* Added a 2-second timeout for secondary discovery.
* Separated BLE/GATT-to-HID code from Procon 2 code.
* Removed all Switch/Procon 2 overlap with the HID kernel driver.
* Link to v2: https://lore.kernel.org/all/20260308124745.19248-1-martinbts@gmx.net/

v3 blurb:

While the overall motivation for my work is the Procon 2 controller, there
are two things very BlueZ specific:

A) Devices (e.g. the Procon 2) may deviate from the spec and not respond
   to service discovery, which currently must result in a failed
   connection attempt.
B) (I think) There currently isn't a facility that allows feeding HID
   devices BLE/GATT traffic.

* Patches 1 and 2 are two alternatives to resolve problem A.
* Patch 5 attempts to resolve problem B.
* Patches 3-4 are minor cleanups (rename set_alias, add Gaming
  appearance class), unchanged from v2.
* Patch 6 is minimalistic support for the Switch 2 controllers so that
  HID drivers can take over

Patch 1 uses a configuration setting (v1 feedback), while
Patch 2 uses a new 2-second timeout (v2 feedback).

Both work, but connecting the controller using only Patch 2 is a lot
less reliable. The Procon 2 does only try/wait for a connection for
a few seconds. BLE discovery tends to take so long that together with
the 2 second timeout the controller gives up before the timeout fires.
Patch 1 always worked, when the device showed up in bluetoothctl.

Patch 1 and Patch 2 are both individually suited to solve my
immediate problem. From my point of view it is not necessary to apply
both. I am submitting both for side-by-side comparison and discussion.

Patch 5 is a GATT-UHID bridge that forwards notifications from the
controller to the hid device and hid-device-writes to the
controller. This was previously burried in all the other code that
supported the Procon 2. It can now be used for other input devices that
use only GATT. As far as I can tell, this does not overlap at all with
other Switch 2 support efforts.

Patche 6 is specific to the Switch 2 controllers so that they can be
interacted with through uhid. In contrast to v1 and v2 this is "minimal"
code that makes bluetoothd create a HID device and does the plumbing for
a GATT-HID bridge. There is no overlap to any published Switch 2 driver (that
I am aware of). The result is not usable. One still needs a driver that
"does the right thing". I am keeping my "works on my machine" code here:
https://github.com/martin-bts/hid-switch2-dkms. I will keep using it
until we get proper driver support in the kernel.

Disclaimer (as in v1): I only have a Nintendo Switch 2 Pro Controller
and cannot attest to anything related to any other controller.

Martin BTS (6):
  shared/gatt: Add skip_secondary option for GATT client
  shared/gatt: Add timeout for secondary service discovery
  device: Rename set_alias to  btd_device_set_alias()
  dbus-common: Add Gaming appearance class (0x2a)
  plugins/gatt-uhid: Add generic GATT-to-UHID bridge
  plugins/switch2: Add Nintendo Switch 2 Controller plugin

 Makefile.plugins         |   5 +
 peripheral/gatt.c        |   3 +-
 plugins/gatt-uhid.c      | 350 +++++++++++++++++++++++++++++++++++++++
 plugins/gatt-uhid.h      |  56 +++++++
 plugins/switch2.c        | 255 ++++++++++++++++++++++++++++
 src/dbus-common.c        |   2 +
 src/device.c             |  24 +--
 src/device.h             |   2 +
 src/shared/gatt-client.c |  70 +++++++-
 src/shared/gatt-client.h |   3 +-
 tools/btgatt-client.c    |   2 +-
 unit/test-bap.c          |   2 +-
 unit/test-gatt.c         |   2 +-
 unit/test-gmap.c         |   2 +-
 unit/test-mcp.c          |   2 +-
 unit/test-micp.c         |   3 +-
 unit/test-tmap.c         |   2 +-
 17 files changed, 762 insertions(+), 23 deletions(-)
 create mode 100644 plugins/gatt-uhid.c
 create mode 100644 plugins/gatt-uhid.h
 create mode 100644 plugins/switch2.c

-- 
2.47.3


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

end of thread, other threads:[~2026-03-17 21:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-17 20:26 [PATCH BlueZ v3 0/6] BLE-HID/Nintendo Switch 2 support Martin BTS
2026-03-17 20:26 ` [PATCH BlueZ v3 1/6] shared/gatt: Add skip_secondary option for GATT client Martin BTS
2026-03-17 21:31   ` BLE-HID/Nintendo Switch 2 support bluez.test.bot
2026-03-17 20:26 ` [PATCH BlueZ v3 2/6] shared/gatt: Add timeout for secondary service discovery Martin BTS
2026-03-17 20:26 ` [PATCH BlueZ v3 3/6] device: Rename set_alias to btd_device_set_alias() Martin BTS
2026-03-17 20:26 ` [PATCH BlueZ v3 4/6] dbus-common: Add Gaming appearance class (0x2a) Martin BTS
2026-03-17 20:26 ` [PATCH BlueZ v3 5/6] plugins/gatt-uhid: Add generic GATT-to-UHID bridge Martin BTS
2026-03-17 20:26 ` [PATCH BlueZ v3 6/6] plugins/switch2: Add Nintendo Switch 2 Controller plugin Martin BTS

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox