Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-radexreader for openSUSE:Factory checked in at 2021-05-06 22:52:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-radexreader (Old) and /work/SRC/openSUSE:Factory/.python-radexreader.new.2988 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-radexreader" Thu May 6 22:52:38 2021 rev:2 rq:891109 version:1.2.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-radexreader/python-radexreader.changes 2021-04-19 21:06:45.948098316 +0200 +++ /work/SRC/openSUSE:Factory/.python-radexreader.new.2988/python-radexreader.changes 2021-05-06 22:53:12.626605198 +0200 @@ -1,0 +2,7 @@ +Wed May 5 20:00:00 UTC 2021 - Fabrice Creuzot <c...@luigifab.fr> + +- New upstream version (1.2.0) + * add support for Radex ONE Geiger counter + * fix a start crash with Radex RD1212 v1 + +------------------------------------------------------------------- Old: ---- python-radexreader-1.1.0.tar.gz New: ---- python-radexreader-1.2.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-radexreader.spec ++++++ --- /var/tmp/diff_new_pack.ZPmPOw/_old 2021-05-06 22:53:13.042603482 +0200 +++ /var/tmp/diff_new_pack.ZPmPOw/_new 2021-05-06 22:53:13.042603482 +0200 @@ -18,9 +18,9 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-radexreader -Version: 1.1.0 +Version: 1.2.0 Release: 0 -Summary: Reader for the RADEX RD1212 Geiger counter +Summary: Reader for the RADEX RD1212 and ONE Geiger counters License: GPL-2.0-or-later URL: https://github.com/luigifab/python-radexreader Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz @@ -37,15 +37,16 @@ %python_subpackages %description -The RadexReader is an user-space driver for the RADEX RD1212 Geiger counter. -It allow to read and clear stored data via USB. +The RadexReader is an user-space driver for the RADEX RD1212 and +the RADEX ONE Geiger counters. It allow to read and clear stored +data via USB. To avoid Access denied (insufficient permissions), don't forget to unplug the device after installation. %prep %setup -q -n python-radexreader-%{version} -sed -i 's/python3-radexreader /python3-radexreader-rpm /g' src/cmd.py +sed -i 's/python3-radexreader /python3-radexreader-rpm /g' src/radexreader.py sed -i 's/\#\!\/usr\/bin\/python3/\#/g' src/radexreader/__init__.py %build @@ -59,7 +60,7 @@ mkdir -p %{buildroot}%{_bindir}/ mkdir -p %{buildroot}%{_udevrulesdir}/ %python_expand install -p -m 644 ../debian/udev %{buildroot}%{_udevrulesdir}/60-python%{$python_bin_suffix}-radexreader.rules -install -p -m 755 ../src/cmd.py %{buildroot}%{_bindir}/radexreader +install -p -m 755 ../src/radexreader.py %{buildroot}%{_bindir}/radexreader %python_clone -a %{buildroot}%{_bindir}/radexreader %files %{python_files} ++++++ python-radexreader-1.1.0.tar.gz -> python-radexreader-1.2.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-radexreader-1.1.0/README.md new/python-radexreader-1.2.0/README.md --- old/python-radexreader-1.1.0/README.md 2021-04-04 22:00:00.000000000 +0200 +++ new/python-radexreader-1.2.0/README.md 2021-05-05 22:00:00.000000000 +0200 @@ -1,54 +1,56 @@ # RadexReader -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. +The RadexReader is an user-space driver for the [RADEX RD1212](https://quartarad.com/product-category/radiation-detector/) and the [RADEX ONE](https://quartarad.com/product-category/radiation-detector/) Geiger counters. It allow to read and clear stored data via USB. Warning! This tool is completely unrelated with QuartaRad. - + + ## Screenshots [](images/read.png?raw=true) [](images/compare.png?raw=true) -* Read `src/cmd.py` for examples. +* Read `src/radexreader.py` for examples. * Run the command `radexreader` available with DEB/RPM packages. -* Run the command `cmd.py` available with PYPI package. +* Run the command `radexreader.py` available with PYPI package. ## Installation -It require *libusb*. +It require *libusb*, *pyusb* and *pyserial*. * Debian and Ubuntu: `sudo apt install python3-radexreader radexreader` (coming soon or via [PPA](https://launchpad.net/~luigifab/+archive/ubuntu/packages)) * Fedora: `sudo dnf install python3-radexreader` (coming soon) -* Linux: `sudo python3 -m pip install pyusb pyserial radexreader` (+libusb) +* OpenSuse: `sudo zypper install python3-radexreader` -* Mac: `sudo pip install pyusb pyserial radexreader` (+libusb) +* Linux: `sudo python3 -m pip install radexreader` (+libusb) -* Windows: `python -m pip install pyusb pyserial radexreader` (+[libusb](https://libusb.info/), put libusb-1.0.dll in system32) +* Mac: `sudo pip install radexreader` (+libusb) + +* Windows: `python -m pip install radexreader` (+[libusb](https://libusb.info/), put libusb-1.0.dll in system32) * 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 pyserial radexreader` +then: `apk update ; apk add libusb ; python3 -m pip install radexreader` ## PPA Installation for Debian and Ubuntu with [PPA](https://launchpad.net/~luigifab/+archive/ubuntu/packages): -``` +```bash sudo add-apt-repository ppa:luigifab/packages sudo apt update sudo apt install python3-radexreader radexreader - -- or -- +# or sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys FFE5BD439356DF7D echo "deb http://ppa.launchpad.net/luigifab/packages/ubuntu hirsute main" | sudo tee -a /etc/apt/sources.list sudo apt update sudo apt install python3-radexreader radexreader - -- or -- +# or sudo wget -O /etc/apt/trusted.gpg.d/luigifab.gpg https://www.luigifab.fr/apt.gpg echo "deb http://ppa.launchpad.net/luigifab/packages/ubuntu hirsute main" | sudo tee -a /etc/apt/sources.list sudo apt update sudo apt install python3-radexreader radexreader ``` - ```bash # sha256sum /etc/apt/trusted.gpg.d/luigifab.gpg 578c89a677048e38007462d543686b53587efba9f93814601169253c45ff9213 @@ -60,15 +62,15 @@ ## Copyright -- Current version: 1.1.0 (04/04/2021) +- Current version: 1.2.0 (05/05/2021) - Compatibility: Python 3.3 / 3.4 / 3.5 / 3.6 / 3.7 / 3.8 / 3.9 - Links: [luigifab.fr](https://www.luigifab.fr/python/radexreader) - [github.com](https://github.com/luigifab/python-radexreader) - [pypi.org](https://pypi.org/project/radexreader/)\ [debian python-radexreader.deb](https://tracker.debian.org/pkg/python3-radexreader) *([ITP](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=973447), [RFS](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=974217))*\ -[fedora python-radexreader.rpm](https://src.fedoraproject.org/rpms/python3-radexreader) - *([RR](https://bugzilla.redhat.com/show_bug.cgi?id=1896742))*\ -[launchpad PPA](https://launchpad.net/~luigifab/+archive/ubuntu/packages) +[fedora python-radexreader.rpm](https://src.fedoraproject.org/rpms/python3-radexreader)\ +[opensuse python-radexreader.rpm](https://software.opensuse.org/package/python-radexreader)\ +[ubuntu PPA](https://launchpad.net/~luigifab/+archive/ubuntu/packages) This program is provided under the terms of the **GNU GPLv2+** license.\ If you like, take some of your time to improve some translations, go to https://bit.ly/2HyCCEc. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-radexreader-1.1.0/debian/changelog new/python-radexreader-1.2.0/debian/changelog --- old/python-radexreader-1.1.0/debian/changelog 2021-04-04 22:00:00.000000000 +0200 +++ new/python-radexreader-1.2.0/debian/changelog 2021-05-05 22:00:00.000000000 +0200 @@ -1,5 +1,5 @@ -python-radexreader (1.1.0-1) unstable; urgency=low +python-radexreader (1.2.0-1) unstable; urgency=low * Initial debian package release (Closes: #973447) - -- Fabrice Creuzot <c...@luigifab.fr> Sun, 04 Apr 2021 20:00:00 +0000 + -- Fabrice Creuzot <c...@luigifab.fr> Wed, 05 May 2021 20:00:00 +0000 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-radexreader-1.1.0/debian/control new/python-radexreader-1.2.0/debian/control --- old/python-radexreader-1.1.0/debian/control 2021-04-04 22:00:00.000000000 +0200 +++ new/python-radexreader-1.2.0/debian/control 2021-05-05 22:00:00.000000000 +0200 @@ -4,17 +4,18 @@ Maintainer: Fabrice Creuzot <c...@luigifab.fr> Build-Depends: debhelper-compat (= 13), python3-all, dh-python, dh-exec Rules-Requires-Root: no -Standards-Version: 4.5.0 +Standards-Version: 4.5.1 Homepage: https://github.com/luigifab/python-radexreader Vcs-Browser: https://github.com/luigifab/python-radexreader Vcs-Git: https://github.com/luigifab/python-radexreader.git Package: python3-radexreader Architecture: all -Depends: ${misc:Depends}, ${python3:Depends}, python3-usb, python3-serial -Description: Reader for the RADEX RD1212 Geiger counter (Python module) - The RadexReader is an user-space driver for the RADEX RD1212. It - allow to read and clear stored data via USB. +Depends: ${misc:Depends}, ${python3:Depends}, python3-serial, python3-usb +Description: Reader for the RADEX RD1212 and ONE Geiger counters (Python module) + The RadexReader is an user-space driver for the RADEX RD1212 and + the RADEX ONE Geiger counters. It allow to read and clear stored + data via USB. . To avoid Access denied (insufficient permissions), don't forget to unplug the device after installation. @@ -22,9 +23,10 @@ Package: radexreader Architecture: all Depends: ${misc:Depends}, ${python3:Depends}, python3-radexreader -Description: Reader for the RADEX RD1212 Geiger counter (CLI) - The RadexReader is an user-space driver for the RADEX RD1212. It - allow to read and clear stored data via USB. +Description: Reader for the RADEX RD1212 and ONE Geiger counters (CLI) + The RadexReader is an user-space driver for the RADEX RD1212 and + the RADEX ONE Geiger counters. It allow to read and clear stored + data via USB. . To avoid Access denied (insufficient permissions), don't forget to unplug the device after installation. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-radexreader-1.1.0/debian/deb.sh new/python-radexreader-1.2.0/debian/deb.sh --- old/python-radexreader-1.1.0/debian/deb.sh 2021-04-04 22:00:00.000000000 +0200 +++ new/python-radexreader-1.2.0/debian/deb.sh 2021-05-05 22:00:00.000000000 +0200 @@ -2,9 +2,8 @@ # debian: sudo apt install dpkg-dev devscripts dh-make dh-python dh-exec - cd "$(dirname "$0")" -version="1.1.0" +version="1.2.0" rm -rf builder/ @@ -32,7 +31,7 @@ # create packages for debian and ubuntu -for serie in unstable hirsute groovy focal bionic xenial trusty precise; do +for serie in unstable impish hirsute groovy focal bionic xenial trusty precise; do if [ $serie = "unstable" ]; then # for ubuntu @@ -100,7 +99,7 @@ cd .. done -ls -dltrh $PWD/builder/*.deb $PWD/builder/*.changes +ls -dltrh builder/*.deb builder/*.changes echo "===========================" # cleanup diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-radexreader-1.1.0/debian/metainfo.xml new/python-radexreader-1.2.0/debian/metainfo.xml --- old/python-radexreader-1.1.0/debian/metainfo.xml 2021-04-04 22:00:00.000000000 +0200 +++ new/python-radexreader-1.2.0/debian/metainfo.xml 2021-05-05 22:00:00.000000000 +0200 @@ -3,14 +3,19 @@ <id>python3-radexreader</id> <name>python3-radexreader</name> <metadata_license>GPL-2+</metadata_license> - <summary>Reader for the RADEX RD1212 Geiger counter</summary> + <summary>Reader for the RADEX RD1212 and ONE Geiger counters</summary> <description> <p> - The RadexReader is an user-space driver for the RADEX RD1212. + The RadexReader is an user-space driver for the RADEX RD1212 and the RADEX ONE Geiger counters. It allow to read and clear stored data via USB. </p> </description> <provides> + <!-- RD1212v2 --> <modalias>usb:v03EBp5603d*</modalias> + <!-- RD1212v1 --> + <modalias>usb:v10C4pEA60d*</modalias> + <!-- ONEv1 --> + <modalias>usb:vABBApA011d*</modalias> </provides> </component> \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-radexreader-1.1.0/debian/radexreader.install new/python-radexreader-1.2.0/debian/radexreader.install --- old/python-radexreader-1.1.0/debian/radexreader.install 2021-04-04 22:00:00.000000000 +0200 +++ new/python-radexreader-1.2.0/debian/radexreader.install 2021-05-05 22:00:00.000000000 +0200 @@ -1,2 +1,2 @@ #!/usr/bin/dh-exec -src/cmd.py => usr/bin/radexreader \ No newline at end of file +src/radexreader.py => usr/bin/radexreader \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-radexreader-1.1.0/debian/rules new/python-radexreader-1.2.0/debian/rules --- old/python-radexreader-1.1.0/debian/rules 2021-04-04 22:00:00.000000000 +0200 +++ new/python-radexreader-1.2.0/debian/rules 2021-05-05 22:00:00.000000000 +0200 @@ -6,4 +6,4 @@ dh $@ --with python3 override_dh_update_autotools_config: - sed -i 's/python3-radexreader /python3-radexreader-deb /g' src/cmd.py + sed -i 's/python3-radexreader /python3-radexreader-deb /g' src/radexreader.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-radexreader-1.1.0/debian/udev new/python-radexreader-1.2.0/debian/udev --- old/python-radexreader-1.1.0/debian/udev 2021-04-04 22:00:00.000000000 +0200 +++ new/python-radexreader-1.2.0/debian/udev 2021-05-05 22:00:00.000000000 +0200 @@ -1 +1,3 @@ -SUBSYSTEM=="usb", ATTR{idVendor}=="03eb", ATTR{idProduct}=="5603", TAG+="uaccess" \ No newline at end of file +SUBSYSTEM=="usb", ATTR{idVendor}=="03eb", ATTR{idProduct}=="5603", TAG+="uaccess" +SUBSYSTEM=="usb", ATTR{idVendor}=="10c4", ATTR{idProduct}=="ea60", TAG+="uaccess" +SUBSYSTEM=="usb", ATTR{idVendor}=="abba", ATTR{idProduct}=="a011", TAG+="uaccess" \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-radexreader-1.1.0/fedora/python-radexreader.spec new/python-radexreader-1.2.0/fedora/python-radexreader.spec --- old/python-radexreader-1.1.0/fedora/python-radexreader.spec 2021-04-04 22:00:00.000000000 +0200 +++ new/python-radexreader-1.2.0/fedora/python-radexreader.spec 2021-05-05 22:00:00.000000000 +0200 @@ -1,35 +1,33 @@ -%global common_summary_en Reader for the RADEX RD1212 Geiger counter -%global common_summary_fr Lecteur pour le compteur Geiger RADEX RD1212 +%global common_summary_en Reader for the RADEX RD1212 and ONE Geiger counters +%global common_summary_fr Lecteur pour les compteurs Geiger RADEX RD1212 et ONE %global common_description_en %{expand: -The RadexReader is an user-space driver for the RADEX RD1212 Geiger counter. -It allow to read and clear stored data via USB. +The RadexReader is an user-space driver for the RADEX RD1212 and +the RADEX ONE Geiger counters. It allow to read and clear stored +data via USB. To avoid Access denied (insufficient permissions), don't forget to unplug the device after installation.} %global common_description_fr %{expand: -Le RadexReader est un pilote en espace utilisateur pour le compteur Geiger -RADEX RD1212. Il permet de lire et d'effacer les donn??es stock??es via USB. +Le RadexReader est un pilote en espace utilisateur pour les compteurs +Geiger RADEX RD1212 et RADEX ONE. Il permet de lire et d'effacer les +donn??es stock??es via USB. Pour ??viter un Access denied (insufficient permissions), n'oubliez pas de d??brancher l'appareil apr??s l'installation.} -Name: python-radexreader -Version: 1.1.0 -Release: 1%{?dist} -Summary: %{common_summary_en} -Summary(fr): %{common_summary_fr} -License: GPLv2+ -URL: https://github.com/luigifab/python-radexreader -Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz -BuildArch: noarch +Name: python-radexreader +Version: 1.2.0 +Release: 1%{?dist} +Summary: %{common_summary_en} +Summary(fr): %{common_summary_fr} +License: GPLv2+ +URL: https://github.com/luigifab/python-radexreader +Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz -BuildRequires: python3-devel +BuildArch: noarch BuildRequires: hunspell-fr -Requires: python3 -Requires: python3dist(pyusb) -Requires: python3dist(pyserial) %description %{common_description_en} %description -l fr %{common_description_fr} @@ -37,14 +35,21 @@ %package -n python3-radexreader %py_provides python3-radexreader -Summary: %{common_summary_en} -Summary(fr): %{common_summary_fr} +Summary: %{common_summary_en} +Summary(fr): %{common_summary_fr} + +BuildRequires: python3-devel +Requires: python3 +Requires: %{py3_dist pyserial} +Requires: %{py3_dist pyusb} + %description -n python3-radexreader %{common_description_en} %description -n python3-radexreader -l fr %{common_description_fr} + %prep %setup -q -n python-radexreader-%{version} -sed -i 's/python3-radexreader /python3-radexreader-rpm /g' src/cmd.py +sed -i 's/python3-radexreader /python3-radexreader-rpm /g' src/radexreader.py sed -i 's/\#\!\/usr\/bin\/python3/\#/g' src/radexreader/__init__.py %build @@ -57,7 +62,7 @@ mkdir -p %{buildroot}%{_bindir}/ mkdir -p %{buildroot}/lib/udev/rules.d/ install -p -m 644 ../debian/udev %{buildroot}/lib/udev/rules.d/60-python3-radexreader.rules -install -p -m 755 ../src/cmd.py %{buildroot}%{_bindir}/radexreader +install -p -m 755 ../src/radexreader.py %{buildroot}%{_bindir}/radexreader %files -n python3-radexreader %license LICENSE @@ -69,5 +74,5 @@ %changelog -* Sun Apr 04 2021 Fabrice Creuzot <c...@luigifab.fr> - 1.1.0-1 -- Initial fedora package release (Closes: #1896742) +* Wed May 05 2021 Fabrice Creuzot <c...@luigifab.fr> - 1.2.0-1 +- Initial fedora package release (Closes: rhbz#1896742) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-radexreader-1.1.0/fedora/rpm.sh new/python-radexreader-1.2.0/fedora/rpm.sh --- old/python-radexreader-1.1.0/fedora/rpm.sh 2021-04-04 22:00:00.000000000 +0200 +++ new/python-radexreader-1.2.0/fedora/rpm.sh 2021-05-05 22:00:00.000000000 +0200 @@ -1,10 +1,9 @@ #!/bin/bash -# debian: sudo apt install dpkg-dev devscripts dh-make dh-python dh-exec rpm -# fedora: sudo dnf install rpmdevtools rpm-sign python3-devel +# fedora: sudo dnf install rpmdevtools rpm-sign python3-devel hunspell-fr # fedora: configure: error: C compiler cannot create executables? remove and reinstall glibc-devel gcc cd "$(dirname "$0")" -version="1.1.0" +version="1.2.0" rm -rf builder/ ~/rpmbuild/ @@ -21,7 +20,7 @@ rm -rf /tmp/${temp}/*/builder/ /tmp/${temp}/radexreader/__pycache__/ mv /tmp/${temp} builder/ - cp /usr/share/common-licenses/GPL-2 builder/${temp}/LICENSE + cp /usr/share/licenses/linux-firmware/GPL-2 builder/${temp}/LICENSE cd builder/ tar czf ${temp}.tar.gz ${temp} @@ -32,7 +31,7 @@ fi # create package (rpm sign https://access.redhat.com/articles/3359321) -rpmbuild --nodeps -ba python-radexreader.spec +rpmbuild -ba python-radexreader.spec rpm --addsign ~/rpmbuild/RPMS/*/*.rpm rpm --addsign ~/rpmbuild/SRPMS/*.rpm mv ~/rpmbuild/RPMS/*/*.rpm builder/ @@ -42,7 +41,7 @@ echo "===========================" rpmlint python-radexreader.spec builder/*.rpm echo "===========================" -ls -dltrh $PWD/builder/*.rpm +ls -dltrh builder/*.rpm echo "===========================" # cleanup Binary files old/python-radexreader-1.1.0/images/ONE.jpg and new/python-radexreader-1.2.0/images/ONE.jpg differ Binary files old/python-radexreader-1.1.0/images/read.png and new/python-radexreader-1.2.0/images/read.png differ Binary files old/python-radexreader-1.1.0/images/thumbs/read.png and new/python-radexreader-1.2.0/images/thumbs/read.png differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-radexreader-1.1.0/opensuse/python-radexreader.spec new/python-radexreader-1.2.0/opensuse/python-radexreader.spec --- old/python-radexreader-1.1.0/opensuse/python-radexreader.spec 1970-01-01 01:00:00.000000000 +0100 +++ new/python-radexreader-1.2.0/opensuse/python-radexreader.spec 2021-05-05 22:00:00.000000000 +0200 @@ -0,0 +1,71 @@ +%{?!python_module:%define python_module() python-%{**} python3-%{**}} +Name: python-radexreader +Version: 1.2.0 +Release: 0 +Summary: Reader for the RADEX RD1212 and ONE Geiger counters +License: GPL-2.0-or-later +URL: https://github.com/luigifab/python-radexreader +Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz + +BuildArch: noarch +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module pyserial} +BuildRequires: %{python_module pyusb} +BuildRequires: python-rpm-macros +BuildRequires: fdupes +Requires: python-pyserial +Requires: python-pyusb +Requires(post): update-alternatives +Requires(postun): update-alternatives + +%python_subpackages + +%description +The RadexReader is an user-space driver for the RADEX RD1212 and +the RADEX ONE Geiger counters. It allow to read and clear stored +data via USB. + +To avoid Access denied (insufficient permissions), don't forget +to unplug the device after installation. + + +%prep +%setup -q -n python-radexreader-%{version} +sed -i 's/python3-radexreader /python3-radexreader-rpm /g' src/radexreader.py +sed -i 's/\#\!\/usr\/bin\/python3/\#/g' src/radexreader/__init__.py + +%build +cd src +%python_build + +%install +cd src +%python_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} +mkdir -p %{buildroot}%{_bindir}/ +mkdir -p %{buildroot}%{_udevrulesdir}/ +%python_expand install -p -m 644 ../debian/udev %{buildroot}%{_udevrulesdir}/60-python%{$python_bin_suffix}-radexreader.rules +install -p -m 755 ../src/radexreader.py %{buildroot}%{_bindir}/radexreader +%python_clone -a %{buildroot}%{_bindir}/radexreader + +%files %{python_files} +%license LICENSE +%doc README.md +%python_alternative %{_bindir}/radexreader +%{python_sitelib}/radexreader/ +%{python_sitelib}/radexreader*egg-info/ +%{_udevrulesdir}/60-python%{python_bin_suffix}-radexreader.rules + +%post +%python_install_alternative radexreader + +%postun +%python_uninstall_alternative radexreader + + +%changelog +* Wed May 05 2021 Fabrice Creuzot <c...@luigifab.fr> - 1.2.0-1 +- New upstream version + +* Sun Apr 04 2021 Fabrice Creuzot <c...@luigifab.fr> - 1.1.0-1 +- Initial opensuse package release diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-radexreader-1.1.0/opensuse/rpm.sh new/python-radexreader-1.2.0/opensuse/rpm.sh --- old/python-radexreader-1.1.0/opensuse/rpm.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/python-radexreader-1.2.0/opensuse/rpm.sh 2021-05-05 22:00:00.000000000 +0200 @@ -0,0 +1,48 @@ +#!/bin/bash +# opensuse: sudo zypper install rpmdevtools rpmlint rpm-build python3-devel aspell-fr + + +cd "$(dirname "$0")" +version="1.2.0" + + +rm -rf builder/ ~/rpmbuild/ +mkdir -p builder ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} + +# copy to a tmp directory +if [ true ]; then + chmod 644 python-radexreader.spec + spectool -g -R python-radexreader.spec +else + temp=python-radexreader-${version} + mkdir /tmp/${temp} + cp -r ../* /tmp/${temp}/ + rm -rf /tmp/${temp}/*/builder/ /tmp/${temp}/radexreader/__pycache__/ + + mv /tmp/${temp} builder/ + cp /usr/share/licenses/kernel-firmware/GPL-2 builder/${temp}/LICENSE + + cd builder/ + tar czf ${temp}.tar.gz ${temp} + cd .. + + cp builder/${temp}.tar.gz ~/rpmbuild/SOURCES/python-radexreader-${version}.tar.gz + chmod 644 python-radexreader.spec +fi + +# create package (rpm sign https://access.redhat.com/articles/3359321) +rpmbuild -ba python-radexreader.spec +rpm --addsign ~/rpmbuild/RPMS/*/*.rpm +rpm --addsign ~/rpmbuild/SRPMS/*.rpm +mv ~/rpmbuild/RPMS/*/*.rpm builder/ +mv ~/rpmbuild/SRPMS/*.rpm builder/ +echo "===========================" +rpm --checksig builder/*.rpm +echo "===========================" +rpmlint python-radexreader.spec builder/*.rpm +echo "===========================" +ls -dltrh builder/*.rpm +echo "===========================" + +# cleanup +rm -rf builder/*/ ~/rpmbuild/ \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-radexreader-1.1.0/pypi/pypi.sh new/python-radexreader-1.2.0/pypi/pypi.sh --- old/python-radexreader-1.1.0/pypi/pypi.sh 2021-04-04 22:00:00.000000000 +0200 +++ new/python-radexreader-1.2.0/pypi/pypi.sh 2021-05-05 22:00:00.000000000 +0200 @@ -2,9 +2,8 @@ # debian: sudo apt install python3-pip python3-setuptools # fedora: sudo dnf install python3-devel - cd "$(dirname "$0")" -version="1.1.0" +version="1.2.0" rm -rf builder/ @@ -14,10 +13,10 @@ cp -r ../src/* builder/radexreader-${version}/ cp ../README.md builder/radexreader-${version}/ -mv builder/radexreader-${version}/cmd.py builder/radexreader-${version}/radexreader/ -cp /usr/share/common-licenses/GPL-2 builder/radexreader-${version}/LICENSE -sed -i 's/python3-radexreader /python3-radexreader-pypi /g' builder/radexreader-${version}/radexreader/cmd.py -sed -i 's/Usage: radexreader /Usage: cmd.py /g' builder/radexreader-${version}/radexreader/cmd.py +cp /usr/share/common-licenses/GPL-2 builder/radexreader-${version}/LICENSE +mv builder/radexreader-${version}/radexreader.py builder/radexreader-${version}/radexreader/ +sed -i 's/python3-radexreader /python3-radexreader-pypi /g' builder/radexreader-${version}/radexreader/radexreader.py +sed -i 's/Usage: radexreader /Usage: radexreader.py /g' builder/radexreader-${version}/radexreader/radexreader.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-radexreader-1.1.0/src/cmd.py new/python-radexreader-1.2.0/src/cmd.py --- old/python-radexreader-1.1.0/src/cmd.py 2021-04-04 22:00:00.000000000 +0200 +++ new/python-radexreader-1.2.0/src/cmd.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,134 +0,0 @@ -#!/usr/bin/python3 -# -*- coding: utf8 -*- -# Created L/19/10/2020 -# Updated V/26/03/2021 -# -# Copyright 2020-2021 | Fabrice Creuzot (luigifab) <code~luigifab~fr> -# https://github.com/luigifab/python-radexreader -# https://www.luigifab.fr/python/radexreader -# -# This program is free software, you can redistribute it or modify -# it under the terms of the GNU General Public License (GPL) as published -# by the free software foundation, either version 2 of the license, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but without any warranty, without even the implied warranty of -# merchantability or fitness for a particular purpose. See the -# GNU General Public License (GPL) for more details. - -from datetime import datetime -from platform import python_version -import time -import sys -import usb -import serial - -try: - import radexreader - msg = 'Information python3-radexreader ' + radexreader.__version__ + ' with python ' + python_version() + ' + pyusb ' + usb.__version__ + ' + pyserial ' + serial.__version__ -except: - import os - sys.path.append(os.path.abspath(__file__).replace('cmd.py', '')) - import radexreader - msg = 'Information radexreader ' + radexreader.__version__ + ' with python ' + python_version() + ' + pyusb ' + usb.__version__ + ' + pyserial ' + serial.__version__ - -if len(sys.argv) > 1: - - if sys.argv[1] == 'serial': - print(msg) - reader = radexreader.RadexReader() - reader.print_info() - reader.print_serial_number() - exit(0) - - if sys.argv[1] == 'erase': - print(msg) - reader = radexreader.RadexReader() - reader.print_info() - reader.erase() - print('done') - exit(0) - - if sys.argv[1] == 'tail': - print(msg) - reader = radexreader.RadexReader() - reader.print_info() - prev = None - while True: - measures = reader.read(True) - for timestamp, measure in measures.items(): - if timestamp != prev: - print('%s %s ??Sv/h ??%s%% (%s ??? %s ??? %s)' % ( - str(datetime.utcfromtimestamp(timestamp)), - str('{:.2f}'.format(measure['val'])).rjust(6, ' '), - str(int(measure['pct'])), - str('{:.2f}'.format(measure['min'])), - str('{:.2f}'.format(measure['val'])), - str('{:.2f}'.format(measure['max'])) - )) - prev = timestamp - time.sleep(10) - exit(0) - - if sys.argv[1] == 'tailjson': - import json - reader = radexreader.RadexReader() - prev = None - while True: - measures = reader.read(True) - for timestamp, measure in measures.items(): - if timestamp != prev: - print(json.dumps(measure)) - prev = timestamp - time.sleep(10) - exit(0) - - if sys.argv[1] == 'readlast': - print(msg) - reader = radexreader.RadexReader() - reader.print_info() - measures = reader.read(True) - for timestamp, measure in measures.items(): - print('%s %s ??Sv/h ??%s%% (%s ??? %s ??? %s)' % ( - str(datetime.utcfromtimestamp(timestamp)), - str('{:.2f}'.format(measure['val'])).rjust(6, ' '), - str(int(measure['pct'])), - str('{:.2f}'.format(measure['min'])), - str('{:.2f}'.format(measure['val'])), - str('{:.2f}'.format(measure['max'])) - )) - if not measures: - print('no data stored') - exit(0) - - if sys.argv[1] == 'jsonlast': - import json - print(json.dumps(radexreader.RadexReader().read(True))) - exit(0) - - if sys.argv[1] == 'readall': - print(msg) - reader = radexreader.RadexReader() - reader.print_info() - measures = reader.read(False) - for timestamp, measure in measures.items(): - print('%s %s ??Sv/h ??%s%% (%s ??? %s ??? %s)' % ( - str(datetime.utcfromtimestamp(timestamp)), - str('{:.2f}'.format(measure['val'])).rjust(6, ' '), - str(int(measure['pct'])), - str('{:.2f}'.format(measure['min'])), - str('{:.2f}'.format(measure['val'])), - str('{:.2f}'.format(measure['max'])) - )) - if not measures: - print('no data stored') - exit(0) - - if sys.argv[1] == 'jsonall': - import json - print(json.dumps(radexreader.RadexReader().read(False))) - exit(0) - -print('Usage: radexreader erase|tail|tailjson|readlast|jsonlast|readall|jsonall') -exit(-1) \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-radexreader-1.1.0/src/radexreader/__init__.py new/python-radexreader-1.2.0/src/radexreader/__init__.py --- old/python-radexreader-1.1.0/src/radexreader/__init__.py 2021-04-04 22:00:00.000000000 +0200 +++ new/python-radexreader-1.2.0/src/radexreader/__init__.py 2021-05-05 22:00:00.000000000 +0200 @@ -1,7 +1,7 @@ #!/usr/bin/python3 # -*- coding: utf8 -*- # Created L/19/10/2020 -# Updated V/26/03/2021 +# Updated D/02/05/2021 # # Copyright 2020-2021 | Fabrice Creuzot (luigifab) <code~luigifab~fr> # https://github.com/luigifab/python-radexreader @@ -18,131 +18,162 @@ # GNU General Public License (GPL) for more details. import sys +import operator +import time +# pyusb import usb.core import usb.util import usb.backend.libusb1 +# pyserial import serial import serial.tools.list_ports -import operator -__version__ = '1.1.0' +__version__ = '1.2.0' class RadexReader(): - dev = None - com = 'usb' + com = None + usb = None + serial = None + keyA = None + keyB = None + keyC = None + keyD = None def __init__(self): - # search usb device (backend only? for alpine with docker) - backend = usb.backend.libusb1.get_backend(find_library=lambda x: '/usr/lib/libusb-1.0.so.0') - self.dev = usb.core.find(idVendor=0x03eb, idProduct=0x5603, backend=backend) - # check - if self.dev is None: + + # backend only for alpine with docker? + backend = usb.backend.libusb1.get_backend(find_library=lambda x: '/usr/lib/libusb-1.0.so.0') + + # RADEX RD1212 v2 + # search usb device (03EB/5603) + self.usb = usb.core.find(idVendor=0x03eb, idProduct=0x5603, backend=backend) + if self.usb is not None: + self.com = 'RD1212v2' + # usb reset + self.usb.reset() + if sys.platform != 'win32' and sys.platform != 'cygwin' and self.usb.is_kernel_driver_active(0): + self.usb.detach_kernel_driver(0) + self.usb.set_configuration() + return # device found + + # RADEX RD1212 v1 + # search usb device (10C4/EA60 = Silicon labs USB to UART bridge) + self.usb = usb.core.find(idVendor=0x10c4, idProduct=0xea60, backend=backend) + if self.usb is not None: + self.com = 'RD1212v1' # search usb serial device (https://stackoverflow.com/a/25112066/2980105) - self.com = 'serial' - devices = serial.tools.list_ports.grep('Radex') + devices = serial.tools.list_ports.grep('RADEX') for device in devices: - self.dev = serial.Serial(port = device.port, baudrate = 115200, timeout = 0.5) - break - # check - if self.dev is None: - # debug - #ports = list(serial.tools.list_ports.comports()) - #for p in ports: - # print(p) - # debug - raise ValueError('Error: RADEX RD1212 not plugged? (usb or serial)') - # reset - else: - self.dev.reset() - if sys.platform != 'win32' and sys.platform != 'cygwin' and self.dev.is_kernel_driver_active(0): - self.dev.detach_kernel_driver(0) - self.dev.set_configuration() - - def get_device(self): - return self.dev + self.serial = serial.Serial(port = device.device, baudrate = 115200, timeout = 0.5) + return # device found + if self.serial is None: + raise ValueError('Error: RADEX RD1212 (serial) not found') + + # RADEX ONE v1 + # search usb device (ABBA/A011) + self.usb = usb.core.find(idVendor=0xabba, idProduct=0xa011, backend=backend) + if self.usb is not None: + self.com = 'ONEv1' + # search usb serial device (https://stackoverflow.com/a/25112066/2980105) + devices = serial.tools.list_ports.grep('RADEX') + for device in devices: + self.serial = serial.Serial(port = device.device, baudrate = 9600, timeout = 0.5) + return # device found + if self.serial is None: + raise ValueError('Error: RADEX ONE (serial) not found') + + # no devices found + if self.usb is None: + raise ValueError('Error: RADEX RD1212 (usb) and RADEX ONE (usb) not plugged?') + + def get_device(self, getusb=False): + if not getusb and self.serial is not None: + return self.serial + return self.usb def print_info(self): - if self.com == 'usb': - print('Manufacturer ' + hex(self.dev.idVendor).ljust(7, ' ') + ' ' + usb.util.get_string(self.dev, self.dev.iManufacturer)) - print('Product ' + hex(self.dev.idProduct).ljust(7, ' ') + ' ' + usb.util.get_string(self.dev, self.dev.iProduct)) - else: - print('ComPort ' + self.dev.port) - print() - print('[info] Sensor: Geiger-M??ller tube SBM 20-1') - print('[info] Measuring range: 0.05 - 999 ??Sv/h') - print('[info] Uncertainty of the result: ??(15+6/D)%') - print('[info] D is the value after a complete cycle of 100 seconds') - print() - print('[warn] The values displayed are only an approximation.') - print('[warn] The actual value can only be measured with suitable professional device.') - print('[warn] For now, not tested with measured values greater than 0.25 ??Sv/h.') - print() + if self.com == 'RD1212v2': + print('Manufacturer ' + hex(self.usb.idVendor).ljust(7, ' ') + ' ' + usb.util.get_string(self.usb, self.usb.iManufacturer)) + print('Product ' + hex(self.usb.idProduct).ljust(7, ' ') + ' ' + usb.util.get_string(self.usb, self.usb.iProduct)) + print() + print('[info] Sensor: Geiger-M??ller tube SBM 20-1') + print('[info] Measuring range: 0.05 - 999 ??Sv/h') + print('[info] Uncertainty of the result: ??(15+6/D)%') + print('[info] D is the value after a complete cycle of 100 seconds') + print() + print('[warn] The values displayed are only an approximation.') + print('[warn] The actual value can only be measured with suitable professional device.') + print('[warn] For now, not tested with measured values greater than 0.25 ??Sv/h.') + print() + elif self.com == 'RD1212v1': + print('Manufacturer ' + hex(self.usb.idVendor).ljust(7, ' ') + ' ' + usb.util.get_string(self.usb, self.usb.iManufacturer)) + print('Product ' + hex(self.usb.idProduct).ljust(7, ' ') + ' ' + usb.util.get_string(self.usb, self.usb.iProduct)) + print('ComPort ' + self.serial.port) + print() + print('[info] Sensor: Geiger-M??ller tube SBM 20-1') + print('[info] Measuring range: 0.05 - 999 ??Sv/h') + print('[info] Uncertainty of the result: ??(15+6/D)%') + print('[info] D is the value after a complete cycle of 100 seconds') + print() + print('[warn] The values displayed are only an approximation.') + print('[warn] The actual value can only be measured with suitable professional device.') + print('[warn] For now, not tested with measured values greater than 0.25 ??Sv/h.') + print() + elif self.com == 'ONEv1': + if sys.platform != 'win32' and sys.platform != 'cygwin': + print('Manufacturer ' + hex(self.usb.idVendor).ljust(7, ' ') + ' ' + usb.util.get_string(self.usb, self.usb.iManufacturer)) + print('Product ' + hex(self.usb.idProduct).ljust(7, ' ') + ' ' + usb.util.get_string(self.usb, self.usb.iProduct)) + else: + print('Manufacturer -x---- QUARTA-RAD') + print('Product -x---- RADEX ONE') + print('ComPort ' + self.serial.port) + print() + print('[info] Sensor: Geiger-M??ller tube SBM 20-1') + print('[info] Measuring range: 0.05 - 999 ??Sv/h') + print('[info] Uncertainty of the result: ??(15+6/D)%') + print('[info] D is the value after a complete cycle of 100? seconds') + print() + print('[warn] The values displayed are only an approximation.') + print('[warn] The actual value can only be measured with suitable professional device.') + print('[warn] For now, not tested with measured values greater than 0.25 ??Sv/h.') + print() def hid_set_report(self, report): - # https://stackoverflow.com/a/52368526/2980105 - if self.com == 'usb': - self.dev.ctrl_transfer( + if self.com == 'RD1212v2': + # https://stackoverflow.com/a/52368526/2980105 + self.usb.ctrl_transfer( 0x21, # REQUEST_TYPE_CLASS | RECIPIENT_INTERFACE | ENDPOINT_OUT 9, # SET_REPORT 0x300, # Vendor Descriptor Type + 0 Descriptor Index 0, # USB interface #0 report # the HID payload as a byte array ) - else: - self.dev.write(report) + elif self.com == 'RD1212v1': + self.serial.write(report) + elif self.com == 'ONEv1': + self.serial.write(report) def hid_get_report(self): - # https://stackoverflow.com/a/52368526/2980105 - if self.com == 'usb': - return self.dev.ctrl_transfer( + if self.com == 'RD1212v2': + # https://stackoverflow.com/a/52368526/2980105 + return self.usb.ctrl_transfer( 0xa1, # REQUEST_TYPE_CLASS | RECIPIENT_INTERFACE | ENDPOINT_IN 1, # GET_REPORT 0x300, # Vendor Descriptor Type + 0 Descriptor Index 0, # USB interface #0 64 # max reply size ) - else: - return self.dev.read(14) - - def print_serial_number(self): - # https://github.com/luigifab/python-radexreader/issues/6 - print('EXPERIMENTAL') - self.hid_set_report((0x12, 0x12, 0x01, 0, 0, 0, 0, 0x3c, 0x84, 0x6b, 0xa8, 0xeb, 0x4f)) - print(self.hid_get_report()) - self.hid_set_report((0x12, 0x12, 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x3c, 0x84)) - print(self.hid_get_report()) - self.hid_set_report((0x12, 0x12, 0x01, 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0x3c, 0x84)) - hexa = self.hid_get_report() - print(hexa) - serial = '' - for i in range(7): - if i == 1 and (hexa[i] - 6) < 10: - serial += ' 0' + str(hexa[i] - 6) - elif i == 1: - serial += ' ' + str(hexa[i] - 6) - elif i == 5 and (hexa[i] - 42) < 10: - serial += ' 0' + str(hexa[i] - 42) - elif i == 5: - serial += ' ' + str(hexa[i] - 42) - elif i == 6 and (hexa[i] - 12) < 10: - serial += ' 0' + str(hexa[i] - 12) - elif i == 6: - serial += ' ' + str(hexa[i] - 12) - elif hexa[i] < 10: - serial += ' 0' + str(hexa[i]) - else: - serial += ' ' + str(hexa[i]) - print() - print(serial + ' (it is YOUR serial number?)') - print() - print(' 0' + str(hexa[0]) + ' xx' + ' 0' + str(hexa[2]) + ' 0' + str(hexa[3]) + ' 0' + str(hexa[4]) + ' xx' + ' xx (debug)') - print(' 04 19 01 01 00 72 22 (7x2)') - print(' 0419010 1007222 (2x7)') - print(' 04190101007222 (1x14)') + elif self.com == 'RD1212v1': + return self.serial.read(14) + elif self.com == 'ONEv1': + return self.serial.read(12 + 21 + 2 + 2 + 2 + 2 + 1) def read(self, last=False): + if self.com == 'ONEv1': + return self.readOne() + values = {} if last: keys = [0x0] @@ -153,10 +184,10 @@ self.hid_set_report((0x12, 0x12, 0x01, 0x02, key, 0, 0, 0, 0, 0, 0, 0, 0x3c, 0x84)) hexa = self.hid_get_report() if hexa[0] != 0: - # timestamp - 01/01/2016 00:00:44 = 1451606444 - # timestamp - 01/01/2016 00:00:44 = 172 + 193 (??256) + 133 (??256??256) + 86 (??256??256??256) + # timestamp = 01/01/2016 00:00:44 = 1451606444 + # timestamp = 01/01/2016 00:00:44 = 172 + 193 (??256) + 133 (??256??256) + 86 (??256??256??256) timestamp = (hexa[2] + hexa[3] * 256 + hexa[4] * 256 * 256 + hexa[5] * 256 * 256 * 256) - # measure - 0.15 ??Sv/h = 15 + # measure = 0.15 ??Sv/h = 15 measure = (hexa[6] + hexa[7] * 256 + hexa[8] * 256 * 256) / 100 # uncertainty of the result percent = 15 + 6 / measure @@ -169,8 +200,51 @@ # memorize values[timestamp] = { 'pct': percent, 'min': measure_min, 'val': measure, 'max': measure_max } - # sort by date - return dict(sorted(values.items(), key=operator.itemgetter(0))) + return dict(sorted(values.items(), key=operator.itemgetter(0))) # sort by date + + def readOne(self): + + if self.keyA is None: + self.keyA = 0x04 - 0x04 + self.keyB = 0x00 + self.keyC = 0x5a + 0x04 + self.keyD = 0x00 + + self.keyA += 0x04 + self.keyC -= 0x04 + if self.keyA > 0xff: + self.keyA -= 0xfe + self.keyB += 0x01 + if self.keyB > 0xff: + self.keyB = 0x00 + self.keyC -= 0x01 + elif self.keyC < 0x00: + self.keyC += 0xff + self.keyD -= 0x01 + if self.keyD < 0x00: + self.keyD = 0xff + + self.hid_set_report((0x7b, 0xff, 0x20, 0, 0x06, 0, self.keyA, self.keyB, 0, 0, self.keyC, self.keyD, 0, 0x08, 0x0c, 0, 0xf3, 0xf7)) + hexa = self.hid_get_report() + + # measure = 0.15 ??Sv/h = 15 / 0.15 ??Sv accumulated = 15 / 15 CPM = 15 + measure = (hexa[20] + hexa[21] * 256 + hexa[22] * 256 * 256) / 100 + measure_acc = (hexa[24] + hexa[25] * 256 + hexa[26] * 256 * 256) / 100 + measure_cpm = hexa[28] + hexa[29] * 256 + hexa[30] * 256 * 256 + # uncertainty of the result + percent = 15 + 6 / measure + measure_min = measure * (1 - percent / 100) + measure_max = measure * (1 + percent / 100) + if measure_min < 0: + measure_min = 0 + if percent > 99.9: + percent = 99.9 + + timestamp = int(time.time()) + return { timestamp: { 'pct': percent, 'min': measure_min, 'val': measure, 'max': measure_max, 'acc': measure_acc, 'cpm': measure_cpm } } def erase(self): - self.hid_set_report((0x12, 0x12, 0x01, 0x03, 0, 0, 0, 0, 0, 0, 0, 0, 0x3c, 0x84)) + if self.com == 'RD1212v2': + self.hid_set_report((0x12, 0x12, 0x01, 0x03, 0, 0, 0, 0, 0, 0, 0, 0, 0x3c, 0x84)) + elif self.com == 'RD1212v1': + self.hid_set_report((0x12, 0x12, 0x01, 0x03, 0, 0, 0, 0, 0, 0, 0, 0, 0x3c, 0x84)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-radexreader-1.1.0/src/radexreader.py new/python-radexreader-1.2.0/src/radexreader.py --- old/python-radexreader-1.1.0/src/radexreader.py 1970-01-01 01:00:00.000000000 +0100 +++ new/python-radexreader-1.2.0/src/radexreader.py 2021-05-05 22:00:00.000000000 +0200 @@ -0,0 +1,147 @@ +#!/usr/bin/python3 +# -*- coding: utf8 -*- +# Created L/19/10/2020 +# Updated D/02/05/2021 +# +# Copyright 2020-2021 | Fabrice Creuzot (luigifab) <code~luigifab~fr> +# https://github.com/luigifab/python-radexreader +# https://www.luigifab.fr/python/radexreader +# +# This program is free software, you can redistribute it or modify +# it under the terms of the GNU General Public License (GPL) as published +# by the free software foundation, either version 2 of the license, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but without any warranty, without even the implied warranty of +# merchantability or fitness for a particular purpose. See the +# GNU General Public License (GPL) for more details. + +from datetime import datetime +from platform import python_version +import sys +import time +import usb +import serial + +try: + import radexreader + msg = 'Information python3-radexreader ' + radexreader.__version__ + msg += ' with python ' + python_version() + ' + pyusb ' + usb.__version__ + ' + pyserial ' + serial.__version__ +except: + import os + sys.path.append(os.path.abspath(__file__).replace('radexreader.py', '')) + import radexreader + msg = 'Information radexreader ' + radexreader.__version__ + msg += ' with python ' + python_version() + ' + pyusb ' + usb.__version__ + ' + pyserial ' + serial.__version__ + +if len(sys.argv) > 1: + + if sys.argv[1] == 'erase': + print(msg) + reader = radexreader.RadexReader() + reader.print_info() + reader.erase() + print('done') + exit(0) + + if sys.argv[1] == 'tail': + print(msg) + reader = radexreader.RadexReader() + reader.print_info() + prev = None + while True: + measures = reader.read(True) + for timestamp, measure in measures.items(): + if timestamp != prev: + print('%s %s ??Sv/h ??%s%% (%s ??? %s ??? %s)' % ( + str(datetime.utcfromtimestamp(timestamp)), + str('{:.2f}'.format(measure['val'])).rjust(6, ' '), + str(int(measure['pct'])), + str('{:.2f}'.format(measure['min'])), + str('{:.2f}'.format(measure['val'])), + str('{:.2f}'.format(measure['max'])) + )) + if reader.com == 'ONEv1': + print(' %s ??Sv accumulated / %s CPM [??%s%%]' % ( + str('{:.2f}'.format(measure['acc'])).rjust(6, ' '), + str('{:.0f}'.format(measure['cpm'])).rjust(6, ' '), + str(int(measure['pct'])) + )) + prev = timestamp + time.sleep(10) + exit(0) + + if sys.argv[1] == 'tailjson': + import json + reader = radexreader.RadexReader() + prev = None + while True: + measures = reader.read(True) + for timestamp, measure in measures.items(): + if timestamp != prev: + print(json.dumps(measure)) + prev = timestamp + time.sleep(10) + exit(0) + + if sys.argv[1] == 'readlast': + print(msg) + reader = radexreader.RadexReader() + reader.print_info() + measures = reader.read(True) + for timestamp, measure in measures.items(): + print('%s %s ??Sv/h ??%s%% (%s ??? %s ??? %s)' % ( + str(datetime.utcfromtimestamp(timestamp)), + str('{:.2f}'.format(measure['val'])).rjust(6, ' '), + str(int(measure['pct'])), + str('{:.2f}'.format(measure['min'])), + str('{:.2f}'.format(measure['val'])), + str('{:.2f}'.format(measure['max'])) + )) + if reader.com == 'ONEv1': + print(' %s ??Sv accumulated / %s CPM [??%s%%]' % ( + str('{:.2f}'.format(measure['acc'])).rjust(6, ' '), + str('{:.0f}'.format(measure['cpm'])).rjust(6, ' '), + str(int(measure['pct'])) + )) + if not measures: + print('no data stored') + exit(0) + + if sys.argv[1] == 'jsonlast': + import json + print(json.dumps(radexreader.RadexReader().read(True))) + exit(0) + + if sys.argv[1] == 'readall': + print(msg) + reader = radexreader.RadexReader() + reader.print_info() + measures = reader.read(False) + for timestamp, measure in measures.items(): + print('%s %s ??Sv/h ??%s%% (%s ??? %s ??? %s)' % ( + str(datetime.utcfromtimestamp(timestamp)), + str('{:.2f}'.format(measure['val'])).rjust(6, ' '), + str(int(measure['pct'])), + str('{:.2f}'.format(measure['min'])), + str('{:.2f}'.format(measure['val'])), + str('{:.2f}'.format(measure['max'])) + )) + if reader.com == 'ONEv1': + print(' %s ??Sv accumulated / %s CPM [??%s%%]' % ( + str('{:.2f}'.format(measure['acc'])).rjust(6, ' '), + str('{:.0f}'.format(measure['cpm'])).rjust(6, ' '), + str(int(measure['pct'])) + )) + if not measures: + print('no data stored') + exit(0) + + if sys.argv[1] == 'jsonall': + import json + print(json.dumps(radexreader.RadexReader().read(False))) + exit(0) + +print('Usage: radexreader erase|tail|tailjson|readlast|jsonlast|readall|jsonall') +exit(-1) \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-radexreader-1.1.0/src/setup.py new/python-radexreader-1.2.0/src/setup.py --- old/python-radexreader-1.1.0/src/setup.py 2021-04-04 22:00:00.000000000 +0200 +++ new/python-radexreader-1.2.0/src/setup.py 2021-05-05 22:00:00.000000000 +0200 @@ -1,7 +1,7 @@ #!/usr/bin/python3 # -*- coding: utf8 -*- # Created L/19/10/2020 -# Updated S/20/03/2021 +# Updated J/15/04/2021 # # Copyright 2020-2021 | Fabrice Creuzot (luigifab) <code~luigifab~fr> # https://github.com/luigifab/python-radexreader @@ -27,8 +27,8 @@ long_description = fh.read().replace('(images/', '(https://raw.githubusercontent.com/luigifab/python-radexreader/master/images/') setup( name='radexreader', - version='1.1.0', - description='Python library for the RADEX RD1212 Geiger counter.', + version='1.2.0', + description='Python library for the RADEX RD1212 and the RADEX ONE Geiger counters.', long_description=long_description, long_description_content_type='text/markdown', license='GPL 2', @@ -41,8 +41,8 @@ except: setup( name='radexreader', - version='1.1.0', - description='Python library for the RADEX RD1212 Geiger counter.', + version='1.2.0', + description='Python library for the RADEX RD1212 and the RADEX ONE Geiger counters.', license='GPL 2', author='Fabrice Creuzot', author_email='c...@luigifab.fr',