* [U-Boot] [PATCH] fastboot: allow retrieving fastboot variables from env
@ 2016-03-17 16:21 Boris Brezillon
2016-03-17 16:44 ` Boris Brezillon
2016-04-02 1:55 ` [U-Boot] " Tom Rini
0 siblings, 2 replies; 6+ messages in thread
From: Boris Brezillon @ 2016-03-17 16:21 UTC (permalink / raw)
To: u-boot
From: Rob Herring <rob.herring@linaro.org>
Some boards need to expose device specific variable through fastboot
(to adpat the flashing script depending on hardware revision for
example).
Provide a way to expose custom fastboot variables. Note that all
variables meant to be exposed through fastboot should be be prefixed
with 'fastboot.', the variable should not exceed 32 bytes (including
the prefix and the trailing '\0') and the variable content should
fit in the response buffer (60 bytes excluding the 'OKAY' prefix and
the trailing '\0').
Signed-off-by: Rob Herring <rob.herring@linaro.org>
[Boris Brezillon: add a commit message]
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
---
drivers/usb/gadget/f_fastboot.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index a54b4ee..2e87fee 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -413,8 +413,16 @@ static void cb_getvar(struct usb_ep *ep, struct usb_request *req)
else
strcpy(response, "FAILValue not set");
} else {
- printf("WARNING: unknown variable: %s\n", cmd);
- strcpy(response, "FAILVariable not implemented");
+ char envstr[32];
+
+ snprintf(envstr, sizeof(envstr) - 1, "fastboot.%s", cmd);
+ s = getenv(envstr);
+ if (s) {
+ strncat(response, s, chars_left);
+ } else {
+ printf("WARNING: unknown variable: %s\n", cmd);
+ strcpy(response, "FAILVariable not implemented");
+ }
}
fastboot_tx_write_str(response);
}
--
2.5.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* [U-Boot] [PATCH] fastboot: allow retrieving fastboot variables from env
2016-03-17 16:21 [U-Boot] [PATCH] fastboot: allow retrieving fastboot variables from env Boris Brezillon
@ 2016-03-17 16:44 ` Boris Brezillon
2016-03-22 22:24 ` Steve Rae
` (2 more replies)
2016-04-02 1:55 ` [U-Boot] " Tom Rini
1 sibling, 3 replies; 6+ messages in thread
From: Boris Brezillon @ 2016-03-17 16:44 UTC (permalink / raw)
To: u-boot
On Thu, 17 Mar 2016 17:21:23 +0100
Boris Brezillon <boris.brezillon@free-electrons.com> wrote:
> From: Rob Herring <rob.herring@linaro.org>
>
> Some boards need to expose device specific variable through fastboot
> (to adpat the flashing script depending on hardware revision for
> example).
>
> Provide a way to expose custom fastboot variables. Note that all
> variables meant to be exposed through fastboot should be be prefixed
> with 'fastboot.', the variable should not exceed 32 bytes (including
> the prefix and the trailing '\0') and the variable content should
> fit in the response buffer (60 bytes excluding the 'OKAY' prefix and
> the trailing '\0').
>
> Signed-off-by: Rob Herring <rob.herring@linaro.org>
> [Boris Brezillon: add a commit message]
> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
>
> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Sorry for the duplicated SoB.
> ---
> drivers/usb/gadget/f_fastboot.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
> index a54b4ee..2e87fee 100644
> --- a/drivers/usb/gadget/f_fastboot.c
> +++ b/drivers/usb/gadget/f_fastboot.c
> @@ -413,8 +413,16 @@ static void cb_getvar(struct usb_ep *ep, struct usb_request *req)
> else
> strcpy(response, "FAILValue not set");
> } else {
> - printf("WARNING: unknown variable: %s\n", cmd);
> - strcpy(response, "FAILVariable not implemented");
> + char envstr[32];
> +
> + snprintf(envstr, sizeof(envstr) - 1, "fastboot.%s", cmd);
> + s = getenv(envstr);
> + if (s) {
> + strncat(response, s, chars_left);
> + } else {
> + printf("WARNING: unknown variable: %s\n", cmd);
> + strcpy(response, "FAILVariable not implemented");
> + }
> }
> fastboot_tx_write_str(response);
> }
--
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 6+ messages in thread* [U-Boot] [PATCH] fastboot: allow retrieving fastboot variables from env
2016-03-17 16:44 ` Boris Brezillon
@ 2016-03-22 22:24 ` Steve Rae
2016-03-22 22:25 ` Steve Rae
2016-03-23 2:05 ` Marek Vasut
2 siblings, 0 replies; 6+ messages in thread
From: Steve Rae @ 2016-03-22 22:24 UTC (permalink / raw)
To: u-boot
On Thu, Mar 17, 2016 at 9:44 AM, Boris Brezillon <
boris.brezillon@free-electrons.com> wrote:
> On Thu, 17 Mar 2016 17:21:23 +0100
> Boris Brezillon <boris.brezillon@free-electrons.com> wrote:
>
> > From: Rob Herring <rob.herring@linaro.org>
> >
> > Some boards need to expose device specific variable through fastboot
> > (to adpat the flashing script depending on hardware revision for
> > example).
> >
> > Provide a way to expose custom fastboot variables. Note that all
> > variables meant to be exposed through fastboot should be be prefixed
> > with 'fastboot.', the variable should not exceed 32 bytes (including
> > the prefix and the trailing '\0') and the variable content should
> > fit in the response buffer (60 bytes excluding the 'OKAY' prefix and
> > the trailing '\0').
> >
> > Signed-off-by: Rob Herring <rob.herring@linaro.org>
> > [Boris Brezillon: add a commit message]
> > Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> >
> > Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
>
> Sorry for the duplicated SoB.
>
> > ---
> > drivers/usb/gadget/f_fastboot.c | 12 ++++++++++--
> > 1 file changed, 10 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/usb/gadget/f_fastboot.c
> b/drivers/usb/gadget/f_fastboot.c
> > index a54b4ee..2e87fee 100644
> > --- a/drivers/usb/gadget/f_fastboot.c
> > +++ b/drivers/usb/gadget/f_fastboot.c
> > @@ -413,8 +413,16 @@ static void cb_getvar(struct usb_ep *ep, struct
> usb_request *req)
> > else
> > strcpy(response, "FAILValue not set");
> > } else {
> > - printf("WARNING: unknown variable: %s\n", cmd);
> > - strcpy(response, "FAILVariable not implemented");
> > + char envstr[32];
> > +
> > + snprintf(envstr, sizeof(envstr) - 1, "fastboot.%s", cmd);
> > + s = getenv(envstr);
> > + if (s) {
> > + strncat(response, s, chars_left);
> > + } else {
> > + printf("WARNING: unknown variable: %s\n", cmd);
> > + strcpy(response, "FAILVariable not implemented");
> > + }
> > }
> > fastboot_tx_write_str(response);
> > }
>
>
>
> --
> Boris Brezillon, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
^ permalink raw reply [flat|nested] 6+ messages in thread* [U-Boot] [PATCH] fastboot: allow retrieving fastboot variables from env
2016-03-17 16:44 ` Boris Brezillon
2016-03-22 22:24 ` Steve Rae
@ 2016-03-22 22:25 ` Steve Rae
2016-03-23 2:05 ` Marek Vasut
2 siblings, 0 replies; 6+ messages in thread
From: Steve Rae @ 2016-03-22 22:25 UTC (permalink / raw)
To: u-boot
On Thu, Mar 17, 2016 at 9:44 AM, Boris Brezillon <
boris.brezillon@free-electrons.com> wrote:
> On Thu, 17 Mar 2016 17:21:23 +0100
> Boris Brezillon <boris.brezillon@free-electrons.com> wrote:
>
> > From: Rob Herring <rob.herring@linaro.org>
> >
> > Some boards need to expose device specific variable through fastboot
> > (to adpat the flashing script depending on hardware revision for
> > example).
> >
> > Provide a way to expose custom fastboot variables. Note that all
> > variables meant to be exposed through fastboot should be be prefixed
> > with 'fastboot.', the variable should not exceed 32 bytes (including
> > the prefix and the trailing '\0') and the variable content should
> > fit in the response buffer (60 bytes excluding the 'OKAY' prefix and
> > the trailing '\0').
> >
> > Signed-off-by: Rob Herring <rob.herring@linaro.org>
> > [Boris Brezillon: add a commit message]
> > Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> >
> > Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
>
> Sorry for the duplicated SoB.
>
> > ---
> > drivers/usb/gadget/f_fastboot.c | 12 ++++++++++--
> > 1 file changed, 10 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/usb/gadget/f_fastboot.c
> b/drivers/usb/gadget/f_fastboot.c
> > index a54b4ee..2e87fee 100644
> > --- a/drivers/usb/gadget/f_fastboot.c
> > +++ b/drivers/usb/gadget/f_fastboot.c
> > @@ -413,8 +413,16 @@ static void cb_getvar(struct usb_ep *ep, struct
> usb_request *req)
> > else
> > strcpy(response, "FAILValue not set");
> > } else {
> > - printf("WARNING: unknown variable: %s\n", cmd);
> > - strcpy(response, "FAILVariable not implemented");
> > + char envstr[32];
> > +
> > + snprintf(envstr, sizeof(envstr) - 1, "fastboot.%s", cmd);
> > + s = getenv(envstr);
> > + if (s) {
> > + strncat(response, s, chars_left);
> > + } else {
> > + printf("WARNING: unknown variable: %s\n", cmd);
> > + strcpy(response, "FAILVariable not implemented");
> > + }
> > }
> > fastboot_tx_write_str(response);
> > }
>
>
Acked-by: Steve Rae <srae@broadcom.com>
>
>
> --
> Boris Brezillon, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
^ permalink raw reply [flat|nested] 6+ messages in thread* [U-Boot] [PATCH] fastboot: allow retrieving fastboot variables from env
2016-03-17 16:44 ` Boris Brezillon
2016-03-22 22:24 ` Steve Rae
2016-03-22 22:25 ` Steve Rae
@ 2016-03-23 2:05 ` Marek Vasut
2 siblings, 0 replies; 6+ messages in thread
From: Marek Vasut @ 2016-03-23 2:05 UTC (permalink / raw)
To: u-boot
On 03/17/2016 05:44 PM, Boris Brezillon wrote:
> On Thu, 17 Mar 2016 17:21:23 +0100
> Boris Brezillon <boris.brezillon@free-electrons.com> wrote:
>
>> From: Rob Herring <rob.herring@linaro.org>
>>
>> Some boards need to expose device specific variable through fastboot
>> (to adpat the flashing script depending on hardware revision for
>> example).
>>
>> Provide a way to expose custom fastboot variables. Note that all
>> variables meant to be exposed through fastboot should be be prefixed
>> with 'fastboot.', the variable should not exceed 32 bytes (including
>> the prefix and the trailing '\0') and the variable content should
>> fit in the response buffer (60 bytes excluding the 'OKAY' prefix and
>> the trailing '\0').
>>
>> Signed-off-by: Rob Herring <rob.herring@linaro.org>
>> [Boris Brezillon: add a commit message]
>> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
>>
>> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
>
> Sorry for the duplicated SoB.
Dropped the double-SoB and applied, thanks!
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] fastboot: allow retrieving fastboot variables from env
2016-03-17 16:21 [U-Boot] [PATCH] fastboot: allow retrieving fastboot variables from env Boris Brezillon
2016-03-17 16:44 ` Boris Brezillon
@ 2016-04-02 1:55 ` Tom Rini
1 sibling, 0 replies; 6+ messages in thread
From: Tom Rini @ 2016-04-02 1:55 UTC (permalink / raw)
To: u-boot
On Thu, Mar 17, 2016 at 05:21:23PM +0100, Boris BREZILLON wrote:
> From: Rob Herring <rob.herring@linaro.org>
>
> Some boards need to expose device specific variable through fastboot
> (to adpat the flashing script depending on hardware revision for
> example).
>
> Provide a way to expose custom fastboot variables. Note that all
> variables meant to be exposed through fastboot should be be prefixed
> with 'fastboot.', the variable should not exceed 32 bytes (including
> the prefix and the trailing '\0') and the variable content should
> fit in the response buffer (60 bytes excluding the 'OKAY' prefix and
> the trailing '\0').
>
> Signed-off-by: Rob Herring <rob.herring@linaro.org>
> [Boris Brezillon: add a commit message]
> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
>
> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> Acked-by: Steve Rae <srae@broadcom.com>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160401/d77bfca5/attachment.sig>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-04-02 1:55 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-17 16:21 [U-Boot] [PATCH] fastboot: allow retrieving fastboot variables from env Boris Brezillon
2016-03-17 16:44 ` Boris Brezillon
2016-03-22 22:24 ` Steve Rae
2016-03-22 22:25 ` Steve Rae
2016-03-23 2:05 ` Marek Vasut
2016-04-02 1:55 ` [U-Boot] " Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox