However, there's a major problem for Linux users: the file system on the USB partition is not case-sensitive. That means opening the HTML files directly on the drive works, but after copying to a case-sensitive file system (such as EXT3/4 on Linux), the links inside the files won't work anymore.
Don't forget to make both files executable:
The following script copies the drive contents to a directory according to the current date. Afterwards, a small Python script is invoked to fix both the file names themselves and the links. It also reduces the file size a bit by converting some images to more space-efficient formats.
copy.sh:
#!/bin/bash
folder=`date +%y-%m-%d`
cp -r /media/SMART_PIX/REPORT ${folder}
chmod -R +w ${folder}
cd ${folder}
# Rename file names and contents to lower case.
../lowercase.py
# Remove some superfluous stuff.
rm -r img/rd*.gif img/scanning.gif img/*.png
# Don't use bitmaps.
for f in `find -name "*.bmp"`; do g=${f/.bmp/.gif}; convert $f $g; rm $f; ln -s `basename $g` $f; done
# Add index file.
ln -s _review.htm index.html
lowercase.py:
#!/usr/bin/env python
import os
import re
def rename_lower(dirpath, name):
upper_path = os.path.join(dirpath, name)
lower_path = os.path.join(dirpath, name.lower())
os.rename(upper_path, lower_path)
return lower_path
pattern = re.compile('"([\w/.]+?)\.([\w/.]+?)"')
for dirpath, dirnames, filenames in os.walk('.', topdown=False):
# rename directories
for name in dirnames:
rename_lower(dirpath, name)
# rename files and change contents
for name in filenames:
filename = rename_lower(dirpath, name)
text = open(filename).read()
replaced = pattern.sub(lambda m: m.group(0).lower(), text)
open(filename, 'w').write(replaced)
Don't forget to make both files executable:
chmod +x copy.sh lowercase.py
Afterwards, simply run
copy.sh
inside the directory where you want the copy to be stored.Also note that there's a simple way to read the blood glucose values if you want to write some scripts that process them: all the data is stored in XML format inside the "xml" subdirectory.
9 comments:
Hello
Thanks for this one!! I one it was a long time ago but I recently got my smart pix and was looking for a way to make it work properly on linux!!
You're very welcome!
Also huge thanks!
I just ordered a Smart Pix despite having been assured by the telesales agent that it would be useless on any OS but Windows. WTF? The multi-OS potential appears to be the WHOLE POINT of the design!
Anyway whatever, thanks again.
Hi, i found your web site and it's interesting.
But can you please help me?
I connect my Smart Pix to my Ubuntu Server 11 in a VM Ware session. But i can't find the device in /media...
You might need to explicitly route through the USB device from the host that runs the VM to your VM. I've never used a VM though for connecting the SmartPix, but used it directly on an Ubuntu host, which worked fine. It might be simpler to copy the data directly from the VM host instead of the VM.
After finding this page, I now just ordered my Smart Pix.
Thanks for posting this information!
You're very welcome! On a side note, my biggest therapy and quality of live improvement came from using a CGM. Unfortunately very expensive, especially without insurance coverage. But definitely worth looking into.
I tried to get my Smartpix working under MacOS back when I got it. The problem seems to be that when the device would read the IR signal and update the contents of the internal data file containing the reading numbers, it seems to switch off it's USB mass storage data volume while it updates the data file, just for a second or so. Windows seems to just ignore the volume going away for a few seconds, and keeps the volume open and mounted. But MacOS (and probably Linux, and probably any OS that implements the USB spec "properly") notices immediately that the storage volume on the USB device has gone away, and dutifully unmounts the volume, totally disrupting the javascript running in the web browser, which is expecting it's volume to still be there. It does work properly in Parallels 5, when I tell Parallels to connect the Smartpix to the Windows Os instead of MacOS. Also, the javascript it uses is rather fussy. It doesn't like Chrome, but only supports IE or Firefox. I suppose we should be happy about the Firefox support.
My ubuntu does not work its script already tried but it only does capture of tele anything else
Post a Comment