diff mbox

[LEDE-DEV,usbmode] fix indices of messages

Message ID 20170518131825.3052-1-julian@labus-online.de
State Changes Requested
Headers show

Commit Message

Julian Labus May 18, 2017, 1:18 p.m. UTC
the way how the script checked if a key already exists in a hash
leads to wrong indices for %messages.

Signed-off-by: Julian Labus <julian@labus-online.de>
---
 convert-modeswitch.pl | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Bastian Bittorf May 18, 2017, 6:21 p.m. UTC | #1
* Julian Labus <julian@labus-online.de> [18.05.2017 20:16]:
> the way how the script checked if a key already exists in a hash
> leads to wrong indices for %messages.
> 
> Signed-off-by: Julian Labus <julian@labus-online.de>
> ---
>  convert-modeswitch.pl | 9 +++++----

thanks for your patch.
it seems you must send your patch upstream:
http://www.draisberghof.de/usb_modeswitch

lede does only use this package.

bye, bastian
Julian Labus May 18, 2017, 7:02 p.m. UTC | #2
Hi Bastian,

to me it looks like LEDE has its own implementation of usb-modeswitch
and only uses usb-modeswitch-data from the upstream project or is this
just a mirror?

https://git.lede-project.org/?p=project/usbmode.git

Regards,
Julian

On 05/18/2017 08:21 PM, Bastian Bittorf wrote:
> * Julian Labus <julian@labus-online.de> [18.05.2017 20:16]:
>> the way how the script checked if a key already exists in a hash
>> leads to wrong indices for %messages.
>>
>> Signed-off-by: Julian Labus <julian@labus-online.de>
>> ---
>>  convert-modeswitch.pl | 9 +++++----
> 
> thanks for your patch.
> it seems you must send your patch upstream:
> http://www.draisberghof.de/usb_modeswitch
> 
> lede does only use this package.
> 
> bye, bastian
Piotr Dymacz May 18, 2017, 7:14 p.m. UTC | #3
Hello Julian, Bastian,

On 18.05.2017 21:02, Julian Labus wrote:
> Hi Bastian,
> 
> to me it looks like LEDE has its own implementation of usb-modeswitch
> and only uses usb-modeswitch-data from the upstream project or is this
> just a mirror?

Yes, that is correct.

I was going to send something similar (Mathias did a quick hack-fix 
here: [1]) as the current version of the conversion script doesn't work 
correctly with updated usb-modeswitch-data (I have already locally 
merged this PR: [2]).

[1] https://gist.github.com/mkresin/c89882289a0f8569f99829224ffc96fe
[2] https://github.com/lede-project/source/pull/1067

--
Cheers,
Piotr

> 
> https://git.lede-project.org/?p=project/usbmode.git
> 
> Regards,
> Julian
> 
> On 05/18/2017 08:21 PM, Bastian Bittorf wrote:
>> * Julian Labus <julian@labus-online.de> [18.05.2017 20:16]:
>>> the way how the script checked if a key already exists in a hash
>>> leads to wrong indices for %messages.
>>>
>>> Signed-off-by: Julian Labus <julian@labus-online.de>
>>> ---
>>>  convert-modeswitch.pl | 9 +++++----
>> 
>> thanks for your patch.
>> it seems you must send your patch upstream:
>> http://www.draisberghof.de/usb_modeswitch
>> 
>> lede does only use this package.
>> 
>> bye, bastian
> 
> _______________________________________________
> Lede-dev mailing list
> Lede-dev@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev
>
Bastian Bittorf May 19, 2017, 5:36 a.m. UTC | #4
* Julian Labus <julian@labus-online.de> [19.05.2017 07:29]:
> to me it looks like LEDE has its own implementation of usb-modeswitch
> and only uses usb-modeswitch-data from the upstream project or is this
> just a mirror?
> 
> https://git.lede-project.org/?p=project/usbmode.git

You are totally right. I was confused bye the Makefile,
which loads "usb-modeswitch-data"* from draisberghof.de - sorry.

bye, bastian
diff mbox

Patch

diff --git a/convert-modeswitch.pl b/convert-modeswitch.pl
index 7b2323b..6e7bb86 100755
--- a/convert-modeswitch.pl
+++ b/convert-modeswitch.pl
@@ -7,12 +7,13 @@  my %devices;
 
 sub add_message {
 	my $msg = shift;
-	my $val = $messages{$msg};
-
-	$val or do {
+	my $val;
+	if (exists $messages{$msg}) {
+		$val = $messages{$msg};
+	} else {
 		$val = $msg_ctr++;
 		$messages{$msg} = $val;
-	};
+	}
 
 	return $val;
 }