Skip to content

Series to clean handle_XXX() in f_dfu.c

Patrick Delaunay u-boot 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2usb: gadget: dfu: correct size for USB_REQ_DFU_GETSTATE resultdrivers/usb/gadget/f_dfu.c+11 -110 replies
2/2usb: gadget: dfu: add result for handle_getstatus()drivers/usb/gadget/f_dfu.c drivers/usb/gadget/f_dfu.h+13 -220 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchLukasz Majewski
SeriesA-b T-b
1/2
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [U-Boot] [PATCH 0/2] Series to clean handle_XXX() in f_dfu.c

1/ DFU_GETSTATE response error

when the DFU device state is requested using libusb with DFU_GETSTATUS a error is generated : LIBUSB_ERROR_IO

I see the issue with my programmer tools based on dfu with libusb and I don't understood the actual code in U-Boot (req->actual is updated but not req->lenght ?)

With the proposed patch, I aligned the code on the GETSTATUS behavior:
the correct lenght is provided in req->lenght as the other answer and the issue is solved.

PS: the issue not see with dfu-util as the existing function
dfu_get_state() is never called in main (with dfu-util 0.9)

But I can reproduce the same issue with patched version of dfu-util to add call to this function, on the dfu-util master branch

src/main.c +7 -0
index 7f31d4c..d99ace9 100644
@@ -535,6 +535,13 @@ dfustate:
        }
 
 status_again:
+       printf("Determining device state: ");
+       ret = dfu_get_state(dfu_root->dev_handle, dfu_root->interface);
+       if (ret < 0) {
+               errx(EX_IOERR, "error get_state: %s", libusb_error_name(ret));
+       }
+       printf("state = %s\n", dfu_state_to_string(ret));
+
        printf("Determining device status: ");
        ret = dfu_get_status(dfu_root, &status );
        if (ret < 0) {

2/ harmonize handle_getstatus() with other function

=> add return value with size of the buffer as
- handle_getstate() add in part 1
or existing functions
- handle_dnload()
- handle_upload()

Patrick Delaunay (2):
usb: gadget: dfu: correct size for USB_REQ_DFU_GETSTATE result
usb: gadget: dfu: add result for handle_getstatus()

 drivers/usb/gadget/f_dfu.c | 56 ++++++++++++++++++++--------------------------
 drivers/usb/gadget/f_dfu.h |  1 -
 2 files changed, 24 insertions(+), 33 deletions(-)
Signature · 1 line
1.9.1