From: Andries.Brouwer@cwi.nl 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 -puN drivers/usb/storage/sddr09.c~usb-sddr09-documentation drivers/usb/storage/sddr09.c --- 25/drivers/usb/storage/sddr09.c~usb-sddr09-documentation 2004-01-25 03:12:23.000000000 -0800 +++ 25-akpm/drivers/usb/storage/sddr09.c 2004-01-25 03:12:23.000000000 -0800 @@ -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 @@ sddr09_read23(struct us_data *us, unsign * * 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) { @@ -487,6 +502,20 @@ sddr09_erase(struct us_data *us, unsigne } /* + * 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. * byte 0: opcode: E9 * bytes 2-5: write address (big-endian, counting shorts, sector aligned). _