I have a custom library that is based off of cwiid user-space library for Nintendo Wiimote connectivity. You can find it at https://github.com/pd-l2ork/cwiid.
Assuming you have your development environment already set up (you will need bluetooth and gtk dev libraries, configure will identify any others that you may be missing), you can build the program by doing (this process should take only a minute, or so):
./configure --disable-python
make
sudo cp libcwiid/libcwiid.so* /usr/lib/
wmgui/wmgui
Then try connecting to a Nintendo Wiimote using File -> Connect option.
Once done testing, if you wish to revert your system, simply remove /usr/lib/libcwiid.so* files with sudo privileges.
sudo rm /usr/lib/libcwiid.so*
In the unlikely event you already had libcwiid installed prior to this, you can always simply reinstall that package.
This library and its demo app wmgui have worked just fine in Ubuntu 20.04 on older laptops and has worked just as well on those same laptops after they have been upgraded to Ubuntu 22.04. Now, on newer Thinkpad L14 Gen4 laptops, I am encountering an issue where a Nintendo Wiimote device is not properly detected in the line 84 of libcwiid/bluetooth.c:
if ((dev_count = hci_inquiry(dev_id, timeout, max_inquiry, NULL,
&dev_list, IREQ_CACHE_FLUSH)) == -1) {
cwiid_err(NULL, "Bluetooth device inquiry error");
err = 1;
goto CODA;
}
After trying to re-discover the Nintendo Wiimote device, it detects it, but then hangs (according to gdb's backtrace) in the line 100 of libcwiid/connect.c:
unsigned char handshake;
if (read(wiimote->ctl_socket, &handshake, 1) != 1) {
cwiid_err(wiimote, "Socket read error (handshake)");
return -1;
}
The Nintendo Wiimote connects fine via the Ubuntu settings widget and is detected as a joystick. However, if it is paired there, it is impossible to access it via the aforesaid cwiid library. So, the only way to allow it to be detected is to not pair it (or unpair it) via the Settings->Bluetooth options.
The code compiles fine on both laptops running Ubuntu 22.04 (there are a few warnings that pop up on both older and newer laptops just the same), which makes me wonder if newer bluetooth hardware may be the cause of this issue. With this in mind, I am wondering what may be the problem.
Please note that I know there are now other libraries that enable connectivity with Nintendo Wiimotes. However, I have an older project that has depended on this approach for over a decade and am looking to update the code. Given the cryptic and inconsistent behavior, I am unsure where to look.
Is it possible that bluetooth library can be run requesting API functionality of the older version (e.g. via a define inside C code)? Could that be a potential temporary solution?
Another thought is whether this may be some kind of an elevated security issue when it comes to userspace access to bluetooth devices and if so, is there a way to sidestep such a limitation?
Thank you for your help.
EDIT: here are some logs I was able to capture.
Application output:
Found old version of the wiimote (Nintendo RVL-CNT-01
ERROR:ssl_client_socket_impl.cc(983) handshake failed; returned -1, SSL error code 1, net_error -100
(not sure if the 2nd line is relevant to the issue or something else threw out this error to the console.
syslog:
Mar 19 12:17:45 Monsoon kernel: [10402.437307] Bluetooth: hci0: unexpected cc 0x041a length: 7 > 1
Mar 19 12:17:48 Monsoon kernel: [10405.931519] Bluetooth: hci0: unexpected cc 0x041a length: 7 > 1
Mar 19 12:17:48 Monsoon kernel: [10405.931535] Bluetooth: hci0: Opcode 0x041a failed: -22
...
Mar 19 14:24:58 Monsoon systemd[1]: Starting Bluetooth service...
Mar 19 14:24:58 Monsoon kernel: [ 3.883602] Bluetooth: Core ver 2.22
Mar 19 14:24:58 Monsoon kernel: [ 3.883630] NET: Registered PF_BLUETOOTH protocol family
Mar 19 14:24:58 Monsoon kernel: [ 3.883632] Bluetooth: HCI device and connection manager initialized
Mar 19 14:24:58 Monsoon kernel: [ 3.883636] Bluetooth: HCI socket layer initialized
Mar 19 14:24:58 Monsoon kernel: [ 3.883639] Bluetooth: L2CAP socket layer initialized
Mar 19 14:24:58 Monsoon kernel: [ 3.883644] Bluetooth: SCO socket layer initialized
...
Mar 19 14:24:58 Monsoon kernel: [ 4.031959] thinkpad_acpi: rfkill switch tpacpi_bluetooth_sw: radio is unblocked
...
Mar 19 14:24:58 Monsoon bluetoothd[836]: Bluetooth daemon 5.64
Mar 19 14:24:58 Monsoon systemd[1]: Started Bluetooth service.
Mar 19 14:24:58 Monsoon systemd[1]: Reached target Bluetooth Support.
Mar 19 14:24:58 Monsoon bluetoothd[836]: Starting SDP server
...
Mar 19 14:24:58 Monsoon bluetoothd[836]: Bluetooth daemon 5.64
Mar 19 14:24:58 Monsoon systemd[1]: Started Bluetooth service.
Mar 19 14:24:58 Monsoon systemd[1]: Reached target Bluetooth Support.
Mar 19 14:24:58 Monsoon bluetoothd[836]: Starting SDP server
...
Mar 19 14:24:58 Monsoon bluetoothd[836]: Bluetooth management interface 1.22 initialized
Mar 19 14:24:58 Monsoon kernel: [ 4.188765] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
Mar 19 14:24:58 Monsoon kernel: [ 4.188770] Bluetooth: BNEP filters: protocol multicast
Mar 19 14:24:58 Monsoon kernel: [ 4.188775] Bluetooth: BNEP socket layer initialized
...
Mar 19 14:25:01 Monsoon kernel: [ 7.430940] Bluetooth: hci0: Device setup in 3340604 usecs
Mar 19 14:25:01 Monsoon kernel: [ 7.430949] Bluetooth: hci0: HCI Enhanced Setup Synchronous Connection command is advertised, but not supported.
Mar 19 14:25:01 Monsoon kernel: [ 7.500941] Bluetooth: hci0: AOSP extensions version v1.00
Mar 19 14:25:01 Monsoon kernel: [ 7.500947] Bluetooth: hci0: AOSP quality report is supported
Mar 19 14:25:01 Monsoon kernel: [ 7.501104] Bluetooth: MGMT ver 1.22
Mar 19 14:25:09 Monsoon bluetoothd[836]: Player registered: sender=:1.36 path=/media_player0
...
Mar 19 14:25:09 Monsoon bluetoothd[836]: Endpoint registered: sender=:1.36 path=/MediaEndpoint/A2DPSource/ldac
Mar 19 14:25:09 Monsoon bluetoothd[836]: Endpoint registered: sender=:1.36 path=/MediaEndpoint/A2DPSink/sbc
Mar 19 14:25:09 Monsoon bluetoothd[836]: Endpoint registered: sender=:1.36 path=/MediaEndpoint/A2DPSource/sbc
Mar 19 14:25:09 Monsoon bluetoothd[836]: Endpoint registered: sender=:1.36 path=/MediaEndpoint/A2DPSink/sbc_xq
Mar 19 14:25:09 Monsoon bluetoothd[836]: Endpoint registered: sender=:1.36 path=/MediaEndpoint/A2DPSource/sbc_xq
Mar 19 14:25:09 Monsoon bluetoothd[836]: Endpoint registered: sender=:1.36 path=/MediaEndpoint/A2DPSource/faststream
Mar 19 14:25:09 Monsoon bluetoothd[836]: Endpoint registered: sender=:1.36 path=/MediaEndpoint/A2DPSource/faststream_duplex
Mar 19 14:25:09 Monsoon wireplumber[1150]: listen(): Address already in use
Mar 19 14:25:09 Monsoon bluetoothd[836]: src/profile.c:register_profile() :1.41 tried to register 00001108-0000-1000-8000-00805F9B34FB which is already registered
Mar 19 14:25:09 Monsoon bluetoothd[836]: src/profile.c:register_profile() :1.41 tried to register 0000111F-0000-1000-8000-00805F9B34FB which is already registered
Mar 19 14:25:09 Monsoon bluetoothd[836]: Player registered: sender=:1.41 path=/media_player1
Mar 19 14:25:09 Monsoon bluetoothd[836]: Endpoint registered: sender=:1.41 path=/MediaEndpoint/A2DPSource/ldac
Mar 19 14:25:09 Monsoon bluetoothd[836]: Endpoint registered: sender=:1.41 path=/MediaEndpoint/A2DPSink/sbc
Mar 19 14:25:09 Monsoon bluetoothd[836]: Endpoint registered: sender=:1.41 path=/MediaEndpoint/A2DPSource/sbc
Mar 19 14:25:09 Monsoon bluetoothd[836]: Endpoint registered: sender=:1.41 path=/MediaEndpoint/A2DPSink/sbc_xq
Mar 19 14:25:09 Monsoon bluetoothd[836]: Endpoint registered: sender=:1.41 path=/MediaEndpoint/A2DPSource/sbc_xq
Mar 19 14:25:09 Monsoon bluetoothd[836]: Endpoint registered: sender=:1.41 path=/MediaEndpoint/A2DPSource/faststream
Mar 19 14:25:09 Monsoon bluetoothd[836]: Endpoint registered: sender=:1.41 path=/MediaEndpoint/A2DPSource/faststream_duplex
Mar 19 14:25:09 Monsoon kernel: [ 14.740513] Bluetooth: RFCOMM TTY layer initialized
Mar 19 14:25:09 Monsoon kernel: [ 14.740521] Bluetooth: RFCOMM socket layer initialized
Mar 19 14:25:09 Monsoon kernel: [ 14.740525] Bluetooth: RFCOMM ver 1.11
...
Mar 19 14:25:17 Monsoon bluetoothd[836]: Endpoint unregistered: sender=:1.41 path=/MediaEndpoint/A2DPSource/ldac
...
Mar 19 14:25:55 Monsoon systemd[1678]: Reached target Bluetooth.
EDIT 2: added btmon output:
Bluetooth monitor ver 5.64
= Note: Linux version 6.1.0-1035-oem (x86_64) 0.884488
= Note: Bluetooth subsystem version 2.22 0.884490
= New Index: E8:65:38:20:9E:AC (Primary,USB,hci0) [hci0] 0.884492
= Open Index: E8:65:38:20:9E:AC [hci0] 0.884492
= Index Info: E8:65:38:20:9E:AC (MediaTek, Inc.) [hci0] 0.884493
@ MGMT Open: bluetoothd (privileged) version 1.22 {0x0001} 0.884494
@ RAW Open: wmgui version 2.22 {0x0002} 8.551253
@ RAW Close: wmgui {0x0002} 8.551268
@ RAW Open: wmgui version 2.22 {0x0002} 8.551294
< HCI Command: Inquiry (0x01|0x0001) plen 5 #1 [hci0] 8.551332
Access code: 0x9e8b33 (General Inquiry)
Length: 6.40s (0x05)
Num responses: 0
> HCI Event: Command Status (0x0f) plen 4 #2 [hci0] 8.667822
Inquiry (0x01|0x0001) ncmd 1
Status: Success (0x00)
> HCI Event: Extended Inquiry Result (0x2f) plen 255 #3 [hci0] 9.212558
Num responses: 1
Address: 5C:17:CF:C3:71:27 (OnePlus Technology (Shenzhen) Co., Ltd)
Page scan repetition mode: R1 (0x01)
Page period mode: P2 (0x02)
Class: 0x5a020c
Major class: Phone (cellular, cordless, payphone, modem)
Minor class: Smart phone
Networking (LAN, Ad hoc)
Capturing (Scanner, Microphone)
Object Transfer (v-Inbox, v-Folder)
Telephony (Cordless telephony, Modem, Headset)
Clock offset: 0x779c
RSSI: -84 dBm (0xac)
Name (complete): OnePlus 8T+ 5G
16-bit Service UUIDs (complete): 11 entries
OBEX Object Push (0x1105)
Audio Source (0x110a)
A/V Remote Control Target (0x110c)
A/V Remote Control (0x110e)
Headset AG (0x1112)
PANU (0x1115)
NAP (0x1116)
Handsfree Audio Gateway (0x111f)
Phonebook Access Server (0x112f)
PnP Information (0x1200)
Message Access Server (0x1132)
128-bit Service UUIDs (complete): 8 entries
Vendor specific
Vendor specific
Vendor specific
Vendor specific
Vendor specific
Vendor specific
Vendor specific
Vendor specific
> HCI Event: Extended Inquiry Result (0x2f) plen 255 #4 [hci0] 9.225053
Num responses: 1
Address: 40:49:0F:19:F5:40 (Hon Hai Precision Ind. Co.,Ltd.)
Page scan repetition mode: R1 (0x01)
Page period mode: P2 (0x02)
Class: 0x08043c
Major class: Audio/Video (headset, speaker, stereo, video, vcr)
Minor class: Video Display and Loudspeaker
Capturing (Scanner, Microphone)
Clock offset: 0x2e54
RSSI: -100 dBm (0x9c)
> HCI Event: Inquiry Result with RSSI (0x22) plen 15 #5 [hci0] 10.657527
Num responses: 1
Address: CC:9E:00:C6:41:82 (Nintendo Co., Ltd.)
Page scan repetition mode: R1 (0x01)
Page period mode: P2 (0x02)
Class: 0x002504
Major class: Peripheral (mouse, joystick, keyboards)
Minor class: 0x01
Limited Discoverable Mode
Clock offset: 0x12fb
RSSI: -56 dBm (0xc8)
> HCI Event: Inquiry Complete (0x01) plen 1 #6 [hci0] 15.155581
Status: Success (0x00)
@ RAW Close: wmgui {0x0002} 15.155776
@ RAW Open: wmgui version 2.22 {0x0002} [hci0] 15.155839
< HCI Command: Remote Name Request (0x01|0x0019) plen 10 #7 [hci0] 15.155876
Address: CC:9E:00:C6:41:82 (Nintendo Co., Ltd.)
Page scan repetition mode: R2 (0x02)
Page scan mode: Mandatory (0x00)
Clock offset: 0x0000
> HCI Event: Command Status (0x0f) plen 4 #8 [hci0] 15.157081
Remote Name Request (0x01|0x0019) ncmd 1
Status: Success (0x00)
> HCI Event: Remote Name Req Complete (0x07) plen 255 #9 [hci0] 15.287859
Status: Success (0x00)
Address: CC:9E:00:C6:41:82 (Nintendo Co., Ltd.)
Name: Nintendo RVL-CNT-01
@ RAW Close: wmgui {0x0002} [hci0] 15.288112
@ RAW Open: wmgui version 2.22 {0x0002} [hci0] 16.288561
< HCI Command: Remote Name Request (0x01|0x0019) plen 10 #10 [hci0] 16.288656
Address: CC:9E:00:C6:41:82 (Nintendo Co., Ltd.)
Page scan repetition mode: R2 (0x02)
Page scan mode: Mandatory (0x00)
Clock offset: 0x0000
> HCI Event: Command Status (0x0f) plen 4 #11 [hci0] 16.291213
Remote Name Request (0x01|0x0019) ncmd 1
Status: Success (0x00)
> HCI Event: Remote Name Req Complete (0x07) plen 255 #12 [hci0] 16.441082
Status: Success (0x00)
Address: CC:9E:00:C6:41:82 (Nintendo Co., Ltd.)
Name: Nintendo RVL-CNT-01
@ RAW Close: wmgui {0x0002} [hci0] 16.441323
< HCI Command: Create Connection (0x01|0x0005) plen 13 #13 [hci0] 16.441414
Address: CC:9E:00:C6:41:82 (Nintendo Co., Ltd.)
Packet type: 0xcc18
DM1 may be used
DH1 may be used
DM3 may be used
DH3 may be used
DM5 may be used
DH5 may be used
Page scan repetition mode: R1 (0x01)
Page scan mode: Mandatory (0x00)
Clock offset: 0x92fb
Role switch: Allow peripheral (0x01)
> HCI Event: Command Status (0x0f) plen 4 #14 [hci0] 16.443061
Create Connection (0x01|0x0005) ncmd 1
Status: Success (0x00)
> HCI Event: Connect Complete (0x03) plen 11 #15 [hci0] 16.937802
Status: Success (0x00)
Handle: 50
Address: CC:9E:00:C6:41:82 (Nintendo Co., Ltd.)
Link type: ACL (0x01)
Encryption: Disabled (0x00)
< HCI Command: Read Remote Support.. (0x01|0x001b) plen 2 #16 [hci0] 16.937971
Handle: 50
> HCI Event: Command Status (0x0f) plen 4 #17 [hci0] 16.938540
Read Remote Supported Features (0x01|0x001b) ncmd 1
Status: Success (0x00)
> HCI Event: Read Remote Supported Featu.. (0x0b) plen 11 #18 [hci0] 16.944036
Status: Success (0x00)
Handle: 50
Features: 0xbc 0x02 0x04 0x38 0x08 0x00 0x00 0x00
Encryption
Slot offset
Timing accuracy
Role switch
Sniff mode
Power control requests
Power control
Enhanced inquiry scan
Interlaced inquiry scan
Interlaced page scan
AFH capable peripheral
< HCI Command: Remote Name Request (0x01|0x0019) plen 10 #19 [hci0] 16.944069
Address: CC:9E:00:C6:41:82 (Nintendo Co., Ltd.)
Page scan repetition mode: R2 (0x02)
Page scan mode: Mandatory (0x00)
Clock offset: 0x0000
< ACL Data TX: Handle 50 flags 0x00 dlen 10 #20 [hci0] 16.944081
L2CAP: Information Request (0x0a) ident 1 len 2
Type: Extended features supported (0x0002)
> HCI Event: Command Status (0x0f) plen 4 #21 [hci0] 16.944660
Remote Name Request (0x01|0x0019) ncmd 1
Status: Success (0x00)
> HCI Event: Number of Completed Packets (0x13) plen 5 #22 [hci0] 16.949035
Num handles: 1
Handle: 50
Count: 1
> ACL Data RX: Handle 50 flags 0x02 dlen 16 #23 [hci0] 16.952842
L2CAP: Information Response (0x0b) ident 1 len 8
Type: Extended features supported (0x0002)
Result: Success (0x0000)
Features: 0x00000004
Bi-directional QoS
< ACL Data TX: Handle 50 flags 0x00 dlen 12 #24 [hci0] 16.952871
L2CAP: Connection Request (0x02) ident 2 len 4
PSM: 17 (0x0011)
Source CID: 64
> HCI Event: Number of Completed Packets (0x13) plen 5 #25 [hci0] 16.955287
Num handles: 1
Handle: 50
Count: 1
> HCI Event: Remote Name Req Complete (0x07) plen 255 #26 [hci0] 16.958654
Status: Success (0x00)
Address: CC:9E:00:C6:41:82 (Nintendo Co., Ltd.)
Name: Nintendo RVL-CNT-01
@ MGMT Event: Device Connected (0x000b) plen 39 {0x0001} [hci0] 16.958670
BR/EDR Address: CC:9E:00:C6:41:82 (Nintendo Co., Ltd.)
Flags: 0x00000008
Connection Locally Initiated
Data length: 26
Name (complete): Nintendo RVL-CNT-01
Class: 0x002504
Major class: Peripheral (mouse, joystick, keyboards)
Minor class: 0x01
Limited Discoverable Mode
> ACL Data RX: Handle 50 flags 0x02 dlen 16 #27 [hci0] 16.958932
L2CAP: Connection Response (0x03) ident 2 len 8
Destination CID: 105
Source CID: 64
Result: Connection pending (0x0001)
Status: No further information available (0x0000)
> ACL Data RX: Handle 50 flags 0x02 dlen 16 #28 [hci0] 16.986624
L2CAP: Connection Response (0x03) ident 2 len 8
Destination CID: 105
Source CID: 64
Result: Connection successful (0x0000)
Status: No further information available (0x0000)
< ACL Data TX: Handle 50 flags 0x00 dlen 12 #29 [hci0] 16.986695
L2CAP: Configure Request (0x04) ident 3 len 4
Destination CID: 105
Flags: 0x0000
> HCI Event: Number of Completed Packets (0x13) plen 5 #30 [hci0] 16.989044
Num handles: 1
Handle: 50
Count: 1
> ACL Data RX: Handle 50 flags 0x02 dlen 18 #31 [hci0] 16.991540
L2CAP: Configure Response (0x05) ident 3 len 10
Source CID: 64
Flags: 0x0000
Result: Success (0x0000)
Option: Maximum Transmission Unit (0x01) [mandatory]
MTU: 185
> ACL Data RX: Handle 50 flags 0x02 dlen 16 #32 [hci0] 16.992849
L2CAP: Configure Request (0x04) ident 49 len 8
Destination CID: 64
Flags: 0x0000
Option: Maximum Transmission Unit (0x01) [mandatory]
MTU: 185
< ACL Data TX: Handle 50 flags 0x00 dlen 18 #33 [hci0] 16.992879
L2CAP: Configure Response (0x05) ident 49 len 10
Source CID: 105
Flags: 0x0000
Result: Success (0x0000)
Option: Maximum Transmission Unit (0x01) [mandatory]
MTU: 185
< ACL Data TX: Handle 50 flags 0x00 dlen 12 #34 [hci0] 16.992967
L2CAP: Connection Request (0x02) ident 4 len 4
PSM: 19 (0x0013)
Source CID: 65
> HCI Event: Number of Completed Packets (0x13) plen 5 #35 [hci0] 16.995919
Num handles: 1
Handle: 50
Count: 1
> HCI Event: Number of Completed Packets (0x13) plen 5 #36 [hci0] 16.996525
Num handles: 1
Handle: 50
Count: 1
> ACL Data RX: Handle 50 flags 0x02 dlen 16 #37 [hci0] 16.999099
L2CAP: Connection Response (0x03) ident 4 len 8
Destination CID: 106
Source CID: 65
Result: Connection successful (0x0000)
Status: No further information available (0x0000)
< ACL Data TX: Handle 50 flags 0x00 dlen 12 #38 [hci0] 16.999119
L2CAP: Configure Request (0x04) ident 5 len 4
Destination CID: 106
Flags: 0x0000
> HCI Event: Number of Completed Packets (0x13) plen 5 #39 [hci0] 17.001534
Num handles: 1
Handle: 50
Count: 1
> ACL Data RX: Handle 50 flags 0x02 dlen 18 #40 [hci0] 17.004036
L2CAP: Configure Response (0x05) ident 5 len 10
Source CID: 65
Flags: 0x0000
Result: Success (0x0000)
Option: Maximum Transmission Unit (0x01) [mandatory]
MTU: 185
> ACL Data RX: Handle 50 flags 0x02 dlen 16 #41 [hci0] 17.005346
L2CAP: Configure Request (0x04) ident 50 len 8
Destination CID: 65
Flags: 0x0000
Option: Maximum Transmission Unit (0x01) [mandatory]
MTU: 185
< ACL Data TX: Handle 50 flags 0x00 dlen 18 #42 [hci0] 17.005419
L2CAP: Configure Response (0x05) ident 50 len 10
Source CID: 106
Flags: 0x0000
Result: Success (0x0000)
Option: Maximum Transmission Unit (0x01) [mandatory]
MTU: 185
< ACL Data TX: Handle 50 flags 0x00 dlen 7 #43 [hci0] 17.006051
Channel: 105 len 3 [PSM 17 mode Basic (0x00)] {chan 0}
52 11 00 R..
> HCI Event: Number of Completed Packets (0x13) plen 5 #44 [hci0] 17.007784
Num handles: 1
Handle: 50
Count: 1
> HCI Event: Number of Completed Packets (0x13) plen 5 #45 [hci0] 17.009034
Num handles: 1
Handle: 50
Count: 1
> HCI Event: QoS Setup Complete (0x0d) plen 21 #46 [hci0] 17.063028
Status: Success (0x00)
Handle: 50
Flags: 0x00
Service type: Best Effort (0x01)
Token rate: 2700
Peak bandwidth: 0
Latency: 10000
Delay variation: 0
> ACL Data RX: Handle 50 flags 0x02 dlen 12 #47 [hci0] 17.064057
Channel: 65 len 8 [PSM 19 mode Basic (0x00)] {chan 1}
a1 20 00 00 02 00 00 b3 . ......
(at this point the program hangs, whereas on the older laptop with the same Ubuntu 22.04 and bluetooth stack, but also different bluetooth interface, the result is wiimote vibrating and finishing connection, after which you can retrieve its data and you see received data showing on the wmgui's GUI)
I also tried adding lp bluetooth and dialout groups to match user's access to those group's privileges, but that made no difference.
Lastly, it appears that fans kick in when left hanging, suggesting there is an increased CPU usage and that the program is stuck in some sort of a loop (wmgui at that point eats 100% of the CPU).
EDIT 3: added gdb output below
Thread 1 "wmgui" received signal SIGINT, Interrupt.
__GI___libc_read (nbytes=1, buf=0x7fffffffd167, fd=12) at ../sysdeps/unix/sysv/linux/read.c:26
26 ../sysdeps/unix/sysv/linux/read.c: No such file or directory.
(gdb) back
#0 __GI___libc_read (nbytes=1, buf=0x7fffffffd167, fd=12)
at ../sysdeps/unix/sysv/linux/read.c:26
#1 __GI___libc_read (fd=12, buf=0x7fffffffd167, nbytes=1)
at ../sysdeps/unix/sysv/linux/read.c:24
#2 0x00007ffff7e834db in verify_handshake (wiimote=0x555555821670)
at util.c:105
#3 0x00007ffff7e7e309 in cwiid_send_rpt
(wiimote=0x555555821670, flags=0 '\000', report=17 '\021', len=1, data=0x7fffffffd1d7) at command.c:130
#4 0x00007ffff7e7e411 in cwiid_set_led (wiimote=0x555555821670, led=0 '\000')
at command.c:159
#5 0x00007ffff7e7f6ad in cwiid_open_timeout
(bdaddr=0x555555570048 <bdaddr>, flags=1, timeout=5) at connect.c:264
#6 0x00007ffff7e7ef1a in cwiid_open (bdaddr=0x555555570048 <bdaddr>, flags=1)
at connect.c:85
#7 0x000055555555bd3c in menuConnect_activate () at main.c:705
#8 0x00007ffff79b4d2f in g_closure_invoke ()
at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#9 0x00007ffff79d0c36 in () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#10 0x00007ffff79d2614 in g_signal_emit_valist ()
at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#11 0x00007ffff79d2863 in g_signal_emit ()
at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
EDIT 4: added more information
So, I tested between two laptops an array of BT USB dongles and none of them worked on either laptop. Further, I swapped the wifi/bluetooth internal laptop cards and found out that while intel 8265 wifi/bluetooth card works on the older laptop with Ubuntu 22.04, it does not on the new one. That eliminates just about everything but the kernel. So, it seems something with the kernel bluetooth stack has changed that has made userspace bluetooth access either deprecated, or something in its API has made the usual pairing impossible. If latter, I was unable to locate anything yet that shows what may be missing...
EDIT 5: looks like every time the library reaches a read() request, attempting to read from the socket, it is when the program/library freeze and get stuck with 100% CPU usage. Write appears to work because before the first read, cwiid writes data that stops Wiimote's LEDs from blinking. I also added user to the input group, which made no difference.