mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] usb: gadget: initialize serialnumber as empty string
@ 2023-10-26 12:46 Marco Felsch
  2023-10-26 12:46 ` [PATCH 2/2] scripts: get_maintainers: drop --status enforcement Marco Felsch
  2023-10-26 14:18 ` [PATCH 1/2] usb: gadget: initialize serialnumber as empty string Ahmad Fatoum
  0 siblings, 2 replies; 9+ messages in thread
From: Marco Felsch @ 2023-10-26 12:46 UTC (permalink / raw)
  To: barebox

Windows hosts do require the serial number to be set to any ascii string
to enumerate correctly. Set the serial number to "empty" to provide a
sane default which works for both hosts. Users can still override this
via the gadget.serialnumber variable.

Reported-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 drivers/usb/gadget/udc/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
index b58498680ad1..dc5d1daa14bf 100644
--- a/drivers/usb/gadget/udc/core.c
+++ b/drivers/usb/gadget/udc/core.c
@@ -1204,7 +1204,7 @@ int usb_add_gadget(struct usb_gadget *gadget)
 	gadget->productname = xstrdup(barebox_get_model());
 	dev_add_param_string(&gadget->dev, "productname", NULL, NULL,
 			     &gadget->productname, NULL);
-	gadget->serialnumber = xstrdup("");
+	gadget->serialnumber = xstrdup("empty");
 	dev_add_param_string(&gadget->dev, "serialnumber", NULL, NULL,
 			     &gadget->serialnumber, NULL);
 
-- 
2.39.2




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2/2] scripts: get_maintainers: drop --status enforcement
  2023-10-26 12:46 [PATCH 1/2] usb: gadget: initialize serialnumber as empty string Marco Felsch
@ 2023-10-26 12:46 ` Marco Felsch
  2023-10-26 14:21   ` Ahmad Fatoum
  2023-10-26 14:18 ` [PATCH 1/2] usb: gadget: initialize serialnumber as empty string Ahmad Fatoum
  1 sibling, 1 reply; 9+ messages in thread
From: Marco Felsch @ 2023-10-26 12:46 UTC (permalink / raw)
  To: barebox

The status parameter is never used so drop it and stop bother the user
of the script.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 scripts/get_maintainer.pl | 2 --
 1 file changed, 2 deletions(-)

diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 7c0d50333400..a19c0e7305d0 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -2,8 +2,6 @@
 # SPDX-License-Identifier: GPL-2.0-only
 # Dummy get_maintainer.pl script for checkpatch.pl to use
 
-die "USAGE: get_maintainer.pl --status\n" unless grep /--status/, @ARGV;
-
 print <<'EOT'
 Sascha Hauer <s.hauer@pengutronix.de> (maintainer:BAREBOX)
 barebox@lists.infradead.org (open list:BAREBOX)
-- 
2.39.2




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] usb: gadget: initialize serialnumber as empty string
  2023-10-26 12:46 [PATCH 1/2] usb: gadget: initialize serialnumber as empty string Marco Felsch
  2023-10-26 12:46 ` [PATCH 2/2] scripts: get_maintainers: drop --status enforcement Marco Felsch
@ 2023-10-26 14:18 ` Ahmad Fatoum
  2023-10-26 14:31   ` Marco Felsch
  1 sibling, 1 reply; 9+ messages in thread
From: Ahmad Fatoum @ 2023-10-26 14:18 UTC (permalink / raw)
  To: Marco Felsch, barebox

Hello Marco,

On 26.10.23 14:46, Marco Felsch wrote:
> Windows hosts do require the serial number to be set to any ascii string
> to enumerate correctly. Set the serial number to "empty" to provide a
> sane default which works for both hosts. Users can still override this
> via the gadget.serialnumber variable.
> 
> Reported-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
>  drivers/usb/gadget/udc/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
> index b58498680ad1..dc5d1daa14bf 100644
> --- a/drivers/usb/gadget/udc/core.c
> +++ b/drivers/usb/gadget/udc/core.c
> @@ -1204,7 +1204,7 @@ int usb_add_gadget(struct usb_gadget *gadget)
>  	gadget->productname = xstrdup(barebox_get_model());
>  	dev_add_param_string(&gadget->dev, "productname", NULL, NULL,
>  			     &gadget->productname, NULL);
> -	gadget->serialnumber = xstrdup("");
> +	gadget->serialnumber = xstrdup("empty");

