             expected_size 9
             cb(null, data.readUInt8(0), data.readUInt32LE(1), data.readUInt32LE(5))
         when OPC_START_FLASH
-            expected_size 9
-            cb(null, data.readUInt8(0), data.readUInt32LE(1), data.readUInt32LE(5))
-        when OPC_STOP_FLASH, OPC_FLUSH
+            expected_size 5
+            cb(null, data.readUInt8(0), data.readUInt32LE(1))
+        when OPC_STOP_FLASH
             expected_size 0
             cb(null)
+        when OPC_FLUSH
+            expected_size 6
+            cb(null, data.readUInt32LE(0), data.readUInt16LE(4))
         else
             cb("invalid response code #{response_code}; expected #{opcode}")
 

                    raise "invalid progress PDU size #{data.length}"

                progress( data.readUInt32LE(0), data.readUInt16LE(4), data.readUInt8(6) )

        unregister_progress_callback: ->
            progress_callback = default_progress_callback


    flash_cb = {
        start_flash: ( start_address, cb ) ->
            execute OPC_START_FLASH, new Buffer( start_address ), (error, mtu, checksum)->
                console.log "flash started. mtu: #{mtu}; checksum: #{checksum}" if VERBOSE
                cb(error, mtu, checksum)

        send_data: ( data ) ->
            queued_data.push data
