]> git.itanic.dy.fi Git - glucose/log
glucose
9 years agoContour Next protocol, work in progress contour-next-testing
Timo Kokkonen [Wed, 1 Oct 2014 19:16:01 +0000 (22:16 +0300)]
Contour Next protocol, work in progress

It dumps out the data now.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
11 years agoHave extra 20ms delay after every 16th read entry master
Timo Kokkonen [Mon, 23 Jul 2012 15:07:19 +0000 (18:07 +0300)]
Have extra 20ms delay after every 16th read entry

Some times the meter refuses to return all entries as expected, and
just returns some crap instead. This becomes especially notcieable
once the meter has reached the limit of 2000 glucose readings.

Having an extra 20ms delay between readings once every 16th reads
appears to help ensuring all data is read reliably out of the device.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
11 years agoDo not return error if no more entries are read
Timo Kokkonen [Mon, 23 Jul 2012 15:01:28 +0000 (18:01 +0300)]
Do not return error if no more entries are read

Since commit 009c9b76361 the tool was always returning an error
condition when the last entry was read from the meter. This is not
correct as reading the last entry is not an error condition.

Unfortunately it is not know how to detect the lack of entries from
the device from the last read entry. Therefore, in case we fail to
read proper data from the device, we will always assume we were able
to read all entries.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
12 years agooptions.c: Indent with tabs, not spaces
Timo Kokkonen [Tue, 27 Mar 2012 19:13:43 +0000 (22:13 +0300)]
options.c: Indent with tabs, not spaces

The coding convention on this project is to indent with tabs. Replace
spaces wit tabs to unify the convention. For example git diffs look
bit odd if tab and space indenting is mixed.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
12 years agooptions.c: Wrap long lines
Timo Kokkonen [Tue, 27 Mar 2012 19:12:26 +0000 (22:12 +0300)]
options.c: Wrap long lines

This makes it easier to read the code on 80 character wide editor and
console windows.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
12 years agoReplace existing printf functions with trace(...)
Timo Kokkonen [Tue, 27 Mar 2012 19:07:51 +0000 (22:07 +0300)]
Replace existing printf functions with trace(...)

This unifies the way printing is done. Everything goes to stderr by
default. Using genering tracing functions also removes the custom
trace_level handling.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
12 years agocontour-protocol: Replace bad macros with static functions
Timo Kokkonen [Tue, 27 Mar 2012 18:52:06 +0000 (21:52 +0300)]
contour-protocol: Replace bad macros with static functions

These macros in question were modifying variables outside of their
parameter listing. As the macros were also used in places where using
some of the variables don't make any sense, the were also some
compiler warning that were introduced since gcc version 4.6:

contour-protocol.c: In function ‘contour_read_entry’:
contour-protocol.c:296:6: warning: variable ‘j’ set but not used [-Wunused-but-set-variable]

As there are so many calls to the macros it makes sense to replace
them with static functions. This also cures the compiler
warning. Another plus side is that now using the macro should not have
any hard to miss side effects to other variables.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
12 years agoReplace strerror() with "%m" at printf
Timo Kokkonen [Tue, 27 Mar 2012 18:15:13 +0000 (21:15 +0300)]
Replace strerror() with "%m" at printf

The printf functions already support printing the errno value as a
string, there is no need to convert it manually.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
12 years ago_hiddev_open: Fix error messages
Timo Kokkonen [Tue, 27 Mar 2012 18:12:01 +0000 (21:12 +0300)]
_hiddev_open: Fix error messages

Not all of the errors are caused by device open. There is actually
only one error case for open and two for ioctls. Fix the error
messages.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
12 years agomain: Only set non-zero elements in user_options structure
Timo Kokkonen [Tue, 27 Mar 2012 17:59:38 +0000 (20:59 +0300)]
main: Only set non-zero elements in user_options structure

As the number of elements may increase over time, it is better to zero
out the entire strucutre and then explicity set default values only on
those entries that have non-zero default.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
12 years agomain.c: Refactor data formatting out of main function
Timo Kokkonen [Tue, 27 Mar 2012 17:53:55 +0000 (20:53 +0300)]
main.c: Refactor data formatting out of main function

The size of the main function is growing a little large. Factor out
the data entry formatting into smaller functions that are easier to
understand.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
12 years agomain.c: Remove forward declaration for token()
Timo Kokkonen [Tue, 27 Mar 2012 16:42:00 +0000 (19:42 +0300)]
main.c: Remove forward declaration for token()

The forward declaration can be avoided by moving the function before
any call sites. As an added bonus, the function is marked as static as
it is not used in any other C file.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
12 years agoTweaked progress tracing.
Steve Sloan [Sat, 24 Mar 2012 19:40:28 +0000 (12:40 -0700)]
Tweaked progress tracing.

12 years agoFixed CSV format.
Steve Sloan [Sat, 24 Mar 2012 19:40:16 +0000 (12:40 -0700)]
Fixed CSV format.

12 years agoFixed option handling.
Steve Sloan [Sat, 24 Mar 2012 19:39:53 +0000 (12:39 -0700)]
Fixed option handling.

12 years agoAdded libusb to linker options.
Steve Sloan [Tue, 20 Mar 2012 16:58:58 +0000 (09:58 -0700)]
Added libusb to linker options.

12 years agoAdded -format option (defaults to "clean"), added "raw" and "CSV" formats.
Steve Sloan [Tue, 20 Mar 2012 16:58:32 +0000 (09:58 -0700)]
Added -format option (defaults to "clean"), added "raw" and "CSV" formats.

