Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Required setup. #3

Closed
niksimms opened this issue Mar 30, 2016 · 12 comments
Closed

Required setup. #3

niksimms opened this issue Mar 30, 2016 · 12 comments

Comments

@niksimms
Copy link

Hi,
I'm currently following this project and have all the scripts running fine on a small odroid running ubuntu.
The scripts run fine but I'm not getting any data. This is possibly because the Next Link 2.4 dongle does have a driver.
Can you confirm your setup and if you are using any specific driver to run the dongle.
It shows up on lsusb but I get nothing via pcap
Thanks again
Nik

@pazaan
Copy link
Owner

pazaan commented Mar 30, 2016

Hi Nik,

I'm running on OS X without any drivers.
The USB stick itself is a HID device, so as long as you have pip installed all the dependencies, it should work.
I've also run it on Windows, though I must admit I haven't tried Linux yet.
Have you updated the hard-coded variables at the top of the MedtronicSession class?
The first part of the MAC's are your pump and stick (link) serial numbers. Leave the numbers after the + the same.
Use the get_hmac_and_key.py script to find out your HMAC and key.

Lennart

On 30 Mar 2016, at 23:40, niksimms [email protected] wrote:

Hi,
I'm currently following this project and have all the scripts running fine on a small odroid running ubuntu.
The scripts run fine but I'm not getting any data. This is possibly because the Next Link 2.4 dongle does have a driver.
Can you confirm your setup and if you are using any specific driver to run the dongle.
It shows up on lsusb but I get nothing via pcap
Thanks again
Nik


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub

@niksimms
Copy link
Author

Hi Lennart,
Right, yep I did the Hmac and Key, that was fine. I noticed the MAC address before the + sign and I have changed them to suit both the link and pump.
I get the Link device info then a send and receive data but then it starts going through the channels (send/receive). So that's where I'm up to.
After it does the channels it just crashes with a couple of errors. The Link is setup on the pump.
I'll get some data over to you but it all seems to be going well.
Nothing seems to be going into the sqlite DB
I'm running it on an Odroid with Ubuntu and python 2.7
Pythons not my cup of tea, I'm more of a C#/PHP, I may get my son on the job.
Cheers,
Nik

@niksimms
Copy link
Author

Hi Lennart,

Here is the output at the moment

