openaps / oref0

oref0: The open reference implementation of the OpenAPS reference design.
http://www.OpenAPS.org
MIT License
430 stars 395 forks source link

bluez 5.47/5.48 and openxshareable issue #847

Closed rkresha closed 6 years ago

rkresha commented 6 years ago
File "/usr/local/lib/python2.7/dist-packages/openxshareble/ble/uart.py", line 78, in pair_auth_code
    self._auth = self._uart.find_characteristic(self.AUTH_UUID)
  File "/home/root/src/Adafruit_Python_BluefruitLE/Adafruit_BluefruitLE/interfaces/gatt.py", line 48, in find_characteristic
    for char in self.list_characteristics():
  File "/home/root/src/Adafruit_Python_BluefruitLE/Adafruit_BluefruitLE/bluez_dbus/gatt.py", line 56, in list_characteristics
    paths = self._props.Get(_SERVICE_INTERFACE, 'Characteristics')
  File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 145, in __call__
    **keywords)
  File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.InvalidArgs: No such property 'Characteristics'

Fixed by rolling back to 5.37 of bluez... probably need to investigate a fix so we can stay current with bluez. Note: in the code we jumped from 5.37 directly to 5.47 due to #724 ... so I'm vulnerable now, but functionality over security.

cduarte commented 6 years ago

Do you use openxshareable? I read about the openxshareable this week and saw that the last update is about 2 yesars ago.

rkresha commented 6 years ago

Yep, G4 w/ share, openxshareable is my offline method

cduarte commented 6 years ago

Thanks for the answer :)

do you use this: https://github.com/openaps/openxshareble ?

cduarte commented 6 years ago

So with this you don't need to use a phone with xdrip? correct? if yes... is perfect :)

rkresha commented 6 years ago

Thanks for the answer :)

do you use this: https://github.com/openaps/openxshareble ?

Yes, if you set your CGM when running oref0-setup.sh to "ShareBLE" it will clone that repo. Or I've run into a dependency issue where it needs to make the bluetooth driver first before it calls the script so I have the clone of that repo before I run oref0-setup.sh (I don't remember the specific error and maybe they've fixed it by now I just still continue to do it the way I used to get it to work)... Do you have a G4 w/ share or a different CGM?

rkresha commented 6 years ago

So with this you don't need to use a phone with xdrip? correct? if yes... is perfect :)

Correct, it will grab BG's from the dexcom and upload them to NS... sometime it can be flaky but reboot the rig and you are back in business. You still need internet but that is where the hotspot with the phone comes in. I run xdrip on my phone still and use openxshareable to make sure something is always uploading BG's... since it can be a PITA to keep turning on the mobile hotspot on my phone

cduarte commented 6 years ago

I have a dexcom G4 with Share but is model pediatric (function normaly with xdrip at android)

cduarte commented 6 years ago

The g4 share send the values to rig and the rig use directly the bg all offline or g4 share send the values to rig and that send to ns (need internet) and the rig get from ns (from internet). ?

So the internet is only to send the values to ns ?

rkresha commented 6 years ago

The g4 share send the values to rig and the rig use directly the bg all offline

Technically the rig pulls values from the G4 via bluetooth and then it will upload the BG to NS (however the uploading is not required for the loop to function)

So the internet is only to send the values to ns ?

yes

cduarte commented 6 years ago

Thanks for the explain

cduarte commented 6 years ago

Please explain the correct form to install. I need to get the bluettoth drive first? I need to do the instalation tutorial of this https://github.com/openaps/openxshareble and then run the oref0-setup.sh with option ShareBLE

PieterGit commented 6 years ago

@rkresha I think technically it's not bluez that's incompatible, but it's the Adafruit_Python_BluefruitLE library. See https://github.com/adafruit/Adafruit_Python_BluefruitLE/issues/23 Can you test the fix mentioned on https://github.com/donatieng/Adafruit_Python_BluefruitLE/commit/af46b05cbcfd82110c8bbd08ed3d483de128fed1 and see if that fixes your problem. I think it's best to report on the upstream Adafruit_Python_BluefruitLE issue if the fix works, and first see if they can merge the fix to their version, release a new Adafruit_Python_BluefruitLE version that we as oref0 can use.

rkresha commented 6 years ago

@PieterGit Yep, did the trick. Looks like we are using a Ben West's fork of the Adafruit and have a TODO of getting that moved over the openaps anyways. Now is as good of a time as ever to do so. Thoughts?

echo Checking Adafruit_BluefruitLE installation
        if ! python -c "import Adafruit_BluefruitLE" 2>/dev/null; then
            if [ -d "$HOME/src/Adafruit_Python_BluefruitLE/" ]; then
                echo "$HOME/src/Adafruit_Python_BluefruitLE/ already exists; pulling latest master branch"
                (cd $HOME/src/Adafruit_Python_BluefruitLE && git fetch && git checkout wip/bewest/custom-gatt-profile && git pull) || die "Couldn't pull latest Adafruit_Python_BluefruitLE wip/bewest/custom-gatt-profile"
            else
                echo -n "Cloning Adafruit_Python_BluefruitLE wip/bewest/custom-gatt-profile: "
                # TODO: get this moved over to openaps and install with pip
                (cd $HOME/src && git clone -b wip/bewest/custom-gatt-profile https://github.com/bewest/Adafruit_Python_BluefruitLE.git) || die "Couldn't clone Adafruit_Python_BluefruitLE wip/bewest/custom-gatt-profile"
            fi
PieterGit commented 6 years ago

Well @scottleibrand asked Adafruit if they are maintaining their library. I rather have an upstream library to which we sent PR if we need it, then maintaining a forked library ourselves.

I asked again and tagged Adafruit in https://github.com/adafruit/Adafruit_Python_BluefruitLE/pull/8 I would say that if they don't respond in january we should fork the library and maintain a fork with all the patches we need.

In oref0 we can combine upgrading to this new Adafruit_Python_BluefruitLE library with http://www.bluez.org/release-of-bluez-5-48/ and https://github.com/openaps/oref0/pull/876 . The new bluez API is now not experimental anymore.

rkresha commented 6 years ago

"Get" with signature "ss" on interface "org.freedesktop.DBus.Properties" doesn't exist

Get this error now with bluez5.48 and openxshareable #876

rkresha commented 6 years ago

Used https://github.com/getsenic/gatt-python/commit/f38fc5136c666d1691c74d04cc752c94630acbe0 to get passed that error but now I'm just getting unable to find UART device. I think we need to revisit openxshareable and make some adjustments

tghoward commented 6 years ago

@PieterGit the fix here https://github.com/donatieng/Adafruit_Python_BluefruitLE/commit/af46b05cbcfd82110c8bbd08ed3d483de128fed1 works for me too (I think!) when using bluez 5.47. I also could remove the --experimental flag. I'm also trying out Debian Stretch (on an Edison).

tghoward commented 6 years ago

Drat. Need to try 5.48. Missed that.

tghoward commented 6 years ago

yes, I now get the same issue as @rkresha: Method "Get" with signature "ss" on interface "org.freedesktop.DBus.Properties" doesn't exist

danamlewis commented 6 years ago

If this is still an issue - please take a look at the 0.7.0 WIP (https://github.com/openaps/oref0/pull/973) as the openxshareble functionality will be incorporated there as part of the Go switchover. Closing this in the meantime.

rkresha commented 6 years ago

Feature branch related to this PR going into 0.7.0-dev #969 (go-dexcom)