diff mbox

[U-Boot,1/2] fastboot: add "fastboot oem" command support

Message ID 1422308941-23543-2-git-send-email-robh@kernel.org
State Accepted
Delegated to: Łukasz Majewski
Headers show

Commit Message

Rob Herring (Arm) Jan. 26, 2015, 9:49 p.m. UTC
From: Michael Scott <michael.scott@linaro.org>

Add code stub to handle "fastboot oem __" command. As unlock is a common
fastboot command, distinguish that it is not implemented.

Signed-off-by: Michael Scott <michael.scott@linaro.org>
Signed-off-by: Rob Herring <robh@kernel.org>
---
 drivers/usb/gadget/f_fastboot.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Łukasz Majewski Jan. 29, 2015, 8:30 a.m. UTC | #1
Hi Rob,

> From: Michael Scott <michael.scott@linaro.org>
> 
> Add code stub to handle "fastboot oem __" command. As unlock is a
> common fastboot command, distinguish that it is not implemented.
> 
> Signed-off-by: Michael Scott <michael.scott@linaro.org>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>  drivers/usb/gadget/f_fastboot.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/usb/gadget/f_fastboot.c
> b/drivers/usb/gadget/f_fastboot.c index 310175a..e2fda86 100644
> --- a/drivers/usb/gadget/f_fastboot.c
> +++ b/drivers/usb/gadget/f_fastboot.c
> @@ -513,6 +513,17 @@ static void cb_flash(struct usb_ep *ep, struct
> usb_request *req) }
>  #endif
>  
> +static void cb_oem(struct usb_ep *ep, struct usb_request *req)
> +{
> +	char *cmd = req->buf;
> +	if (strncmp("unlock", cmd + 4, 8) == 0) {
> +		fastboot_tx_write_str("FAILnot implemented");
> +	}
> +	else {
> +		fastboot_tx_write_str("FAILunknown oem command");
> +	}

Just a minor comment - those braces could be removed.

BTW: Marek shall I take those patches to dfu tree or would you take
them to -usb tree ?

> +}
> +
>  struct cmd_dispatch_info {
>  	char *cmd;
>  	void (*cb)(struct usb_ep *ep, struct usb_request *req);
> @@ -541,6 +552,10 @@ static const struct cmd_dispatch_info
> cmd_dispatch_info[] = { .cb = cb_flash,
>  	},
>  #endif
> +	{
> +		.cmd = "oem",
> +		.cb = cb_oem,
> +	},
>  };
>  
>  static void rx_handler_command(struct usb_ep *ep, struct usb_request
> *req)
Marek Vasut Jan. 29, 2015, 4:49 p.m. UTC | #2
On Thursday, January 29, 2015 at 09:30:27 AM, Lukasz Majewski wrote:
> Hi Rob,

Hi all!

> > From: Michael Scott <michael.scott@linaro.org>
> > 
> > Add code stub to handle "fastboot oem __" command. As unlock is a
> > common fastboot command, distinguish that it is not implemented.
> > 
> > Signed-off-by: Michael Scott <michael.scott@linaro.org>
> > Signed-off-by: Rob Herring <robh@kernel.org>
> > ---
> > 
> >  drivers/usb/gadget/f_fastboot.c | 15 +++++++++++++++
> >  1 file changed, 15 insertions(+)
> > 
> > diff --git a/drivers/usb/gadget/f_fastboot.c
> > b/drivers/usb/gadget/f_fastboot.c index 310175a..e2fda86 100644
> > --- a/drivers/usb/gadget/f_fastboot.c
> > +++ b/drivers/usb/gadget/f_fastboot.c
> > @@ -513,6 +513,17 @@ static void cb_flash(struct usb_ep *ep, struct
> > usb_request *req) }
> > 
> >  #endif
> > 
> > +static void cb_oem(struct usb_ep *ep, struct usb_request *req)
> > +{
> > +	char *cmd = req->buf;
> > +	if (strncmp("unlock", cmd + 4, 8) == 0) {
> > +		fastboot_tx_write_str("FAILnot implemented");
> > +	}
> > +	else {
> > +		fastboot_tx_write_str("FAILunknown oem command");
> > +	}
> 
> Just a minor comment - those braces could be removed.
> 
> BTW: Marek shall I take those patches to dfu tree or would you take
> them to -usb tree ?

Take them through DFU please, thank you!

Best regards,
Marek Vasut
Steve Rae Jan. 29, 2015, 11:27 p.m. UTC | #3
On 15-01-26 01:49 PM, Rob Herring wrote:
> From: Michael Scott <michael.scott@linaro.org>
>
> Add code stub to handle "fastboot oem __" command. As unlock is a common
> fastboot command, distinguish that it is not implemented.
>
> Signed-off-by: Michael Scott <michael.scott@linaro.org>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>   drivers/usb/gadget/f_fastboot.c | 15 +++++++++++++++
>   1 file changed, 15 insertions(+)
>
> diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
> index 310175a..e2fda86 100644
> --- a/drivers/usb/gadget/f_fastboot.c
> +++ b/drivers/usb/gadget/f_fastboot.c
> @@ -513,6 +513,17 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req)
>   }
>   #endif
>
> +static void cb_oem(struct usb_ep *ep, struct usb_request *req)
> +{
> +	char *cmd = req->buf;
> +	if (strncmp("unlock", cmd + 4, 8) == 0) {
> +		fastboot_tx_write_str("FAILnot implemented");
> +	}
> +	else {
> +		fastboot_tx_write_str("FAILunknown oem command");
> +	}
> +}
> +
>   struct cmd_dispatch_info {
>   	char *cmd;
>   	void (*cb)(struct usb_ep *ep, struct usb_request *req);
> @@ -541,6 +552,10 @@ static const struct cmd_dispatch_info cmd_dispatch_info[] = {
>   		.cb = cb_flash,
>   	},
>   #endif
> +	{
> +		.cmd = "oem",
> +		.cb = cb_oem,
> +	},
>   };
>
>   static void rx_handler_command(struct usb_ep *ep, struct usb_request *req)
>