Opening device
Manufacturer: Bayer HealthCare LLC
Product: Contour Link USB Device
Serial No: 0000000001065043
Request Device Info
SEND: 4142430158
Read Device Info
SEND: 4142430104
READ: 05
Request Device Info
SEND: 4142430158
Read Device Info
READ: 040231487c5c5e267c7c4a33373752377c4261796572363231305e30312e31325c30312e30345c32352e32355c30312e30302e415e363231332d313036353034335e303030302d5e424731303635303433427c413d305e433d32315e473d656e2c656e5c61725c7a685c68725c63735c64615c6e6c5c66695c66725c64655c656c5c68655c68755c69745c6a615c6e6f5c706c5c70745c72755c736b5c736c5c65735c73765c74725e493d303230305e523d305e533d30445e553d315e563d32303630305e583d3037303037303037303037303138303133303138303235303037303133305e593d3336303132363039393035343132303035343235323039395e5a3d317c307c7c7c7c7c507c317c32303136303333313139353435300d1730450d0a
READ: 05
6213-1065043
SEND: 4142430115
READ: 04
SEND: 4142430105
READ: 06
SEND: 41424302577c
READ: 06
SEND: 41424302517c
READ: 06
SEND: 41424302317c
READ: 06
Request Open Connection
SEND: 4142433c51033030303030300000000000000000000010010000000000000000200000005f0b54886d21d4754d8c845f10e6652aa3b0b3dce65a2ae388a54bbe
SEND: 414243054f1a511587
READ: 510330303030303000000000000000000000100100000000000000001d000000ee551b0000000000000001ffffffffffffffff000000000000000000a142
Request Read Info
SEND: 4142432151033030303030300000000000000000000014020000000000000000000000008a
READ: 5103303030303030000000000000000000001402000000000000000013000000270023f706821040530023f745ee1004e2010001
Negotiate pump comms channel
Negotiating on channel 20
SEND: 4142433c510330303030303000000000000000000000120300000000000000001e00000060031c011400000007070000025340108206f72300e20410ee45f723
SEND: 41424303009a53
READ: 510330303030303000000000000000000000810300000000000000000600000066550400007e91
READ: 51033030303030300000000000000000000080f517008000000000000d0000005b550b000020000000030000cb80
Negotiating on channel 20
SEND: 4142433c510330303030303000000000000000000000120400000000000000001e00000061031c011400000007070000025340108206f72300e20410ee45f723
SEND: 41424303009a53
READ: 510330303030303000000000000000000000810400000000000000000600000067550400007e91
READ: 51033030303030300000000000000000000080f617008000000000000d0000005c550b000020000000030000cb80
Negotiating on channel 17
SEND: 4142433c510330303030303000000000000000000000120500000000000000001e00000061031c011100000007070000025340108206f72300e20410ee45f723
SEND: 4142430300df10
READ: 510330303030303000000000000000000000810500000000000000000600000068550400007e91
READ: 51033030303030300000000000000000000080f717008000000000000d0000005d550b000020000000030000cb80
Negotiating on channel 14
SEND: 4142433c510330303030303000000000000000000000120600000000000000001e00000012031c010e00000007070000025340108206f72300e20410ee45f723
SEND: 4142430300d4ce
READ: 510330303030303000000000000000000000810600000000000000000600000069550400007e91
READ: 51033030303030300000000000000000000080f817008000000000000d0000005e550b000020000000030000cb80
Negotiating on channel 23
SEND: 4142433c510330303030303000000000000000000000120700000000000000001e0000005d031c011700000007070000025340108206f72300e20410ee45f723
SEND: 4142430300469d
READ: 51033030303030300000000000000000000081070000000000000000060000006a550400007e91
READ: 51033030303030300000000000000000000080f917008000000000000d0000005f550b000020000000030000cb80
Negotiating on channel 26
SEND: 4142433c510330303030303000000000000000000000120800000000000000001e00000032031c011a00000007070000025340108206f72300e20410ee45f723
SEND: 4142430300e1d3
READ: 51033030303030300000000000000000000081080000000000000000060000006b550400007e91
READ: 51033030303030300000000000000000000080fa17008000000000000d00000060550b000020000000030000cb80
Traceback (most recent call last):
File "open.py", line 532, in
mt.negotiateChannel()
File "/usr/local/lib/python2.7/dist-packages/transitions/core.py", line 234, in trigger
if t.execute(event):
File "/usr/local/lib/python2.7/dist-packages/transitions/core.py", line 139, in execute
machine.callback(getattr(event_data.model, func), event_data)
File "/usr/local/lib/python2.7/dist-packages/transitions/core.py", line 484, in callback
func(_event_data.args, *_event_data.kwargs)
File "open.py", line 485, in doNegotiateChannel
raise NegotiationException( 'Could not negotiate a comms channel with the pump. Are you near to the pump?' )
main.NegotiationException: Could not negotiate a comms channel with the pump. Are you near to the pump?

@pazaan
Copy link
Owner

pazaan commented Apr 2, 2016

It looks like you’re using the wrong key and HMAC for your stick serial number. I’ll be pushing an update later in the week to make this a lot easier (it will read the serial number from your stick and get the key and HMAC for you, saving it to the SQLite database).

On 1 Apr 2016, at 06:55, niksimms [email protected] wrote:

Hi Lennart,

Here is the output at the moment

Opening device
Manufacturer: Bayer HealthCare LLC
Product: Contour Link USB Device
Serial No: 0000000001065043
Request Device Info
SEND: 4142430158
Read Device Info
SEND: 4142430104
READ: 05
Request Device Info
SEND: 4142430158
Read Device Info
READ: 040231487c5c5e267c7c4a33373752377c4261796572363231305e30312e31325c30312e30345c32352e32355c30312e30302e415e363231332d313036353034335e303030302d5e424731303635303433427c413d305e433d32315e473d656e2c656e5c61725c7a685c68725c63735c64615c6e6c5c66695c66725c64655c656c5c68655c68755c69745c6a615c6e6f5c706c5c70745c72755c736b5c736c5c65735c73765c74725e493d303230305e523d305e533d30445e553d315e563d32303630305e583d3037303037303037303037303138303133303138303235303037303133305e593d3336303132363039393035343132303035343235323039395e5a3d317c307c7c7c7c7c507c317c32303136303333313139353435300d1730450d0a
READ: 05
6213-1065043
SEND: 4142430115
READ: 04
SEND: 4142430105
READ: 06
SEND: 41424302577c
READ: 06
SEND: 41424302517c
READ: 06
SEND: 41424302317c
READ: 06
Request Open Connection
SEND: 4142433c51033030303030300000000000000000000010010000000000000000200000005f0b54886d21d4754d8c845f10e6652aa3b0b3dce65a2ae388a54bbe
SEND: 414243054f1a511587
READ: 510330303030303000000000000000000000100100000000000000001d000000ee551b0000000000000001ffffffffffffffff000000000000000000a142
Request Read Info
SEND: 4142432151033030303030300000000000000000000014020000000000000000000000008a
READ: 5103303030303030000000000000000000001402000000000000000013000000270023f706821040530023f745ee1004e2010001
Negotiate pump comms channel
Negotiating on channel 20
SEND: 4142433c510330303030303000000000000000000000120300000000000000001e00000060031c011400000007070000025340108206f72300e20410ee45f723
SEND: 41424303009a53
READ: 510330303030303000000000000000000000810300000000000000000600000066550400007e91
READ: 51033030303030300000000000000000000080f517008000000000000d0000005b550b000020000000030000cb80
Negotiating on channel 20
SEND: 4142433c510330303030303000000000000000000000120400000000000000001e00000061031c011400000007070000025340108206f72300e20410ee45f723
SEND: 41424303009a53
READ: 510330303030303000000000000000000000810400000000000000000600000067550400007e91
READ: 51033030303030300000000000000000000080f617008000000000000d0000005c550b000020000000030000cb80
Negotiating on channel 17
SEND: 4142433c510330303030303000000000000000000000120500000000000000001e00000061031c011100000007070000025340108206f72300e20410ee45f723
SEND: 4142430300df10
READ: 510330303030303000000000000000000000810500000000000000000600000068550400007e91
READ: 51033030303030300000000000000000000080f717008000000000000d0000005d550b000020000000030000cb80
Negotiating on channel 14
SEND: 4142433c510330303030303000000000000000000000120600000000000000001e00000012031c010e00000007070000025340108206f72300e20410ee45f723
SEND: 4142430300d4ce
READ: 510330303030303000000000000000000000810600000000000000000600000069550400007e91
READ: 51033030303030300000000000000000000080f817008000000000000d0000005e550b000020000000030000cb80
Negotiating on channel 23
SEND: 4142433c510330303030303000000000000000000000120700000000000000001e0000005d031c011700000007070000025340108206f72300e20410ee45f723
SEND: 4142430300469d
READ: 51033030303030300000000000000000000081070000000000000000060000006a550400007e91
READ: 51033030303030300000000000000000000080f917008000000000000d0000005f550b000020000000030000cb80
Negotiating on channel 26
SEND: 4142433c510330303030303000000000000000000000120800000000000000001e00000032031c011a00000007070000025340108206f72300e20410ee45f723
SEND: 4142430300e1d3
READ: 51033030303030300000000000000000000081080000000000000000060000006b550400007e91
READ: 51033030303030300000000000000000000080fa17008000000000000d00000060550b000020000000030000cb80
Traceback (most recent call last):
File "open.py", line 532, in
mt.negotiateChannel()
File "/usr/local/lib/python2.7/dist-packages/transitions/core.py", line 234, in trigger
if t.execute(event):
File "/usr/local/lib/python2.7/dist-packages/transitions/core.py", line 139, in execute
machine.callback(getattr(event_data.model, func), event_data)
File "/usr/local/lib/python2.7/dist-packages/transitions/core.py", line 484, in callback
func(event_data.args, *event_data.kwargs)
File "open.py", line 485, in doNegotiateChannel
raise NegotiationException( 'Could not negotiate a comms channel with the pump. Are you near to the pump?' )
main.NegotiationException: Could not negotiate a comms channel with the pump. Are you near to the pump?


You are receiving this because you commented.
Reply to this email directly or view it on GitHub #3 (comment)

@niksimms
Copy link
Author

niksimms commented Apr 4, 2016

Maybe it's down to how close the pump is to the dongle. The pump is located on my son and the dongle is plugged into the odroid but not always in proximity. At the moment he is sat 3 meters away and here is the result, not errors:

Opening device
Manufacturer: Bayer HealthCare LLC
Product: Contour Link USB Device
Serial No: 0000000001065043
Request Device Info
SEND: 4142430158
Read Device Info
SEND: 4142430104
READ: 05
Request Device Info
SEND: 4142430158
Read Device Info
READ: 040231487c5c5e267c7c6d7242724a6a7c4261796572363231305e30312e31325c30312e30345c32352e32355c30312e30302e415e363231332d313036353034335e303030302d5e424731303635303433427c413d305e433d32315e473d656e2c656e5c61725c7a685c68725c63735c64615c6e6c5c66695c66725c64655c656c5c68655c68755c69745c6a615c6e6f5c706c5c70745c72755c736b5c736c5c65735c73765c74725e493d303230305e523d305e533d30445e553d315e563d32303630305e583d3037303037303037303037303138303133303138303235303037303133305e593d3336303132363039393035343132303035343235323039395e5a3d317c307c7c7c7c7c507c317c32303136303430343133323434320d1744410d0a
READ: 05
6213-1065043
SEND: 4142430115
READ: 04
SEND: 4142430105
READ: 06
SEND: 41424302577c
READ: 06
SEND: 41424302517c
READ: 06
SEND: 41424302317c
READ: 06
Request Open Connection
SEND: 4142433c51033030303030300000000000000000000010010000000000000000200000005f0b54886d21d4754d8c845f10e6652aa3b0b3dce65a2ae388a54bbe
SEND: 414243054f1a511587
READ: 510330303030303000000000000000000000100100000000000000001d000000ee551b0000000000000001ffffffffffffffff000000000000000000a142
Request Read Info
SEND: 4142432151033030303030300000000000000000000014020000000000000000000000008a
READ: 5103303030303030000000000000000000001402000000000000000013000000270023f706821040530023f745ee1004e2010001
Negotiate pump comms channel
Negotiating on channel 20
SEND: 4142433c510330303030303000000000000000000000120300000000000000001e00000060031c011400000007070000025340108206f72300e20410ee45f723
SEND: 41424303009a53
READ: 510330303030303000000000000000000000810300000000000000000600000066550400007e91
READ: 51033030303030300000000000000000000080fb17008000000000000d00000061550b000020000000030000cb80
Negotiating on channel 20
SEND: 4142433c510330303030303000000000000000000000120400000000000000001e00000061031c011400000007070000025340108206f72300e20410ee45f723
SEND: 41424303009a53
READ: 510330303030303000000000000000000000810400000000000000000600000067550400007e91
READ: 51033030303030300000000000000000000080fc17008000000000000d00000062550b000020000000030000cb80
Negotiating on channel 17
SEND: 4142433c510330303030303000000000000000000000120500000000000000001e00000061031c011100000007070000025340108206f72300e20410ee45f723
SEND: 4142430300df10
READ: 510330303030303000000000000000000000810500000000000000000600000068550400007e91
READ: 51033030303030300000000000000000000080fd17008000000000000d00000063550b000020000000030000cb80
Negotiating on channel 14
SEND: 4142433c510330303030303000000000000000000000120600000000000000001e00000012031c010e00000007070000025340108206f72300e20410ee45f723
SEND: 4142430300d4ce
READ: 510330303030303000000000000000000000810600000000000000000600000069550400007e91
READ: 51033030303030300000000000000000000080fe17008000000000000d00000064550b000020000000030000cb80
Negotiating on channel 23
SEND: 4142433c510330303030303000000000000000000000120700000000000000001e0000005d031c011700000007070000025340108206f72300e20410ee45f723
SEND: 4142430300469d
READ: 51033030303030300000000000000000000081070000000000000000060000006a550400007e91
READ: 51033030303030300000000000000000000080ff17008000000000000d00000065550b000020000000030000cb80
Negotiating on channel 26
SEND: 4142433c510330303030303000000000000000000000120800000000000000001e00000032031c011a00000007070000025340108206f72300e20410ee45f723
SEND: 4142430300e1d3
READ: 51033030303030300000000000000000000081080000000000000000060000006b550400007e91
READ: 510330303030303000000000000000000000800018008000000000002e00000009552c0004e20410ee4502e20410ee45f723008200000000000700355340108206f7230042000000000000001af409
Begin Extended High Speed Mode Session
SEND: 414243365103303030303030000000000000000000001209000000000000000015000000800513e20410ee45f723000710068efb04f7c245cc0d
READ: 510330303030303000000000000000000000810900000000000000000f00000029550d0004000000000300010702adfc
Get Pump Time
SEND: 41424335510330303030303000000000000000000000120a000000000000000014000000800512e20410ee45f723000810050cfb15a9790423
READ: 510330303030303000000000000000000000810a00000000000000000f00000001550d000400000000030001080293ec
READ: 5103303030303030000000000000000000008001180080000000000028000000d555260006e20410ee45f723005340108206f723000237040e0ffb11f6a2d9aa941f28e5a4daf0cf99
Pump time is: Mon, 04 Apr 2016 13:24:18 +0000
Get Pump Status
SEND: 41424335510330303030303000000000000000000000120b000000000000000014000000760512e20410ee45f723000910050dfe0463acd764
READ: 510330303030303000000000000000000000810b00000000000000000f00000005550d0004000000000300010902a2df
READ: 510330303030303000000000000000000000800218008000000000007c000000f8557a0006e20410ee45f723005340108206f72300033504620cfe2ae7226cfb6a82f70630781a320e2f9c5ba6f7483ebd272f21115cb7b35073d085f9aef7d7300b19183110d0fbc85aa300868e09a1b483ec91b1f4a880e50179113efc09bf4b7344216be9bd5f1f685c776f421688acbc6d1a3a2543b861d5981b27
02013c1000000000000000000000000000000fa01e951faa340001000017700000000000000000013b6e32000bb2241900000007d000000000000000000000000000000000000000000000000000000000000000000000000000006c0000006c

@pazaan
Copy link
Owner

pazaan commented May 2, 2016

@niksimms - just curious how you're going with this. Is it all working for you now?

@niksimms
Copy link
Author

niksimms commented May 2, 2016

Hi Lennart,
We've just been to annual gathering for Children with Diabetes UK, which has been over the pass 4 days. I'll get stuck in an give you my feedback.
Nik.

@niksimms
Copy link
Author

niksimms commented May 2, 2016

Hi Lennart,
I've just run it and it worked 100%.
Result:
Manufacturer: Bayer HealthCare LLC
Product: Contour Link USB Device
Serial No: 0000000001065043

Request Device Info

Read Device Info

6213-1065043

Request Open Connection

Request Read Info

Negotiate pump comms channel

Negotiating on channel 26

Begin Extended High Speed Mode Session

Get Pump Time

Pump time is: Mon, 02 May 2016 16:49:02 +0000

Get Pump Status

02013c5000000000000000000000000000002af81eba45ba02000100001a5e00000000000000000186a032000a0d3e190000002af8030580da6ac99ddfe39400e00400ffff2b0000000000000000000000000000000000000000007600000076
Active Insulin: 1.100U
Sensor BGL: 773 mg/dL (42.9 mmol/L) at Mon, 02 May 2016 16:43:57 +0000
BGL trend: Unknown trend
Current basal rate: 0.675U
Units remaining: 65.000U
Battery remaining: 50%
I will wrap this Odroid unit up with the Next Link and battery to make it portable and do a cron tab to make it run every 5-10 mins.
Cheers,
Nik

