mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-03 23:47:08 +00:00
libusb: add README.md, explain linux udev rules
This commit is contained in:
parent
2888825a36
commit
304b2f4d7e
@ -53,19 +53,33 @@ setups, toolchains, programmers, and init scripts.
|
||||
### libusb
|
||||
|
||||
The quickest way to try BTstack is on a Linux or OS X system with an
|
||||
additional USB Bluetooth module. The Makefile [port/libusb]() in requires
|
||||
additional USB Bluetooth dongle. It requires
|
||||
[pkg-config](http://www.freedesktop.org/wiki/Software/pkg-config/)
|
||||
and [libusb-1.0](http://libusb.info) or higher to be
|
||||
installed.
|
||||
|
||||
On Linux, it’s usually necessary to run the examples as root as the
|
||||
kernel needs to detach from the USB module.
|
||||
On Linux, the USB Bluetooth donle is usually not accessible to a regular user. You can:
|
||||
- run the examples as root
|
||||
- add a udev rule for your dongle to extend access rights to user processes
|
||||
|
||||
To add an udev rule, please create `/etc/udev/rules.d/btstack.rules` and add this
|
||||
|
||||
# Match all devices from CSR
|
||||
SUBSYSTEM=="usb", ATTRS{idVendor}=="0a12", MODE="0666"
|
||||
|
||||
# Match DeLOCK Bluetooth 4.0 dongle
|
||||
SUBSYSTEM=="usb", ATTRS{idVendor}=="0a5c", ATTRS{device}=="21e8", MODE="0666"
|
||||
|
||||
# Match Asus BT400
|
||||
SUBSYSTEM=="usb", ATTRS{idVendor}=="0b05", ATTRS{device}=="17cb", MODE="0666"
|
||||
|
||||
On OS X, it’s necessary to tell the OS to only use the internal
|
||||
Bluetooth. For this, execute:
|
||||
|
||||
sudo nvram bluetoothHostControllerSwitchBehavior=never
|
||||
|
||||
You may need to reboot for the change to become active.
|
||||
|
||||
## Windows-WinUSB
|
||||
|
||||
Although libusb basically works with the POSIX Run Loop on Windows, we recommend to use the Windows-WinUSB port that uses a native run loop and the native WinUSB API to access a USB Bluetooth dongle.
|
||||
|
@ -7,7 +7,6 @@ COMMON += hci_transport_h2_libusb.c btstack_run_loop_posix.c le_device_db_fs.c
|
||||
|
||||
include ${BTSTACK_ROOT}/example/Makefile.inc
|
||||
|
||||
# CC = gcc-fsf-4.9
|
||||
CFLAGS += -g -Wall -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Werror -Wunused-parameter -Wredundant-decls -Wsign-compare
|
||||
# CFLAGS += -Werror
|
||||
|
||||
@ -18,16 +17,9 @@ VPATH += ${BTSTACK_ROOT}/platform/embedded
|
||||
VPATH += ${BTSTACK_ROOT}/platform/posix
|
||||
VPATH += ${BTSTACK_ROOT}/platform/libusb
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
LDFLAGS += -lws2_32
|
||||
# assume libusb was installed into /usr/local
|
||||
CFLAGS += -I/usr/local/include/libusb-1.0
|
||||
LDFLAGS += -L/usr/local/lib -lusb-1.0
|
||||
else
|
||||
# use pkg-config
|
||||
CFLAGS += $(shell pkg-config libusb-1.0 --cflags)
|
||||
LDFLAGS += $(shell pkg-config libusb-1.0 --libs)
|
||||
endif
|
||||
|
||||
# use pkg-config for portaudio
|
||||
# CFLAGS += $(shell pkg-config portaudio-2.0 --cflags) -DHAVE_PORTAUDIO
|
||||
|
29
port/libusb/README.md
Normal file
29
port/libusb/README.md
Normal file
@ -0,0 +1,29 @@
|
||||
# BTstack Port for POSIX Systems with libusb library
|
||||
|
||||
The quickest way to try BTstack is on a Linux or OS X system with an
|
||||
additional USB Bluetooth dongle. It requires
|
||||
[pkg-config](http://www.freedesktop.org/wiki/Software/pkg-config/)
|
||||
and [libusb-1.0](http://libusb.info) or higher to be
|
||||
installed.
|
||||
|
||||
On Linux, the USB Bluetooth donle is usually not accessible to a regular user. You can:
|
||||
- run the examples as root
|
||||
- add a udev rule for your dongle to extend access rights to user processes
|
||||
|
||||
To add an udev rule, please create `/etc/udev/rules.d/btstack.rules` and add this
|
||||
|
||||
# Match all devices from CSR
|
||||
SUBSYSTEM=="usb", ATTRS{idVendor}=="0a12", MODE="0666"
|
||||
|
||||
# Match DeLOCK Bluetooth 4.0 dongle
|
||||
SUBSYSTEM=="usb", ATTRS{idVendor}=="0a5c", ATTRS{device}=="21e8", MODE="0666"
|
||||
|
||||
# Match Asus BT400
|
||||
SUBSYSTEM=="usb", ATTRS{idVendor}=="0b05", ATTRS{device}=="17cb", MODE="0666"
|
||||
|
||||
On OS X, it’s necessary to tell the OS to only use the internal
|
||||
Bluetooth. For this, execute:
|
||||
|
||||
sudo nvram bluetoothHostControllerSwitchBehavior=never
|
||||
|
||||
You may need to reboot for the change to become active.
|
Loading…
Reference in New Issue
Block a user