For our purposes, I distinguish three firmware file formats:
-
Full FLASH dumps. Those should NOT be considered "firmware updates" since the dump also contains things like calibration data (reference white balance values) and logs (yes, the scanner keeps a log of all operations). Those dumps, however, are best for disaster recovery purposes - they let you pretty much undo anything weird you might have done to the firmware.
-
The
FIRMDATA
files, as included in Nikon updaters. They use an unknown compression/packing format that is an enormous pain in the ass to reverse engineer. -
The binary files used with Nikon service software. They seem to have a simpler format - just the binary data, starting at 0x10000 or possibly 0x20000. There's a good chance that this is the format that the scanner expects. We need to run an LS-40 USB traffic dump in order to confirm this theory.
A good clue that your firmware update file is correct is a scanner model
string (e.g. DF17811
) located at offset 0x11.
NOTE: This section is pure speculation. I will edit this as I gain more information.
- Send
WRITE BUFFER
command withMODE=5
,BUFFER_ID=7
. The offset and payload should be... I'm not sure what, that's TBD. - The scanner verifies the validity of update (correct model string), deinitializes all peripherals and jumps to Recovery.
- Recovery recognizes this and jumps straight to handling that SCSI command again.
- The markers at
0x4000
are set to indicate firmware is not valid. - The firmware update file is received in chunks and flashed starting
at offset
0x20000
. - The markers at
0x4000
are set to indicate firmware is valid but Recovery is not valid. - When the main firmware starts, it realizes that Recovery is missing
and writes a copy of Recovery from the end of the Main firmware into
sector
0x10000
. - The markers at
0x4000
are set to indicate recovery is valid.
Firmware updates are handled through SCSI WRITE BUFFER
command. The sequence
performed by the original Nikon updater is:
- Issue
IDENTIFY
to confirm eligible scanner model. - Issue
RESERVE UNIT
. - Issue
SEND DIAGNOSTICS.
- Issue
WRITE BUFFER
withMODE=5
, send 4096 bytes ofFIRMDATA
. - Continue 4) until you're out of data.
- Issue
SET PARAMETERS
(0xE0). - Issue
EXECUTE
. Wait for it to complete. - Issue
RELEASE UNIT
.
The exact flow of an LS-40 update can be found here.
In order to be able to reinstall the same firmware version as one that's
already in the scanner FLASH, open the updater in ResEdit/ResHacker and
change the VERSIONVALUE resource to e.g. 00 01 09 09
.