luigifab / python-radexreader

Reader for the RADEX RD1212 and the RADEX ONE Geiger counters.
GNU General Public License v2.0
11 stars 3 forks source link

Radex RD1212v1 + ONE - Not compatible? #2

Closed Vrumfondel closed 3 years ago

Vrumfondel commented 3 years ago

Appearently this lib only works for RD-1212BT, not for RD-1212 (without BT).

This should be mentioned in the documentation.

luigifab commented 3 years ago

Perhaps.

I think this is around: return self.dev.read(12) Other possibility is the configuration of the device: serial.Serial(port = device.device, baudrate = 115200, timeout = 0.5)

I don't know, I searching some google tips.

Tobbinloggin commented 3 years ago

I'll change whatever you want me to change, having this code public would be great.

It'll open up a lot more use for this device so it's worth my time.

The device was still working but the menus stopped working, I'm unsure when this occurred, I had to restart the RADEX ONE for the menus to work again, I assume the python code caused it.

Nope, the menus appear to in-general not work when plugged in, but when unplugged it starts working again, this wasn't the case earlier, weird.

I tried to reproduce the results but it's working normal now

luigifab commented 3 years ago

This is one of our commands that temporary break the device. For my device, a full restart of the device fix all problems.

Can you try some settings:

  1. baudrate = 9600
  2. timeout = 1
  3. timeout = 2
Tobbinloggin commented 3 years ago

Changing the baudrate worked, there's data being printed now! Making progress!

C:\Windows\system32>cmd.py readall
b'z\xff\x00\x80\x00\x00\x02\x00\x00\x00\x82\x80'
b'z\xff \x80\x1e\x00\x03\x00\x00\x00C\x80'
b'\x01\x00\x00\x00\x14\x00\x00\x00\x11\xa4\x00\x00'
b'\xde\r\x00\x00\x12\x00\x03\x1e\x01\x08H\x03'
b'\x08\x00\x00\x00\x95$'
Traceback (most recent call last):
  File "C:\platform-tools\cmd.py", line 114, in <module>
    measures = reader.read(False)
  File "C:\platform-tools\radexreader\__init__.py", line 170, in read
    measure     = (hexa[6] + hexa[7] * 256 + hexa[8] * 256 * 256) / 100
IndexError: index out of range
luigifab commented 3 years ago

Good.

I found that in same time in your video file: 16 10/04/2021 08:46:55 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_BAUD_RATE) DOWN 80 25 00 00 €%.. 4 COM4

Can you capture again packets when you start the python program to check if you found the same IOCTL_SERIAL_SET_BAUD_RATE.

Tobbinloggin commented 3 years ago

cmd.py readall COM4 Monitoring Session 3.txt

I found two IOCTL_SERIAL_SET_BAUD_RATE packets in the packets recorded, a upload and a download.

26 10/04/2021 11:48:09 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_BAUD_RATE) DOWN  80 25 00 00  €%.. 4  COM4  
27 10/04/2021 11:48:09 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_SET_BAUD_RATE) UP STATUS_SUCCESS     COM4  

Just incase I also included the console output below as well.

C:\Windows\system32>cmd.py readall
b'z\xff\x00\x80\x00\x00\x02\x00\x00\x00\x82\x80'
b'z\xff \x80\x1e\x00\x03\x00\x00\x00C\x80'
b'\x01\x00\x00\x00\x14\x00\x00\x00\x11\xa4\x00\x00'
b'\xde\r\x00\x00\x12\x00\x03\x1e\x01\x08H\x03'
b'\x08\x00\x00\x00\x95$'
Traceback (most recent call last):
  File "C:\platform-tools\cmd.py", line 114, in <module>
    measures = reader.read(False)
  File "C:\platform-tools\radexreader\__init__.py", line 170, in read
    measure     = (hexa[6] + hexa[7] * 256 + hexa[8] * 256 * 256) / 100
IndexError: index out of range

Just incase I also included the console output above as well.

luigifab commented 3 years ago

So we are ok.

I read some description of Radex One, and there are no memory with the device, it's only real time, is correct? Based on your video, we can probably get from Radex One the following values: date / time / ambient dose / accumulated / cpm.

Can you try again only these lines:

# 7b ff 20 00 06 00 01 00 00 00 5d 00 01 00 0c 00 f2 ff
self.hid_set_report((0x7b, 0xff, 0x20, 0, 0x06, 0, 0x01, 0, 0, 0, 0x5d, 0, 0x01, 0, 0x0c, 0, 0xf2, 0xff))
print(self.hid_get_report())
Tobbinloggin commented 3 years ago

I read some description of Radex One, and there are no memory with the device, it's only real time, is correct?

Yes, this is why I want this code, after getting it to work on windows I want to modify it to run it on my phone so I can have a more portable way of storing radiation data, without having to write it down, I'll try out this code you've provided now.

Tobbinloggin commented 3 years ago
b'z\xff\x00\x80\x00\x00\x02\x00\x00\x00\x82\x80'
b'z\xff \x80\x1e\x00\x01\x00\x00\x00E\x80'
b'\x01\x00\x00\x00\x14\x00\x00\x00\x11\xa4\x00\x00'
b'\xde\r\x00\x00\x12\x00\x03\x1e\x01\x08H\x03'
b'\x08\x00\x00\x00\x95$'

cmd.py readall COM4 Monitoring Session 4.txt

luigifab commented 3 years ago

Ok, remove all added line in def read, and modify:

for key in keys:
    #self.hid_set_report((0x12, 0x12, 0x01, 0x02, key, 0, 0, 0, 0, 0, 0, 0, 0x3c, 0x84))
    key = 0x01
    self.hid_set_report((0x7b, 0xff, 0x20, 0, 0x06, 0, key, 0, 0, 0, 0x5d, 0, 0x01, 0, 0x0c, 0, 0xf2, 0xff))
    hexa = self.hid_get_report()
    print(hexa)

Then run cmd.py tail.

Tobbinloggin commented 3 years ago
C:\Windows\system32>cmd.py tail
b'z\xff \x80\x1e\x00\x01\x00\x00\x00E\x80'
1970-01-24 03:14:40    0.01 µSv/h  ±99% (0.00 ≤ 0.01 ≤ 0.07)
b'\x01\x00\x00\x00\x14\x00\x00\x00\x11\xa4\x00\x00'
1970-01-16 04:05:20  11141.12 µSv/h  ±15% (9469.89 ≤ 11141.12 ≤ 12812.35)
b'\xde\r\x00\x00\x12\x00\x03\x1e\x01\x08H\x03'
1970-01-14 15:40:48  732.19 µSv/h  ±15% (622.30 ≤ 732.19 ≤ 842.08)
Tobbinloggin commented 3 years ago

11141.12 µSv/h I guess I'll die.

Tobbinloggin commented 3 years ago
b'z\xff \x80\x1e\x00\x01\x00\x00\x00E\x80'
1970-01-24 03:14:40    0.01 µSv/h  ±99% (0.00 ≤ 0.01 ≤ 0.07)
b'\x01\x00\x00\x00\x14\x00\x00\x00\x11\xa4\x00\x00'
1970-01-16 04:05:20  11141.12 µSv/h  ±15% (9469.89 ≤ 11141.12 ≤ 12812.35)
b'\xde\r\x00\x00\x12\x00\x03\x1e\x01\x08H\x03'
1970-01-14 15:40:48  732.19 µSv/h  ±15% (622.30 ≤ 732.19 ≤ 842.08)
b'\x08\x00\x00\x00\x95$z\xff \x80\x1e\x00'
1989-06-13 12:37:20  21625.54 µSv/h  ±15% (18381.65 ≤ 21625.54 ≤ 24869.43)
b'\x01\x00\x00\x00E\x80\x01\x00\x00\x00\x14\x00'
2038-03-12 11:20:32    0.01 µSv/h  ±99% (0.00 ≤ 0.01 ≤ 0.07)
b'\x00\x00\x11\xa4\x00\x00\xde\r\x00\x00\x12\x00'
b'\x03\x1e\x01\x08H\x03\x08\x00\x00\x00\x95$'
1971-09-30 04:18:09    0.08 µSv/h  ±90% (0.01 ≤ 0.08 ≤ 0.15)
b'z\xff \x80\x1e\x00\x01\x00\x00\x00E\x80'
1970-01-24 03:14:40    0.01 µSv/h  ±99% (0.00 ≤ 0.01 ≤ 0.07)
b'\x01\x00\x00\x00\x14\x00\x00\x00\x11\xa4\x00\x00'
1970-01-16 04:05:20  11141.12 µSv/h  ±15% (9469.89 ≤ 11141.12 ≤ 12812.35)
b'\xde\r\x00\x00\x12\x00\x03\x1e\x01\x08H\x03'
1970-01-14 15:40:48  732.19 µSv/h  ±15% (622.30 ≤ 732.19 ≤ 842.08)
b'\x08\x00\x00\x00\x95$z\xff \x80\x1e\x00'
1989-06-13 12:37:20  21625.54 µSv/h  ±15% (18381.65 ≤ 21625.54 ≤ 24869.43)
b'\x01\x00\x00\x00E\x80\x01\x00\x00\x00\x14\x00'
2038-03-12 11:20:32    0.01 µSv/h  ±99% (0.00 ≤ 0.01 ≤ 0.07)
b'\x00\x00\x11\xa4\x00\x00\xde\r\x00\x00\x12\x00'
b'\x03\x1e\x01\x08H\x03\x08\x00\x00\x00\x95$'
1971-09-30 04:18:09    0.08 µSv/h  ±90% (0.01 ≤ 0.08 ≤ 0.15)
b'z\xff \x80\x1e\x00\x01\x00\x00\x00E\x80'
1970-01-24 03:14:40    0.01 µSv/h  ±99% (0.00 ≤ 0.01 ≤ 0.07)
b'\x01\x00\x00\x00\x14\x00\x00\x00\x11\xa4\x00\x00'
1970-01-16 04:05:20  11141.12 µSv/h  ±15% (9469.89 ≤ 11141.12 ≤ 12812.35)
b'\xde\r\x00\x00\x12\x00\x03\x1e\x01\x08H\x03'
1970-01-14 15:40:48  732.19 µSv/h  ±15% (622.30 ≤ 732.19 ≤ 842.08)
b'\x08\x00\x00\x00\x95$z\xff \x80\x1e\x00'
1989-06-13 12:37:20  21625.54 µSv/h  ±15% (18381.65 ≤ 21625.54 ≤ 24869.43)
b'\x01\x00\x00\x00E\x80\x01\x00\x00\x00\x14\x00'
2038-03-12 11:20:32    0.01 µSv/h  ±99% (0.00 ≤ 0.01 ≤ 0.07)
b'\x00\x00\x11\xa4\x00\x00\xde\r\x00\x00\x12\x00'
b'\x03\x1e\x01\x08H\x03\x08\x00\x00\x00\x95$'
1971-09-30 04:18:09    0.08 µSv/h  ±90% (0.01 ≤ 0.08 ≤ 0.15)
b'z\xff \x80\x1e\x00\x01\x00\x00\x00E\x80'
1970-01-24 03:14:40    0.01 µSv/h  ±99% (0.00 ≤ 0.01 ≤ 0.07)
b'\x01\x00\x00\x00\x14\x00\x00\x00\x11\xa4\x00\x00'
1970-01-16 04:05:20  11141.12 µSv/h  ±15% (9469.89 ≤ 11141.12 ≤ 12812.35)
b'\xde\r\x00\x00\x12\x00\x03\x1e\x01\x08H\x03'
1970-01-14 15:40:48  732.19 µSv/h  ±15% (622.30 ≤ 732.19 ≤ 842.08)
b'\x08\x00\x00\x00\x95$z\xff \x80\x1e\x00'
1989-06-13 12:37:20  21625.54 µSv/h  ±15% (18381.65 ≤ 21625.54 ≤ 24869.43)
b'\x01\x00\x00\x00E\x80\x01\x00\x00\x00\x14\x00'
2038-03-12 11:20:32    0.01 µSv/h  ±99% (0.00 ≤ 0.01 ≤ 0.07)
b'\x00\x00\x11\xa4\x00\x00\xde\r\x00\x00\x12\x00'
b'\x03\x1e\x01\x08H\x03\x08\x00\x00\x00\x95$'
1971-09-30 04:18:09    0.08 µSv/h  ±90% (0.01 ≤ 0.08 ≤ 0.15)
b'z\xff \x80\x1e\x00\x01\x00\x00\x00E\x80'
1970-01-24 03:14:40    0.01 µSv/h  ±99% (0.00 ≤ 0.01 ≤ 0.07)
b'\x01\x00\x00\x00\x14\x00\x00\x00\x11\xa4\x00\x00'
1970-01-16 04:05:20  11141.12 µSv/h  ±15% (9469.89 ≤ 11141.12 ≤ 12812.35)
b'\xde\r\x00\x00\x12\x00\x03\x1e\x01\x08H\x03'
1970-01-14 15:40:48  732.19 µSv/h  ±15% (622.30 ≤ 732.19 ≤ 842.08)
b'\x08\x00\x00\x00\x95$z\xff \x80\x1e\x00'
1989-06-13 12:37:20  21625.54 µSv/h  ±15% (18381.65 ≤ 21625.54 ≤ 24869.43)

Here's the data it's generated so far, hope it helps.

luigifab commented 3 years ago

It is bullshit, but we are reading things.

Now we will try to find the time, I will assume that it is the same encoding as on the Radex RD1212. What is the minimum and the maximum date that you can configure on your device? For the Radex RD1212, it's 01/01/2016 - 31/12/2036.

EDIT: Can you run cmd.py readlast with the following changes (I think we have not all data):

for key in keys:
    #self.hid_set_report((0x12, 0x12, 0x01, 0x02, key, 0, 0, 0, 0, 0, 0, 0, 0x3c, 0x84))
    key = 0x01
    self.hid_set_report((0x7b, 0xff, 0x20, 0, 0x06, 0, key, 0, 0, 0, 0x5d, 0, 0x01, 0, 0x0c, 0, 0xf2, 0xff))
    hexa = self.dev.read(12)
    print(hexa)
    hexa = self.dev.read(21)
    print(hexa)
    hexa = self.dev.read(2)
    print(hexa)
    hexa = self.dev.read(2)
    print(hexa)
    hexa = self.dev.read(2)
    print(hexa)
    hexa = self.dev.read(2)
    print(hexa)
    hexa = self.dev.read(1)
    print(hexa)

Reference:

454 10/04/2021 08:47:01 IRP_MJ_WRITE DOWN  7b ff 20 00 06 00 01 00 00 00 5d 00  {ÿ .......]. 12 12 COM4  
455 10/04/2021 08:47:01 IRP_MJ_WRITE UP STATUS_SUCCESS 7b ff 20 00 06 00 01 00 00 00 5d 00  {ÿ .......]. 12  COM4  
456 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) DOWN      COM4  
457 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) UP STATUS_SUCCESS 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  .................... 20  COM4  
458 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) DOWN      COM4  
459 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) UP STATUS_SUCCESS 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  .................... 20  COM4  
460 10/04/2021 08:47:01 IRP_MJ_WRITE DOWN  01 00 0c 00  .... 4 4 COM4  
461 10/04/2021 08:47:01 IRP_MJ_WRITE UP STATUS_SUCCESS 01 00 0c 00  .... 4  COM4  
462 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) DOWN      COM4  
463 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) UP STATUS_SUCCESS 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  .................... 20  COM4  
464 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) DOWN      COM4  
465 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) UP STATUS_SUCCESS 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  .................... 20  COM4  
466 10/04/2021 08:47:01 IRP_MJ_WRITE DOWN  f2 ff  òÿ 2 2 COM4  
467 10/04/2021 08:47:01 IRP_MJ_WRITE UP STATUS_SUCCESS f2 ff  òÿ 2  COM4  
468 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) DOWN      COM4  
469 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) UP STATUS_SUCCESS 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  .................... 20  COM4  
470 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) DOWN      COM4  
471 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) UP STATUS_SUCCESS 00 00 00 00 00 00 00 00 21 00 00 00 00 00 00 00 00 00 00 00  ........!........... 20  COM4  
472 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) DOWN      COM4  
473 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) UP STATUS_SUCCESS 00 00 00 00 00 00 00 00 21 00 00 00 00 00 00 00 00 00 00 00  ........!........... 20  COM4  
474 10/04/2021 08:47:01 IRP_MJ_READ DOWN     12 COM4  
475 10/04/2021 08:47:01 IRP_MJ_READ UP STATUS_SUCCESS 7a ff 20 80 1e 00 01 00 00 00 45 80  zÿ €......E€ 12  COM4  
476 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) DOWN      COM4  
477 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) UP STATUS_SUCCESS 00 00 00 00 00 00 00 00 15 00 00 00 00 00 00 00 00 00 00 00  .................... 20  COM4  
478 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) DOWN      COM4  
479 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) UP STATUS_SUCCESS 00 00 00 00 00 00 00 00 15 00 00 00 00 00 00 00 00 00 00 00  .................... 20  COM4  
480 10/04/2021 08:47:01 IRP_MJ_READ DOWN     21 COM4  
481 10/04/2021 08:47:01 IRP_MJ_READ UP STATUS_SUCCESS 01 00 00 00 14 00 00 00 11 a4 00 00 de 0d 00 00 12 00 03 1e 01  .........¤..Þ........ 21  COM4  
482 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) DOWN      COM4  
483 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) UP STATUS_SUCCESS 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  .................... 20  COM4  
484 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) DOWN      COM4  
485 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) UP STATUS_SUCCESS 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00  .................... 20  COM4  
486 10/04/2021 08:47:01 IRP_MJ_READ DOWN     2 COM4  
487 10/04/2021 08:47:01 IRP_MJ_READ UP STATUS_SUCCESS 08 48  .H 2  COM4  
488 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) DOWN      COM4  
489 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) UP STATUS_SUCCESS 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  .................... 20  COM4  
490 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) DOWN      COM4  
491 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) UP STATUS_SUCCESS 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00  .................... 20  COM4  
492 10/04/2021 08:47:01 IRP_MJ_READ DOWN     2 COM4  
493 10/04/2021 08:47:01 IRP_MJ_READ UP STATUS_SUCCESS 03 08  .. 2  COM4  
494 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) DOWN      COM4  
495 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) UP STATUS_SUCCESS 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  .................... 20  COM4  
496 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) DOWN      COM4  
497 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) UP STATUS_SUCCESS 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00  .................... 20  COM4  
498 10/04/2021 08:47:01 IRP_MJ_READ DOWN     2 COM4  
499 10/04/2021 08:47:01 IRP_MJ_READ UP STATUS_SUCCESS 00 00  .. 2  COM4  
500 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) DOWN      COM4  
501 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) UP STATUS_SUCCESS 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  .................... 20  COM4  
502 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) DOWN      COM4  
503 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) UP STATUS_SUCCESS 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00  .................... 20  COM4  
504 10/04/2021 08:47:01 IRP_MJ_READ DOWN     2 COM4  
505 10/04/2021 08:47:01 IRP_MJ_READ UP STATUS_SUCCESS 00 95  .• 2  COM4  
506 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) DOWN      COM4  
507 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) UP STATUS_SUCCESS 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  .................... 20  COM4  
508 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) DOWN      COM4  
509 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) UP STATUS_SUCCESS 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00  .................... 20  COM4  
510 10/04/2021 08:47:01 IRP_MJ_READ DOWN     1 COM4  
511 10/04/2021 08:47:01 IRP_MJ_READ UP STATUS_SUCCESS 24  $ 1  COM4  
512 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_PURGE) DOWN  0f 00 00 00  .... 4  COM4  
513 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_PURGE) UP STATUS_SUCCESS     COM4  
514 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) DOWN      COM4  
515 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) UP STATUS_SUCCESS 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  .................... 20  COM4  
516 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) DOWN      COM4  
517 10/04/2021 08:47:01 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) UP STATUS_SUCCESS 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  .................... 20  COM4
[10/04/2021 08:20:42] Written data (COM4) 
    7b ff 20 00 06 00 01 00 00 00 5d 00 01 00 0c 00   {ÿ .......]..... 
    f2 ff                                             òÿ               
[10/04/2021 08:20:42] Read data (COM4) 
    7a ff 20 80 1e 00 01 00 00 00 45 80 01 00 00 00   zÿ €......E€.... 
    14 00 00 00 11 a4 00 00 de 0d 00 00 12 00 03 1e   .....¤..Þ....... 
    01 08 48 03 08 00 00 00 95 24                     ..H.....•$       
Tobbinloggin commented 3 years ago
C:\Windows\system32>cmd.py readlast
b'z\xff \x80\x1e\x00\x01\x00\x00\x00E\x80'
b'\x01\x00\x00\x00\x14\x00\x00\x00\x11\xa4\x00\x00'
b'\xde\r\x00\x00\x12\x00\x03\x1e\x01\x08H\x03'
b'\x08\x00\x00\x00\x95$'
Traceback (most recent call last):
  File "C:\platform-tools\cmd.py", line 91, in <module>
    measures = reader.read(True)
  File "C:\platform-tools\radexreader\__init__.py", line 170, in read
    measure     = (hexa[6] + hexa[7] * 256 + hexa[8] * 256 * 256) / 100
IndexError: index out of range
Tobbinloggin commented 3 years ago

I see you edited the code, I'll run that as well.

luigifab commented 3 years ago

Ok, I updated the code, please try again :). Yes, I see many IRP_MJ_READ DOWN, we will do same.

Tobbinloggin commented 3 years ago
C:\Windows\system32>cmd.py readlast
b'z\xff \x80\x1e\x00\x01\x00\x00\x00E\x80'
b'\x01\x00\x00\x00\x14\x00\x00\x00\x11\xa4\x00\x00\xde\r\x00\x00\x12\x00\x03\x1e\x01'
b'\x08H'
b'\x03\x08'
b'\x00\x00'
b'\x00\x95'
b'$'
Traceback (most recent call last):
  File "C:\platform-tools\cmd.py", line 91, in <module>
    measures = reader.read(True)
  File "C:\platform-tools\radexreader\__init__.py", line 174, in read
    timestamp   = (hexa[2] + hexa[3] * 256 + hexa[4] * 256 * 256 + hexa[5] * 256 * 256 * 256)
IndexError: index out of range
luigifab commented 3 years ago

Good. Can you check date on your device?

Tobbinloggin commented 3 years ago

How do I do that? The Radex one doesn't have a date setting option in the settings, the date on my computer is 4/10/2021 at 12:30 PM

luigifab commented 3 years ago

Okay. So if you change your computer date, and run the official tool to read data, the date displayed is your computer date, right? So, date is not transferred.

So we can supposed, that the previous results contains expected but encoded measures:

  1. b'z\xff \x80\x1e\x00\x01\x00\x00\x00E\x80'
  2. b'\x01\x00\x00\x00\x14\x00\x00\x00\x11\xa4\x00\x00\xde\r\x00\x00\x12\x00\x03\x1e\x01'
  3. b'\x08H'
  4. b'\x03\x08'
  5. b'\x00\x00'
  6. b'\x00\x95'
  7. b'$' (I will suppose a stop mark)
Tobbinloggin commented 3 years ago

Okay. So if you change your computer date, and run the official tool to read data, the date displayed is your computer date, right? So, date is not transferred.

image Yep, date is not transferred.

luigifab commented 3 years ago

So we are searching three values. We need more data.

I'm not sure, but we can try the cmd.py tail with the following read function:

    def read(self, last=False):
        print("go")
        values = {}
        #if last:
        #   keys = [0x01]
        #else:
        keys = list(range(0x01, 0x09)) # from 0x01 to 0x08
        for key in keys:
            self.hid_set_report((0x7b, 0xff, 0x20, 0, 0x06, 0, key, 0, 0, 0, 0x5d, 0, 0x01, 0, 0x0c, 0, 0xf2, 0xff))
            print("=== " + str(key) + " ===")
            hexa = self.dev.read(12)
            print(hexa)
            hexa = self.dev.read(21)
            print(hexa)
            hexa = self.dev.read(2)
            print(hexa)
            hexa = self.dev.read(2)
            print(hexa)
            hexa = self.dev.read(2)
            print(hexa)
            hexa = self.dev.read(2)
            print(hexa)
            hexa = self.dev.read(1)
            print(hexa)
        time.sleep(2)
        return dict(sorted(values.items(), key=operator.itemgetter(0)))
Tobbinloggin commented 3 years ago
go
=== 1 ===
b'z\xff \x80\x1e\x00\x01\x00\x00\x00E\x80'
b'\x01\x00\x00\x00\x14\x00\x00\x00\x11\xa4\x00\x00\xde\r\x00\x00\x12\x00\x03\x1e\x01'
b'\x08H'
b'\x03\x08'
b'\x00\x00'
b'\x00\x95'
b'$'
=== 2 ===
b''
b''
b''
b''
b''
b''
b''
=== 3 ===
b''
b''
b''
b''
b''
b''
b''
=== 4 ===
b''
b''
b''
b''
b''
b''
b''
=== 5 ===
b''
b''
b''
b''
b''
b''
b''
=== 6 ===
b''
b''
b''
b''
b''
b''
b''
=== 7 ===
b''
b''
b''
b''
b''
b''
b''
=== 8 ===
b''
b''
b''
b''
b''
b''
b''
luigifab commented 3 years ago

Ok, is there data for 2 / 3 / 4 / 5 / 6 / 7 / 8 after some seconds/minute?

Tobbinloggin commented 3 years ago

The only one with a result is 1, the rest are always empty.

Tobbinloggin commented 3 years ago

KeyLoopResult.txt It's the same thing repeated, nothing is changing.

luigifab commented 3 years ago

Ok, I know why, a story of addresses, perhaps... Try again with this:


    def read(self, last=False):
        print("go")
        values = {}
        keys = {
            (0x7b, 0xff, 0x20, 0, 0x06, 0, 0x01, 0, 0, 0, 0x5d, 0, 0x01, 0,    0x0c, 0, 0xf2, 0xff),
            (0x7b, 0xff, 0x20, 0, 0x06, 0, 0x02, 0, 0, 0, 0x5c, 0, 0x01, 0x08, 0x0c, 0, 0xf2, 0xf7),
            (0x7b, 0xff, 0x20, 0, 0x06, 0, 0x03, 0, 0, 0, 0x5b, 0, 0x01, 0,    0x0c, 0, 0xf2, 0xff),
            (0x7b, 0xff, 0x20, 0, 0x06, 0, 0x04, 0, 0, 0, 0x5a, 0, 0,    0x08, 0x0c, 0, 0xf2, 0xf7),
            (0x7b, 0xff, 0x20, 0, 0x06, 0, 0x05, 0, 0, 0, 0x59, 0, 0x01, 0,    0x0c, 0, 0xf2, 0xff),
            (0x7b, 0xff, 0x20, 0, 0x06, 0, 0x06, 0, 0, 0, 0x58, 0, 0,    0x08, 0x0c, 0, 0xf2, 0xf7),
            (0x7b, 0xff, 0x20, 0, 0x06, 0, 0x07, 0, 0, 0, 0x57, 0, 0x01, 0,    0x0c, 0, 0xf2, 0xff),
            (0x7b, 0xff, 0x20, 0, 0x06, 0, 0x08, 0, 0, 0, 0x56, 0, 0,    0x08, 0x0c, 0, 0xf2, 0xf7)
        }
        for key in keys:
            self.hid_set_report(key)
            print("=== " + str(key[6]) + " ===")
            hexa = self.dev.read(12)
            print(hexa)
            hexa = self.dev.read(21)
            print(hexa)
            hexa = self.dev.read(2)
            print(hexa)
            hexa = self.dev.read(2)
            print(hexa)
            hexa = self.dev.read(2)
            print(hexa)
            hexa = self.dev.read(2)
            print(hexa)
            hexa = self.dev.read(1)
            print(hexa)
        time.sleep(2)
        return dict(sorted(values.items(), key=operator.itemgetter(0)))
Tobbinloggin commented 3 years ago

KeyLoopResult 1.txt I see a lot of repetition.

Tobbinloggin commented 3 years ago

image

luigifab commented 3 years ago

Can you capture packets again with the official program like your first text file format?

Then open all files. Search in files: 7b ff 20 00 06 00 01 Do you see:

in all files?

Tobbinloggin commented 3 years ago

MinuteofData4.txt MinuteofData5.txt MinuteofData6.txt

RadexDataCenter_MinuteofData_4.png RadexDataCenter_MinuteofData_5.png RadexDataCenter_MinuteofData_6.png

luigifab commented 3 years ago

I did some cleanup in previous comments.

Can you try this new version with cmd.py tail for 1 minute? In this version we are sending same written data as MinuteofData4.txt.

Tobbinloggin commented 3 years ago

RADEX ONE results.

Tobbinloggin commented 3 years ago

I did a few more of these readlast tests, and the only thing that has changed is the time, I've kept an eye on the geiger counter and it's shifting around (0.09 ~ 0.14µSv/h).

Tobbinloggin commented 3 years ago

RADEX ONE results.

Tobbinloggin commented 3 years ago

RADEX ONE results, same code ran another time.

luigifab commented 3 years ago

Yes, I think that the data previously displayed is a ack. I changed data displayed. On the latest result this is better. I will think about it.

Gist updated again. Just to check, but results will be wrong.

Tobbinloggin commented 3 years ago
Microsoft Windows [Version 10.0.18363.1440]
(c) 2019 Microsoft Corporation. All rights reserved.

C:\Windows\System32>cmd.py readlast
Information   python3-radexreader 1.2.0 with python 3.9.1 + pyusb 1.1.1 + pyserial 3.5
ComPort       COM4

[info] Measuring range: 0.05 - 999 µSv/h
[info] Uncertainty of the result: ±(15+6/D)%
[info]   D is the value after a complete cycle of 100? seconds

[warn] The values displayed are only an approximation.
[warn] The actual value can only be measured with suitable professional device.
[warn] For now, not tested with measured values greater than 0.25 µSv/h.

=== block1 ===
11/04/2021 10:08:00
read
b'z\xff\x00\x80\x00\x00\x05\x00\x00\x00\x7f\x80'
b''
b''
b''
Traceback (most recent call last):
  File "C:\platform-tools\cmd.py", line 91, in <module>
    measures = reader.read(True)
  File "C:\platform-tools\radexreader\__init__.py", line 245, in read
    self.testread()
  File "C:\platform-tools\radexreader\__init__.py", line 225, in testread
    print("= " + str(hexa[1] + hexa[2]))
IndexError: index out of range

C:\Windows\System32>
luigifab commented 3 years ago

Gist updated again. Run it multiple times to check if results are same or not.

Tobbinloggin commented 3 years ago

No difference. Test 1 Test 2 I checked the geiger counter, the CPM was definitely different.

luigifab commented 3 years ago

Okay. So, gist updated again. Run it multiple times to check if results are same or not. This time I displayed all reads.

Tobbinloggin commented 3 years ago

I'm using https://www.diffchecker.com/diff to compare the tests, there are differences in the two results. Test 1 w/ ALL READS Test 2 w/ ALL READS

luigifab commented 3 years ago

Good. Perhaps measures are here, or we are wrong. I updated the gist to display only them.

Tobbinloggin commented 3 years ago

Test 1 Test 2 It definitely looks like data of some kind, it seems promising.

luigifab commented 3 years ago

I updated the gist to extract them. Not sure. Try to change value for line 222/223/224.

Tobbinloggin commented 3 years ago

Change them to what?

Tobbinloggin commented 3 years ago

print("value:" + str(hexa[16])) is 100% printing the CPM, I stared at the display while looking at that number and it got it right three times in a row.

Tobbinloggin commented 3 years ago
=== block6 ===
11/04/2021 10:47:45
read
b'\x00\x08\x00\x00\x0c\x00\x00\x00\x0c\x00\x00\x00\x14\x02\x00\x00\x0f\x00\x00\x00\xc4'
value:12
value:15
value:196
b'\xf5'
=== block7 ===
11/04/2021 10:47:58
read
b''
Traceback (most recent call last):
  File "C:\platform-tools\cmd.py", line 91, in <module>
    measures = reader.read(True)
  File "C:\platform-tools\radexreader\__init__.py", line 329, in read
    self.testread()
  File "C:\platform-tools\radexreader\__init__.py", line 222, in testread
    print("value:" + str(hexa[8]))
IndexError: index out of range
Tobbinloggin commented 3 years ago

print("value:" + str(hexa[8])) appears to be printing the µSv/h, 14 means 0.14 µSv/h and 9 means 0.09 µSv/h, etc.