[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Acquiring Dental RVG on Linux



On Sun, Dec 13, 2020 at 07:11:24PM +0100, Karsten Hilbert wrote:
> I would start even earlier: Even without the device attached
> _at all_.
> 
> - start capture
> - start windows app
> - stop capture
> - stop windows app
> 
> - rinse and repeat until you see a pattern (of what is sent
>   to the USB port at startup of the app)
> 
> - then repeat with the device plugged in
> 
> - you should start seeing a response, stop there
> 
> - now you know the (start of the) "normal setup sequence"
> 
> Try to send that sequence to the device and check whether it
> elicits the same response.


I used this[1] tool to overcome the usbmon truncation problem. I find this
much better than wireshark (a subjective view).

Now, to begin with the trace below is repeatable. It occurs on merely
plugging in the usb cable to the usb port.

It happens to be same on Linux and Windows so seems to be a part of some
generic protocol.

Using pyusb, however, I am still unable to mimic even the first packet of
the sequence. Can someone please advise whether I am doing the right thing
below.

<code>
import usb.core
VENDOR_ID = 0x082b
PRODUCT_ID = 0x000c

dev = usb.core.find(idVendor=VENDOR_ID, idProduct=PRODUCT_ID)
if dev.is_kernel_driver_active(0):
        print('detaching kernel driver')
        dev.detach_kernel_driver(0)
dev.reset()
dev.set_configuration()
usb.util.claim_interface(dev,0)

arr = [ 0x00, 0x12, 0x80, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x12 ]
dev.write(0x1,arr)
# End point at index 0 has address 0x1, though I have tried all end point
# addresses. They draw input/output error
</code>

<error>
Traceback (most recent call last):
  File "uread.py", line 21, in <module>
    dev.write(0x1,arr)
  File "/usr/local/lib/python3.8/dist-packages/usb/core.py", line 977, in
write
    return fn(
  File "/usr/local/lib/python3.8/dist-packages/usb/backend/libusb1.py",
line 837, in bulk_write
    return self.__write(self.lib.libusb_bulk_transfer,
  File "/usr/local/lib/python3.8/dist-packages/usb/backend/libusb1.py",
line 938, in __write
    _check(retval)
  File "/usr/local/lib/python3.8/dist-packages/usb/backend/libusb1.py",
line 604, in _check
    raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 5] Input/Output Error
</error>

 
<trace>
1.022.000 S Ci 0012 80 06 0100 0000 0012
1.022.000 C Ci 0012 OK
                    12 01 00 02 ff ff ff 40 2b 08 0c 00 01 00 00 00 00 01
1.022.000 S Ci 0009 80 06 0200 0000 0009
1.022.000 C Ci 0009 OK
                    09 02 ab 00 01 01 00 80 32
1.022.000 S Ci 00ab 80 06 0200 0000 00ab
1.022.000 C Ci 00ab OK
                    09 02 ab 00 01 01 00 80 32 09 04 00 00 00 ff ff ff 00
09 04 00 01 06 ff ff ff 00 07 05 01 02 00 02 00 07 05 81 02 00 02 00 07 05
02 02 00 02 00 07 05 04 02 00 02 00 07 05 86 02 00 02 00 07 05 88 02 00 02
00 09 04 00 02 06 ff ff ff 00 07 05 01 03 40 00 01 07 05 81 03 40 00 01 07
05 02 03 00 02 01 07 05 04 02 00 02 00 07 05 86 03 00 02 01 07 05 88 02 00
02 00 09 04 00 03 06 ff ff ff 00 07 05 01 03 40 00 01 07 05 81 03 40 00 01
07 05 02 01 00 02 01 07 05 04 02 00 02 00 07 05 86 01 00 02 01 07 05 88 02
00 02 00
</trace>

[1] https://github.com/swetland/usbmon


Reply to: