Mar 162014
 

fitbit linux
Recentemente ho ricevuto un FitBit flex come regalo, e mi piace, questo dispositivo personale registra i passi, la distanza e le calorie bruciate. Di notte, traccia la qualità del sonno e ti sveglia silenziosamente al mattino. Basta controllare le luci per vedere come si accumulano rispetto al proprio obiettivo personale. Flex consente di impostare un obiettivo e utilizza luci a LED per mostrare come si sta andando. Ogni indicatore rappresenta il 20% del proprio obiettivo . Si sceglie quale – passi, calorie, o la distanza. Si accende come un tabellone, invogliando ad essere ogni giorno più attivi.

Flex sincronizza automaticamente i dati con PC e Mac con il dongle Wireless di Fitbit ( incluso), molti dispositivi iOS ed alcuni telefoni Android si collegano al dispositivo. Ora tutto questo suono fantastico e davvero divertente se vi piace prendere le vostre statistiche e vedere bei grafici, ma c’è un piccolo (grande) problema circa Fitbit, non supporta ufficialmente Linux.

Certo, è possibile utilizzare un smartphone , ma in generale mi piace l’idea di utilizzare i miei computer Linux per tutto e facendo alcune ricerche ed alcuni test sono stato in grado di sincronizzare con successo il mio flex con il mio Linux Mint 16 .



Da Fitbit one and Debian:

In primo luogo, inizierò con alcune informazioni tecniche sul Fitbit. I nuovi sistemi FitBit utilizzano Bluetooth 4.0 LE per la sincronizzazione, piuttosto che il protocollo ANT proprietario. Questo è un bene ed un male per gli sviluppatori. Il protocollo Bluetooth è abbastanza aperto per sviluppare, ma vi sono ancora problemi di come comunicare con il tracker Fitbit. Fortunatamente per noi, ci sono sviluppatori che hanno lavorato sui modi per farlo .

La più antica implementazione per sincronizzare Fitbit era con libfitbit – questo era il protocollo ANT per sincronizzare i tracker. Questo si è evoluto fino a quando una brava persona di nome Benoît Allard ha creato uno script python chiamato galileo . Questo è lo script che ci accingiamo a utilizzare per sincronizzare il tracker. Una cosa interessante Fitbit, è che il server analizza l’ID del dispositivo e collega i dati trasmessi ai conti appropriati, piuttosto che un’applicazione client – side che svolgesse il collegamento ad un determinato account. Questo rende la sincronizzazione un po’ più facile.

Galileo è un programma di utilità Python per sincronizzare in modo sicuro un dispositivo Fitbit con il servizio web Fitbit. Esso permette di consultare i dati sul loro sito web, e le loro applicazioni.

Tutti i tracker basati su Bluetooth sono supportati. Questi sono:

  • Fitbit One
  • Zip Fitbit
  • Fitbit Flex
  • Probabilmente Fitbit Force

nota : Il tracker Ultra di Fitbit è ** non supportato ** in quanto comunica utilizzando il protocollo ANT. Per sincronizzarlo si può utilizzare libfitbit.

Le caratteristiche principali di Galileo sono:

  • Sincronizza i tracker Fitbit con il server Fitbit utilizzando il dongle incluso.
  • Comunica (tramite HTTPS) con il server Fitbit.
  • Salvare tutti i tuoi dati a livello locale con un dump per un eventuale successiva analisi.

Dan, l’autore dell’articolo ha correttamente installato la versione stabile di Galileo in una Debian 7 e tutto ha funzionato senza problemi per lui, io non ho avuto la stessa fortuna sulla mia Mint 16, quindi probabilmente la maggior parte degli utenti di Ubuntu avranno i miei stessi problemi, ma con qualche cambiamento sono riuscito a farlo funzionare, ecco come.

Attenzione: Galileo è ancora nelle sue prime fasi di sviluppo ed è disponibile solo dalla riga di comando, quindi non aspettatevi di avere un’applicazione grafica simile a quella che si trova in Windows, per usarlo si deve lavorare sul terminale, la buona notizia è che non è così difficile farlo funzionare e probabilmente in futuro qualche applicazione grafica basata su di esso sarà disponibile per tutti.