Tested-by: Steve Rae <srae@broadcom.com>
Rob Herring (Arm) Jan. 30, 2015, 2:20 p.m. UTC | #4
On Thu, Jan 29, 2015 at 2:30 AM, Lukasz Majewski <l.majewski@samsung.com> wrote:
> Hi Rob,
>
>> From: Michael Scott <michael.scott@linaro.org>
>>
>> Add code stub to handle "fastboot oem __" command. As unlock is a
>> common fastboot command, distinguish that it is not implemented.
>>
>> Signed-off-by: Michael Scott <michael.scott@linaro.org>
>> Signed-off-by: Rob Herring <robh@kernel.org>
>> ---
>>  drivers/usb/gadget/f_fastboot.c | 15 +++++++++++++++
>>  1 file changed, 15 insertions(+)
>>
>> diff --git a/drivers/usb/gadget/f_fastboot.c
>> b/drivers/usb/gadget/f_fastboot.c index 310175a..e2fda86 100644
>> --- a/drivers/usb/gadget/f_fastboot.c
>> +++ b/drivers/usb/gadget/f_fastboot.c
>> @@ -513,6 +513,17 @@ static void cb_flash(struct usb_ep *ep, struct
>> usb_request *req) }
>>  #endif
>>
>> +static void cb_oem(struct usb_ep *ep, struct usb_request *req)
>> +{
>> +     char *cmd = req->buf;
>> +     if (strncmp("unlock", cmd + 4, 8) == 0) {
>> +             fastboot_tx_write_str("FAILnot implemented");
>> +     }
>> +     else {
>> +             fastboot_tx_write_str("FAILunknown oem command");
>> +     }
>
> Just a minor comment - those braces could be removed.

When the format command is added in the next patch, then they need to
be added back if you want all clauses to be the same (braces or not).

Rob

> BTW: Marek shall I take those patches to dfu tree or would you take
> them to -usb tree ?
>
>> +}
>> +
>>  struct cmd_dispatch_info {
>>       char *cmd;
>>       void (*cb)(struct usb_ep *ep, struct usb_request *req);
>> @@ -541,6 +552,10 @@ static const struct cmd_dispatch_info
>> cmd_dispatch_info[] = { .cb = cb_flash,
>>       },
>>  #endif
>> +     {
>> +             .cmd = "oem",
>> +             .cb = cb_oem,
>> +     },
>>  };
>>
>>  static void rx_handler_command(struct usb_ep *ep, struct usb_request
>> *req)
>
>
>
> --
> Best regards,
>
> Lukasz Majewski
>
> Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Łukasz Majewski Jan. 30, 2015, 2:29 p.m. UTC | #5
Hi Rob,

> On Thu, Jan 29, 2015 at 2:30 AM, Lukasz Majewski
> <l.majewski@samsung.com> wrote:
> > Hi Rob,
> >
> >> From: Michael Scott <michael.scott@linaro.org>
> >>
> >> Add code stub to handle "fastboot oem __" command. As unlock is a
> >> common fastboot command, distinguish that it is not implemented.
> >>
> >> Signed-off-by: Michael Scott <michael.scott@linaro.org>
> >> Signed-off-by: Rob Herring <robh@kernel.org>
> >> ---
> >>  drivers/usb/gadget/f_fastboot.c | 15 +++++++++++++++
> >>  1 file changed, 15 insertions(+)
> >>
> >> diff --git a/drivers/usb/gadget/f_fastboot.c
> >> b/drivers/usb/gadget/f_fastboot.c index 310175a..e2fda86 100644
> >> --- a/drivers/usb/gadget/f_fastboot.c
> >> +++ b/drivers/usb/gadget/f_fastboot.c
> >> @@ -513,6 +513,17 @@ static void cb_flash(struct usb_ep *ep, struct
> >> usb_request *req) }
> >>  #endif
> >>
> >> +static void cb_oem(struct usb_ep *ep, struct usb_request *req)
> >> +{
> >> +     char *cmd = req->buf;
> >> +     if (strncmp("unlock", cmd + 4, 8) == 0) {
> >> +             fastboot_tx_write_str("FAILnot implemented");
> >> +     }
> >> +     else {
> >> +             fastboot_tx_write_str("FAILunknown oem command");
> >> +     }
> >
> > Just a minor comment - those braces could be removed.
> 
> When the format command is added in the next patch, then they need to
> be added back if you want all clauses to be the same (braces or not).

Then the patch can stay as it is. Thanks for explanation :-)

> 
> Rob
> 
> > BTW: Marek shall I take those patches to dfu tree or would you take
> > them to -usb tree ?
> >
> >> +}
> >> +
> >>  struct cmd_dispatch_info {
> >>       char *cmd;
> >>       void (*cb)(struct usb_ep *ep, struct usb_request *req);
> >> @@ -541,6 +552,10 @@ static const struct cmd_dispatch_info
> >> cmd_dispatch_info[] = { .cb = cb_flash,
> >>       },
> >>  #endif
> >> +     {
> >> +             .cmd = "oem",
> >> +             .cb = cb_oem,
> >> +     },
> >>  };
> >>
> >>  static void rx_handler_command(struct usb_ep *ep, struct
> >> usb_request *req)
> >
> >
> >
> > --
> > Best regards,
> >
> > Lukasz Majewski
> >
> > Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Łukasz Majewski Jan. 30, 2015, 3:02 p.m. UTC | #6
Hi Rob,

> From: Michael Scott <michael.scott@linaro.org>
> 
> Add code stub to handle "fastboot oem __" command. As unlock is a
> common fastboot command, distinguish that it is not implemented.
> 
> Signed-off-by: Michael Scott <michael.scott@linaro.org>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>  drivers/usb/gadget/f_fastboot.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/usb/gadget/f_fastboot.c
> b/drivers/usb/gadget/f_fastboot.c index 310175a..e2fda86 100644
> --- a/drivers/usb/gadget/f_fastboot.c
> +++ b/drivers/usb/gadget/f_fastboot.c
> @@ -513,6 +513,17 @@ static void cb_flash(struct usb_ep *ep, struct
> usb_request *req) }
>  #endif
>  
> +static void cb_oem(struct usb_ep *ep, struct usb_request *req)
> +{
> +	char *cmd = req->buf;
> +	if (strncmp("unlock", cmd + 4, 8) == 0) {
> +		fastboot_tx_write_str("FAILnot implemented");
> +	}
> +	else {
> +		fastboot_tx_write_str("FAILunknown oem command");
> +	}
> +}
> +
>  struct cmd_dispatch_info {
>  	char *cmd;
>  	void (*cb)(struct usb_ep *ep, struct usb_request *req);
> @@ -541,6 +552,10 @@ static const struct cmd_dispatch_info
> cmd_dispatch_info[] = { .cb = cb_flash,
>  	},
>  #endif
> +	{
> +		.cmd = "oem",
> +		.cb = cb_oem,
> +	},
>  };
>  
>  static void rx_handler_command(struct usb_ep *ep, struct usb_request
> *req)

Applied to u-boot-dfu.

Thanks.
diff mbox

Patch

diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 310175a..e2fda86 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -513,6 +513,17 @@  static void cb_flash(struct usb_ep *ep, struct usb_request *req)
 }
 #endif
 
+static void cb_oem(struct usb_ep *ep, struct usb_request *req)
+{
+	char *cmd = req->buf;
+	if (strncmp("unlock", cmd + 4, 8) == 0) {
+		fastboot_tx_write_str("FAILnot implemented");
+	}
+	else {
+		fastboot_tx_write_str("FAILunknown oem command");
+	}
+}
+
 struct cmd_dispatch_info {
 	char *cmd;
 	void (*cb)(struct usb_ep *ep, struct usb_request *req);
@@ -541,6 +552,10 @@  static const struct cmd_dispatch_info cmd_dispatch_info[] = {
 		.cb = cb_flash,
 	},
 #endif
+	{
+		.cmd = "oem",
+		.cb = cb_oem,
+	},
 };
 
 static void rx_handler_command(struct usb_ep *ep, struct usb_request *req)