You are not logged in.

#1 2019-09-10 16:26:15

regid
Member
Registered: 2016-06-06
Posts: 131

Patching linux drivers/usb/serial/option.c

Considering the following patch:

--- drivers/usb/serial/option.c	2019-08-29 12:01:40.610860632 +0000
+++ drivers/usb/serial/option.c	2019-09-09 22:43:12.653155298 +0000
@@ -82,6 +82,7 @@
 #define HUAWEI_PRODUCT_K3765			0x1465
 #define HUAWEI_PRODUCT_K4605			0x14C6
 #define HUAWEI_PRODUCT_E173S6			0x1C07
+#define HUAWEI_PRODUCT_E3531S2			0x1F01
 
 #define QUANTA_VENDOR_ID			0x0408
 #define QUANTA_PRODUCT_Q101			0xEA02
@@ -599,6 +600,8 @@
 	{ USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLE) },
 	{ USB_DEVICE(QUANTA_VENDOR_ID, 0xea42),
 	  .driver_info = RSVD(4) },
+	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E3531S2, 0xff, 0xff, 0xff),
+	  .driver_info = RSVD(1) | RSVD(2) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c05, USB_CLASS_COMM, 0x02, 0xff) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c1f, USB_CLASS_COMM, 0x02, 0xff) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c23, USB_CLASS_COMM, 0x02, 0xff) },

More specifically, the two consecutive lines

+	{ USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E3531S2, 0xff, 0xff, 0xff),
+	  .driver_info = RSVD(1) | RSVD(2) },
  1. Are there better places to ask?

  2. Are these lines at the right place? It is quite obvious it should be close to were it is now. But the internal order of the HUAWEI lines at the

    static const struct usb_device_id option_ids[]

    array is not obvious. Perhaps there isn't any imposed order.

  3. There are three 0xff constants. Anyone can explain them, or explain

    struct usb_device_id

    ?

  4. The lines

            /*
             * Don't bind reserved interfaces (like network ones) w
    hich often have
             * the same class/subclass/protocol as the serial inter
    faces.  Look at
             * the Windows driver .INF files for reserved interface
     numbers.
             */
            if (device_flags & RSVD(iface_desc->bInterfaceNumber))
                    return -ENODEV;

    , copied from the bottom of the option.c file, might explain

    .driver_info = RSVD(1) | RSVD(2)

    . Is there more information? Where is Windows driver .INF files?

  5. Is that all the information required to get option.c support HUAWEI_PRODUCT_E3531S2?


powerofforreboot.efi (AUR): Utilities to be used from within a UEFI boot manager or shell.

Offline

#2 2019-09-10 18:50:08

regid
Member
Registered: 2016-06-06
Posts: 131

Re: Patching linux drivers/usb/serial/option.c

In the initial mode, a CD-ROM is emulated. Exploring it:

$ ls -R /mnt 
/mnt:
ArConfig.dat  autorun.sh     linux_mbb_install
AutoRun.exe   HiLink.app     MobileBrServ
AUTORUN.INF   install_linux  Startup.ico

/mnt/HiLink.app:
Contents

/mnt/HiLink.app/Contents:
_CodeSignature	Info.plist  MacOS  PkgInfo  Resources

/mnt/HiLink.app/Contents/_CodeSignature:
CodeResources

/mnt/HiLink.app/Contents/MacOS:
HiLink

/mnt/HiLink.app/Contents/Resources:
English.lproj  mbbserviceopen.app  mbbserviceSetup.pkg
Installer.png  mbbservicePkg.app

/mnt/HiLink.app/Contents/Resources/English.lproj:
custom.strings	InfoPlist.strings  Logo.icns  main.nib

/mnt/HiLink.app/Contents/Resources/English.lproj/main.nib:
objects.xib

/mnt/HiLink.app/Contents/Resources/mbbserviceopen.app:
Contents

/mnt/HiLink.app/Contents/Resources/mbbserviceopen.app/Contents:
Info.plist  MacOS  PkgInfo  Resources

/mnt/HiLink.app/Contents/Resources/mbbserviceopen.app/Contents/MacOS:
mbbserviceopen

/mnt/HiLink.app/Contents/Resources/mbbserviceopen.app/Contents/Resources:
English.lproj  Logo.icns

/mnt/HiLink.app/Contents/Resources/mbbserviceopen.app/Contents/Resources/English.lproj:
InfoPlist.strings  main.nib

/mnt/HiLink.app/Contents/Resources/mbbserviceopen.app/Contents/Resources/English.lproj/main.nib:
objects.xib

/mnt/HiLink.app/Contents/Resources/mbbservicePkg.app:
Contents

/mnt/HiLink.app/Contents/Resources/mbbservicePkg.app/Contents:
Info.plist  MacOS  PkgInfo  Resources

/mnt/HiLink.app/Contents/Resources/mbbservicePkg.app/Contents/MacOS:
applet	HiLink

/mnt/HiLink.app/Contents/Resources/mbbservicePkg.app/Contents/Resources:
applet.icns  description.rtfd  InfoPlist.strings  Scripts
applet.rsrc  HiLink.rsrc       install

/mnt/HiLink.app/Contents/Resources/mbbservicePkg.app/Contents/Resources/description.rtfd:
TXT.rtf

/mnt/HiLink.app/Contents/Resources/mbbservicePkg.app/Contents/Resources/Scripts:
main.scpt

/mnt/HiLink.app/Contents/Resources/mbbserviceSetup.pkg:
Contents

/mnt/HiLink.app/Contents/Resources/mbbserviceSetup.pkg/Contents:
Archive.bom  Archive.pax.gz  Info.plist  PkgInfo  Resources

/mnt/HiLink.app/Contents/Resources/mbbserviceSetup.pkg/Contents/Resources:
ArConfig.dat  package_version  postupgrade
en.lproj      postinstall

/mnt/HiLink.app/Contents/Resources/mbbserviceSetup.pkg/Contents/Resources/en.lproj:
Description.plist

/mnt/linux_mbb_install:
7zr  ArConfig.dat  install  mbbservice.bin  readme.txt

/mnt/MobileBrServ:
data.bin  mbbServiceSetup.exe
$ cat cat /mnt/AUTORUN.INF 
[AutoRun]
open=AutoRun.exe
icon=Startup.ico
$ cat /mnt/ArConfig.dat
[INSTALL]
app_install_path=MobileBrServ
setup_name=mbbServiceSetup.exe
runservice_name=mbbservice.exe
service_name=Mobile Broadband HL Service
service_desc=Mobile Broadband HL Service
service_descDetail=Provide service for mobile broadband device.
service=yes

[PRODUCT_VERSION]
value=22.001.25.00.03

[PRODUCT_ID]
pid=14db,1f01;14dc,1f01;14dd,1f01;14db,157d;14dc,157d;14dd,157d;14db,1f02;14dc,1f02;14dd,1f02;14db,158b;14dc,158b;14dd,158b;14d7,1f01;14d8,1f01;14d9,1f01;14de,1f01;14df,1f01;14d7,1f02;14d8,1f02;14d9,1f02;14de,1f02;14df,1f02;14d7,157d;14d8,157d;14d9,157d;14de,157d;14df,157d;14d7,158b;14d8,158b;14d9,158b;14de,158b;14df,158b

[APP_PATH]
path=/Library/StartupItems/MobileBrServ

[VOLUMES]
name=HiLink
proname=mbbservice
disable_cdrom=false

[SYSTEM]
fileversion=1
vrversion=22
vversion=200
rversion=002
buildversion=001
debugversion=25
spversion=00
customizeversion=03

[REGEDIT]
GlobalMaxTcpWindowSize=0x00020000
TcpWindowSize=0x00020000
Tcp1323Opts=0x00000001
DefaultSendWindow=0x00020000
DefaultReceiveWindow=0x00020000
Publisher=Huawei Technologies Co.,Ltd
HelpLink=http://mobile.huawei.com
URLInfoAbout=http://www.huawei.com
DisplayName=Mobile Broadband HL Service
Publisher=Huawei Technologies Co.,Ltd
HelpLink=http://mobile.huawei.com
URLInfoAbout=http://www.huawei.com
DisplayName=Mobile Broadband HL Service

[OPENBR_TIME]
wait_time=1

[OPEN_URL]
domain=
url=http://192.168.1.1
auto_open_url=1

[PROMPT]
value=1
language=English

[ShortCut]
;DesktopShortCut=HiLink
;DTShortCutIcon=HiLink.ico
;StartMenuName=HiLink
;StartMenuShortCut=HiLink
;SMenuShortCutIcon=HiLink.ico
withversion=1

Perhaps it doesn't fit drivers/usb/serial/option.c.


powerofforreboot.efi (AUR): Utilities to be used from within a UEFI boot manager or shell.

Offline

#3 2019-09-10 20:03:25

loqs
Member
Registered: 2014-03-06
Posts: 8,436

Re: Patching linux drivers/usb/serial/option.c

https://elixir.bootlin.com/linux/latest … RFACE_INFO
Edit:
Is usb modeswitch able to switch the devices mode?

Last edited by loqs (2019-09-11 14:37:01)

Offline

Board footer

Powered by FluxBB