Subject: Re: bug#35640: Make USB modems just work on Guix

From: Ludovic Courtès <[email-masked]>
Date: Sat, 25 May 2019 19:44:37 +0200

Hello,

"pelzflorian (Florian Pelz)" <[email-masked]> skribis:

> Please find attached a patch that no longer propagates
> usb-modeswitch-data from usb-modeswitch.  I can now modeswitch my USB
> modem by running

Yay!

> The udev rules file in usb-modeswitch-data has lines like:
>
> ATTR{idVendor}=="03f0", ATTR{idProduct}=="002a", RUN+="usb_modeswitch '/%k'"
>
> Maybe I should substitute these by
>
> RUN+="/gnu/store/…-usb-modeswich-2.5.2/usb_modeswitch '/%k'"
>
> but this would introduce a cyclic dependency between usb-modeswitch
> and usb-modeswitch-data.  Therefore this rules file should rather be
> fixed in a future USB_ModeSwitch service type.

Sounds good.  Another option would be to install the udev rule as part
of the ‘usb-modeswitch’ package, which makes more sense and would solve
the problem.  But anyway, don’t lose your hair over it.

>> +                 (substitute* "usb_modeswitch_dispatcher"
>> +                   (("!/usr/bin/tclsh")
>> +                    (string-append "!" jimtcl "/bin/jimsh"))

I don’t think it’s needed, is it?

>> +                   (("/usr/sbin") bin)
>> +                   (("/usr/share/usb_modeswitch")
>> +                    (string-append data "/share/usb_modeswitch.d"))
>> +                   (("\\[ParseGlobalConfig\\]") ;use config in command line
>> +                    "[ParseGlobalConfig $argv]")
>> +                   (("proc \\{ParseGlobalConfig\\} \\{\\}")
>> +                    "proc {ParseGlobalConfig} {argv}")
>> +                   (("set configFile \\\"\\\"")
>> +                    "
>> +if {[lindex $argv 2] == \"--config-file\"} {
>> +        set configFile [lindex $argv 3]
>> +}"))
>
>
> Or should I rather use a patch file instead of substitute*?

I think it’s OK like this.  It does mean Guix’s
‘usb_modeswitch_dispatcher’ has an option that upstream doesn’t provide.
It would be worth proposing it upstream.

Thanks!

Ludo’.