All of lore.kernel.org
 help / color / mirror / Atom feed
From: bugzilla-daemon@kernel.org
To: linux-usb@vger.kernel.org
Subject: [Bug 220422] New: USB: Misdecoded serial number from Dymo Twin Turbo (0922:0018) breaks multi-device support in CUPS
Date: Thu, 07 Aug 2025 01:46:44 +0000	[thread overview]
Message-ID: <bug-220422-208809@https.bugzilla.kernel.org/> (raw)

https://bugzilla.kernel.org/show_bug.cgi?id=220422

            Bug ID: 220422
           Summary: USB: Misdecoded serial number from Dymo Twin Turbo
                    (0922:0018) breaks multi-device support in CUPS
           Product: Drivers
           Version: 2.5
    Kernel Version: Mainline
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: USB
          Assignee: drivers_usb@kernel-bugs.kernel.org
          Reporter: steve@groesz.org
        Regression: No

Created attachment 308461
  --> https://bugzilla.kernel.org/attachment.cgi?id=308461&action=edit
Dymo Twin Turbo Packet Capture

**Summary:**
The Linux USB core incorrectly decodes the serial number string descriptor of
the Dymo LabelWriter Twin Turbo printer (USB ID 0922:0018), resulting in
invalid or unreadable characters. This causes user-space tools such as CUPS to
generate incorrect or duplicate URIs, making it difficult or impossible to use
more than one device concurrently.

**System:**

* Distribution: Linux Mint 22.1
* Kernel: 6.8.0-71-generic (also affects mainline kernels)
* Architecture: x86\_64
* Device: Dymo LabelWriter Twin Turbo
* USB ID: 0922:0018

**Steps to Reproduce:**

1. Connect two Dymo Twin Turbo printers via USB.
2. Inspect `/sys/bus/usb/devices/*/serial` — the serials differ in raw binary
but decode to unreadable (non-ASCII) strings.
3. Run:
   `lpinfo -v | grep usb`
   → Both devices appear as:
   `usb://DYMO/LabelWriter%20Twin%20Turbo?serial=??????????????`

**Problem:**
Each printer reports a unique serial number at the descriptor level, but the
raw USB string descriptor data is misaligned or malformed. For example:

```
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'
```

This is not properly aligned for UTF-16LE decoding. The kernel’s USB string
decoder (`usb_string_sub()` in `drivers/usb/core/message.c`) treats high bytes
as non-ASCII and replaces them with `?`, resulting in a decoded string like:

```
??????????????
```

This leads CUPS and other tools to construct identical URIs for both devices,
preventing proper multi-device support.

**Analysis:**
The descriptor appears to contain valid UTF-16LE if the first byte is skipped.
After correcting for this offset, the decoded string is:

```
"006103010161575"
```

This matches the `GET_DEVICE_ID` response from the device, confirming the
intended serial value.

The decoding logic in `usb_string_sub()` assumes correct UTF-16LE alignment and
does not handle malformed or misaligned descriptors, causing loss of unique
identifiers in sysfs and downstream applications.

**Expected Behavior:**
The kernel should decode USB string descriptors defensively, including recovery
from common misalignment issues in UTF-16LE encoding. Devices that return
malformed descriptors should still expose unique serial numbers if the raw data
permits recovery.

**Suggested Fixes:**

* Add fallback decoding logic (e.g., try shifted decoding if the result is all
`?`)
* Add a USB quirk for device ID 0922:0018 to apply corrected decoding
* Optionally expose raw descriptor data in sysfs for user-space tools to
perform recovery

I have attached a wireshark packet capture with sample packets from one device.
I can provide additional packet captures if needed.

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

             reply	other threads:[~2025-08-07  1:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-07  1:46 bugzilla-daemon [this message]
2025-08-07  1:48 ` [Bug 220422] USB: Misdecoded serial number from Dymo Twin Turbo (0922:0018) breaks multi-device support in CUPS bugzilla-daemon
2025-08-07 16:04 ` [Bug 220422] New: " Greg KH
2025-08-07 16:04 ` [Bug 220422] " bugzilla-daemon
2025-08-07 18:32 ` bugzilla-daemon
2025-08-08  0:45 ` bugzilla-daemon
2025-10-02  3:02 ` bugzilla-daemon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-220422-208809@https.bugzilla.kernel.org/ \
    --to=bugzilla-daemon@kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.