ffs: Send response for GET_STATUS setup request 06/280106/2
authorDongwoo Lee <dwoo08.lee@samsung.com>
Thu, 11 Aug 2022 06:08:12 +0000 (15:08 +0900)
committerJihoon Jung <jh8801.jung@samsung.com>
Wed, 24 Aug 2022 22:47:32 +0000 (07:47 +0900)
In order to finalize handling GET_STATUS setup request, sending ack
to the host is required. Otherwise, setup request stalls and the next
request cannot be handled because the stall of request is condiered
endpoint halt. To prevent this, the response of GET_STATUS is sent
explicitly.

Change-Id: I09307d2db5f9b50483d194bbf4eedb56854466c6
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
src/mtp_usb_driver_ffs.c

index 443dcce2a438d53185f4375f63b2592cec820b31..a7cea9e572e0b59b10f9114b95b1a1a5ac7b589d 100644 (file)
@@ -546,7 +546,6 @@ static void __handle_control_request(mtp_int32 request)
                if (kernel_reset == FALSE) {
                        kernel_reset = TRUE;
                }
-
                status = read(g_usb_ep0, NULL, 0);
                if (status < 0) {
                        ERR("IOCTL MTP_SEND_RESET_ACK Failed [%d]\n",
@@ -603,6 +602,13 @@ static void __handle_control_request(mtp_int32 request)
                        return;
                } */
 
+               status = write(g_usb_ep0, &statusreq_data, sizeof(statusreq_data));
+               if (status < 0) {
+                       char error[256];
+                       ERR("Failed to write data for GETSTATUS request\n: %s",
+                                       strerror_r(errno, error, sizeof(error)));
+               }
+
                break;
 
        case USB_PTPREQUEST_GETEVENT: