ChangeSet 1.1557.49.31, 2004/02/19 15:42:36-08:00, Andries.Brouwer@cwi.nl [PATCH] USB: add comments to sddr09.c People ask how to write the CIS on a SmartMedia card using an sddr09 reader/writer. The patch below documents the required command (but does not add the code). Two years ago or so I used this to fix the CIS on a card that my camera no longer wanted to accept. A Linux utility to do this might be useful, but the problem always is that we do not really have a good mechanism. How does one tell a driver that it has to do something special? Add yet another ioctl? drivers/usb/storage/sddr09.c | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+) diff -Nru a/drivers/usb/storage/sddr09.c b/drivers/usb/storage/sddr09.c --- a/drivers/usb/storage/sddr09.c Thu Feb 19 17:20:32 2004 +++ b/drivers/usb/storage/sddr09.c Thu Feb 19 17:20:32 2004 @@ -27,6 +27,20 @@ * 675 Mass Ave, Cambridge, MA 02139, USA. */ +/* + * Known vendor commands: 12 bytes, first byte is opcode + * + * E7: read scatter gather + * E8: read + * E9: write + * EA: erase + * EB: reset + * EC: read status + * ED: read ID + * EE: write CIS (?) + * EF: compute checksum (?) + */ + #include "transport.h" #include "protocol.h" #include "usb.h" @@ -461,6 +475,7 @@ * * Always precisely one block is erased; bytes 2-5 and 10-11 are ignored. * The byte address being erased is 2*Eaddress. + * The CIS cannot be erased. */ static int sddr09_erase(struct us_data *us, unsigned long Eaddress) { @@ -485,6 +500,20 @@ return result; } + +/* + * Write CIS Command: 12 bytes. + * byte 0: opcode: EE + * bytes 2-5: write address in shorts + * bytes 10-11: sector count + * + * This writes at the indicated address. Don't know how it differs + * from E9. Maybe it does not erase? However, it will also write to + * the CIS. + * + * When two such commands on the same page follow each other directly, + * the second one is not done. + */ /* * Write Command: 12 bytes.