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