Given that we initialize productname to model, it makes sense to initialize
serialnumber to global.serial_number now that we have that generic variable.

If that's unset, you can use a fixed value, I'd prefer "unset" though
instead of "empty".

Cheers,
Ahmad

>  	dev_add_param_string(&gadget->dev, "serialnumber", NULL, NULL,
>  			     &gadget->serialnumber, NULL);
>  

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] scripts: get_maintainers: drop --status enforcement
  2023-10-26 12:46 ` [PATCH 2/2] scripts: get_maintainers: drop --status enforcement Marco Felsch
@ 2023-10-26 14:21   ` Ahmad Fatoum
  2023-10-26 14:27     ` Marco Felsch
  0 siblings, 1 reply; 9+ messages in thread
From: Ahmad Fatoum @ 2023-10-26 14:21 UTC (permalink / raw)
  To: Marco Felsch, barebox

On 26.10.23 14:46, Marco Felsch wrote:
> The status parameter is never used so drop it and stop bother the user
> of the script.
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>

Our get_maintainer.pl script doesn't have the same breadth of features
as the kernel's and only --status is implemented, thus the check.

> ---
>  scripts/get_maintainer.pl | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
> index 7c0d50333400..a19c0e7305d0 100755
> --- a/scripts/get_maintainer.pl
> +++ b/scripts/get_maintainer.pl
> @@ -2,8 +2,6 @@
>  # SPDX-License-Identifier: GPL-2.0-only
>  # Dummy get_maintainer.pl script for checkpatch.pl to use
>  
> -die "USAGE: get_maintainer.pl --status\n" unless grep /--status/, @ARGV;
> -
>  print <<'EOT'
>  Sascha Hauer <s.hauer@pengutronix.de> (maintainer:BAREBOX)
>  barebox@lists.infradead.org (open list:BAREBOX)

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] scripts: get_maintainers: drop --status enforcement
  2023-10-26 14:21   ` Ahmad Fatoum
@ 2023-10-26 14:27     ` Marco Felsch
  2023-10-26 14:29       ` Ahmad Fatoum
  0 siblings, 1 reply; 9+ messages in thread
From: Marco Felsch @ 2023-10-26 14:27 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On 23-10-26, Ahmad Fatoum wrote:
> On 26.10.23 14:46, Marco Felsch wrote:
> > The status parameter is never used so drop it and stop bother the user
> > of the script.
> > 
> > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> 
> Our get_maintainer.pl script doesn't have the same breadth of features
> as the kernel's and only --status is implemented, thus the check.

Where? I see only 'print << 'EOT' <text> EOT'

Regards,
  Marco

