* [PATCH] usb: storage: add quirks for CASIO calculators
@ 2026-11-05 15:13 Thomas Touhey
2026-11-05 15:19 ` sashiko-bot
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Thomas Touhey @ 2026-11-05 15:13 UTC (permalink / raw)
To: linux-usb; +Cc: Thomas Touhey, stable
CASIO calculators using USB Mass Storage, bearing
product IDs 6102 and 6103, always report non-zero
dCSWDataResidue for requested transfer length
>4096 bytes while bCSWStatus == 0.
Information about an fx-CG50 (OS 3.11):
T: Bus=03 Lev=01 Prnt=01 Port=06 Cnt=03 Dev#= 24 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=07cf ProdID=6102 Rev= 1.00
S: Manufacturer=CASIO MassStorage Device
S: Product=CASIO MassStorage Device
S: SerialNumber=0000xdPUBVUq
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
Information about an fx-9750GIII (OS 3.71):
T: Bus=03 Lev=01 Prnt=01 Port=06 Cnt=03 Dev#= 25 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=07cf ProdID=6103 Rev= 1.00
S: Manufacturer=CASIO MassStorage Device
S: Product=CASIO MassStorage Device
S: SerialNumber=000000000001
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
Cc: stable <stable@kernel.org>
Signed-off-by: Thomas Touhey <thomas@touhey.fr>
---
drivers/usb/storage/unusual_devs.h | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index ac22fa318734..492b5f050f0b 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -1168,6 +1168,25 @@ UNUSUAL_DEV( 0x07cf, 0x1167, 0x0100, 0x0100,
"EX-N1 DigitalCamera",
USB_SC_8070, USB_PR_DEVICE, NULL, 0),
+/*
+ * CASIO calculators using UMS for "USB Key" mode always
+ * reports non-zero residue when the transfer length is larger
+ * than 4096 bytes.
+ *
+ * Reported by Thomas Touhey <thomas@touhey.fr>
+ * and augmented by 0v0katai <0v0katai@gmail.com>
+ */
+UNUSUAL_DEV( 0x07cf, 0x6102, 0x0100, 0x0100,
+ "Casio",
+ "fx-CP400",
+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+ US_FL_IGNORE_RESIDUE ),
+UNUSUAL_DEV( 0x07cf, 0x6103, 0x0100, 0x0100,
+ "Casio",
+ "fx-CG50",
+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+ US_FL_IGNORE_RESIDUE ),
+
/* Submitted by Hartmut Wahl <hwahl@hwahl.de>*/
UNUSUAL_DEV( 0x0839, 0x000a, 0x0001, 0x0001,
"Samsung",
--
2.56.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] usb: storage: add quirks for CASIO calculators 2026-11-05 15:13 [PATCH] usb: storage: add quirks for CASIO calculators Thomas Touhey @ 2026-11-05 15:19 ` sashiko-bot 2026-11-05 16:02 ` Alan Stern 2026-11-07 2:24 ` Artem Novak 2 siblings, 0 replies; 6+ messages in thread From: sashiko-bot @ 2026-11-05 15:19 UTC (permalink / raw) To: Thomas Touhey, linux-usb > CASIO calculators using USB Mass Storage, bearing > product IDs 6102 and 6103, always report non-zero > dCSWDataResidue for requested transfer length > >4096 bytes while bCSWStatus == 0. > > Information about an fx-CG50 (OS 3.11): > T: Bus=03 Lev=01 Prnt=01 Port=06 Cnt=03 Dev#= 24 Spd=480 MxCh= 0 > D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 > P: Vendor=07cf ProdID=6102 Rev= 1.00 > S: Manufacturer=CASIO MassStorage Device > S: Product=CASIO MassStorage Device > S: SerialNumber=0000xdPUBVUq > C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=100mA > I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage > E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms > [ ... ] > E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms > E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms > > Cc: stable <stable@kernel.org> > Signed-off-by: Thomas Touhey <thomas@touhey.fr> Sashiko has reviewed this patch and found no issues. -- Sashiko AI review · https://sashiko.dev/#/patchset/20261105151348.19009-1-thomas@touhey.fr?part=1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] usb: storage: add quirks for CASIO calculators 2026-11-05 15:13 [PATCH] usb: storage: add quirks for CASIO calculators Thomas Touhey 2026-11-05 15:19 ` sashiko-bot @ 2026-11-05 16:02 ` Alan Stern 2026-11-05 19:06 ` Thomas Touhey [not found] ` <CAFCjBVE3zDqQnWdHmU6rwHHfRrS_p7r+PwsyXhbqVSEk4Vc-Lg@mail.gmail.com> 2026-11-07 2:24 ` Artem Novak 2 siblings, 2 replies; 6+ messages in thread From: Alan Stern @ 2026-11-05 16:02 UTC (permalink / raw) To: Thomas Touhey; +Cc: linux-usb, stable On Thu, Nov 05, 2026 at 04:13:48PM +0100, Thomas Touhey wrote: > CASIO calculators using USB Mass Storage, bearing > product IDs 6102 and 6103, always report non-zero > dCSWDataResidue for requested transfer length > >4096 bytes while bCSWStatus == 0. Do the calculators' Mass Storage interface work correctly when the quirk is present? In other words, is the non-zero dCSWDataResidue value simply wrong, or does it accurately reflect the fact that the device hasn't accepted anything beyond the first 4 KB of the data transfer? If the latter is true then the quirk won't help. Instead it would be necessary to set the device's max_sectors value to 8, limiting individual transfers to 8 * 512 = 4096 bytes. How much storage space do these devices provide? Alan Stern > Information about an fx-CG50 (OS 3.11): > T: Bus=03 Lev=01 Prnt=01 Port=06 Cnt=03 Dev#= 24 Spd=480 MxCh= 0 > D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 > P: Vendor=07cf ProdID=6102 Rev= 1.00 > S: Manufacturer=CASIO MassStorage Device > S: Product=CASIO MassStorage Device > S: SerialNumber=0000xdPUBVUq > C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=100mA > I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage > E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms > E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms > > Information about an fx-9750GIII (OS 3.71): > T: Bus=03 Lev=01 Prnt=01 Port=06 Cnt=03 Dev#= 25 Spd=480 MxCh= 0 > D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 > P: Vendor=07cf ProdID=6103 Rev= 1.00 > S: Manufacturer=CASIO MassStorage Device > S: Product=CASIO MassStorage Device > S: SerialNumber=000000000001 > C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=100mA > I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage > E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms > E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms > > Cc: stable <stable@kernel.org> > Signed-off-by: Thomas Touhey <thomas@touhey.fr> > --- > drivers/usb/storage/unusual_devs.h | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h > index ac22fa318734..492b5f050f0b 100644 > --- a/drivers/usb/storage/unusual_devs.h > +++ b/drivers/usb/storage/unusual_devs.h > @@ -1168,6 +1168,25 @@ UNUSUAL_DEV( 0x07cf, 0x1167, 0x0100, 0x0100, > "EX-N1 DigitalCamera", > USB_SC_8070, USB_PR_DEVICE, NULL, 0), > > +/* > + * CASIO calculators using UMS for "USB Key" mode always > + * reports non-zero residue when the transfer length is larger > + * than 4096 bytes. > + * > + * Reported by Thomas Touhey <thomas@touhey.fr> > + * and augmented by 0v0katai <0v0katai@gmail.com> > + */ > +UNUSUAL_DEV( 0x07cf, 0x6102, 0x0100, 0x0100, > + "Casio", > + "fx-CP400", > + USB_SC_DEVICE, USB_PR_DEVICE, NULL, > + US_FL_IGNORE_RESIDUE ), > +UNUSUAL_DEV( 0x07cf, 0x6103, 0x0100, 0x0100, > + "Casio", > + "fx-CG50", > + USB_SC_DEVICE, USB_PR_DEVICE, NULL, > + US_FL_IGNORE_RESIDUE ), > + > /* Submitted by Hartmut Wahl <hwahl@hwahl.de>*/ > UNUSUAL_DEV( 0x0839, 0x000a, 0x0001, 0x0001, > "Samsung", > -- > 2.56.0 > > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] usb: storage: add quirks for CASIO calculators 2026-11-05 16:02 ` Alan Stern @ 2026-11-05 19:06 ` Thomas Touhey [not found] ` <CAFCjBVE3zDqQnWdHmU6rwHHfRrS_p7r+PwsyXhbqVSEk4Vc-Lg@mail.gmail.com> 1 sibling, 0 replies; 6+ messages in thread From: Thomas Touhey @ 2026-11-05 19:06 UTC (permalink / raw) To: Alan Stern; +Cc: linux-usb, stable Hey, thanks for your review and response! > How much storage space do these devices provide? Usually between 2MB to around 32MB (usually around 15-20MB on modern devices). > Do the calculators' Mass Storage interface work correctly when the quirk > is present? In other words, is the non-zero dCSWDataResidue value > simply wrong, or does it accurately reflect the fact that the device > hasn't accepted anything beyond the first 4 KB of the data transfer? It does, the dCSWDataResidue is wrong. We made two experiments, one on Linux and one on Win32. 0v0katai (quoted in the commit) tested this on Win32 with the default driver (USBSTOR), which seems to already ignore the CSW residue in this situation. They wrote a random 1M file it, read it back, then compared SHA256 hashes; they were identical. The writing part can be found in the attached "test-win32-write1M.pcapng" file. I tested this on Linux by applying the quirk using "options usb-storage quirks=07cf:6102:r,07cf:6103:r" with modprobe, starting my Graph 90+E (French variant of the fx-CG50) in USB Key mode, writing the file ("test-linux-00-write4M" file), detaching, reattaching, reading the file ("test-linux-01-read4M"), then diff-ing both the source and the obtained file. Identical once again. :-) Let me know if there are additional tests I should run! Regards, Thomas Touhey P-S: Resending with all recipients this time, because I answered to you only by mistake. Sorry, new to the git review process by e-mail :-) Le jeu. 5 nov. 2026 à 17:02, Alan Stern <stern@rowland.harvard.edu> a écrit : > > On Thu, Nov 05, 2026 at 04:13:48PM +0100, Thomas Touhey wrote: > > CASIO calculators using USB Mass Storage, bearing > > product IDs 6102 and 6103, always report non-zero > > dCSWDataResidue for requested transfer length > > >4096 bytes while bCSWStatus == 0. > > Do the calculators' Mass Storage interface work correctly when the quirk > is present? In other words, is the non-zero dCSWDataResidue value > simply wrong, or does it accurately reflect the fact that the device > hasn't accepted anything beyond the first 4 KB of the data transfer? > > If the latter is true then the quirk won't help. Instead it would be > necessary to set the device's max_sectors value to 8, limiting > individual transfers to 8 * 512 = 4096 bytes. > > How much storage space do these devices provide? > > Alan Stern > > > Information about an fx-CG50 (OS 3.11): > > T: Bus=03 Lev=01 Prnt=01 Port=06 Cnt=03 Dev#= 24 Spd=480 MxCh= 0 > > D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 > > P: Vendor=07cf ProdID=6102 Rev= 1.00 > > S: Manufacturer=CASIO MassStorage Device > > S: Product=CASIO MassStorage Device > > S: SerialNumber=0000xdPUBVUq > > C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=100mA > > I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage > > E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms > > E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms > > > > Information about an fx-9750GIII (OS 3.71): > > T: Bus=03 Lev=01 Prnt=01 Port=06 Cnt=03 Dev#= 25 Spd=480 MxCh= 0 > > D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 > > P: Vendor=07cf ProdID=6103 Rev= 1.00 > > S: Manufacturer=CASIO MassStorage Device > > S: Product=CASIO MassStorage Device > > S: SerialNumber=000000000001 > > C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=100mA > > I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage > > E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms > > E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms > > > > Cc: stable <stable@kernel.org> > > Signed-off-by: Thomas Touhey <thomas@touhey.fr> > > --- > > drivers/usb/storage/unusual_devs.h | 19 +++++++++++++++++++ > > 1 file changed, 19 insertions(+) > > > > diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h > > index ac22fa318734..492b5f050f0b 100644 > > --- a/drivers/usb/storage/unusual_devs.h > > +++ b/drivers/usb/storage/unusual_devs.h > > @@ -1168,6 +1168,25 @@ UNUSUAL_DEV( 0x07cf, 0x1167, 0x0100, 0x0100, > > "EX-N1 DigitalCamera", > > USB_SC_8070, USB_PR_DEVICE, NULL, 0), > > > > +/* > > + * CASIO calculators using UMS for "USB Key" mode always > > + * reports non-zero residue when the transfer length is larger > > + * than 4096 bytes. > > + * > > + * Reported by Thomas Touhey <thomas@touhey.fr> > > + * and augmented by 0v0katai <0v0katai@gmail.com> > > + */ > > +UNUSUAL_DEV( 0x07cf, 0x6102, 0x0100, 0x0100, > > + "Casio", > > + "fx-CP400", > > + USB_SC_DEVICE, USB_PR_DEVICE, NULL, > > + US_FL_IGNORE_RESIDUE ), > > +UNUSUAL_DEV( 0x07cf, 0x6103, 0x0100, 0x0100, > > + "Casio", > > + "fx-CG50", > > + USB_SC_DEVICE, USB_PR_DEVICE, NULL, > > + US_FL_IGNORE_RESIDUE ), > > + > > /* Submitted by Hartmut Wahl <hwahl@hwahl.de>*/ > > UNUSUAL_DEV( 0x0839, 0x000a, 0x0001, 0x0001, > > "Samsung", > > -- > > 2.56.0 > > > > ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <CAFCjBVE3zDqQnWdHmU6rwHHfRrS_p7r+PwsyXhbqVSEk4Vc-Lg@mail.gmail.com>]
* Re: [PATCH] usb: storage: add quirks for CASIO calculators [not found] ` <CAFCjBVE3zDqQnWdHmU6rwHHfRrS_p7r+PwsyXhbqVSEk4Vc-Lg@mail.gmail.com> @ 2026-11-05 19:54 ` Alan Stern 0 siblings, 0 replies; 6+ messages in thread From: Alan Stern @ 2026-11-05 19:54 UTC (permalink / raw) To: Thomas Touhey; +Cc: USB mailing list, stable On Thu, Nov 05, 2026 at 07:43:07PM +0100, Thomas Touhey wrote: > Hey, thanks for your review and response! > > > How much storage space do these devices provide? > > Usually between 2MB to around 32MB (usually around 15-20MB on modern devices). > > > Do the calculators' Mass Storage interface work correctly when the quirk > > is present? In other words, is the non-zero dCSWDataResidue value > > simply wrong, or does it accurately reflect the fact that the device > > hasn't accepted anything beyond the first 4 KB of the data transfer? > > It does, the dCSWDataResidue is wrong. We made two experiments, one on > Linux and one on Win32. > > 0v0katai (quoted in the commit) tested this on Win32 with the default > driver (USBSTOR), which seems to already ignore the CSW residue in > this situation. They wrote a random 1M file it, read it back, then > compared SHA256 hashes; they were identical. The writing part can be > found in the attached "test-win32-write1M.pcapng" file. > > I tested this on Linux by applying the quirk using "options > usb-storage quirks=07cf:6102:r,07cf:6103:r" with modprobe, starting my > Graph 90+E (French variant of the fx-CG50) in USB Key mode, writing > the file ("test-linux-00-write4M" file), detaching, reattaching, > reading the file ("test-linux-01-read4M"), then diff-ing both the > source and the obtained file. Identical once again. :-) > > Let me know if there are additional tests I should run! No, that's fine. I just wanted to make sure you had considered this possibility. As for the patch: Acked-by: Alan Stern <stern@rowland.harvard.edu> Alan Stern ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] usb: storage: add quirks for CASIO calculators 2026-11-05 15:13 [PATCH] usb: storage: add quirks for CASIO calculators Thomas Touhey 2026-11-05 15:19 ` sashiko-bot 2026-11-05 16:02 ` Alan Stern @ 2026-11-07 2:24 ` Artem Novak 2 siblings, 0 replies; 6+ messages in thread From: Artem Novak @ 2026-11-07 2:24 UTC (permalink / raw) To: thomas; +Cc: stern, linux-usb, stable, Artem Novak Tested on a Casio fx-9750GIII running OS 3.71 (USB ID 07cf:6103). With US_FL_IGNORE_RESIDUE enabled through the usb-storage runtime quirks parameter, 8 KiB reads and a 1 MiB write/readback test passed. The readback was verified using SHA-256 and cmp after disconnecting and reconnecting the calculator. Tested-by: Artem Novak <artem122novak@gmail.com> ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-11-07 2:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-05 15:13 [PATCH] usb: storage: add quirks for CASIO calculators Thomas Touhey
2026-11-05 15:19 ` sashiko-bot
2026-11-05 16:02 ` Alan Stern
2026-11-05 19:06 ` Thomas Touhey
[not found] ` <CAFCjBVE3zDqQnWdHmU6rwHHfRrS_p7r+PwsyXhbqVSEk4Vc-Lg@mail.gmail.com>
2026-11-05 19:54 ` Alan Stern
2026-11-07 2:24 ` Artem Novak
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.