12 years agoWrite trace messages to stderr so only data goes to stdout (allows for shell redirect...
Steve Sloan [Tue, 20 Mar 2012 16:56:24 +0000 (09:56 -0700)]
Write trace messages to stderr so only data goes to stdout (allows for shell redirection).

12 years agoAdd copyright notices
Timo Kokkonen [Mon, 19 Mar 2012 16:50:32 +0000 (18:50 +0200)]
Add copyright notices

I, as the creator of this project, am making a decision to distribute
this project under the GPLv2 license. Now you know it. Thank you. Live
long and prosper.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
12 years agomain: Print how many entries we have read from the meter
Timo Kokkonen [Fri, 24 Jun 2011 15:55:34 +0000 (18:55 +0300)]
main: Print how many entries we have read from the meter

This makes it easier for an inpatient user to wait until all the
readings have been taken out from the device.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
12 years agoAdd support for printing out data to a file
Timo Kokkonen [Thu, 5 May 2011 16:00:11 +0000 (19:00 +0300)]
Add support for printing out data to a file

If no file is given, results are printed out to stdout, as before.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
12 years agoutils: Add sanitize_ascii()
Timo Kokkonen [Thu, 5 May 2011 15:59:19 +0000 (18:59 +0300)]
utils: Add sanitize_ascii()

This can be used to ensure all characters on an ascii array are
printable.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
12 years agoSeparate initialization and data reading into a separate steps
Timo Kokkonen [Sun, 1 May 2011 14:12:39 +0000 (17:12 +0300)]
Separate initialization and data reading into a separate steps

This makes it possible in future to do something useful with the data
instead of just dumping it out to stdout.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
12 years agocontour-protocol: Do not explicitly print out the proggress note
Timo Kokkonen [Sun, 1 May 2011 13:49:33 +0000 (16:49 +0300)]
contour-protocol: Do not explicitly print out the proggress note

Allow the proggress note to be only printed when a special read
function is used.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
12 years agoRefactor Contour USB communication routines into separate file
Timo Kokkonen [Sun, 1 May 2011 13:36:21 +0000 (16:36 +0300)]
Refactor Contour USB communication routines into separate file

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
12 years agoIf no suitable devices are found, wait until one is found
Timo Kokkonen [Sat, 30 Apr 2011 14:28:57 +0000 (17:28 +0300)]
If no suitable devices are found, wait until one is found

This makes it more convenient to use this tool as it doesn't
immediately bail out if it can't find a device to talk to.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
12 years agomain: Print proggress percentage during device initialization
Timo Kokkonen [Fri, 29 Apr 2011 20:37:31 +0000 (23:37 +0300)]
main: Print proggress percentage during device initialization

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
12 years agoFix crossed vendor and product IDs
Timo Kokkonen [Fri, 29 Apr 2011 20:37:03 +0000 (23:37 +0300)]
Fix crossed vendor and product IDs

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
12 years agohiddev: Coding convention fix
Timo Kokkonen [Fri, 29 Apr 2011 20:36:04 +0000 (23:36 +0300)]
hiddev: Coding convention fix

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
12 years agohiddev: Print error message only when there is an error
Timo Kokkonen [Fri, 29 Apr 2011 20:34:54 +0000 (23:34 +0300)]
hiddev: Print error message only when there is an error

For example when device IDs don't match, there is no real error that
needs to be printed.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
12 years agohiddev: Fix bug when matching incorrect device IDs
Timo Kokkonen [Fri, 29 Apr 2011 20:30:10 +0000 (23:30 +0300)]
hiddev: Fix bug when matching incorrect device IDs

If device IDs don't match, we must return negative error code in order
to let the caller know about the error.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
12 years agomain: Use default vendor and product IDs when no explicit device path is given
Timo Kokkonen [Fri, 29 Apr 2011 20:05:38 +0000 (23:05 +0300)]
main: Use default vendor and product IDs when no explicit device path is given

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
12 years agooptions: Make verbose level adjustable
Timo Kokkonen [Fri, 29 Apr 2011 20:04:58 +0000 (23:04 +0300)]
options: Make verbose level adjustable

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
12 years agohiddev: Add support for opening hid devices by vendor and product IDs.
Timo Kokkonen [Fri, 29 Apr 2011 20:03:49 +0000 (23:03 +0300)]
hiddev: Add support for opening hid devices by vendor and product IDs.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
12 years agohiddev: Put debug traces behind trace() call
Timo Kokkonen [Fri, 29 Apr 2011 20:02:28 +0000 (23:02 +0300)]
hiddev: Put debug traces behind trace() call

This way user can adjust the desired tracing level and hide
unnecessary debug messages at will.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
12 years agoRead options from command line
Timo Kokkonen [Thu, 28 Apr 2011 18:49:18 +0000 (21:49 +0300)]
Read options from command line

The usb device node and verbosity level is supported.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
12 years agoMake excess debug messages to be hidden by default
Timo Kokkonen [Thu, 28 Apr 2011 18:22:14 +0000 (21:22 +0300)]
Make excess debug messages to be hidden by default

Only desired debug messages are shown depending on the tracing level.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
12 years agoAdd README file
Timo Kokkonen [Wed, 27 Apr 2011 19:14:22 +0000 (22:14 +0300)]
Add README file

Anyone who is using this software should be aware that this is very
experimental piece of software and might damage the device.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
12 years agoFactor out misc functions into utils.[ch] files
Timo Kokkonen [Wed, 27 Apr 2011 19:01:14 +0000 (22:01 +0300)]
Factor out misc functions into utils.[ch] files

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
12 years agoRefactor hiddev functions out from main.c
Timo Kokkonen [Wed, 27 Apr 2011 18:09:18 +0000 (21:09 +0300)]
Refactor hiddev functions out from main.c

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
12 years agoSignificantly reduce the delays between messages
Timo Kokkonen [Wed, 27 Apr 2011 17:59:31 +0000 (20:59 +0300)]
Significantly reduce the delays between messages

There only needs to be relatively short delay between the different
messages, but the delay between different messages varies quite
much. The delays introduced here are far from being optimal, but
reducing the delays too much causes unexpected behaviour.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
12 years agoInitial commit
Timo Kokkonen [Wed, 27 Apr 2011 15:25:49 +0000 (18:25 +0300)]
Initial commit

This version is extremely slow and prints huge amounts of verbose
debug messages. But it is able to import the glucose readings from the
device.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>