0

我正在尝试让以下 git 运行https://github.com/com2m/anki-overdrive-goes-iot/blob/master/Documentation.md#bluez5.42

在构建它时,我遇到了一个错误,这似乎是 gcc 7 中的一个错误。我在 Qmake 之后运行 make 时遵循了编译错误来编译它。

之后我在运行时遇到了 Segemntationfaultbuild/ankioverdrive

运行 gdb 在 BT Full 中给我以下信息

#0  0x00007ffff7931ccb in QLowEnergyController::connectToDevice() () from /usr/lib/x86_64-linux-gnu/libQt5Bluetooth.so.5
No symbol table info available.
#1  0x00005555555718cc in AnkiCar::reconnect (this=0x5555557a82d0) at src/ankicar.cpp:444
No locals.
#2  0x00005555555654b3 in DriveMode::requestBatteryUpdate (this=0x5555557a6400) at src/drivemode.cpp:102
        racecar = 0x5555557a82d0
        _container_ = {c = {<QListSpecialMethods<Racecar*>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4, 
                          _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x5555557a85a0}, d = 0x5555557a85a0}}, i = {i = 0x5555557a85b8}, e = {i = 0x5555557a85d0}, 
          control = 1}
#3  0x00005555555768df in DriveMode::qt_static_metacall (_o=0x5555557a6400, _c=QMetaObject::InvokeMetaMethod, _id=8, _a=0x7fffffffdf20) at moc_drivemode.cpp:156
        _t = 0x5555557a6400
#4  0x00007ffff745f5b5 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
No symbol table info available.
#5  0x00007ffff746c027 in QTimer::timeout(QTimer::QPrivateSignal) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
No symbol table info available.
#6  0x00007ffff746c388 in QTimer::timerEvent(QTimerEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
No symbol table info available.
#7  0x00007ffff74600db in QObject::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
No symbol table info available.
#8  0x00007ffff7430991 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
No symbol table info available.
#9  0x00007ffff7488d8e in QTimerInfoList::activateTimers() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
No symbol table info available.
#10 0x00007ffff7489551 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
No symbol table info available.
#11 0x00007ffff5002287 in g_main_context_dispatch () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#12 0x00007ffff50024c0 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#13 0x00007ffff500254c in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#14 0x00007ffff74898ef in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
No symbol table info available.
#15 0x00007ffff742e9ea in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
No symbol table info available.
#16 0x00007ffff7437a84 in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
No symbol table info available.
#17 0x000055555555b42e in main (argc=1, argv=0x7fffffffe468) at src/main.cpp:29
        a = <incomplete type>

我认为这是bluez的问题。我正在运行 bluez 5.47,同时通过运行确保配置允许实验模式

./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc --localstatedir=/var --enable-experimental --enable-maintainer-mode

并改变了/lib/systemd/system/bluetooth.service

我通过调用确保我的蓝牙正在运行

sudo hciconfig hci0 up

用我的蓝牙设备蜂鸣 hci0

但仍然没有任何成功

我目前正在Kubuntu 18.04作为发行版尝试所有这些。

我不知道如何解决这个问题。

4

1 回答 1

0

ankicar.cpp在尝试重新连接之前,我已更改为检查蓝牙控制器当前是否未连接:

void AnkiCar::reconnect() {
    if (lowEnergyController != 0) {
        if (lowEnergyController->state() == QLowEnergyController::UnconnectedState)
            lowEnergyController->connectToDevice();
    }
}

通过此更改,汽车得到连接并且连接似乎稳定(即使没有--experimental 如上所述的开关)。

[E6:45:5A:32:6E:4A]>> CONNECTED.
[E6:45:5A:32:6E:4A]>> SERVICE DISCOVERY FINISHED.
[E6:45:5A:32:6E:4A]>> FOUND ANKI SERVICE.
[E6:45:5A:32:6E:4A]>> SERVICE CHARACTERISTICS DISCOVERED.
[E6:45:5A:32:6E:4A]>> SDK ON.
[E6:45:5A:32:6E:4A]>> DESCRIPTOR SUCCESSFULLY WRITTEN.
[E6:45:5A:32:6E:4A]>> NOT CHARGING, NOT ON TRACK.
[E6:45:5A:32:6E:4A]>> ATTEMPT TO ACCESS GAMEPAD FAILED.
[E6:45:5A:32:6E:4A]>> USING GAMEPAD #1.
[E6:45:5A:32:6E:4A]>> READY.
[E6:45:5A:32:6E:4A]>> NOT CHARGING, ON TRACK.

您需要在轨道上稍微移动汽车以使其识别为ON TRACK. 我已经安装了以下软件包以便能够构建项目:

pi@raspberrypi:~ $ sudo apt-get install bluetooth bluez blueman
pi@raspberrypi:~ $ sudo apt-get install bluez bluez-firmware       
pi@raspberrypi:~ $ sudo apt-get install pi-bluetooth
pi@raspberrypi:~ $ sudo apt-get install qt5-qmake
pi@raspberrypi:~ $ sudo apt-get install qt5-default
pi@raspberrypi:~ $ sudo apt-get install qtconnectivity5-dev

我还需要添加QMAKE_CFLAGS_ISYSTEM = -I到项目文件中ankioverdrive.pro(参见/usr/include/c++/7/cstdlib:75:15: fatal error: stdlib.h: No such file or directory #include_next <stdlib.h>

QT 文档在 http://doc.qt.io/qt-5.6/qlowenergycontroller.html#connectToDevice中说

void QLowEnergyController::connectToDevice()
// Connects to the remote Bluetooth Low Energy device.

如果控制器的 state() 不等于 UnconnectedState,则此函数不执行任何操作。成功建立连接后,将发出 connected() 信号。在 Linux/BlueZ 系统上,无法使用此类的两个实例连接到同一个远程设备。对该函数的第二次调用可能会因错误而失败。在未来的版本中可能会删除此限制。

于 2019-01-05T11:19:58.913 回答