Installare le librerie necessarie

Galileo è scritto in python e quindi abbiamo bisogno delle librerie usb per python, per distribuzioni basate su Debian potete usare questo comando:

sudo apt-get install python-usb python-requests

Inoltre Galileo richiede le librerie pyusb alla versione 1.0 o superiore, la 0.4 non è supportata, quindi ho seguito il suggerimento di Dan ed ho aggiornato manualmente la libreria python-usb con le sue istruzioni:

Scaricare lo script pyusb dal file zip che si trova qui .

Decomprimere la cartella in una posizione comoda.

Andare nella nuova directory in un terminale come root ed eseguire il seguente comando:

 python setup.py install

Ora avete i prerequisiti installati.

Installare Galileo, metodo 1

Come primo metodo vi suggerisco di provare a installare Galileo in modo “standard”, questo sembra funzionare per alcune distribuzioni (Debian e Arch), per fare questo aprire un terminale e digitare:

sudo pip install galileo

Dovreste avere un output di questo tipo:

$ sudo pip install galileo
Downloading/unpacking galileo
  Downloading galileo-0.3.1.tar.gz
  Running setup.py egg_info for package galileo
 
Requirement already satisfied (use --upgrade to upgrade): requests in /usr/lib/python2.7/dist-packages (from galileo)
Requirement already satisfied (use --upgrade to upgrade): pyusb in /usr/local/lib/python2.7/dist-packages (from galileo)
Installing collected packages: galileo
  Running setup.py install for galileo
 
    Installing galileo script to /usr/local/bin
Successfully installed galileo
Cleaning up...

Ora è possibile testare questa versione di Galileo con il comando :

 sudo galileo

Se tutto funziona dovreste vedere qualcosa di simile a :

1 trackers found, 0 skipped, 1 successfully synchronized

E si può passare alla sezione “Come eseguire Galileo come utente diverso da root” , nel mio caso ho ottenuto questo errore :

$ sudo galileo
Traceback (most recent call last):
  File "/usr/local/bin/galileo", line 9, in 
    load_entry_point('galileo==0.3.1', 'console_scripts', 'galileo')()
  File "/usr/local/lib/python2.7/dist-packages/galileo.py", line 564, in main
    total, success, skipped = syncAllTrackers(cmdlineargs.force, cmdlineargs.dump)
  File "/usr/local/lib/python2.7/dist-packages/galileo.py", line 423, in syncAllTrackers
    fitbit.disconnect()
  File "/usr/local/lib/python2.7/dist-packages/galileo.py", line 203, in disconnect
    self.dongle.ctrl_write([2, 2])
  File "/usr/local/lib/python2.7/dist-packages/galileo.py", line 150, in ctrl_write
    l = self.dev.write(0x02, data, self.CtrlIF.bInterfaceNumber, timeout=timeout)
TypeError: write() got multiple values for keyword argument 'timeout'

Installare Galileo, metodo 2

Ho scaricato lo zip della versione più recente dalla pagina del progetto e l’ho decompresso.
Ora, nella nuova directory troverete il comando run , che in questa versione sostituisce il comando galileo .

Per testarlo muoversi nella nuova directory e dare il comando:

sudo ./run

Ancora una volta, se si vede un output di successo tutto è fatto e si può passare alla sezione successiva, nel mio caso avevo ancora un errore:

