Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to determin which BT adapter to use? #20

Open
DrCWO opened this issue Nov 18, 2022 · 2 comments
Open

How to determin which BT adapter to use? #20

DrCWO opened this issue Nov 18, 2022 · 2 comments

Comments

@DrCWO
Copy link

DrCWO commented Nov 18, 2022

Hello,
I used successful our great work on Raspbian. Thank you for that.

Now I chaged to dietpi and node v19 and "rocket-nuimo": "^1.2.1",
With the built in BT adapter of Pi4 anything works fine.

This is my code working with the internal BT adapter of Pi4

'use strict';

const { DeviceDiscoveryManager} = require('rocket-nuimo');

// Device connection manager
const manager = DeviceDiscoveryManager.defaultManager;
start();

async function start() {

	const session = manager.startDiscoverySession()
	console.log('Waiting for device...')

	var device = await session.waitForFirstDevice()
	console.log('----- Appeared deviceId: ' + device.id);

	if (await device.connect()) {
		console.log('Connected to Nuimo Control');
	}
	else {
		console.log('No connection');
	}
}

After my script ran I can see in bluetoothctl:

[Nuimo]# list
Controller E4:5F:01:85:E7:2A rooExtend [default]

Now I added the USB BT antenna and did a reboot. The antenna works as I see.

# hciconfig
hci1:   Type: Primary  Bus: UART
        BD Address: E4:5F:01:85:E7:2A  ACL MTU: 1021:8  SCO MTU: 64:1
        DOWN
        RX bytes:7363 acl:95 sco:0 events:379 errors:0
        TX bytes:8595 acl:88 sco:0 commands:290 errors:0

hci0:   Type: Primary  Bus: USB
        BD Address: 00:E0:4C:7B:7B:03  ACL MTU: 1021:6  SCO MTU: 255:12
        UP RUNNING
        RX bytes:7438 acl:0 sco:0 events:510 errors:0
        TX bytes:22021 acl:0 sco:0 commands:440 errors:0

The external antenna is hci0. With bluetoothctl I set it to be the default adapter

[bluetooth]# select  00:E0:4C:7B:7B:03
Controller 00:E0:4C:7B:7B:03 rooExtend #1 [default]
[bluetooth]# list
Controller E4:5F:01:85:E7:2A rooExtend
Controller 00:E0:4C:7B:7B:03 rooExtend #1 [default]

To be sure I only have the hci0 up and running I blocked hci1 with rfkill:

# rfkill
ID TYPE      DEVICE      SOFT      HARD
 0 bluetooth hci0   unblocked unblocked
 1 wlan      phy0     blocked unblocked
 2 bluetooth hci1     blocked unblocked

Now if I start the scripts I see
----- Appeared deviceId: c810cec31489
But no connection will be made.

Funny enough: Same antenna, same dietpi running on a Nanopi Neo R2S Box (that has no internal BT controller) works like charm.

Help would be appreciated.
Thanks DrCWO

@DrCWO
Copy link
Author

DrCWO commented Nov 18, 2022

I did the next test running the antenna and pairing a Microsoft Surface Dial with the Pi.
Works like charm and with hciconfig I can see that the RX and TX bytes got transferred via hci0 which is the USB antenna.

This makes me believe that something in your software is no more compatible with the second BT controller.

@DrCWO
Copy link
Author

DrCWO commented Nov 22, 2022

Back to node v18.7.0 and rocket-nuimo": "^1.2.1", anything works for me.
To me it really seems to be a bug using node v19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant