[U-Boot] [U-Boot PATCH V2 6/9] usb: ums: add do_extra_command

Eddie Cai eddie.cai.linux at gmail.com
Sun Apr 16 15:54:11 UTC 2017


add do_extra_command to let people deal with customized command

Signed-off-by: Eddie Cai <eddie.cai.linux at gmail.com>
---
 drivers/usb/gadget/f_mass_storage.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index 333f069..d431e53 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -2168,6 +2168,10 @@ unknown_cmnd:
 	return 0;
 }
 
+int __weak do_extra_command(struct fsg_common *common)
+{
+	return -EINVAL;
+}
 /*-------------------------------------------------------------------------*/
 
 static int received_cbw(struct fsg_dev *fsg, struct fsg_buffhd *bh)
@@ -2540,8 +2544,10 @@ int fsg_main_thread(void *common_)
 		if (!exception_in_progress(common))
 			common->state = FSG_STATE_DATA_PHASE;
 
-		if (do_scsi_command(common) || finish_reply(common))
+		if ((do_extra_command(common) && do_scsi_command(common)) ||
+		    finish_reply(common)) {
 			continue;
+		}
 
 		if (!exception_in_progress(common))
 			common->state = FSG_STATE_STATUS_PHASE;
-- 
2.10.2



More information about the U-Boot mailing list