srmio is a small C library to access the PowerControl V of a SRM bike power meter. It's implementing the serial communication protocol to the PC.
Furthermore it's supporting reading and writing the original SRM file formats SRM6 and SRM7. This allows it to nicely coexist with existing software like srmwin or Golden Cheetah. Well, actually GoldenCheetah is using srmio for PCV downloads.
The package includes a small command-line frontend for the most important, daily tasks. If you're a script guy, you're finally able to automate sending your cycling recordings to your coach.
For now this is in an early stage, but it's sufficient for my daily use. I can successfully access 2 different PCV (each running a different Firmware version) and I have successful reports of others. So far only the most important things (data download, setting the time + recint) are implemented. So you still need srmwin for the more "exotic" tasks.
I'm using this in linux. It's confirmed to compile and work fine on Mac OS X and cygwin. I expect it to work on all unix-like platforms offering a working prolific usb2serial driver for the original SRM download cable. Please check the included README for details and examples. If it doesn't compile on your platform, please help me doing so.
Please be warned, that I had to use srmwin to clean the PCV settings several times during development. Maybe your PCV behaves slightly differently and it gets completely unusably when trying to use it with this softare. To avoid problems, the library has a whitelist with firmware versions that are known to be supported. Though, If you're brave enough, you can override the whitelist checking.
Wishlist:
Feel free to provide instructions for other platforms / USB drivers.
Please report if you've success with other firmware versions. This allows me to add them to the whitelist.
Support for PC VI is something I'm quite keen on to implement. Unless I'm mistaken SRM ships a FTDI usb2serial driver for the PCVI. Unfortunatly srmwin seems to unload the VCP driver in favour of the d2xx.dll one. So portmon won't help and it's up to capturing the USB traffic.
There seems to be a free usbsnoop / SnoopyPro available. To read usbsnoop's captures I'm using usblogdump -e.
Thanks to Sean Rhea for providing a first capture. Unfortunatly it shows a communication completely different to what the PCV does. To support this, I really need to get hold of a PCVI. Any volunteers lending/donating one to me?
Is somebody volunteering to help with native windows support? (cygwin is supported - see above). I've absolutely no experience in this area (API, build systems, ...).
Changes:
0.0.5 2010-01-21:
- srmpc: log version on device open
- README: misc updates
- added srmpc_get_version()
- srmpc: fix comm errors after downloading data
- srmpc: log correct block number during download
- genautomake.sh: adjusted to support OSX
0.0.4 2009-12-31:
- fix srm_data_write: pick lowest timestamp (not necessarily the first)
- fix srm_data_write: properly determin days since 1880
- made autoconf probe for localtime_r
- catch integer overflows to avoid writing broken data
- automatically put package version into man page
- fixed memory leak in reading/writing files.
- fix srm_data_blocks initialisation.
- improved documentation of library interface
- added script to run autotools
- srmcmd: added -d option to get workout date.
- srmcmd: adjusted -n option to work on files, too.
- added example script srmwinget.sh for srmwin-compatible filenames
- srmcmd: avoid errors when attempting to write empty data
- fix download with empty PCV that uses stxetx
- added srmpc_busy/ready to give PCV time to finish last command
- renamed srmpc_get_chunks/srmpc_get_data getall parameter for clarification.
- fixed rounding of values when writing files.
- srmcmd: included elevation in CSV dump
- fixed retrieving unfinished marker.
0.0.3 2009-08-05
- fixed getopt chars
- srmpc: data fixup also corrects blocks with <1 sec overlap
- srmpc: fixed calculation of averaged data
- fix termios baudrate setting
- portability: type cleanups, printf formats
- portability: replace strndup, use cfset?speed
- start to use configure results
0.0.2 2009-07-30
- added option to override PCV Version whitelist
- don't skip complete block on empty chunk.
- changed internal time representation to srm_time_t. got rid of .tsec.
- optionally fill mini-gaps at block-bounaries as srmin does.
- internal: srmpc_get_data/-_chunks now pass parameters as struct
- use PCV time to guess "current" year when downloading data
- first attempt to fix timestamps for subsecond recints
- try other baudrates/parity in srmpc_open
0.0.1 2009-07-19
- first public release
Download / Code:
You can find the source tarballs for releases in the srmio files section.
Browse the git repository with the latest development changes on github.
Git clone url: git://github.com/rclasen/srmio.git