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

Is it possible to switch PHY on USB-BT5.0+ adapter in LE Long Range? #1135

Open
pvvx opened this issue Feb 17, 2023 · 4 comments
Open

Is it possible to switch PHY on USB-BT5.0+ adapter in LE Long Range? #1135

pvvx opened this issue Feb 17, 2023 · 4 comments

Comments

@pvvx
Copy link

pvvx commented Feb 17, 2023

ble_monitor: bt_helpers.py (0x0045: Packet([Parameter(name='selected_phys', width=4)])) -> API btmgmt_protocol.py (SetPHYConfiguration = 0x0045) -> Bluetooth Management API (Linux kernel)


http://www.bluez.org/
Bluetooth Management API
/doc/mgmt-api.txt

Set PHY Configuration Command
=============================

	Command Code:		0x0045
	Controller Index:	<controller id>
	Command Parameters: 	Selected_PHYs (4 Octet)
	Return Parameters:

	This command is used to set the default PHY to the controller.

	This will be stored and used for all the subsequent scanning
	and connection initiation.

	The list of supported PHYs can be retrieved via the
	Get PHY Configuration command. Selecting unsupported or
	deselecting default PHYs will result in an Invalid Parameter
	error.

	This can be called at any point to change the Selected PHYs.

	Refer Get PHY Configuration command for PHYs parameter.

	This command generates a Command Complete event on success
	or a Command Status event on failure.

	Possible errors:	Invalid Parameters
				Invalid Index
@pvvx
Copy link
Author

pvvx commented Feb 19, 2023

Set advertising acceptance and operation in Bluetooth 5.0+ SIG (PHY 1M and Coded):
hcitool -i hciX cmd 08 31 03 05 05

Set advertising acceptance and operation in all PHYs: 1M/2M/Coded:
hcitool -i hciX cmd 08 31 03 07 07

log btmon:

@ RAW Open: hcitool (privileged) version 2.22
< HCI Command: LE Set Default PHY (0x08|0x0031) plen 3
        All PHYs preference: 0x03
          No TX PHY preference
          No RX PHY preference
        TX PHYs preference: 0x07
          LE 1M
          LE 2M
          LE Coded
        RX PHYs preference: 0x07
          LE 1M
          LE 2M
          LE Coded
> HCI Event: Command Complete (0x0e) plen 4
      LE Set Default PHY (0x08|0x0031) ncmd 2
        Status: Success (0x00)

@pvvx
Copy link
Author

pvvx commented Feb 22, 2023

Show current PHY setting:

# btmgmt -i 1 phy
Supported phys: BR1M1SLOT BR1M3SLOT BR1M5SLOT EDR2M1SLOT EDR2M3SLOT EDR2M5SLOT EDR3M1SLOT EDR3M3SLOT EDR3M5SLOT LE1MTX LE1MRX LE2MTX LE2MRX LECODEDTX LECODEDRX
Configurable phys: BR1M3SLOT BR1M5SLOT EDR2M1SLOT EDR2M3SLOT EDR2M5SLOT EDR3M1SLOT EDR3M3SLOT EDR3M5SLOT LE2MTX LE2MRX LECODEDTX LECODEDRX
Selected phys: BR1M1SLOT BR1M3SLOT BR1M5SLOT EDR2M1SLOT EDR2M3SLOT EDR2M5SLOT EDR3M1SLOT EDR3M3SLOT EDR3M5SLOT LE1MTX LE1MRX

To the 'Selected phys' options, add the options 'LECODEDTX' and 'LECODEDRX':

# btmgmt -i 1 phy BR1M1SLOT BR1M3SLOT BR1M5SLOT EDR2M1SLOT EDR2M3SLOT EDR2M5SLOT EDR3M1SLOT EDR3M3SLOT EDR3M5SLOT LE1MTX LE1MRX LECODEDTX LECODEDRX
PHY Configuration successfully set

@wiesener
Copy link

Hi,

I did the fix hcitool -i hciX cmd 08 31 03 07 07and it worked to get 2 Mbps for my 5.1 dongle. But afterwards, the 4.2 dongle does not get recognized anymore. No matter what I am doing restarting bluetooth service, kernel modules or restart. It stays the same. Dmesg and lsusb show no errors the device is correctly recognized. And even if I switch back to 1 Mbps with hcitool -i hciX cmd 08 31 03 05 05 it still does not show a hci device. I've also checked that the dongle is working on other Ubuntu machines without calling the stated command.

Machine:
Ubuntu 22.04
bluez 5.64
Dongle 5.1: Edimax BT-8500
Dongle 4.2: Laird BT820

@pvvx
Copy link
Author

pvvx commented Apr 27, 2023

Edimax BT-8500

Bluetooth 5.0? May not support PHY Coded

#btmgmt -i 1 phy ?

log btmon ? (#hcitool -i hciX cmd 08 31 03 05 05)

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

2 participants