> 
> > ---
> >  scripts/get_maintainer.pl | 2 --
> >  1 file changed, 2 deletions(-)
> > 
> > diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
> > index 7c0d50333400..a19c0e7305d0 100755
> > --- a/scripts/get_maintainer.pl
> > +++ b/scripts/get_maintainer.pl
> > @@ -2,8 +2,6 @@
> >  # SPDX-License-Identifier: GPL-2.0-only
> >  # Dummy get_maintainer.pl script for checkpatch.pl to use
> >  
> > -die "USAGE: get_maintainer.pl --status\n" unless grep /--status/, @ARGV;
> > -
> >  print <<'EOT'
> >  Sascha Hauer <s.hauer@pengutronix.de> (maintainer:BAREBOX)
> >  barebox@lists.infradead.org (open list:BAREBOX)
> 
> -- 
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> 
> 



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] scripts: get_maintainers: drop --status enforcement
  2023-10-26 14:27     ` Marco Felsch
@ 2023-10-26 14:29       ` Ahmad Fatoum
  2023-10-26 14:34         ` Marco Felsch
  0 siblings, 1 reply; 9+ messages in thread
From: Ahmad Fatoum @ 2023-10-26 14:29 UTC (permalink / raw)
  To: Marco Felsch; +Cc: barebox

On 26.10.23 16:27, Marco Felsch wrote:
> On 23-10-26, Ahmad Fatoum wrote:
>> On 26.10.23 14:46, Marco Felsch wrote:
>>> The status parameter is never used so drop it and stop bother the user
>>> of the script.
>>>
>>> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
>>
>> Our get_maintainer.pl script doesn't have the same breadth of features
>> as the kernel's and only --status is implemented, thus the check.
> 
> Where? I see only 'print << 'EOT' <text> EOT'

Ye, the output is similar to what you'd get with the kernel's --status.
The script is just here, because checkpatch depends on it and calls
it with --status.

Cheers,
Ahmad

> 
> Regards,
>   Marco
> 
>>
>>> ---
>>>  scripts/get_maintainer.pl | 2 --
>>>  1 file changed, 2 deletions(-)
>>>
>>> diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
>>> index 7c0d50333400..a19c0e7305d0 100755
>>> --- a/scripts/get_maintainer.pl
>>> +++ b/scripts/get_maintainer.pl
>>> @@ -2,8 +2,6 @@
>>>  # SPDX-License-Identifier: GPL-2.0-only
>>>  # Dummy get_maintainer.pl script for checkpatch.pl to use
>>>  
>>> -die "USAGE: get_maintainer.pl --status\n" unless grep /--status/, @ARGV;
>>> -
>>>  print <<'EOT'
>>>  Sascha Hauer <s.hauer@pengutronix.de> (maintainer:BAREBOX)
>>>  barebox@lists.infradead.org (open list:BAREBOX)
>>
>> -- 
>> Pengutronix e.K.                           |                             |
>> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
>> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
>> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
>>
>>
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] usb: gadget: initialize serialnumber as empty string
  2023-10-26 14:18 ` [PATCH 1/2] usb: gadget: initialize serialnumber as empty string Ahmad Fatoum
@ 2023-10-26 14:31   ` Marco Felsch
  0 siblings, 0 replies; 9+ messages in thread
From: Marco Felsch @ 2023-10-26 14:31 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On 23-10-26, Ahmad Fatoum wrote:
> Hello Marco,
> 
> On 26.10.23 14:46, Marco Felsch wrote:
> > Windows hosts do require the serial number to be set to any ascii string
> > to enumerate correctly. Set the serial number to "empty" to provide a
> > sane default which works for both hosts. Users can still override this
> > via the gadget.serialnumber variable.
> > 
> > Reported-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
> > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> > ---
> >  drivers/usb/gadget/udc/core.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
> > index b58498680ad1..dc5d1daa14bf 100644
> > --- a/drivers/usb/gadget/udc/core.c
> > +++ b/drivers/usb/gadget/udc/core.c
> > @@ -1204,7 +1204,7 @@ int usb_add_gadget(struct usb_gadget *gadget)
> >  	gadget->productname = xstrdup(barebox_get_model());
> >  	dev_add_param_string(&gadget->dev, "productname", NULL, NULL,
> >  			     &gadget->productname, NULL);
> > -	gadget->serialnumber = xstrdup("");
> > +	gadget->serialnumber = xstrdup("empty");
> 
> Given that we initialize productname to model, it makes sense to initialize
> serialnumber to global.serial_number now that we have that generic variable.
> 
> If that's unset, you can use a fixed value, I'd prefer "unset" though
> instead of "empty".

I will adapt it, thanks.

Regards,
  Marco



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] scripts: get_maintainers: drop --status enforcement
  2023-10-26 14:29       ` Ahmad Fatoum
@ 2023-10-26 14:34         ` Marco Felsch
  2023-10-26 21:30           ` Ahmad Fatoum
  0 siblings, 1 reply; 9+ messages in thread
From: Marco Felsch @ 2023-10-26 14:34 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On 23-10-26, Ahmad Fatoum wrote:
> On 26.10.23 16:27, Marco Felsch wrote:
> > On 23-10-26, Ahmad Fatoum wrote:
> >> On 26.10.23 14:46, Marco Felsch wrote:
> >>> The status parameter is never used so drop it and stop bother the user
> >>> of the script.
> >>>
> >>> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> >>
> >> Our get_maintainer.pl script doesn't have the same breadth of features
> >> as the kernel's and only --status is implemented, thus the check.
> > 
> > Where? I see only 'print << 'EOT' <text> EOT'
> 
> Ye, the output is similar to what you'd get with the kernel's --status.
> The script is just here, because checkpatch depends on it and calls
> it with --status.

