diff --git a/doc/manual/docs/quick_start.md b/doc/manual/docs/quick_start.md index 9c7c6bfe9..70c9677b0 100644 --- a/doc/manual/docs/quick_start.md +++ b/doc/manual/docs/quick_start.md @@ -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. diff --git a/port/libusb/Makefile b/port/libusb/Makefile index 2c8149de7..633ce94cb 100644 --- a/port/libusb/Makefile +++ b/port/libusb/Makefile @@ -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 diff --git a/port/libusb/README.md b/port/libusb/README.md new file mode 100644 index 000000000..a3be55958 --- /dev/null +++ b/port/libusb/README.md @@ -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.