lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-asf4-dfu/+/42172?usp=email )


Change subject: dfu: irq: GET_STATUS: set state before sending it
......................................................................

dfu: irq: GET_STATUS: set state before sending it

The DFU spec, v1.1: "6.1.2 DFU_GETSTATUS Request" states the
GET_STATUS should contain the state,
to which the device transistions to after processing this message.

Change-Id: I6d28404d6936f7ea79fcee90f0c8191f0f623ad8
---
M usb/class/dfu/device/dfudf.c
1 file changed, 9 insertions(+), 8 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-asf4-dfu refs/changes/72/42172/1

diff --git a/usb/class/dfu/device/dfudf.c b/usb/class/dfu/device/dfudf.c
index 882cad8..c66454b 100644
--- a/usb/class/dfu/device/dfudf.c
+++ b/usb/class/dfu/device/dfudf.c
@@ -160,14 +160,6 @@
                to_return = ERR_UNSUPPORTED_OP; // stall control pipe (don't 
reply to the request)
                break;
        case USB_DFU_GETSTATUS: // get status
-               response[0] = dfu_status; // set status
-               response[1] = 10; // set poll timeout (24 bits, in 
milliseconds) to small value for periodical poll
-               response[2] = 0; // set poll timeout (24 bits, in milliseconds) 
to small value for periodical poll
-               response[3] = 0; // set poll timeout (24 bits, in milliseconds) 
to small value for periodical poll
-               response[4] = dfu_state; // set state
-               response[5] = 0; // string not used
-               to_return = usbdc_xfer(ep, response, 6, false); // send back 
status
-
                switch (dfu_state) {
                case USB_DFU_STATE_DFU_DNLOAD_SYNC: // download has not 
completed
                        dfu_state = USB_DFU_STATE_DFU_DNBUSY; // switch to busy 
state
@@ -184,6 +176,15 @@
                default:
                        break;
                }
+
+               response[0] = dfu_status; // set status
+               response[1] = 10; // set poll timeout (24 bits, in 
milliseconds) to small value for periodical poll
+               response[2] = 0; // set poll timeout (24 bits, in milliseconds) 
to small value for periodical poll
+               response[3] = 0; // set poll timeout (24 bits, in milliseconds) 
to small value for periodical poll
+               response[4] = dfu_state; // set state
+               response[5] = 0; // string not used
+               to_return = usbdc_xfer(ep, response, 6, false); // send back 
status
+
                break;
        case USB_DFU_GETSTATE: // get state
                response[0] = dfu_state; // return state

--
To view, visit https://gerrit.osmocom.org/c/osmo-asf4-dfu/+/42172?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: osmo-asf4-dfu
Gerrit-Branch: master
Gerrit-Change-Id: I6d28404d6936f7ea79fcee90f0c8191f0f623ad8
Gerrit-Change-Number: 42172
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <[email protected]>

Reply via email to