@niksimms
Copy link
Author

niksimms commented May 2, 2016

Sensor BGL: 773 mg/dL (42.9 mmol/L) at Mon, 02 May 2016 16:43:57 +0000
The sensor has expired 'change sensor' so we will need to restart the sensor to start getting figures.

@niksimms
Copy link
Author

niksimms commented May 2, 2016

consecutive calls I would get:

Opening device

Manufacturer: Bayer HealthCare LLC
Product: Contour Link USB Device
Serial No: 0000000001065043

Request Device Info

Read Device Info

Traceback (most recent call last):
File "read_minimed_next24.py", line 676, in
mt.getDeviceInfo()
File "/usr/local/lib/python2.7/dist-packages/transitions/core.py", line 234, in trigger
if t.execute(event):
File "/usr/local/lib/python2.7/dist-packages/transitions/core.py", line 145, in execute
machine.callback(getattr(event_data.model, func), event_data)
File "/usr/local/lib/python2.7/dist-packages/transitions/core.py", line 484, in callback
func(_event_data.args, *_event_data.kwargs)
File "read_minimed_next24.py", line 541, in readDeviceInfo
raise RuntimeError( 'Expected to get an ASTM message, but got {0} instead'.format( binascii.hexlify( msg ) ) )
RuntimeError: Expected to get an ASTM message, but got 510330303030303000000000000000000000804118008000000000000d00000021550b0000000200000300007d65 instead

@niksimms
Copy link
Author

niksimms commented May 2, 2016

Opening device

Manufacturer: Bayer HealthCare LLC
Product: Contour Link USB Device
Serial No: 0000000001065043

Request Device Info

Read Device Info

6213-1065043

Request Open Connection

Request Read Info

Negotiate pump comms channel

Negotiating on channel 26

Begin Extended High Speed Mode Session

Get Pump Time

Pump time is: Mon, 02 May 2016 18:57:29 +0000

Get Pump Status

02013c10000000000000000000000000000055f01eba602b03000100001c52000000000000000001bf443200138be8190000003e8000000000000000000000000000000000000000000000000000000000000000000000000000007600000076
Active Insulin: 1.600U
Traceback (most recent call last):
File "read_minimed_next24.py", line 691, in
time.strftime( "%a, %d %b %Y %H:%M:%S +0000", status.sensorBGLTimestamp ) )
File "read_minimed_next24.py", line 381, in sensorBGLTimestamp
return DateTimeHelper.decodeDateTime( dateTimeData )
File "read_minimed_next24.py", line 91, in decodeDateTime
return time.localtime( baseTime + rtc + offset )
ValueError: timestamp out of range for platform time_t

Also If the script cannot read any part of the request it will freak out the usb causing it not to be seen by the system:
python read_minimed_next24.py

Opening device

Traceback (most recent call last):
File "read_minimed_next24.py", line 675, in
mt.initDevice()
File "/usr/local/lib/python2.7/dist-packages/transitions/core.py", line 234, in trigger
if t.execute(event):
File "/usr/local/lib/python2.7/dist-packages/transitions/core.py", line 139, in execute
machine.callback(getattr(event_data.model, func), event_data)
File "/usr/local/lib/python2.7/dist-packages/transitions/core.py", line 484, in callback
func(_event_data.args, *_event_data.kwargs)
File "read_minimed_next24.py", line 489, in openDevice
self.device.open( self.USB_VID, self.USB_PID )
File "hid.pyx", line 66, in hid.device.open (hid.c:1569)
IOError: open failed

@pazaan
Copy link
Owner

pazaan commented May 4, 2016

@niksimms, I've opened #5 and #6 to cover the items you're talking about above. I've split them out, because they're 2 different problems, making them easier to track.
I'll close this issue since I believe we've resolved the initial reason for this particular issue.

@pazaan pazaan closed this as completed May 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants