Closed emanuel4you closed 2 months ago
I'm not familiar with the AMLOGIC s922x, nor with LibreElec or its toolchain. So can't help you with that. Nevertheless, it is remarkable that the bluepy3-helper
was built without version information.
Could you please post the output from this command:
dt=$(date '+%Y-%m-%d %H:%M'); helpermaker --list; journalctl --since "${dt}"
NOTE: It will also build the bluepy3-helper
as designed.
Are you trying this on different hardware platforms or on different OS's? Please post details on each combination of hardware (make, model and CPU) and OS and Python version.
Did bluepy3
come with LibreELEC pre-installed?
And could you confirm that your BT-modem supports BLE?
Are you trying this on different hardware platforms or on different OS's?
yes, raspberrypi5 and dreambox two. In armbian (on s922X) I've found the issue is Python 3.11 (import error Self) but armbian is not importen for me. I need the BLE Remote in LibreElec.
Did bluepy3 come with LibreELEC pre-installed?
no, I've made the package. GNU Make 4.3 (update added VERSION_STRING):
PKG_NAME="bluepy3"
PKG_VERSION="2.12.1"
PKG_ARCH="arm aarch64"
PKG_SHA256="f38de9f0f2dff0f367826edaaf85a09e152343ab80d08d6b215a5629ec1aa544"
PKG_LICENSE="MIT"
PKG_SITE="https://pypi.org/project/bluepy3"
PKG_URL="https://github.com/Mausy5043/bluepy3/archive/refs/tags/v${PKG_VERSION}.tar.gz"
PKG_DEPENDS_TARGET="toolchain Python3 distutilscross:host"
PKG_SHORTDESC="connect to ble devices."
PKG_LONGDESC="This is a Python3 library to allow communication with Bluetooth Low Energy devices on Linux."
PKG_TOOLCHAIN="manual"
pre_configure_target() {
export PYTHONXCPREFIX="$SYSROOT_PREFIX/usr"
export LDSHARED="$CC -shared"
export CFLAGS="$CFLAGS -fcommon"
export CPPFLAGS="$TARGET_CPPFLAGS -I${SYSROOT_PREFIX}/usr/include/$PKG_PYTHON_VERSION"
sed -i 's!5.70!5.76!'g bluepy3/Makefile
sed -i 's!/tmp/bluez!./bluez!'g bluepy3/Makefile
BUILD_VERSION="${PKG_VERSION}-5.76"
echo "#define VERSION_STRING \"${BUILD_VERSION}\"" > bluepy3/version.h
}
make_target() {
cd bluepy3
make
}
And could you confirm that your BT-modem supports BLE?
yes, both raspberrypi5 and dreambox two/one s922X do support BLE and do run bluepy3 under other os.
original raspberry pi5 OS:
python btle.py 00:09:34:b2:ca:2b public
00002a00-0000-1000-8000-00805f9b34fb
Connecting to: 00:09:34:b2:ca:2b, address type: public
-btle- Running /usr/local/lib/python3.11/dist-packages/bluepy3/bluepy3-helper
-btle- Sent: conn 00:09:34:b2:ca:2b public
-btle- Got: # bluepy3-helper.c version 2.12.1-5.66 built at 16:42:22 on Aug 4 2024
-btle- Got: rsp=$stat; state=$tryconn; dst=00:09:34:b2:ca:2b; mtu=h0; sec=low
-btle- Got: rsp=$stat; state=$conn; dst=00:09:34:b2:ca:2b; mtu=h0; sec=low
-btle- Succesfully connected.
-btle- Sent: disc
-btle- Got: rsp=$stat; state=$conn; dst=00:09:34:b2:ca:2b; mtu=hF7; sec=low
-btle- Updated MTU: 247
-btle- Stopping /usr/local/lib/python3.11/dist-packages/bluepy3/bluepy3-helper
emanuel@raspberrypi:/usr/local/lib/python3.11/dist-packages/bluepy3 $
Could you please post the output from this command: dt=$(date '+%Y-%m-%d %H:%M'); helpermaker --list; journalctl --since "${dt}"
No, because LibreELEC is ro OS, with out make. I've added version string in my build package script for the toolchain but as expected, it does not make a difference.
LibreELEC:~/.kodi/addons/script.module.bluepy3/lib/bluepy3 # python btle.py 00:09:34:b2:ca:2b public
00002a00-0000-1000-8000-00805f9b34fb
Connecting to: 00:09:34:b2:ca:2b, address type: public
-btle- Running /storage/.kodi/addons/script.module.bluepy3/lib/bluepy3/bluepy3-helper
-btle- Sent: conn 00:09:34:b2:ca:2b public
-btle- Got: # bluepy3-helper.c version 2.12.1-5.76 built at 13:51:09 on Aug 7 2024
-btle- Got: rsp=$stat; state=$tryconn; dst=00:09:34:b2:ca:2b; mtu=h0; sec=low
-btle- Got: rsp=$stat; state=$disc; mtu=h0; sec=low
-btle- Stopping /storage/.kodi/addons/script.module.bluepy3/lib/bluepy3/bluepy3-helper
*** -btle- Failed to connect. (5)
...
*** -btle- Failed to connect. (1)
Traceback (most recent call last):
File "/storage/.kodi/addons/script.module.bluepy3/lib/bluepy3/btle.py", line 1076, in <module>
conn = Peripheral(my_device_address)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/storage/.kodi/addons/script.module.bluepy3/lib/bluepy3/btle.py", line 625, in __init__
self._connect(addr, addrType, iface, timeout)
File "/storage/.kodi/addons/script.module.bluepy3/lib/bluepy3/btle.py", line 710, in _connect
raise BTLEConnectError(
BTLEConnectError: (btle) Failed to connect to peripheral 00:09:34:b2:ca:2b, addr type: public, interface None, timeout=32.1
LibreELEC:~/.kodi/addons/script.module.bluepy3/lib/bluepy3 #
installed files:
LibreELEC:~/.kodi/addons/script.module.bluepy3/lib/bluepy3 # ls
__init__.py bluepy3-helper btle.py helpermaker.py
blescan.py bluepy3-helper.c get_services.py uuids.json
LibreELEC:~/.kodi/addons/script.module.bluepy3/lib/bluepy3 #
EDIT: fixed quoting for readability
Are you trying this on different hardware platforms or on different OS's?
yes, raspberrypi5 and dreambox two. In armbian (on s922X) I've found the issue is Python 3.11 (import error Self) but armbian is not importen for me. I need the BLE Remote in LibreElec.
Okay. Let's park the issue with the RPi5/Armbian then. Feel free to create a separate issue for that if you want, but let's focus on the Dreambox/LibreElec issue.
Did bluepy3 come with LibreELEC pre-installed?
no, I've made the package. [...]
Could you please post the output from this command:[...]
I need the version of bluetoothctl
that's installed. It would have been in the output from the helpermaker.py --list
command.
No, because LibreELEC is ro OS, with out make.
.... so you built a custom executable on a different OS, packaged it for LibreElec and that doesn't work? Why would you do that? Does LibreElec not have native bluetooth support?
I've added version string in my build package script for the toolchain but as expected, it does not make a difference.
Indeed, I do also not expect that the versionstring would make any difference. However, building the helper using the helpermaker.py
script ensures that it is built with the correct tools and the correct version of the BlueZ sourcetree. And the versionstring is an indicator of that the right buildprocess was used. As you have built it differently there will be additional unknowns that could contribute to the problem.
Okay. Let's park the issue with the RPi5/Armbian then. Feel free to create a separate issue for that if you want, but let's focus on the Dreambox/LibreElec issue.
Let's park Dreambox/Armbian issues. (I do not build armbian for RPI) and let's focus on LibreElec (Dreambox and RPI), because they got the same os, arch and that issue.
I need the version of bluetoothctl that's installed. It would have been in the output from the helpermaker.py --list command.
As you can see in the first post abouve the issue is the same using "bluetoothctl" in terminal. Connection cound not be established. And that is the main problem! Here the version:
LibreELEC (community): devel-20240623195447-d897522 (AMLGX.aarch64)
LibreELEC:~ # bluetoothctl -v
bluetoothctl: 5.76
LibreELEC:~ #
.... so you built a custom executable on a different OS, packaged it for LibreElec and that doesn't work? Why would you do that? Does LibreElec not have native bluetooth support?
yes, inside the LE toolchain (docker). I've also built the Python module "evdev" for my driver, and it works as expected. So I thing the "bluepy3" was also built well. I think the problem comes from further down. Either it's the bluez version or the kernel itself. LibreElec has got a bluetooth scanner, but it do not find the Dreambox BLE Remote.
Building "bluepy3" in LE toolchain, brings up only one error while building: in lines: https://github.com/Mausy5043/bluepy3/blob/devel/bluepy3/Makefile#L35 https://github.com/Mausy5043/bluepy3/blob/devel/bluepy3/Makefile#L36 there are two times "$(IMPORT_SRCS)" and the toolchain do exec this two times. So there is a error msg: "bluez src already exists" I can can patch this lines later - but that's not the problem, just unpleasant to build.
EDIT: fixed quoting for readability (again)
Building "bluepy3" in LE toolchain, brings up only one error while building: in lines: https://github.com/Mausy5043/bluepy3/blob/devel/bluepy3/Makefile#L35 https://github.com/Mausy5043/bluepy3/blob/devel/bluepy3/Makefile#L36 there are two times "$(IMPORT_SRCS)" and the toolchain do exec this two times. So there is a error msg: "bluez src already exists" I can can patch this lines later - but that's not the problem, just unpleasant to build.
There is nothing wrong with the Makefile. Line 35 has the target name and lists the prerequisites. Line 36 is the command to be executed. Your toolchain seems to be defective.
Ref.: https://www.gnu.org/software/make/manual/html_node/Rule-Introduction.html
yes, inside the LE toolchain (docker). I've also built the Python module "evdev" for my driver, and it works as expected. So I thing the "bluepy3" was also built well. I think the problem comes from further down. Either it's the bluez version or the kernel itself. LibreElec has got a bluetooth scanner, but it do not find the Dreambox BLE Remote.
If built against the BlueZ sourcetree for v5.76 it should work. This indeed doesn't seem to be caused by bluepy3
.
Tip: you can make DEBUGGING=1 ...
to enable the display of debugging info from the helper and the BT stack. Maybe that gives some info about what is going on.
Closing this issue assuming this is resolved with the latest release. Please feel free to re-open if you wish to add additional info.
Hello, maybe someone can help me or know more about the topic I've build bluepy3 modules in LibreElec toolcain. First I've used bluez-5.72 src, for building bluepy3, later 5.70, 5.66 - with same results :-(
I have got this issues on amlogic s922x, raspberry pi5 (current LibreElec). I have got this issues on amlogic s922x - pip3 install (current armbian Ubuntu builds).
On Raspbian debian (bluez-5.66, kernel 6.6.y) it works normal.
what can I do?
see log: