- How do i include for NDK toolchain’s gcc
- 1 Answer 1
- Linked
- Related
- Hot Network Questions
- Subscribe to RSS
- Bluetooth no such file or directory
- Python code for Bluetooth throws error after I had to reset the adapter
- bluetooth.btcommon.BluetoothError: [Errno 2] No such file or directory
- Saved searches
- Use saved searches to filter your results more quickly
- npm install — fatal error: bluetooth/bluetooth.h: No such file or directory #1
- npm install — fatal error: bluetooth/bluetooth.h: No such file or directory #1
- Comments
How do i include for NDK toolchain’s gcc
first of all, i got into a problem last time when trying to compile a c program to linux- arm architecture, for using it in an android app later. I succeeded in doing so, and i’ll write later a post on how to use the NDK standalone toolchain. Now that i’ve finally got that working, I’m trying to compile a .c file, which has a line «include bluetooth/bluetooth.h» in it. When I try to compile the file, i get a: «no such file or directory» error on it. My makefile includes the word «-libbluetooth». The standart NDK gcc library does’nt have a bluetooth support, so i’ve downloaded «libbluetooth.so» from my device, which is what i needed to make it work, according to the brief research on the subject over the internet. I still get the same error. I’ll be glad to know if anyone has encountered the same problem. thank u Dekel
1 Answer 1
You need the bluetooth library to link your program; but to compile it, you need the appropriate headers. libbluetooth.so is not part of Android official API, but luckily you can find it sources and the include files that declare its public (but unofficial) API, if you download the AOSP source tree, according to Google’s instructions. Actually, you are interested in a small part of the tree: ./external/bluetooth/bluez/lib . There you will find the bluetooth/bluetooth.h include file. In your Android.mk , you will have a line similar to:
LOCAL_C_INCLUDES += $(AOSP_ROOT)/external/bluetooth/bluez/lib
Linked
Related
Hot Network Questions
Subscribe to RSS
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.7.14.43533
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
Bluetooth no such file or directory
Error:
bluetooth.btcommon.BluetoothError: (2, ‘No such file or directory’)
or
Failed to connect to SDP server on FF:FF:FF:00:00:00: No such file or directory
sudo vim /lib/systemd/system/bluetooth.service
modify ExecStart=/usr/lib/bluez5/bluetooth/bluetoothd -E -C
sudo systemctl daemon-reload
sudo systemctl restart bluetooth
sudo sdptool browse local
The last class is executed successfully output the following results:
Browsing FF:FF:FF:00:00:00 . Service RecHandle: 0x10000 Service Class ID List: "PnP Information" (0x1200) Profile Descriptor List: "PnP Information" (0x1200) Version: 0x0103 Browsing FF:FF:FF:00:00:00 . Service Search failed: Invalid argument Service Name: Generic Access Profile Service Provider: BlueZ Service RecHandle: 0x10001 Service Class ID List: "Generic Access" (0x1800) Protocol Descriptor List: "L2CAP" (0x0100) PSM: 31 "ATT" (0x0007) uint16: 0x0001 uint16: 0x0005 Service Name: Generic Attribute Profile Service Provider: BlueZ Service RecHandle: 0x10002 Service Class ID List: "Generic Attribute" (0x1801) Protocol Descriptor List: "L2CAP" (0x0100) PSM: 31 "ATT" (0x0007) uint16: 0x0006 uint16: 0x0009 Service Name: AVRCP CT Service RecHandle: 0x10003 Service Class ID List: "AV Remote" (0x110e) "AV Remote Controller" (0x110f) Protocol Descriptor List: "L2CAP" (0x0100) PSM: 23 "AVCTP" (0x0017) uint16: 0x0103 Profile Descriptor List: "AV Remote" (0x110e) Version: 0x0106 .
from bluetooth import * server_sock = BluetoothSocket( RFCOMM ) server_sock.bind(("",PORT_ANY)) server_sock.listen(1) port = server_sock.getsockname()[1] # uuid = "94f39d29-7d6d-437d-973b-fba39e49d4ee" uuid = "00001101-0000-1000-8000-00805f9b34fb" advertise_service( server_sock, "HAServer", service_id = uuid, service_classes = [ uuid, SERIAL_PORT_CLASS ], profiles = [ SERIAL_PORT_PROFILE ], # protocols = [ OBEX_UUID ] ) print("Waiting for connection on RFCOMM channel %d" % port) client_sock, client_info = server_sock.accept() print("Accepted connection from ", client_info) while True: try: req = client_sock.recv(1024) if len(req) == 0: break data = req.decode() print("received [%s]" % data) print("sending [%s]" % data) client_sock.send(data) except IOError: pass except KeyboardInterrupt: print("disconnected") client_sock.close() server_sock.close() print("all done") break
Python code for Bluetooth throws error after I had to reset the adapter
I was trying out bluetooth programming in python. It was working fine till yesterday. This morning, there was a power outage and for some reason, the bluetooth module got disabled and it could not be turned on. So, I did a sudo hciconfig hci0 reset and then turned it on. From that point onwards, the simplest of the programs are failing to execute. Take this one for example. It gets stuck at advertise_service in bluetooth module and throws the following error (FYI: virtualenv was not a problem here. The systemwide python also does the same thing).
Traceback (most recent call last): File "bt.py", line 17, in advertise_service( server_sock, "SampleServer", service_id = uuid, service_classes = [ uuid, SERIAL_PORT_CLASS ], profiles = [ SERIAL_PORT_PROFILE ]) File "/home/machinename/.virtualenvs/py27/local/lib/python2.7/site-packages/bluetooth/bluez.py", line 242, in advertise_service raise BluetoothError (str (e)) bluetooth.btcommon.BluetoothError: (2, 'No such file or directory')
Traceback (most recent call last): File "build/bdist.linux-x86_64/egg/bluetooth/bluez.py", line 268, in advertise_service bluetooth.btcommon.BluetoothError: error no advertisable device.
But all of these worked like a charm before in that machine; in fact all of the program works just fine with my other ubuntu (14.04LTS) machine as I write this. I inspected the source code, and traced to a _bluetooth.so file — which is a compiled code, hence I couldn’t figure out what to do anymore. Any pointer will be highly appreciated.
bluetooth.btcommon.BluetoothError: [Errno 2] No such file or directory
I’m trying to connect to a bluetooth device through a Python script using pybluez on a Khadas board (kind of like a Raspberry Pi, aarch64). I have manually updated PyBluez to 5.65 as it contains a fix I need. Both bluetoothctl —version and bluetoothd —version return 5.65. Upon launching my script, I get
> python main.py . File "/home/khadas/env/lib/python3.8/site-packages/bluetooth/bluez.py", line 271, in advertise_service _bt.sdp_advertise_service (sock._sock, name, service_id, \ _bluetooth.error: (2, 'No such file or directory') During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/khadas/copilot/copilot/process/process.py", line 126, in run self._pre_run() File "/home/khadas/copilot/copilot/task/bluetooth_connector_task.py", line 55, in _pre_run bluetooth.advertise_service( File "/home/khadas/env/lib/python3.8/site-packages/bluetooth/bluez.py", line 275, in advertise_service raise BluetoothError (*e.args) bluetooth.btcommon.BluetoothError: [Errno 2] No such file or directory
Following this, I have edited /etc/systemd/system/dbus-org.bluez.service and /lib/systemd/system/bluetooth.service to have
ExecStart=/usr/libexec/bluetooth/bluetoothd -C
sudo systemctl daemon-reload & sudo systemctl restart bluetooth & sudo sdptool add SP
but my error persists. Has any of you encountered this before? Thank you for your time 🙂 Note: This thread indicates that, following sudo sdptool add SP , a file at /var/run/sdp should have been created; it is not. Note: The bluetooth service is running, but there are errors, i.e.
(env) khadas@khadas > systemctl status bluetooth.service ● bluetooth.service - Bluetooth service Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2022-08-11 13:23:09 UTC; 13min ago Docs: man:bluetoothd(8) Main PID: 14256 (bluetoothd) Status: "Running" Tasks: 1 (limit: 2932) Memory: 676.0K CGroup: /system.slice/bluetooth.service └─14256 /usr/libexec/bluetooth/bluetoothd -C Aug 11 13:23:09 khadas systemd[1]: Starting Bluetooth service. Aug 11 13:23:09 khadas bluetoothd[14256]: Bluetooth daemon 5.65 Aug 11 13:23:09 khadas systemd[1]: Started Bluetooth service. Aug 11 13:23:09 khadas bluetoothd[14256]: Starting SDP server Aug 11 13:23:09 khadas bluetoothd[14256]: src/sdpd-server.c:init_server() binding UNIX socket: Read-only file system Aug 11 13:23:09 khadas bluetoothd[14256]: src/sdpd-server.c:start_sdp_server() Server initialization failed Aug 11 13:23:09 khadas bluetoothd[14256]: Bluetooth management interface 1.14 initialized Aug 11 13:23:09 khadas bluetoothd[14256]: src/adapter.c:reset_adv_monitors_complete() Failed to reset Adv Monitors: Unknown Command (0x01)
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
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
npm install — fatal error: bluetooth/bluetooth.h: No such file or directory #1
npm install — fatal error: bluetooth/bluetooth.h: No such file or directory #1
Comments
Can some help me with this problem:
I have following error when I run npm install inside /iot-sensor-tag/publish folder.
«. Release/obj.target/hci-ble/src/hci-ble.o
../src/hci-ble.c:9:33: fatal error: bluetooth/bluetooth.h: No such file or directory
compilation terminated.
make: *** [Release/obj.target/hci-ble/src/hci-ble.o] Error 1
make: Leaving directory. «
This is in a Galaxy S4 Active Android phone running debian linux.
root@localhost:/opt/konectera/gitwork/iot-sensor-tag/publish# npm install
npm WARN package.json @ No repository field.
/
noble@0.3.5 install /opt/konectera/gitwork/iot-sensor-tag/publish/node_modules/sensortag/node_modules/noble
node install.js
noble install: platform is «linux’
noble install: running node-gyp .
make: Entering directory ‘/opt/konectera/gitwork/iot-sensor-tag/publish/node_modules/sensortag/node_modules/noble/build’
CC(target) Release/obj.target/hci-ble/src/hci-ble.o
../src/hci-ble.c:9:33: fatal error: bluetooth/bluetooth.h: No such file or directory
#include
^
compilation terminated.
hci-ble.target.mk:78: recipe for target ‘Release/obj.target/hci-ble/src/hci-ble.o’ failed
make: *** [Release/obj.target/hci-ble/src/hci-ble.o] Error 1
make: Leaving directory ‘/opt/konectera/gitwork/iot-sensor-tag/publish/node_modules/sensortag/node_modules/noble/build’
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:810:12)
gyp ERR! System Linux 3.4.0-1429916
gyp ERR! command «node» «/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js» «configure» «build»
gyp ERR! cwd /opt/konectera/gitwork/iot-sensor-tag/publish/node_modules/sensortag/node_modules/noble
gyp ERR! node -v v0.10.32
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok
noble install: done
npm ERR! noble@0.3.5 install: node install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the noble@0.3.5 install script.
npm ERR! This is most likely a problem with the noble package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls noble
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.4.0-1429916
npm ERR! command «/usr/bin/node» «/usr/bin/npm» «install»
npm ERR! cwd /opt/konectera/gitwork/iot-sensor-tag/publish
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0
The text was updated successfully, but these errors were encountered: