1 <?xml version=
"1.0" encoding=
"ISO-8859-1"?>
2 <rss version='
2.0' xmlns:lj='http://www.livejournal.org/rss/lj/
1.0/'
>
4 <title>Petter Reinholdtsen - Entries from March
2016</title>
5 <description>Entries from March
2016</description>
6 <link>http://people.skolelinux.org/pere/blog/
</link>
10 <title>Full battery stats collector is now available in Debian
</title>
11 <link>http://people.skolelinux.org/pere/blog/Full_battery_stats_collector_is_now_available_in_Debian.html
</link>
12 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/Full_battery_stats_collector_is_now_available_in_Debian.html
</guid>
13 <pubDate>Wed,
23 Mar
2016 22:
10:
00 +
0100</pubDate>
14 <description><p
>Since this morning, the battery-stats package in Debian include an
15 extended collector that will collect the complete battery history for
16 later processing and graphing. The original collector store the
17 battery level as percentage of last full level, while the new
18 collector also record battery vendor, model, serial number, design
19 full level, last full level and current battery level. This make it
20 possible to predict the lifetime of the battery as well as visualise
21 the energy flow when the battery is charging or discharging.
</p
>
23 <p
>The new tools are available in
<tt
>/usr/share/battery-stats/
</tt
>
24 in the version
0.5.1 package in unstable. Get the new battery level graph
25 and lifetime prediction by running:
28 /usr/share/battery-stats/battery-stats-graph /var/log/battery-stats.csv
29 </pre
></p
>
31 <p
>Or select the
'Battery Level Graph
' from your application menu.
</p
>
33 <p
>The flow in/out of the battery can be seen by running (no menu
37 /usr/share/battery-stats/battery-stats-graph-flow
38 </pre
></p
>
40 <p
>I
'm not quite happy with the way the data is visualised, at least
41 when there are few data points. The graphs look a bit better with a
42 few years of data.
</p
>
44 <p
>A while back one important feature I use in the battery stats
45 collector broke in Debian. The scripts in
46 <tt
>/usr/lib/pm-utils/power.d/
</tt
> were no longer executed. I
47 suspect it happened when Jessie started using systemd, but I do not
48 know. The issue is reported as bug #
818649 against pm-utils. I
49 managed to work around it by adding an udev rule to call the collector
50 script every time the power connector is connected and disconnected.
51 With this fix in place it was finally time to make a new release of
52 the package, and get it into Debian.
</p
>
54 <p
>If you are interested in how your laptop battery is doing, please
56 <a href=
"https://tracker.debian.org/pkg/battery-stats
">battery-stats
</a
>
57 in Debian unstable, or rebuild it on Jessie to get it working on
58 Debian stable. :) The upstream source is available from
59 <a href=
"https://github.com/petterreinholdtsen/battery-stats
">github
</a
>.
60 As always, patches are very welcome.
</p
>
65 <title>UsingQR -
"Electronic
" paper invoices using JSON and QR codes
</title>
66 <link>http://people.skolelinux.org/pere/blog/UsingQR____Electronic__paper_invoices_using_JSON_and_QR_codes.html
</link>
67 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/UsingQR____Electronic__paper_invoices_using_JSON_and_QR_codes.html
</guid>
68 <pubDate>Sat,
19 Mar
2016 09:
40:
00 +
0100</pubDate>
69 <description><p
>Back in
2013 I proposed
70 <a href=
"http://people.skolelinux.org/pere/blog/_Electronic__paper_invoices___using_vCard_in_a_QR_code.html
">a
71 way to make paper and PDF invoices easier to process electronically by
72 adding a QR code with the key information about the invoice
</a
>. I
73 suggested using vCard field definition, to get some standard format
74 for name and address, but any format would work. I did not do
75 anything about the proposal, but hoped someone one day would make
76 something like it. It would make it possible to efficiently send
77 machine readable invoices directly between seller and buyer.
</p
>
79 <p
>This was the background when I came across a proposal and
80 specification from the web based accounting and invoicing supplier
81 <a href=
"http://www.visma.com/
">Visma
</a
> in Sweden called
82 <a href=
"http://usingqr.com/
">UsingQR
</a
>. Their PDF invoices contain
83 a QR code with the key information of the invoice in JSON format.
84 This is the typical content of a QR code following the UsingQR
85 specification (based on a real world example, some numbers replaced to
86 get a more bogus entry). I
've reformatted the JSON to make it easier
87 to read. Normally this is all on one long line:
</p
>
89 <p
><img src=
"http://people.skolelinux.org/pere/blog/images/
2016-
03-
19-qr-invoice.png
" align=
"right
"><pre
>
91 "vh
":
500.00,
96 "nme
":
"Din Leverandør
",
97 "cc
":
"NO
",
98 "cid
":
"997912345 MVA
",
99 "iref
":
"12300001",
100 "idt
":
"20151022",
101 "ddt
":
"20151105",
102 "due
":
2500.0000,
103 "cur
":
"NOK
",
104 "pt
":
"BBAN
",
105 "acc
":
"17202612345",
106 "bc
":
"BIENNOK1
",
107 "adr
":
"0313 OSLO
"
109 </pre
></p
>
111 </p
>The interpretation of the fields can be found in the
112 <a href=
"http://usingqr.com/wp-content/uploads/
2014/
06/UsingQR_specification1.pdf
">format
113 specification
</a
> (revision
2 from june
2014). The format seem to
114 have most of the information needed to handle accounting and payment
115 of invoices, at least the fields I have needed so far here in
118 <p
>Unfortunately, the site and document do not mention anything about
119 the patent, trademark and copyright status of the format and the
120 specification. Because of this, I asked the people behind it back in
121 November to clarify. Ann-Christine Savlid (ann-christine.savlid (at)
122 visma.com) replied that Visma had not applied for patent or trademark
123 protection for this format, and that there were no copyright based
124 usage limitations for the format. I urged her to make sure this was
125 explicitly written on the web pages and in the specification, but
126 unfortunately this has not happened yet. So I guess if there is
127 submarine patents, hidden trademarks or a will to sue for copyright
128 infringements, those starting to use the UsingQR format might be at
129 risk, but if this happen there is some legal defense in the fact that
130 the people behind the format claimed it was safe to do so. At least
131 with patents, there is always
132 <a href=
"http://www.paperspecs.com/paper-news/beware-the-qr-code-patent-trap/
">a
133 chance of getting sued...
</a
></p
>
135 <p
>I also asked if they planned to maintain the format in an
136 independent standard organization to give others more confidence that
137 they would participate in the standardization process on equal terms
138 with Visma, but they had no immediate plans for this. Their plan was
139 to work with banks to try to get more users of the format, and
140 evaluate the way forward if the format proved to be popular. I hope
141 they conclude that using an open standard organisation like
142 <a href=
"http://www.ietf.org/
">IETF
</a
> is the correct place to
143 maintain such specification.
</p
>
145 <p
><strong
>Update
2016-
03-
20</strong
>: Via Twitter I became aware of
146 <a href=
"https://news.ycombinator.com/item?id=
11319492">some comments
147 about this blog post
</a
> that had several useful links and references to
148 similar systems. In the Czech republic, the Czech Banking Association
149 standard #
26, with short name SPAYD, uses QR codes with payment
150 information. More information is available from the Wikipedia page on
151 <a href=
"https://en.wikipedia.org/wiki/Short_Payment_Descriptor
">Short
152 Payment Descriptor
</a
>. And in Germany, there is a system named
153 <a href=
"http://www.bezahlcode.de/
">BezahlCode
</a
>,
154 (
<a href=
"http://www.bezahlcode.de/wp-content/uploads/BezahlCode_TechDok.pdf
">specification
155 v1.8
2013-
12-
05 available as PDF
</a
>), which uses QR codes with
156 URL-like formatting using
"bank:
" as the URI schema/protocol to
157 provide the payment information. There is also the
158 <a href=
"http://www.ferd-net.de/front_content.php?idcat=
231">ZUGFeRD
</a
>
159 file format that perhaps could be transfered using QR codes, but I am
160 not sure if it is done already. Last, in Bolivia there are reports
161 that tax information since november
2014 need to be printed in QR
162 format on invoices. I have not been able to track down a
163 specification for this format, because of my limited language skill
169 <title>Making battery measurements a little easier in Debian
</title>
170 <link>http://people.skolelinux.org/pere/blog/Making_battery_measurements_a_little_easier_in_Debian.html
</link>
171 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/Making_battery_measurements_a_little_easier_in_Debian.html
</guid>
172 <pubDate>Tue,
15 Mar
2016 15:
00:
00 +
0100</pubDate>
173 <description><p
>Back in September, I blogged about
174 <a href=
"http://people.skolelinux.org/pere/blog/The_life_and_death_of_a_laptop_battery.html
">the
175 system I wrote to collect statistics about my laptop battery
</a
>, and
176 how it showed the decay and death of this battery (now replaced). I
177 created a simple deb package to handle the collection and graphing,
178 but did not want to upload it to Debian as there were already
179 <a href=
"https://tracker.debian.org/pkg/battery-stats
">a battery-stats
180 package in Debian
</a
> that should do the same thing, and I did not see
181 a point of uploading a competing package when battery-stats could be
182 fixed instead. I reported a few bugs about its non-function, and
183 hoped someone would step in and fix it. But no-one did.
</p
>
185 <p
>I got tired of waiting a few days ago, and took matters in my own
186 hands. The end result is that I am now the new upstream developer of
187 battery stats (
<a href=
"https://github.com/petterreinholdtsen/battery-stats
">available from github
</a
>) and part of the team maintaining
188 battery-stats in Debian, and the package in Debian unstable is finally
189 able to collect battery status using the
<tt
>/sys/class/power_supply/
</tt
>
190 information provided by the Linux kernel. If you install the
191 battery-stats package from unstable now, you will be able to get a
192 graph of the current battery fill level, to get some idea about the
193 status of the battery. The source package build and work just fine in
194 Debian testing and stable (and probably oldstable too, but I have not
195 tested). The default graph you get for that system look like this:
</p
>
197 <p align=
"center
"><img src=
"http://people.skolelinux.org/pere/blog/images/
2016-
03-
15-battery-stats-graph-example.png
" width=
"70%
" align=
"center
"></p
>
199 <p
>My plans for the future is to merge my old scripts into the
200 battery-stats package, as my old scripts collected a lot more details
201 about the battery. The scripts are merged into the upstream
202 battery-stats git repository already, but I am not convinced they work
203 yet, as I changed a lot of paths along the way. Will have to test a
204 bit more before I make a new release.
</p
>
206 <p
>I will also consider changing the file format slightly, as I
207 suspect the way I combine several values into one field might make it
208 impossible to know the type of the value when using it for processing
209 and graphing.
</p
>
211 <p
>If you would like I would like to keep an close eye on your laptop
212 battery, check out the battery-stats package in
213 <a href=
"https://tracker.debian.org/pkg/battery-stats
">Debian
</a
> and
215 <a href=
"https://github.com/petterreinholdtsen/battery-stats
">github
</a
>.
216 I would love some help to improve the system further.
</p
>