Update README.md

This commit is contained in:
wp
2025-08-05 22:27:19 -05:00
parent 51b39209c6
commit 56595b0b5a

View File

@@ -40,10 +40,13 @@ print(f"Dymo 450 Raw Serial value: {usb.control.get_descriptor(dymo450,254,0x03,
print(f"Dymo-TT Raw Serial value: {usb.control.get_descriptor(dymott,254,0x03,dymott.iSerialNumber,dymott.langids[0])[2:30].tobytes().decode('utf-16-le')}") # returns gibberish
print(f"Dymo 450 string result as bytes: {usb.control.get_descriptor(dymo450,254,0x03,dymo450.iSerialNumber,dymo450.langids[0])[2:30].tobytes().decode('utf-16-le').encode('utf-8')}") # returns b'17100616184230'
print(f"Dymo 450 string result as bytes: {usb.control.get_descriptor(dymott,254,0x03,dymott.iSerialNumber,dymott.langids[0])[2:30].tobytes().decode('utf-16-le').encode('utf-8')}") # returns b'\xe3\x80\xb0\xe3\x98\x80\xe3\x84\x80\xe3\x80\x80\xe3\x8c\x80\xe3\x80\x80\xe3\x84\x80\xe3\x80\x80\xe3\x84\x80\xe3\x98\x80\xe3\x84\x80\xe3\x94\x80\xe3\x9c\x80\xe3\x94\x80'
```
The Twin-Turbo serial is supposed to be 006103010161575. Due to the extra 0 byte `b'\x30'`, the rest of the return data becomes shifted and is interpreted like
`b'\x30\x30\x00\x36\x00\x31\x00\x30\x00\x33\x00\x30\x00\x31\x00\x30\x00\x31\x00\x36\x00\x31\x00\x35\x00\x37\x00\x35'.decode('utf-16-le')` or literally unicode values `\x3500\x3700\x3500\x3100\x3600\x3100\x3000\x3100\x3000\x3300\x3000\x3100\x3600\x3030`
Note: Linux Mint 22.1 <- Ubuntu 24.04 Noble <- Debian Trixie/sid <- Kernel 6.8.0-71-generic; pyusb version 1.3.1; python version 3.12.3
References
https://www.beyondlogic.org/usbnutshell/usb5.shtml#StringDescriptors