Skip to content

Commit fe8dbcb

Browse files
committed
Version 1.1.0
1 parent e60f259 commit fe8dbcb

File tree

12 files changed

+208
-98
lines changed

12 files changed

+208
-98
lines changed

README.md

Lines changed: 59 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,74 @@
11
# RadexReader
22

3-
The RadexReader is an user-space driver for the [RADEX RD1212](https://quartarad.com/product-category/radiation-detector/) Geiger counter. It allow to read and clear stored data via USB. Warning! This tool is completely unrelated with QuartaRad.
3+
The RadexReader is an user-space driver for the [RADEX RD1212](https://quartarad.com/product-category/radiation-detector/) Geiger counter. It allow to read and clear **stored data** via USB. Warning! This tool is completely unrelated with QuartaRad.
44

5-
Debian and Fedora packages submitted: [deb](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=974217), [rpm](https://bugzilla.redhat.com/show_bug.cgi?id=1896742). Ubuntu: [PPA](https://launchpad.net/~luigifab/+archive/ubuntu/packages).
5+
![RD1212](images/RD1212.jpg?raw=true)
66

7-
## Installation
8-
9-
It require *libusb*.
7+
## Screenshots
108

11-
* Debian and Ubuntu: `sudo apt install python3-radexreader radexreader` (coming soon, or via PPA)
12-
13-
* Fedora: `sudo dnf install python3-radexreader` (coming soon)
14-
15-
* Linux: `sudo python3 -m pip install pyusb radexreader` (+libusb)
9+
[![Screnshot 1](images/thumbs/read.png?raw=true)](images/read.png?raw=true)
10+
[![Screnshot 2](images/thumbs/compare.png?raw=true)](images/compare.png?raw=true)
1611

17-
* Mac: `sudo pip install pyusb radexreader` (+libusb)
12+
* Read `src/cmd.py` for examples.
13+
* Run the command `radexreader` available with DEB/RPM packages.
14+
* Run the command `cmd.py` available with PYPI package.
1815

19-
* Windows: `python -m pip install pyusb radexreader` (+[libusb](https://libusb.info/), put libusb-1.0.dll in system32)
16+
## Installation
2017

21-
* Docker Alpine: `sudo docker run --rm --user root -it --privileged -v /dev:/dev python:3.x-alpine /bin/sh` then: `apk update ; apk add libusb ; python3 -m pip install pyusb radexreader`
18+
It require *libusb*.
2219

23-
## Usage and Screenshots
20+
* Debian and Ubuntu: `sudo apt install python3-radexreader radexreader` (coming soon or via [PPA](https://launchpad.net/~luigifab/+archive/ubuntu/packages))
2421

25-
* Read `src/cmd.py` for usage examples.
26-
* Run the command `radexreader` available with DEB/RPM packages.
27-
* Run the command `cmd.py` available with PYPI package.
22+
* Fedora: `sudo dnf install python3-radexreader` (coming soon)
2823

29-
[![Screnshot 1](images/thumbs/read.png?raw=true)](images/read.png?raw=true)
30-
[![Screnshot 2](images/thumbs/compare.png?raw=true)](images/compare.png?raw=true)
24+
* Linux: `sudo python3 -m pip install pyusb pyserial radexreader` (+libusb)
25+
26+
* Mac: `sudo pip install pyusb pyserial radexreader` (+libusb)
27+
28+
* Windows: `python -m pip install pyusb pyserial radexreader` (+[libusb](https://libusb.info/), put libusb-1.0.dll in system32)
29+
30+
* Docker Alpine: `sudo docker run --rm --user root -it --privileged -v /dev:/dev python:3.x-alpine /bin/sh`\
31+
then: `apk update ; apk add libusb ; python3 -m pip install pyusb pyserial radexreader`
32+
33+
## PPA
34+
35+
Installation for Debian and Ubuntu with [PPA](https://launchpad.net/~luigifab/+archive/ubuntu/packages):
36+
```
37+
sudo add-apt-repository ppa:luigifab/packages
38+
sudo apt update
39+
sudo apt install python3-radexreader radexreader
40+
-- or --
41+
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys FFE5BD439356DF7D
42+
echo "deb http://ppa.launchpad.net/luigifab/packages/ubuntu hirsute main" | sudo tee -a /etc/apt/sources.list
43+
sudo apt update
44+
sudo apt install python3-radexreader radexreader
45+
-- or --
46+
sudo wget -O /etc/apt/trusted.gpg.d/luigifab.gpg https://www.luigifab.fr/apt.gpg
47+
echo "deb http://ppa.launchpad.net/luigifab/packages/ubuntu hirsute main" | sudo tee -a /etc/apt/sources.list
48+
sudo apt update
49+
sudo apt install python3-radexreader radexreader
50+
```
51+
52+
```bash
53+
# sha256sum /etc/apt/trusted.gpg.d/luigifab.gpg
54+
578c89a677048e38007462d543686b53587efba9f93814601169253c45ff9213
55+
# apt-key list
56+
/etc/apt/trusted.gpg.d/luigifab.gpg
57+
pub rsa4096 2020-10-31 [SC]
58+
458B 0C46 D024 FD8C B8BC 99CD FFE5 BD43 9356 DF7D
59+
```
3160

3261
## Copyright
3362

34-
- Current version: 1.0.0 (11/11/2020)
63+
- Current version: 1.1.0 (04/04/2021)
3564
- Compatibility: Python 3.3 / 3.4 / 3.5 / 3.6 / 3.7 / 3.8 / 3.9
36-
- Links: [PYPI package](https://pypi.org/project/radexreader/), [PPA](https://launchpad.net/~luigifab/+archive/ubuntu/packages)
37-
38-
This program is provided under the terms of the *GNU GPLv2+* license.
65+
- Links: [luigifab.fr](https://www.luigifab.fr/python/radexreader) - [github.com](https://github.com/luigifab/python-radexreader) - [pypi.org](https://pypi.org/project/radexreader/)\
66+
[debian python-radexreader.deb](https://tracker.debian.org/pkg/python3-radexreader)
67+
*([ITP](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=973447),
68+
[RFS](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=974217))*\
69+
[fedora python-radexreader.rpm](https://src.fedoraproject.org/rpms/python3-radexreader)
70+
*([RR](https://bugzilla.redhat.com/show_bug.cgi?id=1896742))*\
71+
[launchpad PPA](https://launchpad.net/~luigifab/+archive/ubuntu/packages)
72+
73+
This program is provided under the terms of the **GNU GPLv2+** license.\
74+
If you like, take some of your time to improve some translations, go to https://bit.ly/2HyCCEc.

debian/changelog

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
python-radexreader (1.0.0-5) unstable; urgency=low
1+
python-radexreader (1.1.0-1) unstable; urgency=low
22

33
* Initial debian package release (Closes: #973447)
44

5-
-- Fabrice Creuzot <code@luigifab.fr> Wed, 11 Nov 2020 12:00:00 +0000
5+
-- Fabrice Creuzot <code@luigifab.fr> Sun, 04 Apr 2021 20:00:00 +0000

debian/control

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Vcs-Git: https://github.com/luigifab/python-radexreader.git
1111

1212
Package: python3-radexreader
1313
Architecture: all
14-
Depends: ${misc:Depends}, ${python3:Depends}, python3-usb
14+
Depends: ${misc:Depends}, ${python3:Depends}, python3-usb, python3-serial
1515
Description: Reader for the RADEX RD1212 Geiger counter (Python module)
1616
The RadexReader is an user-space driver for the RADEX RD1212. It
1717
allow to read and clear stored data via USB.
@@ -20,7 +20,6 @@ Description: Reader for the RADEX RD1212 Geiger counter (Python module)
2020
to unplug the device after installation.
2121

2222
Package: radexreader
23-
Section: devel
2423
Architecture: all
2524
Depends: ${misc:Depends}, ${python3:Depends}, python3-radexreader
2625
Description: Reader for the RADEX RD1212 Geiger counter (CLI)

debian/copyright

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Source: https://github.com/luigifab/python-radexreader
33
Upstream-Contact: Fabrice Creuzot <code@luigifab.fr>
44

55
Files: *
6-
Copyright: 2020 Fabrice Creuzot (luigifab) <code@luigifab.fr>
6+
Copyright: 2020-2021 Fabrice Creuzot (luigifab) <code@luigifab.fr>
77
License: GPL-2+
88

99
License: GPL-2+

debian/deb.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
cd "$(dirname "$0")"
7-
version="1.0.0"
7+
version="1.1.0"
88

99

1010
rm -rf builder/
@@ -81,7 +81,7 @@ for serie in unstable hirsute groovy focal bionic xenial trusty precise; do
8181
echo 9 > debian/compat
8282
fi
8383
sed -i 's/unstable/'${serie}'/g' debian/changelog
84-
sed -i 's/-5) /-5+'${serie}') /' debian/changelog
84+
sed -i 's/-1) /-1+'${serie}') /' debian/changelog
8585
dpkg-buildpackage -us -uc -ui -d -S
8686
fi
8787
echo "==========================="

fedora/python-radexreader.spec

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Pour éviter un Access denied (insufficient permissions), n'oubliez pas
1616
de débrancher l'appareil après l'installation.}
1717

1818
Name: python-radexreader
19-
Version: 1.0.0
19+
Version: 1.1.0
2020
Release: 1%{?dist}
2121
Summary: %{common_summary_en}
2222
Summary(fr): %{common_summary_fr}
@@ -29,6 +29,7 @@ BuildRequires: python3-devel
2929
BuildRequires: hunspell-fr
3030
Requires: python3
3131
Requires: python3dist(pyusb)
32+
Requires: python3dist(pyserial)
3233

3334
%description %{common_description_en}
3435
%description -l fr %{common_description_fr}
@@ -68,5 +69,5 @@ install -p -m 755 ../src/cmd.py %{buildroot}%{_bindir}/radexreader
6869

6970

7071
%changelog
71-
* Wed Nov 11 2020 Fabrice Creuzot <code@luigifab.fr> - 1.0.0-1
72+
* Sun Apr 04 2021 Fabrice Creuzot <code@luigifab.fr> - 1.1.0-1
7273
- Initial fedora package release (Closes: #1896742)

fedora/rpm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# fedora: configure: error: C compiler cannot create executables? remove and reinstall glibc-devel gcc
55

66
cd "$(dirname "$0")"
7-
version="1.0.0"
7+
version="1.1.0"
88

99

1010
rm -rf builder/ ~/rpmbuild/

images/RD1212.jpg

8.91 KB
Loading

pypi/pypi.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
cd "$(dirname "$0")"
7-
version="1.0.0"
7+
version="1.1.0"
88
rm -rf builder/
99

1010

@@ -31,8 +31,7 @@ sed -i 's/Usage: radexreader /Usage: cmd.py /g' builder/radexreader-
3131

3232

3333

34-
# create package
35-
# https://packaging.python.org/tutorials/packaging-projects/
34+
# create package (https://packaging.python.org/tutorials/packaging-projects/)
3635
cd builder/radexreader-${version}/
3736
python3 -m pip install --user --upgrade setuptools wheel --no-warn-script-location
3837
python3 setup.py sdist bdist_wheel

src/cmd.py

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/usr/bin/python3
22
# -*- coding: utf8 -*-
33
# Created L/19/10/2020
4-
# Updated D/08/11/2020
4+
# Updated V/26/03/2021
55
#
6-
# Copyright 2020 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
6+
# Copyright 2020-2021 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
77
# https://github.com/luigifab/python-radexreader
88
# https://www.luigifab.fr/python/radexreader
99
#
@@ -22,24 +22,32 @@
2222
import time
2323
import sys
2424
import usb
25+
import serial
2526

2627
try:
2728
import radexreader
28-
msg = 'Information python3-radexreader ' + radexreader.__version__ + ' with python ' + python_version() + ' and pyusb ' + usb.__version__
29+
msg = 'Information python3-radexreader ' + radexreader.__version__ + ' with python ' + python_version() + ' + pyusb ' + usb.__version__ + ' + pyserial ' + serial.__version__
2930
except:
3031
import os
3132
sys.path.append(os.path.abspath(__file__).replace('cmd.py', ''))
3233
import radexreader
33-
msg = 'Information radexreader ' + radexreader.__version__ + ' with python ' + python_version() + ' and pyusb ' + usb.__version__
34+
msg = 'Information radexreader ' + radexreader.__version__ + ' with python ' + python_version() + ' + pyusb ' + usb.__version__ + ' + pyserial ' + serial.__version__
3435

3536
if len(sys.argv) > 1:
3637

38+
if sys.argv[1] == 'serial':
39+
print(msg)
40+
reader = radexreader.RadexReader()
41+
reader.print_info()
42+
reader.print_serial_number()
43+
exit(0)
44+
3745
if sys.argv[1] == 'erase':
3846
print(msg)
3947
reader = radexreader.RadexReader()
4048
reader.print_info()
4149
reader.erase()
42-
print('done!')
50+
print('done')
4351
exit(0)
4452

4553
if sys.argv[1] == 'tail':
@@ -51,7 +59,7 @@
5159
measures = reader.read(True)
5260
for timestamp, measure in measures.items():
5361
if timestamp != prev:
54-
print("%s %s µSv/h ±%s%% (%s ≤ %s ≤ %s)" % (
62+
print('%s %s µSv/h ±%s%% (%s ≤ %s ≤ %s)' % (
5563
str(datetime.utcfromtimestamp(timestamp)),
5664
str('{:.2f}'.format(measure['val'])).rjust(6, ' '),
5765
str(int(measure['pct'])),
@@ -63,13 +71,26 @@
6371
time.sleep(10)
6472
exit(0)
6573

74+
if sys.argv[1] == 'tailjson':
75+
import json
76+
reader = radexreader.RadexReader()
77+
prev = None
78+
while True:
79+
measures = reader.read(True)
80+
for timestamp, measure in measures.items():
81+
if timestamp != prev:
82+
print(json.dumps(measure))
83+
prev = timestamp
84+
time.sleep(10)
85+
exit(0)
86+
6687
if sys.argv[1] == 'readlast':
6788
print(msg)
6889
reader = radexreader.RadexReader()
6990
reader.print_info()
7091
measures = reader.read(True)
7192
for timestamp, measure in measures.items():
72-
print("%s %s µSv/h ±%s%% (%s ≤ %s ≤ %s)" % (
93+
print('%s %s µSv/h ±%s%% (%s ≤ %s ≤ %s)' % (
7394
str(datetime.utcfromtimestamp(timestamp)),
7495
str('{:.2f}'.format(measure['val'])).rjust(6, ' '),
7596
str(int(measure['pct'])),
@@ -78,7 +99,12 @@
7899
str('{:.2f}'.format(measure['max']))
79100
))
80101
if not measures:
81-
print("no data stored")
102+
print('no data stored')
103+
exit(0)
104+
105+
if sys.argv[1] == 'jsonlast':
106+
import json
107+
print(json.dumps(radexreader.RadexReader().read(True)))
82108
exit(0)
83109

84110
if sys.argv[1] == 'readall':
@@ -87,7 +113,7 @@
87113
reader.print_info()
88114
measures = reader.read(False)
89115
for timestamp, measure in measures.items():
90-
print("%s %s µSv/h ±%s%% (%s ≤ %s ≤ %s)" % (
116+
print('%s %s µSv/h ±%s%% (%s ≤ %s ≤ %s)' % (
91117
str(datetime.utcfromtimestamp(timestamp)),
92118
str('{:.2f}'.format(measure['val'])).rjust(6, ' '),
93119
str(int(measure['pct'])),
@@ -96,18 +122,13 @@
96122
str('{:.2f}'.format(measure['max']))
97123
))
98124
if not measures:
99-
print("no data stored")
100-
exit(0)
101-
102-
if sys.argv[1] == 'jsonlast':
103-
import json
104-
print(json.dumps(radexreader.RadexReader().read(True)))
125+
print('no data stored')
105126
exit(0)
106127

107128
if sys.argv[1] == 'jsonall':
108129
import json
109130
print(json.dumps(radexreader.RadexReader().read(False)))
110131
exit(0)
111132

112-
print('Usage: radexreader erase|tail|readlast|readall|jsonlast|jsonall')
133+
print('Usage: radexreader erase|tail|tailjson|readlast|jsonlast|readall|jsonall')
113134
exit(-1)

0 commit comments

Comments
 (0)