You still can run it with --status, I just won't enforce it. At least to
me it's not clear why we need to enforce it and I use the script from
time to time and always forget the param.

Regards,
  Marco

> 
> Cheers,
> Ahmad
> 
> > 
> > Regards,
> >   Marco
> > 
> >>
> >>> ---
> >>>  scripts/get_maintainer.pl | 2 --
> >>>  1 file changed, 2 deletions(-)
> >>>
> >>> diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
> >>> index 7c0d50333400..a19c0e7305d0 100755
> >>> --- a/scripts/get_maintainer.pl
> >>> +++ b/scripts/get_maintainer.pl
> >>> @@ -2,8 +2,6 @@
> >>>  # SPDX-License-Identifier: GPL-2.0-only
> >>>  # Dummy get_maintainer.pl script for checkpatch.pl to use
> >>>  
> >>> -die "USAGE: get_maintainer.pl --status\n" unless grep /--status/, @ARGV;
> >>> -
> >>>  print <<'EOT'
> >>>  Sascha Hauer <s.hauer@pengutronix.de> (maintainer:BAREBOX)
> >>>  barebox@lists.infradead.org (open list:BAREBOX)
> >>
> >> -- 
> >> Pengutronix e.K.                           |                             |
> >> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> >> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> >> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> >>
> >>
> > 
> 
> -- 
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> 
> 



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] scripts: get_maintainers: drop --status enforcement
  2023-10-26 14:34         ` Marco Felsch
@ 2023-10-26 21:30           ` Ahmad Fatoum
  0 siblings, 0 replies; 9+ messages in thread
From: Ahmad Fatoum @ 2023-10-26 21:30 UTC (permalink / raw)
  To: Marco Felsch; +Cc: barebox

On 26.10.23 16:34, Marco Felsch wrote:
> On 23-10-26, Ahmad Fatoum wrote:
>> On 26.10.23 16:27, Marco Felsch wrote:
>>> On 23-10-26, Ahmad Fatoum wrote:
>>>> On 26.10.23 14:46, Marco Felsch wrote:
>>>>> The status parameter is never used so drop it and stop bother the user
>>>>> of the script.
>>>>>
>>>>> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
>>>>
>>>> Our get_maintainer.pl script doesn't have the same breadth of features
>>>> as the kernel's and only --status is implemented, thus the check.
>>>
>>> Where? I see only 'print << 'EOT' <text> EOT'
>>
>> Ye, the output is similar to what you'd get with the kernel's --status.
>> The script is just here, because checkpatch depends on it and calls
>> it with --status.
> 
> You still can run it with --status, I just won't enforce it. At least to
> me it's not clear why we need to enforce it and I use the script from
> time to time and always forget the param.

The idea was not to mislead users that assume that barebox get_maintainers.pl
behaves the same as Linux. But now thinking about it, just printing the same
always won't hurt.

>>>>> -die "USAGE: get_maintainer.pl --status\n" unless grep /--status/, @ARGV;
>>>>> -
>>>>>  print <<'EOT'
>>>>>  Sascha Hauer <s.hauer@pengutronix.de> (maintainer:BAREBOX)
>>>>>  barebox@lists.infradead.org (open list:BAREBOX)
>>>>
>>>> -- 
>>>> Pengutronix e.K.                           |                             |
>>>> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
>>>> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
>>>> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
>>>>
>>>>
>>>
>>
>> -- 
>> Pengutronix e.K.                           |                             |
>> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
>> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
>> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
>>
>>
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-10-26 21:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-26 12:46 [PATCH 1/2] usb: gadget: initialize serialnumber as empty string Marco Felsch
2023-10-26 12:46 ` [PATCH 2/2] scripts: get_maintainers: drop --status enforcement Marco Felsch
2023-10-26 14:21   ` Ahmad Fatoum
2023-10-26 14:27     ` Marco Felsch
2023-10-26 14:29       ` Ahmad Fatoum
2023-10-26 14:34         ` Marco Felsch
2023-10-26 21:30           ` Ahmad Fatoum
2023-10-26 14:18 ` [PATCH 1/2] usb: gadget: initialize serialnumber as empty string Ahmad Fatoum
2023-10-26 14:31   ` Marco Felsch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox