Skip to content

How to determin which BT adapter to use? #20

@DrCWO

Description

@DrCWO

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions