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

I have tested and developed the program with the RD-1212 without BT. Can you connect your device and send the dmesg output:

sudo dmesg
[...]
[  237.479120] usb 3-2: new full-speed USB device number 4 using xhci_hcd
[  237.810913] usb 3-2: New USB device found, idVendor=03eb, idProduct=5603, bcdDevice= 1.00
[  237.810964] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  237.810972] usb 3-2: Product: RADEX 1212
[  237.810978] usb 3-2: Manufacturer: QWARTA-RAD
[  237.810983] usb 3-2: SerialNumber: 0001A0000000
[  237.827820] hid-generic 0003:03EB:5603.0004: hiddev2,hidraw3: USB HID v1.00 Device
 [QWARTA-RAD RADEX 1212] on usb-0000:01:00.0-2/input0

Perhaps the idVendor/idProduct are a little different !?

Vrumfondel commented 3 years ago

Hm - strange. I tried to modify the id's to the one of my RD-1212 - then it is detected, but the communication seems different. Once I find some time I will try to do some reverse engineering...

Vrumfondel commented 3 years ago

Some more insights:

The USB ID for my device is 10C4/EA60 - which represents a Silicon labs USB to UART Bridge. It seems this is the most significant difference: The device wants to be handled as an UART. I was believing the problems I saw after changing the IDs was due to the fact that I was running it in Windows, but in linux I got the same: Pipe Error.

The communication protocol as such seems quite similar, the only difference I noticed is that the ending bytes after the command itselfe are 0x00, not something like 3c 84 (in case of read values). On the other hand it seems no to hurt if they are not 0x00.

So if you can add the device to be handled as a series port - I think this is all needed. Unfortunately Python is not "my" language - otherwise I would have done it myselfe quickly ..

luigifab commented 3 years ago

If your device is 10C4/EA60, why not. I'm not sure what I need to change. You are getting a pipe error when?

Can you plug your device and start RadexRead of QuartaRad, then start an usb capture with Wireshark, then start read data with RadexRead? For information my data: wireshark.pcapng.gz

Vrumfondel commented 3 years ago

1st important thing: There is two version of the RadexRead tool: The one published on the us website of quartarad - this is NOT working for me. Then there is one on the russian website - this works. I can't really do traces with Wireshark - since wireshark is not supporting serial ports. Of course I might be able to trace the raw USB traffic, but I think this is not the way to go. What your are currently doing in your script is to send and receive the command/response in a pipe directly to the USB device. This is not working in case of the device I got. Roughly the following steps are needed:

  1. Determine by USB IDs which version of the device it is
  2. If it is the current device - continue as today
  3. If it is 10C4/EA60: Determine which COM-Port this references, then open the comport with 115200/8N1. The bytewise communication after this shold be as it is today.
luigifab commented 3 years ago

Ah, okay! I see. I'll think about it.

Vrumfondel commented 3 years ago

OK, I was to eager to get it working ....

I started to implement the support - most likely I'm going to send a pull request today or tomorrow. The pure requesting and reading of data is working. I'm now stuck at one thing: I'd like to automatically determine from the USB IDs which device (linux) or Com (win) the interface is using. Not sure so far how this is doable. Plan "b" would be to pass the port as 2nd commandline parameter.

luigifab commented 3 years ago

Thanks, I will check it and search how to autodetect com port.

Tobbinloggin commented 3 years ago

Could it be possible to create a version of this that works with the Radex one?

I'd really like a phone app that works with the Radex one using a USB-C to Microusb cable.

luigifab commented 3 years ago

Yes, perhaps it works already with some minor change. Plug your device to your computer an run dmesg:

fabrice@mario:~$ sudo dmesg | tail
[   15.488594] IPv6: ADDRCONF(NETDEV_CHANGE): veth4ca8bbb: link becomes ready
[   15.489527] docker0: port 8(veth4ca8bbb) entered blocking state
[   15.490303] docker0: port 8(veth4ca8bbb) entered forwarding state
[ 2048.574006] usb 3-2: new full-speed USB device number 4 using xhci_hcd
[ 2048.909903] usb 3-2: New USB device found, idVendor=03eb, idProduct=5603, bcdDevice= 1.00
[ 2048.909920] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2048.909927] usb 3-2: Product: RADEX 1212
[ 2048.909933] usb 3-2: Manufacturer: QWARTA-RAD
[ 2048.909938] usb 3-2: SerialNumber: 0001A0000000
[ 2048.929647] hid-generic 0003:03EB:5603.0004: hiddev2,hidraw3: USB HID v1.00
   Device [QWARTA-RAD RADEX 1212] on usb-0000:01:00.0-2/input0

Get your idVendor=03eb, idProduct=5603 and update __init.py__ line 38 with your values. Try the program.

Tobbinloggin commented 3 years ago

My device is still in the mail, I'll try this when it arrives, thanks!

With this it'll be possible to use it in a phone app? How would you go about running this code on an android?

The reason I want a phone app is the Radex One does not contain a memory, the only method to store radiation data long term is with a windows application, but that's not a feasible long-term option at all, code that stores detected radiation data on the phone instead is the only feasible long-term option.

luigifab commented 3 years ago

If Android apps can run python and python-usb or python-serial, yes you can try.

Tobbinloggin commented 3 years ago

Did as you said, changed the values in init to idVendor=0xABBA, idProduct=0xA011, which is what the RADEX ONE outputted, I got this error when running cmd.py readall.

C:\Windows\system32>cmd.py readall
Information   python3-radexreader 1.1.0 with python 3.9.1 + pyusb 1.1.1 + pyserial 3.5
Traceback (most recent call last):
  File "C:\platform-tools\cmd.py", line 112, in <module>
    reader = radexreader.RadexReader()
  File "C:\platform-tools\radexreader\__init__.py", line 57, in __init__
    self.dev.reset()
  File "C:\Users\Xeta\AppData\Local\Programs\Python\Python39\lib\site-packages\usb\core.py", line 949, in reset
    self._ctx.managed_open()
  File "C:\Users\Xeta\AppData\Local\Programs\Python\Python39\lib\site-packages\usb\core.py", line 113, in wrapper
    return f(self, *args, **kwargs)
  File "C:\Users\Xeta\AppData\Local\Programs\Python\Python39\lib\site-packages\usb\core.py", line 131, in managed_open
    self.handle = self.backend.open_device(self.dev)
  File "C:\Users\Xeta\AppData\Local\Programs\Python\Python39\lib\site-packages\usb\backend\libusb1.py", line 804, in open_device
    return _DeviceHandle(dev)
  File "C:\Users\Xeta\AppData\Local\Programs\Python\Python39\lib\site-packages\usb\backend\libusb1.py", line 652, in __init__
    _check(_lib.libusb_open(self.devid, byref(self.handle)))
  File "C:\Users\Xeta\AppData\Local\Programs\Python\Python39\lib\site-packages\usb\backend\libusb1.py", line 600, in _check
    raise NotImplementedError(_strerror(ret))
NotImplementedError: Operation not supported or unimplemented on this platform

I know this means the device isn't being detected by Libusb, if not that, a problem with Libusb, but I'm unsure how to fix it?

I fixed that issue above by installing a Libusb driver, now I'm getting this error instead.

C:\Windows\system32>python C:\platform-tools\cmd.py readall
Information   python3-radexreader 1.1.0 with python 3.9.1 + pyusb 1.1.1 + pyserial 3.5
Traceback (most recent call last):
  File "C:\platform-tools\cmd.py", line 112, in <module>
    reader = radexreader.RadexReader()
  File "C:\platform-tools\radexreader\__init__.py", line 57, in __init__
    self.dev.reset()
  File "C:\Users\Xeta\AppData\Local\Programs\Python\Python39\lib\site-packages\usb\core.py", line 949, in reset
    self._ctx.managed_open()
  File "C:\Users\Xeta\AppData\Local\Programs\Python\Python39\lib\site-packages\usb\core.py", line 113, in wrapper
    return f(self, *args, **kwargs)
  File "C:\Users\Xeta\AppData\Local\Programs\Python\Python39\lib\site-packages\usb\core.py", line 131, in managed_open
    self.handle = self.backend.open_device(self.dev)
  File "C:\Users\Xeta\AppData\Local\Programs\Python\Python39\lib\site-packages\usb\backend\libusb1.py", line 804, in open_device
    return _DeviceHandle(dev)
  File "C:\Users\Xeta\AppData\Local\Programs\Python\Python39\lib\site-packages\usb\backend\libusb1.py", line 652, in __init__
    _check(_lib.libusb_open(self.devid, byref(self.handle)))
  File "C:\Users\Xeta\AppData\Local\Programs\Python\Python39\lib\site-packages\usb\backend\libusb1.py", line 604, in _check
    raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 13] Access denied (insufficient permissions)

Yes, I ran cmd as administrator.

Tobbinloggin commented 3 years ago

Screenshot_68 The device doesn't have any HID drivers.

luigifab commented 3 years ago

For my device I got: image

You can try to force the serial mode, replace line 38 self.dev = ... by self.dev = None

Tobbinloggin commented 3 years ago

I changed line 38

C:\Windows\system32>cmd.py readall
Information   python3-radexreader 1.1.0 with python 3.9.1 + pyusb 1.1.1 + pyserial 3.5
Traceback (most recent call last):
  File "C:\platform-tools\cmd.py", line 112, in <module>
    reader = radexreader.RadexReader()
  File "C:\platform-tools\radexreader\__init__.py", line 54, in __init__
    raise ValueError('Error: RADEX RD1212 not plugged? (usb or serial)')
ValueError: Error: RADEX RD1212 not plugged? (usb or serial)

This is my Hardware IDs Screenshot_69

luigifab commented 3 years ago

Good! Can you uncomment lines 50/51/52. I think that the grep line 43 is bad.

Tobbinloggin commented 3 years ago
C:\Windows\system32>cmd.py readall
Information   python3-radexreader 1.1.0 with python 3.9.1 + pyusb 1.1.1 + pyserial 3.5
COM3 - USB5734 COM Port (COM3)
COM1 - Communications Port (COM1)
Traceback (most recent call last):
  File "C:\platform-tools\cmd.py", line 112, in <module>
    reader = radexreader.RadexReader()
  File "C:\platform-tools\radexreader\__init__.py", line 54, in __init__
    raise ValueError('Error: RADEX RD1212 not plugged? (usb or serial)')
ValueError: Error: RADEX RD1212 not plugged? (usb or serial)

This is what was outputted.

luigifab commented 3 years ago

I'm sad, I didn't see COM4 here as we can see in your previous screenshot.

Have you started QuartaRad or other programs at same time? If yes, try to close it and try again. You can also try the command line: python -m serial.tools.list_ports to check if COM4 is displayed.

Tobbinloggin commented 3 years ago

I can also suggest to change line 50 by: ports = list(serial.tools.list_ports.comports(include_links=True)) And to try again cmd.py.

COM4 is only visible when I have the Radex driver installed. But then nothing appears when I run CMD.PY When I reinstall the Libusb driver, overwriting the Radex driver COM4 disappears and

COM3 - USB5734 COM Port (COM3)
COM1 - Communications Port (COM1)

re-appears when I re-run CMD.py

C:\Windows\system32>cmd.py readall
Information   python3-radexreader 1.1.0 with python 3.9.1 + pyusb 1.1.1 + pyserial 3.5
Traceback (most recent call last):
  File "C:\platform-tools\cmd.py", line 112, in <module>
    reader = radexreader.RadexReader()
  File "C:\platform-tools\radexreader\__init__.py", line 45, in __init__
    self.dev = serial.Serial(port = device.port, baudrate = 115200, timeout = 0.5)
AttributeError: 'ListPortInfo' object has no attribute 'port'

This is the error that occurs when I have the original Radex driver installed, with the absence of COM3 and COM1.

I'll try those changes, just a moment.

Tobbinloggin commented 3 years ago

image This is what the RADEX ONE looks like with the Libusb driver installed.

luigifab commented 3 years ago

I see one interesting thing here:

C:\Windows\system32>cmd.py readall
Information   python3-radexreader 1.1.0 with python 3.9.1 + pyusb 1.1.1 + pyserial 3.5
Traceback (most recent call last):
  File "C:\platform-tools\cmd.py", line 112, in <module>
    reader = radexreader.RadexReader()
  File "C:\platform-tools\radexreader\__init__.py", line 45, in __init__
    self.dev = serial.Serial(port = device.port, baudrate = 115200, timeout = 0.5)
AttributeError: 'ListPortInfo' object has no attribute 'port'

I think we have found the Radex, but there is a code error. I think the solution is device.device instead of device.port (but not sure).

Tobbinloggin commented 3 years ago

I commented Line 45, I uninstalled the Libusb driver and reinstalled the original Radex driver and ran the code again;

C:\Windows\system32>cmd.py readall
Information   python3-radexreader 1.1.0 with python 3.9.1 + pyusb 1.1.1 + pyserial 3.5
COM3 - USB5734 COM Port (COM3)
COM1 - Communications Port (COM1)
COM4 - RADEX ONE (COM4)
Traceback (most recent call last):
  File "C:\platform-tools\cmd.py", line 112, in <module>
    reader = radexreader.RadexReader()
  File "C:\platform-tools\radexreader\__init__.py", line 54, in __init__
    raise ValueError('Error: RADEX RD1212 not plugged? (usb or serial)')
ValueError: Error: RADEX RD1212 not plugged? (usb or serial)

COM4 is showing up now.

Tobbinloggin commented 3 years ago

I uncommented Line 45 and changed device.port to device.device, the program outputs this now;

C:\Windows\system32>cmd.py readall
Information   python3-radexreader 1.1.0 with python 3.9.1 + pyusb 1.1.1 + pyserial 3.5
ComPort       COM4

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 156, in read
    if hexa[0] != 0:
IndexError: index out of range
luigifab commented 3 years ago

Okay, I think we are connected to the Radex. Before the if hexa[0] != 0, can you add print(hexa) and try again?

            hexa = self.hid_get_report()
            print(hexa)
            if hexa[0] != 0:

For my device, result is:

array('B', [1, 18, 118, 166, 113, 96, 9, 0, 0, 0, 0, 0, 60, 132, 0, 0,
 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 104, 89, 136, 60])
2021-04-10 13:21:58    0.09 µSv/h  ±81% (0.02 ≤ 0.09 ≤ 0.16)
Tobbinloggin commented 3 years ago

adding print(hexa) outputs;

b''
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 157, in read
    if hexa[0] != 0:
IndexError: index out of range
luigifab commented 3 years ago

lol, ok!

So to summarize, for Radex One, you need the original QuartaRad Radex driver to get COM4 working. I need to fix my program with device.device.

Now reading values does not work, so, it is more complicated. There are many possibilities:

  1. self.dev.write(report) does not work
  2. return self.dev.read(14) does not work
  3. (0x12, 0x12, 0x01, 0x02, key, 0, 0, 0, 0, 0, 0, 0, 0x3c, 0x84) is not the good address
  4. communication with the Radex does not work
  5. or other reasons

For 2, you can try to increase the number or you can try return self.dev.readline(), I don't know. For 3, you need to do some reverse engineering, you can install Wireshark and the official RadexReadOne program, then run Wireshark to capture COM4 packets, then run RadexReadOne to read device values.

Tobbinloggin commented 3 years ago

If I were to guess it's probably 3

Tobbinloggin commented 3 years ago

Increasing the number for return self.dev.read(14) and changing it to return self.dev.readline() did not solve the issue, I will download wireshark and post the logs here.

The software used on windows for the RADEX ONE is RADEX Data Center not RadexReadOne

Tobbinloggin commented 3 years ago

Wireshark does not support COM sniffing :(

Tobbinloggin commented 3 years ago

How do I capture the values?

luigifab commented 3 years ago

I found Eltima Serial Port Monitor, 14 days trial, for Windows, it look like Wireshark. I don't know it, and there are others programs to do it. I don't know them.

Tobbinloggin commented 3 years ago

I used Serial Port Monitor, I opened Radex Data Center let it run for a little bit, then closed it.

This is what the sniffer found. COM4 Monitoring Session.txt

If it's helpful to you I could even record the Radex Data Center window and the Serial Port Monitor windows side by side and upload the MP4 here.

luigifab commented 3 years ago

Yes, why not for the MP4 video. I can suppose that starting line 115, we have measures.

[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.....•$      

Because:

So we can try some tests. Line 147 add (after def read(self, last=False):):

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

As promised, the video.

https://user-images.githubusercontent.com/53196506/114270351-6c6f3300-99fb-11eb-88f1-5942ed3522f1.mp4

I'll try the code you sent now.

And here's a copy of the exact same logs in text form.

COM4 Monitoring Session Video.txt

Tobbinloggin commented 3 years ago

I added your code, it output;

b''
b''
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 158, in read
    if hexa[0] != 0:
IndexError: index out of range
luigifab commented 3 years ago

Okay, perhaps we need more. Based on your first txt files, we will send all written data.

[10/04/2021 08:20:27] Written data (COM4) 
    7b ff 00 00 00 00 02 00 00 00 82 00
[10/04/2021 08:20:27] Written data (COM4) 
    7b ff 20 00 06 00 03 00 00 00 5b 00 01 00 0c 00 f2 ff
[10/04/2021 08:20:30] Written data (COM4) 
    7b ff 00 00 00 00 05 00 00 00 7f 00
[10/04/2021 08:20:30] Written data (COM4) 
    7b ff 20 00 06 00 06 00 00 00 58 00 01 00 0c 00 f2 ff
[10/04/2021 08:20:33] Written data (COM4) 
    7b ff 00 00 00 00 08 00 00 00 7c 00
[10/04/2021 08:20:33] Written data (COM4) 
    7b ff 20 00 06 00 09 00 00 00 55 00 01 00 0c 00 f2 ff
[10/04/2021 08:20:36] Written data (COM4) 
    7b ff 00 00 00 00 0b 00 00 00 79 00
[10/04/2021 08:20:36] Written data (COM4) 
    7b ff 20 00 06 00 0c 00 00 00 52 00 01 00 0c 00 f2 ff
[10/04/2021 08:20:38] Written data (COM4) 
    7b ff 00 00 00 00 0e 00 00 00 76 00
[10/04/2021 08:20:39] Written data (COM4) 
    7b ff 20 00 06 00 0f 00 00 00 4f 00 01 00 0c 00 f2 ff
[10/04/2021 08:20:41] Written data (COM4) 
    7b ff 00 00 00 00 11 00 00 00 73 00
[10/04/2021 08:20:41] Written data (COM4) 
    7b ff 20 00 06 00 12 00 00 00 4c 00 01 00 0c 00 f2 ff
[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] Written data (COM4) 
    7b ff 20 00 06 00 02 00 00 00 5c 00 01 08 0c 00 f2 f7

Add each 7b lines in python file:

    def read(self, last=False):
        # 7b ff 00 00 00 00 02 00 00 00 82 00
        self.hid_set_report((0x7b, 0xff, 0, 0, 0, 0, 0x02, 0, 0, 0, 0x82, 0))
        print(self.hid_get_report())
        # 7b ff 20 00 06 00 03 00 00 00 5b 00 01 00 0c 00 f2 ff
        self.hid_set_report((0x7b, 0xff, 0x20, 0, 0x06, 0, 0x03, 0, 0, 0, 0x5b, 0, 0x01, 0, 0x0c, 0, 0xf2, 0xff))
        print(self.hid_get_report())
        ...

And try again. If you get nothing for each print, try to record packets when you run the python program.

Tobbinloggin commented 3 years ago
b''
b''
b''
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 162, in read
    if hexa[0] != 0:
IndexError: index out of range
luigifab commented 3 years ago

I suppose the hid_set_report is not working... Try to record packets when you run the python program.

Tobbinloggin commented 3 years ago

cmd.py readall COM4 Monitoring Session 1.txt This is what the packets look like when I run cmd.py with the modified code.

luigifab commented 3 years ago

This is not the same format as your first txt file, but we can see:

40 10/04/2021 09:15:10 IRP_MJ_WRITE DOWN  7b ff 00 00 00 00 02 00 00 00 82 00  ... 12 12 COM4  
41 10/04/2021 09:15:10 IRP_MJ_WRITE UP STATUS_SUCCESS 7b ff 00 00 00 00 02 00 00 00 82 00  ... 12  COM4  

But the read does not work:

44 10/04/2021 09:15:10 IRP_MJ_READ DOWN     14 COM4  
45 10/04/2021 09:15:11 IRP_MJ_READ UP STATUS_TIMEOUT     COM4  
luigifab commented 3 years ago

Try 12 instead of 14 here: self.dev.read(14). And try again.

Tobbinloggin commented 3 years ago

Yeah, I used that format because I thought it gave more information, I can use the old one if you want?

luigifab commented 3 years ago

No it's perfect.

Tobbinloggin commented 3 years ago

self.dev.read(12) has the same result

b''
b''
b''
Traceback (most recent call last):
luigifab commented 3 years ago

At the beginning of the file add import time Before the two print add sleep(0.1). Try again, If it does not work, capture packets and try again.

Tobbinloggin commented 3 years ago
b''
b''
b''
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 165, in read
    if hexa[0] != 0:
IndexError: index out of range
Tobbinloggin commented 3 years ago

cmd.py readall (time.sleep) COM4 Monitoring Session 2.txt

luigifab commented 3 years ago

Ok let's compare results:

video file txt

46 10/04/2021 08:46:55 IRP_MJ_WRITE DOWN  7b ff 00 00 00 00 02 00 00 00 82 00  {ÿ........‚. 12 12 COM4  
47 10/04/2021 08:46:55 IRP_MJ_WRITE UP STATUS_SUCCESS 7b ff 00 00 00 00 02 00 00 00 82 00  {ÿ........‚. 12  COM4  
48 10/04/2021 08:46:55 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) DOWN      COM4  
49 10/04/2021 08:46:55 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  
50 10/04/2021 08:46:55 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) DOWN      COM4  
51 10/04/2021 08:46:55 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) UP STATUS_SUCCESS 00 00 00 00 00 00 00 00 0c 00 00 00 00 00 00 00 00 00 00 00  .................... 20  COM4  
52 10/04/2021 08:46:55 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) DOWN      COM4  
53 10/04/2021 08:46:55 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) UP STATUS_SUCCESS 00 00 00 00 00 00 00 00 0c 00 00 00 00 00 00 00 00 00 00 00  .................... 20  COM4  
54 10/04/2021 08:46:55 IRP_MJ_READ DOWN     12 COM4  
55 10/04/2021 08:46:55 IRP_MJ_READ UP STATUS_SUCCESS 7a ff 00 80 00 00 02 00 00 00 82 80  zÿ.€......‚€ 12  COM4  
56 10/04/2021 08:46:55 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_PURGE) DOWN  0f 00 00 00  .... 4  COM4  
57 10/04/2021 08:46:55 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_PURGE) UP STATUS_SUCCESS     COM4  
58 10/04/2021 08:46:55 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) DOWN      COM4  
59 10/04/2021 08:46:55 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  
60 10/04/2021 08:46:55 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) DOWN      COM4  
61 10/04/2021 08:46:55 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  
62 10/04/2021 08:46:55 IRP_MJ_WRITE DOWN  7b ff 20 00 06 00 03 00 00 00 5b 00  {ÿ .......[. 12 12 COM4  

last test:

40 10/04/2021 09:29:47 IRP_MJ_WRITE DOWN  7b ff 00 00 00 00 02 00 00 00 82 00  {ÿ........‚. 12 12 COM4  
41 10/04/2021 09:29:47 IRP_MJ_WRITE UP STATUS_SUCCESS 7b ff 00 00 00 00 02 00 00 00 82 00  {ÿ........‚. 12  COM4  
42 10/04/2021 09:29:47 IRP_MJ_DEVICE_CONTROL (IOCTL_SERIAL_GET_COMMSTATUS) DOWN      COM4  
43 10/04/2021 09:29:47 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  
44 10/04/2021 09:29:47 IRP_MJ_READ DOWN     12 COM4  
45 10/04/2021 09:29:48 IRP_MJ_READ UP STATUS_TIMEOUT     COM4  
46 10/04/2021 09:29:48 IRP_MJ_WRITE DOWN  7b ff 20 00 06 00 03 00 00 00 5b 00 01 00 0c 00 f2 ff  {ÿ .......[.....òÿ 18 18 COM4  

It lacks some IRP_MJ_DEVICE_CONTROL.

Tobbinloggin commented 3 years ago

We missing some IRP_MJ_DEVICE_CONTROL.

So you need to decipher and mimic/reproduce this missing IRP_MJ_DEVICE_CONTROL in the python code for it to work?