openyou / libfitbit Goto Github PK
View Code? Open in Web Editor NEWLibrary for accessing and transfering data from the Fitbit health device
Home Page: http://www.openyou.org
License: BSD 3-Clause "New" or "Revised" License
Library for accessing and transfering data from the Fitbit health device
Home Page: http://www.openyou.org
License: BSD 3-Clause "New" or "Revised" License
Some insights for us n00bs how to configure it would be nice:
http://askubuntu.com/questions/162074/configure-libfitbit-on-12-04
Right now, the commands that the web server sends to write data to the device always fail through our library. Figure out why and how to fix this.
Figure out how the device is identified and communicated with during the bonding portion of setup.
First time ever I try it... I wonder why it stucks on tha last receive :-S
; fitbit_client.py
<-- ['b7', 'a4', '09', '4e', '00', '21', '75', '00', '00', '00', '00', '00', '00', 'b7', 'a4', '09', '4e', '00', '21', '75', '00', '00', '00', '00', '00', '00', 'b7', 'a4', '09', '4e', '00', '21', '75', '00', '00', '00', '00', '00', '00', 'b7', 'a4', '09', '4e', '00', '21', '75', '00', '00', '00', '00', '00', '00', 'b7', 'a4', '09', '4e', '00', '21', '75', '00', '00', '00', '00', '00']
--> ['a4', '01', '4a', '00', 'ef']
<-- ['a4', '01', '6f', '20', 'ea']
--> ['a4', '09', '46', '00', '00', '00', '00', '00', '00', '00', '00', '00', 'eb']
<-- ['a4', '03', '40', '00', '46', '00', 'a1']
--> ['a4', '03', '42', '00', '00', '00', 'e5']
<-- ['a4', '03', '40', '00', '42', '00', 'a5']
--> ['a4', '03', '43', '00', '00', '10', 'f4']
<-- ['a4', '03', '40', '00', '43', '00', 'a4']
--> ['a4', '02', '45', '00', '02', 'e1']
<-- ['a4', '03', '40', '00', '45', '00', 'a2']
--> ['a4', '02', '47', '00', '03', 'e2']
<-- ['a4', '03', '40', '00', '47', '00', 'a0']
--> ['a4', '02', '44', '00', 'ff', '1d']
<-- ['a4', '03', '40', '00', '44', '00', 'a3']
--> ['a4', '05', '51', '00', 'ff', 'ff', '01', '01', 'f0']
<-- ['a4', '03', '40', '00', '51', '00', 'b6']
--> ['a4', '01', '4b', '00', 'ee']
<-- ['a4', '03', '40', '00', '4b', '00', 'ac']
As it is we are required to pair with the tracker using another OS. This is a big missing piece IMHO.
I'm running Arch linux, and currently trying to sync my (classic) fitbit, but this is the output I get
Anybody got an idea what is wrong?
Found FitBit base
Start reset () {}
sent: ['xx', 'xx', 'xx', 'xx', 'xx']
[a pause here...]
Fail reset
Failed with Failed to detect reset response
------------------------------------------------------------
Traceback (most recent call last):
File "python/fitbit_client.py", line 172, in <module>
main()
File "python/fitbit_client.py", line 161, in main
f.run_upload_request()
File "python/fitbit_client.py", line 129, in run_upload_request
self.fitbit.init_tracker_for_transfer()
File "/home/skaverat/projekte/libfitbit/python/fitbit.py", line 167, in init_tracker_for_transfer
self.init_fitbit()
File "/home/skaverat/projekte/libfitbit/python/fitbit.py", line 152, in init_fitbit
self.init_device_channel([0xff, 0xff, 0x01, 0x01])
File "/home/skaverat/projekte/libfitbit/python/fitbit.py", line 156, in init_device_channel
self.base.reset()
File "/home/skaverat/projekte/libfitbit/python/antprotocol/protocol.py", line 70, in wrapper
res = f(self, *args, **kwargs)
File "/home/skaverat/projekte/libfitbit/python/antprotocol/protocol.py", line 160, in reset
self._check_reset_response(0x20)
File "/home/skaverat/projekte/libfitbit/python/antprotocol/protocol.py", line 131, in _check_reset_response
raise ANTStatusException("Failed to detect reset response")
ANTStatusException: Failed to detect reset response
------------------------------------------------------------
Hi. Absentee maintainer here. Anyone still using this library? Just wondering how much work I should put into cleanup, since it's basically maintaining a version of the hardware that is no longer sold.
Hi,
I just upgraded my Ubuntu install to 12.04 and the udev rules provided in the "platform/linux" directory no longer seem to work. They worked previously with a then up-to-date install of 11.10.
I've tried a few simple edits but couldn't get them to function again so I'm running it with as root for now and it works just as well.
Thanks for this code, I love not having to reboot in Windows to update my fitbit profile!
I just compiled and installed this to run on my Mac under 10.8.1 and it appears to work pretty well when I am at home, however when I am at work and behind a proxy I can't connect to upload the data.
Any chance that you support proxies, mine does not require authentication.
Thanks
The Fitbit One uses bluetooth 4.0 for the communication. Is it enough to get bluetooth 4.0 working in linux for using the Fitbit One?
Or does it use a completly different protocoll?
Having the ANT libs in the libfitbit repo for the moment is ok as both of them are being developed, but since I'm going to have other libraries that will use ANT, it'd be best to split these before v1.0 of libfitbit.
Just got an interesting request in. Someone wants to be able to take their fitbit to a place with spotty internet for a long period of time, and therefore cache off their data locally, then sync everything later.
Does seem like this would be a great idea for fitbit to implement themselves, but they don't seem to be doin' so well on the software side these days in their website alone, much less nifty features. :)
Libfitbit currently does not support the Fitbit Zip (and newer fitbits)
I'm staging this so it can be a sponsored issue on FreedomSponsors
Right now, we just get all of whatever is sitting on the rx buffer and parse the received data as one packet. However, sometimes (like when closing a channel), we get multiple packets back at once. This causes the library to freak out because the bytes are where it wants them to be. Change the message parser to work as a state machine instead of a bulk parser.
Hay running this the script on my rasbery pi and get the fallowing error
when running
sudo python libfitbit/python/fitbit.py
i get the output of
Traceback (most recent call last):
File "libfitbit/python/fitbit.py", line 386, in
sys.exit(main())
File "libfitbit/python/fitbit.py", line 352, in main
if not base.open():
File "/home/nigel_d/libfitbit/python/antprotocol/bases.py", line 28, in open
self.init()
File "/home/nigel_d/libfitbit/python/antprotocol/bases.py", line 53, in init
self._receive()
File "/home/nigel_d/libfitbit/python/antprotocol/libusb.py", line 94, in _receive
return self._connection.read(self.ep['in'], size, 0, self.timeout)
TypeError: read() takes at most 4 arguments (5 given)
any advise i be gratefull
When using the fitbit_client script I receive a "Cannot complete data bank" error. Detailed log output can be found at https://gist.github.com/2774859
Running fitbit.py:
Start _check_burst_response
received: ['a4', '09', '4f', '00', '3d', '81', '00', '00', '00', '00', '00', '00', '5e']
End _check_burst_response
['0xda', '0xfe', '0xe6', '0x4f', '0xbc', '0x24', '0xd9', '0x00', '0x00', '0x00', '0x33', '0x79', '0x02']
Time: 2012-06-24 13:49:46 Daily Steps: 217
['0x00', '0x00']
Traceback (most recent call last):
File "./fitbit.py", line 360, in <module>
sys.exit(main())
File "./fitbit.py", line 352, in main
device.parse_bank1_data(device.run_data_bank_opcode(0x01))
File "./fitbit.py", line 319, in parse_bank1_data
daily_steps = data[i+7] << 8 | data[i+6]
IndexError: list index out of range
Should I mention that I'm using an Ultra tracker ?
received: ['a4', '09', '50', '20', '00', '86', '0a', '00', '81', '0a', '00', '81', '5b']
received: ['a4', '09', '50', '40', '0a', '00', '85', '18', '00', '85', '18', '0b', 'bc']
received: ['a4', '09', '50', '60', '81', '0a', '00', '81', '0a', '00', '81', '0a', '16']
received: ['a4', '09', '50', '20', '00', '85', '18', '00', '85', '18', '04', '85', '5c']
received: ['a4', '09', '50', '40', '18', '00', '81', '0a', '00', '85', '18', '00', 'b3']
received: ['a4', '09', '50', '60', '81', '0a', '00', '81', '0a', '00', '81', '0a', '16']
received: ['a4', '09', '50', '20', '00', '81', '0a', '00', '85', '0a', '00', '81', '58']
received: ['a4', '09', '50', '40', '0a', '00', '81', '0a', '00', '81', '0a', '00', 'b7']
received: ['a4', '03', '40', '00', '01', '04', 'e2']
fail _check_burst_response
Traceback (most recent call last):
File "./fitbit.py", line 360, in <module>
sys.exit(main())
File "./fitbit.py", line 344, in main
d = device.run_data_bank_opcode(0x00) # 7
File "./fitbit.py", line 267, in run_data_bank_opcode
return self.run_opcode([0x22, index, 0x00, 0x00, 0x00, 0x00, 0x00])
File "./fitbit.py", line 216, in run_opcode
return self.get_data_bank()
File "./fitbit.py", line 273, in get_data_bank
bank = self.check_tracker_data_bank(self.current_bank_id, cmd)
File "./fitbit.py", line 264, in check_tracker_data_bank
return self._get_tracker_burst()
File "./fitbit.py", line 197, in _get_tracker_burst
d = self.base._check_burst_response()
File "/Users/ben/Python/libfitbit/python/antprotocol/protocol.py", line 72, in wrapper
res = f(self, *args, **kwargs)
File "/Users/ben/Python/libfitbit/python/antprotocol/protocol.py", line 253, in _check_burst_response
raise ANTReceiveException("Burst receive failed by event!")
antprotocol.protocol.ANTReceiveException: Burst receive failed by event!
Fitbitclient uses the old API. Needs to update to new API.
I've encountered a repeatable timeout problem with the most recent libfitbit.
herman@touring:~/fitbit/libfitbit$ git log | head -n 5 commit ee607b24c57b19872959c4ab8edf4dbeed5404d3 Author: qdot Date: Sun Aug 7 22:21:36 2011 -0700Made libusb base core reset on open, making communication much more reliable
- Unplug, then replug fitbit. Now, log of running the test:
Script started on Mon 08 Aug 2011 05:24:47 PM CDT herman@touring:~/fitbit/libfitbit/python$ su root@touring:/home/herman/fitbit/libfitbit/python# python fitbit.py Traceback (most recent call last): File "fitbit.py", line 351, in sys.exit(main()) File "fitbit.py", line 317, in main if not base.open(): File "/home/herman/fitbit/libfitbit/python/antprotocol/bases.py", line 24, in open if not super(FitBitANT, self).open(vid, pid): File "/home/herman/fitbit/libfitbit/python/antprotocol/libusb.py", line 78, in open self._check_reset_response(0x80) File "/home/herman/fitbit/libfitbit/python/antprotocol/protocol.py", line 127, in _check_re set_response data = self._receive() File "/home/herman/fitbit/libfitbit/python/antprotocol/libusb.py", line 91, in _receive r = self._connection.read(self.ep['in'], size, 0, self.timeout) File "/usr/lib/python2.6/site-packages/usb/core.py", line 637, in read self.__get_timeout(timeout) File "/usr/lib/python2.6/site-packages/usb/_debug.py", line 52, in do_trace return f(*args, **named_args) File "/usr/lib/python2.6/site-packages/usb/backend/libusb10.py", line 493, in bulk_read timeout) File "/usr/lib/python2.6/site-packages/usb/backend/libusb10.py", line 593, in __read timeout)) File "/usr/lib/python2.6/site-packages/usb/backend/libusb10.py", line 357, in _check raise USBError(_str_error[retval.value]) usb.core.USBError: Operation timed out- Background info.
Linux kernel: Linux version 2.6.37.6-smp (root@midas) (gcc version 4.5.2 (GCC) ) #2 SMP Sat Ap r 9 23:39:07 CDT 2011Distro: Slackware 13.37.0
Vmlinuz config: config-huge-smp-2.6.37.6-smp:
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_ROOT_HUB_TT=y
CONFIG_USB_EHCI_TT_NEWSCHED=y
CONFIG_USB_OXU210HP_HCD=y
CONFIG_USB_ISP116X_HCD=y
CONFIG_USB_ISP1760_HCD=y
CONFIG_USB_ISP1362_HCD=y
CONFIG_USB_OHCI_HCD=yCONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
CONFIG_USB_OHCI_LITTLE_ENDIAN=y
CONFIG_USB_UHCI_HCD=y
CONFIG_USB_U132_HCD=m
CONFIG_USB_SL811_HCD=y
CONFIG_USB_SL811_CS=m
CONFIG_USB_R8A66597_HCD=y
CONFIG_USB_WHCI_HCD=m
CONFIG_USB_HWA_HCD=m
- Tail of /var/log/messages showing device unplug/replug:
Aug 8 17:19:57 touring kernel: [27583.000141] usb 4-1: USB disconnect, address 12 Aug 8 17:20:01 touring kernel: [27586.665026] usb 4-1: new full speed USB device using uhci_hcd and address 13 Aug 8 17:20:01 touring kernel: [27586.819034] usb 4-1: New USB device found, idVendor=10c4, idProduct=84c4 Aug 8 17:20:01 touring kernel: [27586.819043] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 Aug 8 17:20:01 touring kernel: [27586.819049] usb 4-1: Product: Fitbit Base Station Aug 8 17:20:01 touring kernel: [27586.819054] usb 4-1: Manufacturer: Silicon Labs Aug 8 17:20:01 touring kernel: [27586.819058] usb 4-1: SerialNumber: 01014A9BF5F4E37402014A9BF5F4Base station eventually cannot see tracker
If I leave the base station running for a long time (several hours, it seems) I seem to be getting into a state where it cannot hear the beacon from the tracker. The fitbit_client.py code initializes the base station just fine, but then it seems to go endlessly waiting to hear the beacon. If I unplug and re-plug the base station, I can successfully sync again.
I did see reports of a failure to sync for other platforms, and it seems that a software update fixed things, but at a first glance at the logs from their newest software, it seems to be programming the base station just the same (I have not done a detailed comparison yet, though).
Has anybody else seen this problem before? I have a little script that runs fitbit_client.py with a timeout that kills it after 10 minutes, then restarts it again. I'd like to leave it running "forever" and have things just sync, but I keep running into this issue and have to unplug and re-plug the base station to get a successful sync.
BTW, is there any reason to supply "Commodore 64" instead of "linux" for the os? Just to dig at somebody at fitbit if they actually read their logs?
Checksums not always on r[:-1] ?
I've noticed that checksum errors are intermittent, mostly on the very first transaction, not very deterministic though, after a few tries it does not complain anymore. But that one caught my eye, it happened in the middle of a large conversation:
<-- ['a4', '03', '40', '00', '01', '05', 'e3']
Receive packet: array('B', [164, 9, 79, 0, 62, 97, 14, 0, 0, 0, 0, 0, 179])
9
Checksum: 179
<-- ['a4', '09', '4f', '00', '3e', '61', '0e', '00', '00', '00', '00', '00', 'b3']
--> ['a4', '09', '50', '00', '3f', '80', '0e', '00', '00', '00', '00', '61', '2d']
--> ['a4', '09', '50', '20', '00', 'c7', 'ea', '4d', '00', '00', '00', '00', 'bd']
--> ['a4', '09', '50', 'c0', 'ff', 'ff', 'fe', 'ff', 'ff', 'ff', '00', '00', '3c']
Receive packet: array('B', [164, 9, 78, 0, 62, 97, 14, 0, 0, 0, 0, 0, 178, 164, 3])
9
Checksum: 164
Traceback (most recent call last):
File "fitbit_client.py", line 132, in
sys.exit(main())
File "fitbit_client.py", line 128, in main
f.run_upload_request()
File "fitbit_client.py", line 113, in run_upload_request
self.info_dict["opResponse[%d]" % op_index] = base64.b64encode(''.join([chr(x) for x in self.fitbit.run_opcode(o["opcode"], o["payload"])]))
File "/home/romanvg/dev/libfitbit/python/fitbit.py", line 233, in run_opcode
data = self.receive_acknowledged_reply()
File "/home/romanvg/dev/libfitbit/python/antprotocol/protocol.py", line 205, in receive_acknowledged_reply
status = self._receive()
File "/home/romanvg/dev/libfitbit/python/antprotocol/libusb.py", line 85, in _receive
raise ANTReceiveException("Checksums for packet do not match received values!")
antprotocol.protocol.ANTReceiveException: Checksums for packet do not match received values!Oh, btw, I may inadvertedly dumping my steps on your account, since I haven't change the UUID or anything (using the one that comes on the script itself.... sorry :-S).
Figure out data formats
Figure out what we're getting out of each dataset the website is requesting, and update the reader example to output that information.
over flow errors
on running fitbit.py, once the fitbit connects over ANT, i get this:
Traceback (most recent call last): File "python/fitbit.py", line 351, in <module> sys.exit(main()) File "python/fitbit.py", line 328, in main device.parse_bank2_data(device.run_data_bank_opcode(0x02)) File "python/fitbit.py", line 258, in run_data_bank_opcode return self.run_opcode([0x22, index, 0x00, 0x00, 0x00, 0x00, 0x00]) File "python/fitbit.py", line 210, in run_opcode return self.get_data_bank() File "python/fitbit.py", line 264, in get_data_bank bank = self.check_tracker_data_bank(self.current_bank_id) File "python/fitbit.py", line 255, in check_tracker_data_bank return self._get_tracker_burst() File "python/fitbit.py", line 196, in _get_tracker_burst d = self.base._check_burst_response() File "/home/brenda/projects/libfitbit/python/antprotocol/protocol.py", line 248, in _check_burst_response status = self._receive(15) File "/home/brenda/projects/libfitbit/python/antprotocol/libusb.py", line 95, in _receive r = self._connection.read(self.ep['in'], size, 0, self.timeout) File "/home/brenda/projects/libfitbit/python/usb/core.py", line 624, in read self.__get_timeout(timeout) File "/home/brenda/projects/libfitbit/python/usb/_debug.py", line 53, in do_trace return f(_args, *_named_args) File "/home/brenda/projects/libfitbit/python/usb/backend/libusb10.py", line 483, in bulk_read timeout) File "/home/brenda/projects/libfitbit/python/usb/backend/libusb10.py", line 581, in __read timeout)) File "/home/brenda/projects/libfitbit/python/usb/backend/libusb10.py", line 353, in _check raise USBError(_str_error[retval.value]) usb.core.USBError: Overflow
and then on the next run:
File "/home/brenda/projects/libfitbit/python/antprotocol/libusb.py", line 100, in _receive raise ANTReceiveException("Checksums for packet do not match received values!") antprotocol.protocol.ANTReceiveException: Checksums for packet do not match received values!
Difficulty getting this running on Ubuntu 11.10
Maybe I just missing something basic, but any help would be appreciated.
The base is definitely seen by the system:
lsusb | grep Cyg
Bus 002 Device 006: ID 10c4:84c4 Cygnal Integrated Products, Inc.
ll /dev/fit
lrwxrwxrwx 1 root root 15 2011-10-28 17:44 /dev/fitbit-ant_2-1.5 -> bus/usb/002/006
...but I get an AttributeError when starting it:
python fitbit.py
Traceback (most recent call last):
File "fitbit.py", line 351, in
sys.exit(main())
File "fitbit.py", line 317, in main
if not base.open():
File "/home/mooredan/src/libfitbit/python/antprotocol/bases.py", line 24, in open
if not super(FitBitANT, self).open(vid, pid):
File "/home/mooredan/src/libfitbit/python/antprotocol/libusb.py", line 63, in open
self._connection = usb.core.find(idVendor = vid,
AttributeError: 'module' object has no attribute 'core'dpkg --get-selections | grep usb | grep py
python-usb install
uname -a
Linux horsetooth 3.0.0-12-server #20-Ubuntu SMP Fri Oct 7 16:36:30 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
cat /etc/issue
Ubuntu 11.10 \n \l
Please let me know if you need more info, thanks.
Dan
Trying to re-transmit data, failing in an odd way...
OK, I'm trying to add re-transmission to send_acknowledged_data(), but what I am seeing is a bit odd:
sent: ['a4', '09', '4f', '00', '3c', '22', '05', '00', '00', '00', '00', '00', 'f9']
^^^ This is the original packet that was sent
received: ['a4', '09', '4e', '00', '3b', '81', '00', '00', '00', '00', '00', '00', '59']
^^^ Received broadcast data this cell, nothing unusualreceived: ['a4', '03', '40', '00', '01', '02', 'e4']
^^^ Received channel event, '02' => EVENT_RX_FAILsent: ['a4', '09', '4f', '00', '3c', '22', '05', '00', '00', '00', '00', '00', 'f9']
^^^ So, I re-transmit the original packet
received: ['a4', '03', '40', '00', '4f', '1f', 'b7']
^^^ And receive a channel event that looks like the response to configuration messages..sent: ['a4', '09', '4f', '00', '3c', '22', '05', '00', '00', '00', '00', '00', 'f9']
^^^ Re-transmit again...
received: ['a4', '03', '40', '00', '4f', '1f', 'b7']
^^^ Keep getting this style of response..The description of EVENT_RX_FAIL is:
A receive channel missed a message which it was expecting. This happens when a slave is tracking a master and is expecting a message at the set message rate.This does occur just after an http exchange, if that may make a difference... Still, what would be the proper recovery out of this state? It seems that I need to re-transmit the original packet, but it looks like ANT won't accept the packet again..
Any ideas?
Thanks!
Add erase/set data updates to protocol doc
I never finished the portion of the protocol documentation with commands for erasing and setting clock/stride/etc... on the device. Need to do that.
Fitbit times out on initial connect/ANT reset after first send
Just starting with libfitbit, hope I can get this running. Documentation is impressive, especially the log/trace of the ANT protocol to the device. However, when I tried (both using latest download or git clone), there's a timeout error. Here's how it appears when I try:
root># python fitbit.py --> ['a4', '01', '4a', '00', 'ef']
Traceback (most recent call last):
File "fitbit.py", line 373, in
sys.exit(main())
File "fitbit.py", line 294, in main
device.init_tracker_for_transfer()
File "fitbit.py", line 185, in init_tracker_for_transfer
self.init_fitbit()
File "fitbit.py", line 169, in init_fitbit
self.init_device_channel([0xff, 0xff, 0x01, 0x01])
File "fitbit.py", line 173, in init_device_channel
self.reset()
File "/home/herman/fitbit/libfitbit/python/antprotocol/protocol.py", line 165, in reset
self._check_reset_response()
File "/home/herman/fitbit/libfitbit/python/antprotocol/protocol.py", line 141, in _check_reset_response
data = self._receive()
File "/home/herman/fitbit/libfitbit/python/antprotocol/libusb.py", line 77, in _receive
r = self._connection.read(self.ep['in'], size, 0, self.timeout)
File "/usr/lib/python2.6/site-packages/usb/core.py", line 637, in read
self.__get_timeout(timeout)
File "/usr/lib/python2.6/site-packages/usb/_debug.py", line 52, in do_trace
return f(_args, *_named_args)
File "/usr/lib/python2.6/site-packages/usb/backend/libusb10.py", line 493, in bulk_read
timeout)
File "/usr/lib/python2.6/site-packages/usb/backend/libusb10.py", line 593, in __read
timeout))
File "/usr/lib/python2.6/site-packages/usb/backend/libusb10.py", line 357, in _check
raise USBError(_str_error[retval.value])
usb.core.USBError: Operation timed outNOTE: thinking this might be a machine-specific timing issue, I manually changed the timeout value from 1000 to 10000, but the result was the same. Any ideas where I am going wrong?
-- Thanks, Ted.
Exception AttributeError when unplugging fitbit ultra base
Hi, I got this error when unplugging the base, which makes libfitbit to exit:
Failed to find a base
No base found!
[]Closing USB device
Exception AttributeError: "'FitBitClient' object has no attribute 'fitbit'" in <bound method FitBitClient.del of <main.FitBitClient object at 0x926b6cc>> ignoredIt would be better to keep looking if the base would be plugged again instead of crashing/exiting.
USB Overflow when retrieving large amounts of data
After collecting multiple days worth of data without syncing, trying to sync via libfitbit causes a usb overflow error.
Move to python-ant library
I wrote my own ANT library on this, but it's in no way complete, and possibly not even correct. https://github.com/mvillalba/python-ant looks like a more mature project that supports more sticks/bases.
Using vendor/product (0x0fcf, 0x1008), get Pipe error
$ dmesg
[34601.057057] usb 4-2: New USB device found, idVendor=0fcf, idProduct=1008
[34601.057064] usb 4-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[34601.057068] usb 4-2: Product: ANT USBStick2
[34601.057072] usb 4-2: Manufacturer: Dynastream Innovations
[34601.057076] usb 4-2: SerialNumber: 038$ vi fitbit.py
def open(self):
#return super(FitBit, self).open(0x10c4, 0x84c4)
print "super(FitBit, self).open(0x0fcf, 0x1008)"
return super(FitBit, self).open(0x0fcf, 0x1008)$ python fitbit.py
super(FitBit, self).open(0x0fcf, 0x1008)
Traceback (most recent call last):
File "fitbit.py", line 375, in
sys.exit(main())
File "fitbit.py", line 296, in main
device.init_tracker_for_transfer()
File "fitbit.py", line 187, in init_tracker_for_transfer
self.init_fitbit()
File "fitbit.py", line 170, in init_fitbit
self.fitbit_control_init()
File "fitbit.py", line 146, in fitbit_control_init
self._connection.ctrl_transfer(0x40, 0x00, 0xFFFF, 0x0, [])
File "/usr/lib/python2.7/site-packages/usb/core.py", line 668, in ctrl_transfer
self.__get_timeout(timeout)
File "/usr/lib/python2.7/site-packages/usb/_debug.py", line 53, in do_trace
return f(_args, *_named_args)
File "/usr/lib/python2.7/site-packages/usb/backend/libusb10.py", line 538, in ctrl_transfer
timeout))
File "/usr/lib/python2.7/site-packages/usb/backend/libusb10.py", line 353, in _check
raise USBError(_str_error[retval.value])
usb.core.USBError: Pipe errorI want to reverse engineer a Garmin Chirp for linux, ala
http://itunes.apple.com/us/app/geobeacon/id449451508?mt=8
but for linux, not iphoneAny help?
run_opcode "default" return?
in python/fitbit.py, FitBit::run_opcode, it looks like there is something missing..
First, it sends the opcode to the tracker, then looks at the reply data[1]. There are three cases for 0x42, 0x61, and 0x41. If it isn't any of those, then we just fall out of the routine and don't return anything? Is that correct behavior?
For the 0x61 case, we optionally send a payload, then look for a reply (does this work even if we don't send a payload??) Once we get a payload, we check data[1] for 0x41 (should we validate data[0] like above??) and return if it matches, but if it doesn't, then we just fall into the outer switch (which will check against 0x41 again, guaranteed to fail..), and then fall out of the routine.
I don't know enough about what's happening with the protocol to make sense of what should be done here, but it looks a bit incomplete. Maybe it's just missing error handling?
FailFinal _check_tx_response
fitbit_client.py usually works great for me, but suddenly yesterday it stopped working. I keep getting this cycle over and over:
FailFinal _check_tx_response sent: ['a4', '09', '4f', '00', '39', '24', '00', '00', '00', '00', '00', '00', 'ff'] Start _check_tx_response received: ['a4', '03', '40', '00', '4f', '1f', 'b7'] FailFinal _check_tx_response
Not sure whats going on.
Here is the full output:
https://gist.github.com/2279781Altimeter Data from Fitbit Ultra
Don't have a fitbit ultra yet, but they're out there, and it'd be nice to get the altimeter data off of it.
Syncing multiple fitbits with 1 station
I'm wondering if this is possible. The sync is working for me, but it randomly picks 1 of the 2 fitbits (one for me, one for my girlfriend).
I have 2 'docks' so starting the client with some parameter is fine for me too, just need it to work with 2 fitbits.Thanks, for the help!
Recommend Projects
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
TensorFlow
An Open Source Machine Learning Framework for Everyone
Django
The Web framework for perfectionists with deadlines.
Laravel
A PHP framework for web artisans
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
Recommend Topics
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
web
Some thing interesting about web. New door for the world.
server
A server is a program made to process requests and deliver data to clients.
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Visualization
Some thing interesting about visualization, use data art
Game
Some thing interesting about game, make everyone happy.
Recommend Org
We are working to build community through open source technology. NB: members must have two-factor auth.
Microsoft
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba
Alibaba Open Source for everyone
D3
Data-Driven Documents codes.
Tencent
China tencent open source team.