Changeset d0c3ef4 in subsurface


Ignore:
Timestamp:
Jun 26, 2017, 10:20:01 PM (4 months ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
4f3a9cdb
Parents:
bbde0a1
git-author:
Linus Torvalds <torvalds@…> (06/26/17 18:17:06)
git-committer:
Dirk Hohndel <dirk@…> (06/26/17 22:20:01)
Message:

Bluetooth: make LE-only devices add "LE:" as an address prefix

This seems a bit odd, but it actually has three different reasons for it:

  • It's a visual indication of BT LE mode for users
  • the rfcomm code only works with legacy BT support, and if we scan a device that only does LE, we want the custom serial code to instead automatically fall back on a "emulate serial over LE packets" model.
  • we want rfcomm to remain the default for devices that do both legacy BT _and_ LE, but we want people to have the ability to override the choice manually. They can now do so by just editing the address field and adding the "LE:" prefix manually, and it automatically gets saved for next time.

So while a bit hacky, it's actually a very convenient model that not
only works automatically, but allows the manual override.

Signed-off-by: Linus Torvalds <torvalds@…>
Signed-off-by: Dirk Hohndel <dirk@…>

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • core/qt-ble.cpp

    r6f1590b rd0c3ef4  
    122122dc_status_t qt_ble_open(dc_custom_io_t *io, dc_context_t *context, const char *devaddr)
    123123{
     124        /*
     125         * LE-only devices get the "LE:" prepended by the scanning
     126         * code, so that the rfcomm code can see they only do LE.
     127         *
     128         * We just skip that prefix (and it doesn't always exist,
     129         * since the device may support both legacy BT and LE).
     130         */
     131        if (!strncmp(devaddr, "LE:", 3))
     132                devaddr += 3;
     133
    124134        QBluetoothAddress remoteDeviceAddress(devaddr);
    125135
  • desktop-widgets/btdeviceselectiondialog.cpp

    r9021a44 rd0c3ef4  
    421421{
    422422        if (selectedRemoteDeviceInfo) {
    423                 return selectedRemoteDeviceInfo.data()->address().toString();
     423                QBluetoothDeviceInfo *deviceInfo = selectedRemoteDeviceInfo.data();
     424                QBluetoothDeviceInfo::CoreConfigurations flags;
     425                QString prefix = "";
     426
     427                flags = deviceInfo->coreConfigurations();
     428                if (flags == QBluetoothDeviceInfo::LowEnergyCoreConfiguration)
     429                        prefix = "LE:";
     430                return prefix + deviceInfo->address().toString();
    424431        }
    425432
Note: See TracChangeset for help on using the changeset viewer.