$ sudo ./run
No handlers could be found for logger "galileo.config"
# A serious error happened, which is probably due to a
# programming error. Please open a new issue with the following
# information on the galileo bug tracker:
#    https://bitbucket.org/benallard/galileo/issues/new
# ./run: 0.4dev
# Python: 2.7.5+ (default, Feb 27 2014, 19:37:08) [GCC 4.8.1]
# Platform: Linux mint-desktop 3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9 16:20:46 UTC 2013 x86_64 x86_64
# pyusb: 1.0.0b2
# requests: 1.2.3
# yaml: own version
Traceback (most recent call last):
  File "./run", line 5, in 
    main()
  File "/home/linuxaria/Downloads/benallard-galileo-540c1f6d394a/galileo/main.py", line 239, in main
    }[config.mode](config)
  File "/home/linuxaria/Downloads/benallard-galileo-540c1f6d394a/galileo/main.py", line 174, in sync
    total, success, skipped = syncAllTrackers(config)
  File "/home/linuxaria/Downloads/benallard-galileo-540c1f6d394a/galileo/main.py", line 37, in syncAllTrackers
    fitbit.disconnect()
  File "/home/linuxaria/Downloads/benallard-galileo-540c1f6d394a/galileo/tracker.py", line 36, in disconnect
    self.dongle.ctrl_write([2, 2])
  File "/home/linuxaria/Downloads/benallard-galileo-540c1f6d394a/galileo/dongle.py", line 115, in ctrl_write
    l = self.dev.write(0x02, data, self.CtrlIF.bInterfaceNumber, timeout)
TypeError: write() takes at most 4 arguments (5 given)

Guardando nella lista di bug di Galileo ho trovato questa  informazione:

Benoît Allard

This is a duplicate of issue #36 and #27. Please use a tagged release of pyusb, or remove the third parameter in the calls to write and read in galileo/dongle.py

Io non sono un programmatore python, ma ho provato a seguire l’istruzione e così ho tolto il terzo parametro nel file galileo/dongle.py, per farla breve ho rimosso il parametro self.CtrlIF.bInterfaceNumber nelle linee: 115, 122, 136 e 144 (il numero di riga potrebbe cambiare nelle versioni future).

Questo è un diff dal file originale e quello ho cambiato:

115c115
< l = self.dev.write(0x02, data, self.CtrlIF.bInterfaceNumber, timeout) --- >         l = self.dev.write(endpoint=0x02, data=data, timeout=timeout)
122c122
< data = self.dev.read(0x82, length, self.CtrlIF.bInterfaceNumber, --- >             data = self.dev.read(0x82, length,
136c136
< l = self.dev.write(0x01, msg.asList(), self.DataIF.bInterfaceNumber, --- >         l = self.dev.write(0x01, msg.asList(), 
144c144
< data = self.dev.read(0x81, 32, self.DataIF.bInterfaceNumber, --- >             data = self.dev.read(0x81, 32,

E con questo cambiamento finalmente funziona con Mint 16 !!

$ ./ sudo run -v
2014-03-16 22:38:11,302:INFO: Running in mode: sync
2014-03-16 22:38:11,314:INFO: Disconnecting from any connected trackers
2014-03-16 22:38:13,328:INFO: Discovering trackers to synchronize
2014-03-16 22:38:17,340:INFO: 1 trackers discovered
2014-03-16 22:38:17,340:INFO: Attempting to synchronize tracker EDB71B44D7D7
2014-03-16 22:38:17,353:INFO: Starting new HTTPS connection (1): client.fitbit.com
2014-03-16 22:38:26,911:INFO: Getting data from tracker
2014-03-16 22:38:27,819:INFO: Sending tracker data to Fitbit
2014-03-16 22:38:27,821:INFO: Starting new HTTPS connection (1): client.fitbit.com
2014-03-16 22:38:29,566:INFO: Successfully sent tracker data to Fitbit
2014-03-16 22:38:29,567:INFO: Passing Fitbit response to tracker
1 trackers found, 0 skipped, 1 successfully synchronized

Opzioni utili di Galileo

Stò utilizzando la versione 0.4dev, nella versione 0.3 potreste non avere tutte queste opzioni:

Livello di logging :
-v, –verbose Mostra i progressi durante la sincronizzazione
-d, –debug Mostra le attività interne (implica anche l’output dell’opzione verbose)
-q, –quiet Mostra solo gli errori ed il sommario finale (default)

se sincronizzare anche se il tracker segnala un recente sync (< 15 minuti) --force --no-force DEFAULT Quindi, per impostazione predefinita, se si utilizza il comando run 2 volte di seguito NON invierà i dati a fitbit.com e vedrete un messaggio di skipping:

$ sudo ./run  -v
No handlers could be found for logger "galileo.config"
2014-03-16 22:39:51,946:INFO: Disconnecting from any connected trackers
2014-03-16 22:39:53,959:INFO: Discovering trackers to synchronize
2014-03-16 22:39:57,971:INFO: 1 trackers discovered
2014-03-16 22:39:57,972:INFO: Tracker EDB71B44D7D7 was recently synchronized; skipping for now
2014-03-16 22:39:57,972:INFO: Tracker EDB71B44D7D7 is to be skipped due to configuration; skipping
1 trackers found, 1 skipped, 0 successfully synchronized
Se salvare o no il megadump su file:
 
--dump DEFAULT
--no-dump
 
I dump si trovano per default nella directory ~/.galileo/YOURTRACKERID/ e sono file binari, se non avete intenzione di usarli si può usare l'opzione --no-dump.
 
<h3>Come eseguire Galileo come utente non privilegiato</h3>
 
L'esecuzione di galileo richiede sudo, ma si può aggirare questa limitazione aggiungendo una semplice regola udev. Creare e aggiungere quanto segue a /etc/udev/rules.d/99-fitbit.rules
 
<pre lang="bash">SUBSYSTEM=="usb", ATTR{idVendor}=="2687", ATTR{idProduct}=="fb01", SYMLINK+="fitbit", MODE="0666"

Non dimenticatevi di:

Fare un restart dei servizi udev con :

sudo service udev restart

.
togliere e rimettere il dongle usb fornito da fitbit per attivare la nuova regola.

Conclusioni

Come si può vedere il progetto è ancora nuovo ed ha bisogno di qualche ritocco per funzionare, ma ha un sacco di potenzialità ed opzioni utili.
Una volta che funziona sul vostro PC è possibile impostare un cron ogni 30 minuti o più per sincronizzare i dati con il sito web, oppure è possibile eseguirlo come demone (solo versione 0.4 o successiva) ed avere tutte le statistiche aggiornate dal vostro PC GNU/Linux.

Ora è anche possibile invitarmi ad essere vostro amico su fitbit.com, la mia email è [email protected]

Buon allenamento a tutti gli utenti GNU/Linux !


Popular Posts:

Flattr this!

  36 Responses to “Come sincronizzare il proprio Fitbit usando Linux”

  1. Galileo is great! One less reason to keep Windows around in a VM.

    After I downloaded galileo, it installed on Fedora 19 without a hitch. I used the following two commands

    yum -y install python-pip pyusb python-requests
    pip install galileo

    Looking forward to seeing the evolution of this product.

  2. Excellent, thank you for this guide.
    I only have one issue left now and thats running it as non sudo
    Followed your guide and created the udev rule, restarted udev etc and it works, but only once , after that it will only work using sudo.
    Seems to work if i pull dongle out and put it back in but will have to check that again in a bit.

    Again thank you for your superb guide

  3. I’ve made it easier for Ubuntu users and packaged galileo in a PPA, so now all you need to do is `sudo add-apt-repository ppa:cwayne18 && sudo apt-get update && sudo apt-get install galileo` and then reboot, and syncing will take place automatically

    • Can this synch via the USB cable without the dongle on Ubuntu?

    • Great job Chris !!! Been trying get sync for a couple of weeks with no luck… Tried on daughter’s Mac and it synced yesterday….
      Tried your improved program tonight and saw this message:

      user@user-HP-Pavilion-g6-Notebook-PC:~$ galileo
      Tracker: BFEBF806E5E6: Skipped because recently synchronised

      Hope this means that the PC Dongle is talking with the fitbit charge HR. Am running Kubuntu 14.04 .

      Again, Thank you so much !!!

      Jim

  4. Followed Chris’s instructions for Ubuntu dated 04/26/2014 above on 14.04 amd64 and was advised “Unable to locate package galileo.”

  5. The install mostly worked for Ubuntu Precise, except for galileo itself.
    ]$ sudo apt-get install galileo
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: Unable to locate package galileo

    ]$ sudo apt-get install fitbit-steps-indicator
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    The following packages were automatically installed and are no longer required:
    libts-0.0-0:i386 twolame linux-headers-3.2.0-29
    linux-headers-3.2.0-29-generic libaften0 nvidia-settings-304 mjpegtools
    Use ‘apt-get autoremove’ to remove them.
    The following NEW packages will be installed:
    fitbit-steps-indicator
    0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
    Need to get 8,070 B of archives.
    After this operation, 60.4 kB of additional disk space will be used.
    Get:1 http://ppa.launchpad.net/cwayne18/fitbit/ubuntu/ precise/main fitbit-steps-indicator amd64 0.2~precise1 [8,070 B]
    Fetched 8,070 B in 0s (25.4 kB/s)
    Selecting previously unselected package fitbit-steps-indicator.
    (Reading database … 839219 files and directories currently installed.)
    Unpacking fitbit-steps-indicator (from …/fitbit-steps-indicator_0.2~precise1_amd64.deb) …
    Setting up fitbit-steps-indicator (0.2~precise1) …

  6. This is fantastic. I was wanting to get this going on Raspberry Pi.
    Worked on it with both Raspbian and Pidora. Pidora required less work.

    Raspbian:
    be sure to apt-get update and apt-get dist-upgrade and apt-get install python-requests (as mentioned above)
    usbhid.quirks=0x2687:0xfb01:0x0004 added to /boot/cmdline.txt (to keep usbhid from taking over the dongle)
    manual upgrade of libusb (1.0.19 I think, http://sourceforge.net/projects/libusb/, download, unpack, ./configure, make and make install — configure required more packages but I don’t recall which) in order for 1.0.0b2 of pyusb and 0.5dev (maybe 0.4 too) of galileo to work.

    Pidora needed pyusb updated only.

    galileo needed adjustments to the write and read params in dongle.py similarly as mentioned above.

    Also had trouble running in daemon mode (my preference). Kept getting Resource busy on the second run. Finally figured out how to fix that (after many hours trying to understand the code). In dongle.py in class USBDevice change:

    def __del__(self):
    pass

    to:

    def __del__(self):
    self.dev.reset()
    pass

    This made it work nicely.

    Now just need to add wifi dongle and connect to local wireless, pick a nice central location and power it up and let it go.

    • Your fix has been integrated into galileo. Thank you very much !

      Next time that you spend some time fixing an open-source project, consider proposing the change to the original project so that more people can benefit from it ! I would probably have never seen it on my own !

      • I agree. Thank you for your program. Is there a plan to use a 3rd party/native BLE instead of a fitbit dongle?
        I would like to see a version that uses the ANT dongle, for backward compatibility.

        Would like to get in touch with some development work. You can contact me at the email address below. Thanks.

  7. I have the same unable to locate package issue:
    E: unable to locate package galileo

    Ubuntu version is 12.04

  8. Is this known to work with Fitbit Charge?

  9. I had to register my FitBit Charge on a Windows 7 machine but it appears I am able to sync with Fitbit using galileo.

    Is there a way to register a FitBit using galileo?

  10. Hello,
    Could someone help me? It looks that I successfuly install galileo but it failed to discover tracker. I have this error:
    **
    galileo -d
    2015-01-09 20:50:08,810:DEBUG: Configuration: {‘httpsOnly’: True, ‘logLevel’: 10, ‘doUpload’: True, ‘keepDumps’: True, ‘includeTrackers’: None, ‘forceSync’: False, ‘rcConfigName’: None, ‘dumpDir’: ‘~/.galileo’, ‘daemonPeriod’: 15000, ‘excludeTrackers’: set([]), ‘mode’: ‘sync’}
    2015-01-09 20:50:08,810:DEBUG: galileo initialising
    2015-01-09 20:50:08,829:INFO: Disconnecting from any connected trackers
    2015-01-09 20:50:08,830:DEBUG: –> 02 – 2
    2015-01-09 20:50:08,830:DEBUG: Switching to a newer pyusb compatibility mode
    2015-01-09 20:50:08,836:DEBUG: <– CancelDiscovery
    2015-01-09 20:50:08,840:DEBUG: <– TerminateLink
    2015-01-09 20:50:08,842:DEBUG: <– 02 ( 00 ) – 3
    # A serious error happened, which is probably due to a
    # programming error. Please open a new issue with the following
    # information on the galileo bug tracker:
    # https://bitbucket.org/benallard/galileo/issues/new
    # /usr/local/bin/galileo: 0.4.2
    # Python: 2.7.3 (default, Dec 18 2014, 19:03:52) [GCC 4.6.3]
    # Platform: Linux eliya-LifeBook-A6025 3.2.0-74-generic #109-Ubuntu SMP Tue Dec 9 16:47:54 UTC 2014 i686 i686
    # pyusb: 1.0.0rc1
    # requests: 0.8.2
    # yaml: 3.10 (with libyaml)
    Traceback (most recent call last):
    File "/usr/local/bin/galileo", line 9, in
    load_entry_point(‘galileo==0.4.2’, ‘console_scripts’, ‘galileo’)()
    File “/usr/local/lib/python2.7/dist-packages/galileo/main.py”, line 267, in main
    }[config.mode](config)
    File “/usr/local/lib/python2.7/dist-packages/galileo/main.py”, line 197, in sync
    for tracker in syncAllTrackers(config):
    File “/usr/local/lib/python2.7/dist-packages/galileo/main.py”, line 38, in syncAllTrackers
    fitbit.disconnect()
    File “/usr/local/lib/python2.7/dist-packages/galileo/tracker.py”, line 48, in disconnect
    self.dongle.ctrl_read()
    File “/usr/local/lib/python2.7/dist-packages/galileo/dongle.py”, line 212, in ctrl_read
    data = self.read(0x82, length, timeout)
    File “/usr/local/lib/python2.7/dist-packages/galileo/dongle.py”, line 191, in read
    return self.dev.read(*params)
    File “/usr/local/lib/python2.7/dist-packages/usb/core.py”, line 925, in read
    self.__get_timeout(timeout))
    File “/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py”, line 835, in intr_read
    timeout)
    File “/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py”, line 920, in __read
    _check(retval)
    File “/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py”, line 588, in _check
    raise USBError(_strerror(ret), ret, _libusb_errno[ret])
    usb.core.USBError: [Errno 19] No such device (it may have been disconnected)

  11. Well … it looks that it works with Charge as well.
    Initially I reported that it does not work but after I restarted Charge Fitbit and ran command it discovered and synced.
    **
    $ galileo -v
    2015-01-09 23:14:42,744:INFO: Disconnecting from any connected trackers
    2015-01-09 23:14:44,758:INFO: Discovering trackers to synchronize
    2015-01-09 23:14:48,768:INFO: 1 trackers discovered
    2015-01-09 23:14:48,768:INFO: Tracker A2F88DECDDE5 was recently synchronized; skipping for now
    2015-01-09 23:14:48,769:INFO: Tracker A2F88DECDDE5 skipped due to configuration
    Tracker: A2F88DECDDE5: Skipped because recently synchronised

  12. On Linux Mint 17 and
    FitBit one
    I may be out of my depth here but….
    I used you tute using method 1 and got to “:-

    val-GA-78LMT-S2P pyusb-master # apt-get install galileo
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    galileo is already the newest version.
    0 to upgrade, 0 to newly install, 0 to remove and 33 not to upgrade.

    then i ran galileo :-

    val-GA-78LMT-S2P pyusb-master # galileo
    # A serious error happened, which is probably due to a
    # programming error. Please open a new issue with the following
    # information on the galileo bug tracker:
    # https://bitbucket.org/benallard/galileo/issues/new
    # /usr/bin/galileo: 0.5dev
    # Python: 2.7.6 (default, Mar 22 2014, 22:59:38) [GCC 4.8.2]
    # Platform: Linux val-GA-78LMT-S2P 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:31:42 UTC 2014 i686 athlon
    # pyusb: 1.0.0rc1
    # requests: 2.2.1
    # yaml: own version
    # Last communications:
    Traceback (most recent call last):
    File “/usr/bin/galileo”, line 9, in
    load_entry_point(‘galileo==0.5dev’, ‘console_scripts’, ‘galileo’)()
    File “/usr/lib/python2.7/dist-packages/galileo/main.py”, line 284, in main
    }[config.mode](config)
    File “/usr/lib/python2.7/dist-packages/galileo/main.py”, line 193, in sync
    for tracker in syncAllTrackers(config):
    File “/usr/lib/python2.7/dist-packages/galileo/main.py”, line 31, in syncAllTrackers
    if not dongle.setup():
    File “/usr/lib/python2.7/dist-packages/galileo/dongle.py”, line 225, in setup
    self.dev.set_configuration()
    File “/usr/local/lib/python2.7/dist-packages/usb/core.py”, line 811, in set_configuration
    self._ctx.managed_set_configuration(self, configuration)
    File “/usr/local/lib/python2.7/dist-packages/usb/core.py”, line 129, in managed_set_configuration
    self.backend.set_configuration(self.handle, cfg.bConfigurationValue)
    File “/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py”, line 781, in set_configuration
    _check(self.lib.libusb_set_configuration(dev_handle.handle, config_value))
    File “/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py”, line 588, in _check
    raise USBError(_strerror(ret), ret, _libusb_errno[ret])
    usb.core.USBError: [Errno 16] Resource busy

    Is there enough info here to make a comment on what’s wrong here ?

  13. For what it’s worth . . . Current distro (*NOT* package!) as of 3/8/2015, and Slackware 14.1 . . . Added the two python dependencies, placed the udev rule, typed “run” and watched it work . . .

    Not sure why they call that the “hard way” . . . to me, packages where you don’t get to see what is going on is the really hard way . . . But in any case, this worked flawlessly right out of the box!

    – Tim

    • I’m running Slackware64 14.1. But ran into some issues.
      Using slackbuilds or sbopkg, python-requests. Checkout pyusb, but modify the slackbuild and info files to version 1.0.0b1 and the change lines 43 and 73 of slackbuild for .rst files. Don’t use pyusb-1.0.0b2 because it won’t let you access the dongle.
      Then downloaded and unpacked galileo to its own directory, setup the udev rule as described at the end of this article, NOT AS described in the galileo directory README. You might need to check the two id’s to verify proper idVendor and idProduct using lsusb from root. Mine matched both (with the first four (idVendor) and last four (idProduct) ) for the udev rule as listed above.
      Now type ./run from the Galileo folder as root. You might get a warning of SSL issue, but a second ./run doesn’t create the warning. Last thing is to setup a cron to run every 30 minutes as user.

  14. Maybe I didn’t get the point, but the problem I’m faced with is that the fitbit bluetooth dongle is not recognized by the system (Kubuntu 14.04).
    When plugging it to the PC running a Windows XP with VM-ware player, the dongle is recognized.

    Any useful hint for a solution is appreciated.

    Alwin

  15. Excellent! Works a treat, thanks

  16. Hello, thanks for the guide. I successfully installed galileo (and even changed the udev file), but the problem is that my tablet is a HUAWEI and doesn’t connect with my FitBit Flex, is not supported. Long story short, I managed to have an account on FitBit.com, a galileo on my laptop, but the two are not connected.
    I tried to do

    galileo --force

    but it gave me this error

    2015-05-19 11:22:27,854:ERROR: Fitbit server refused data from tracker AAD5CDB483D2, reason: Unpaired tracker contacted site. Tracker Wire Id: df955e2f1607
    Tracker: AAD5CDB483D2: Synchronisation failed: Unpaired tracker contacted site. Tracker Wire Id: df955e2f1607

    On the website I don’t find any place where I can insert the tracker ID.
    So I’m stuck.
    Is there a way to match the device with the account with galileo?

    Thanks

  17. Andrea, did you ever get your “unpaired tracker” issue resolved? I’m having the same problem with my brand new FitBit Zip.

  18. Hi,
    I’m on linux mint and I also have the issue #a serious error happened …
    I downgraded python usb package as Jonathan Carter said and now I have another error :

    $ ~ sudo galileo -v
    2015-11-15 15:37:37,123:INFO: Disconnecting from any connected trackers
    2015-11-15 15:37:39,128:ERROR: Dirty state, not able to start synchronisation.
    $

  19. Hi. I’m trying to use a raspberry pi 2 to sync with a new fitbit flex. When I manually type galileo I just get a carriage return. When I type galileo I get the following.

    # A serious error happened, which is probably due to a
    # programming error. Please open a new issue with the following
    # information on the galileo bug tracker:
    # https://bitbucket.org/benallard/galileo/issues/new
    # /usr/local/bin/galileo: 0.4.4
    # Python: 2.7.9 (default, Mar 8 2015, 00:52:26) [GCC 4.9.2]
    # Platform: Linux raspberrypi 4.1.13-v7+ #826 SMP PREEMPT Fri Nov 13 20:19:03 GMT 2015 armv7l
    # pyusb: 1.0.0b2
    # requests: 2.4.3
    # yaml: own version
    Traceback (most recent call last):
    File “/usr/local/bin/galileo”, line 9, in
    load_entry_point(‘galileo==0.4.4’, ‘console_scripts’, ‘galileo’)()
    File “/usr/local/lib/python2.7/dist-packages/galileo/main.py”, line 276, in main
    }[config.mode](config)
    File “/usr/local/lib/python2.7/dist-packages/galileo/main.py”, line 206, in sync
    for tracker in syncAllTrackers(config):
    File “/usr/local/lib/python2.7/dist-packages/galileo/main.py”, line 37, in syncAllTrackers
    dongle.setup()
    File “/usr/local/lib/python2.7/dist-packages/galileo/dongle.py”, line 159, in setup
    self.dev.set_configuration()
    File “/usr/local/lib/python2.7/dist-packages/usb/core.py”, line 799, in set_configuration
    self._ctx.managed_set_configuration(self, configuration)
    File “/usr/local/lib/python2.7/dist-packages/usb/core.py”, line 128, in managed_set_configuration
    self.backend.set_configuration(self.handle, cfg.bConfigurationValue)
    File “/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py”, line 730, in set_configuration
    _check(self.lib.libusb_set_configuration(dev_handle.handle, config_value))
    File “/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py”, line 552, in _check
    raise USBError(_strerror(ret), ret, _libusb_errno[ret])
    usb.core.USBError: [Errno 16] Resource busy

  20. I followed instructions successfully. There is hex data in ./galileo/#####. How does one interpret it?

  21. I got an error:

    2015-12-29 22:04:10,036:ERROR: Insufficient permissions to access the Fitbit dongle

    To be able to run the fitbit utility as a non-privileged user, you first
    should install a ‘udev rule’ that lower the permissions needed to access the
    fitbit dongle. In order to do so, as root, create the file
    /etc/udev/rules.d/99-fitbit.rules with the following content (in one line):

    SUBSYSTEM==”usb”, ATTR{idVendor}==”2687″, ATTR{idProduct}==”fb01″, SYMLINK+=”fitbit”, MODE=”0666″

    The dongle must then be removed and reinserted to receive the new permissions.
    Exception usb.core.USBError: USBError(13, u’Access denied (insufficient permissions)’) in <bound method FitBitDongle.__del__ of > ignored

    I changed the rules to look like this entry:
    https://github.com/mbmccormick/fitbitpi/blob/master/99-fitbit.rules

    Now it works.

  22. I forgot to mention that for Fedora 23 I needed to run:
    udevadm control –reload-rules

    then remove and reinsert the dongle

  23. Thanks for this! I only had to make a couple of changes to get it to work on Fedora 22:

    sudo apt-get install python-usb python-requests becomes sudo dnf install pyusb python-requests

    and sudo service udev restart becomes sudo service systemd-udevd restart.

  24. FYI the same instructions work fine for Lubuntu 15.10, even udev rules just make sure you restart udev and replug the dongle.
    Only caveat is that you need to install on Windows/Macintosh using their app first, at least one time.
    Afterwards, plug the same dongle into the Lubuntu system, run: galileo -v –force sync
    Should see a successful synchronization eventually, and bob’s your uncle!

  25. I had success installing on Linux Mint 18.2 and syncing my FitBit One. I suspect that means my phone is crapping out and not the much cheaper FitBit.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

*