Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    D-Link DWM-157 USB Stock not recognized

    Scheduled Pinned Locked Moved Hardware
    39 Posts 6 Posters 9.6k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • stephenw10S Online
      stephenw10 Netgate Administrator
      last edited by

      Mmm, but that product is from a different vendor so it will not match.

      If you manage to make this work it will be via bunch of workarounds that may fail. I recommend using a different modem if you can.

      Steve

      1 Reply Last reply Reply Quote 0
      • C Offline
        chedxb
        last edited by

        Thanks Steve, I will try with a different modem.

        Best,

        Savas

        1 Reply Last reply Reply Quote 0
        • stephenw10S Online
          stephenw10 Netgate Administrator
          last edited by

          If it is the C1 version it just needs to be ejected anyway:
          https://github.com/NetworkManager/usb_modeswitch-data/blob/master/usb_modeswitch.d/2001:a407

          And then it may appear as a usb Ethernet device which you can use directly. There are issues with that though.

          Steve

          1 Reply Last reply Reply Quote 0
          • C Offline
            chedxb
            last edited by

            I am afraid it is D1
            20190415_135623353_iOS.jpg

            1 Reply Last reply Reply Quote 0
            • C Offline
              chedxb
              last edited by

              I also tried usb_modeswitch -v 2001 -p a407 -K -W, however it didn't generate any verbose output.

              and this is what I see on the system log,

              Apr 15 18:17:57 kernel da0: quirks=0x2<NO_6_BYTE>
              Apr 15 18:17:57 kernel da0: Attempt to query device size failed: ILLEGAL REQUEST, Invalid field in CDB
              Apr 15 18:17:57 kernel da0: 40.000MB/s transfers
              Apr 15 18:17:57 kernel da0: <HSPA USB SCSI CD-ROM 6225> Removable Direct Access SCSI device
              Apr 15 18:17:57 kernel da0 at umass-sim0 bus 0 scbus2 target 0 lun 0
              Apr 15 18:17:57 kernel umass0: <Mass Storage > on usbus4
              Apr 15 18:17:57 kernel umass0 on uhub1
              Apr 15 18:17:57 kernel ugen4.2: <D-Link,Inc D-Link DWM-157> at usbus4
              Apr 15 18:17:55 kernel ugen4.2: <D-Link,Inc D-Link DWM-157> at usbus4 (disconnected)
              Apr 15 18:17:55 kernel umass0: detached
              Apr 15 18:17:55 kernel (cd0:umass-sim0:0:0:0): Periph destroyed
              Apr 15 18:17:55 kernel cd0: <HSPA USB SCSI CD-ROM 6225> s/n 531399703502680 detached
              Apr 15 18:17:55 kernel cd0 at umass-sim0 bus 0 scbus2 target 0 lun 0
              Apr 15 18:17:55 kernel umass0: at uhub1, port 1, addr 2 (disconnected)
              Apr 15 18:17:36 kernel cd0: quirks=0x10<10_BYTE_ONLY>
              Apr 15 18:17:36 kernel cd0: 14MB (28672 512 byte sectors)
              Apr 15 18:17:36 kernel cd0: 40.000MB/s transfers
              Apr 15 18:17:36 kernel cd0: Serial Number 531399703502680
              Apr 15 18:17:36 kernel cd0: <HSPA USB SCSI CD-ROM 6225> Removable CD-ROM SCSI device
              Apr 15 18:17:36 kernel cd0 at umass-sim0 bus 0 scbus2 target 0 lun 0
              Apr 15 18:17:36 kernel umass0: <Mass Storage > on usbus4
              Apr 15 18:17:36 kernel umass0 on uhub1
              Apr 15 18:17:36 kernel ugen4.2: <D-Link,Inc D-Link DWM-157> at usbus4

              basically when I run usb_modeswitch -v 2001 -p a407 -K -W, it ejects cd0 and turns into da0, not modem.

              Best,

              Savas

              1 Reply Last reply Reply Quote 0
              • stephenw10S Online
                stephenw10 Netgate Administrator
                last edited by

                Mmm, it sure looks like a C1 version in many ways. You see anything else in the system log after you do that?

                Try running usbconfig dump_all_desc against it after you have ejected it to change it's mode like LOM suggested.

                Steve

                1 Reply Last reply Reply Quote 0
                • C Offline
                  chedxb
                  last edited by

                  I cannot post the logs, I am getting SPAM message

                  "Post content was flagged as spam by Akismet.com"

                  1 Reply Last reply Reply Quote 0
                  • C Offline
                    chedxb
                    last edited by

                    so these are the interfaces after the camcontrol eject cd0 command.

                    MI_00 D-Link Mobile Broadband Device (Network Adapter) (cdc_mbim)
                    MI_02 D-Link HSPA+DataCard Diagnostics Interface (also ppp dialup modem)
                    MI_03 D-Link HSPA+DataCard NMEA Device
                    MI_04 D-Link HSPA+DataCard Speech Port
                    MI_05 D-Link HSPA+DataCard Debug Port
                    MI_06 USB Mass Storage Device

                    So I understand as follows,

                    Since the drivers are not available in pfSense/BSD for the interfaces from 0 to 5, when I do camcontrol eject cd0, it uses the 6th interface (USB Mass Storage Device)

                    Thoughts?

                    Best,

                    Savas

                    1 Reply Last reply Reply Quote 0
                    • stephenw10S Online
                      stephenw10 Netgate Administrator
                      last edited by

                      Yes, only interfaces 2 and 3 would otherwise be available if u3g attached to them.

                      The usbconfig output should show those interfaces though even if no driver does attach.

                      I have upvoted some of your posts which should stop akismet triggering but it does seem have a mind of it's own. We have almost no control over it.

                      Steve

                      C 1 Reply Last reply Reply Quote 0
                      • C Offline
                        chedxb
                        last edited by stephenw10

                        ugen4.2: <D-Link,Inc D-Link DWM-157> at usbus4, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)
                        
                        bLength = 0x0012
                        bDescriptorType = 0x0001
                        bcdUSB = 0x0200
                        bDeviceClass = 0x00ef <Miscellaneous device>
                        bDeviceSubClass = 0x0002
                        bDeviceProtocol = 0x0001
                        bMaxPacketSize0 = 0x0040
                        idVendor = 0x2001
                        idProduct = 0x7d0e
                        bcdDevice = 0x0300
                        iManufacturer = 0x0009 <D-Link,Inc >
                        iProduct = 0x000a <D-Link DWM-157>
                        iSerialNumber = 0x0000 <no string>
                        bNumConfigurations = 0x0001
                        
                        Configuration index 0
                        
                        bLength = 0x0009
                        bDescriptorType = 0x0002
                        wTotalLength = 0x00e4
                        bNumInterfaces = 0x0007
                        bConfigurationValue = 0x0001
                        iConfiguration = 0x0000 <no string>
                        bmAttributes = 0x00a0
                        bMaxPower = 0x00fa
                        
                        Additional Descriptor
                        
                        bLength = 0x08
                        bDescriptorType = 0x0b
                        bDescriptorSubType = 0x00
                        RAW dump:
                        0x00 | 0x08, 0x0b, 0x00, 0x02, 0x02, 0x0e, 0x00, 0x01
                        
                        
                        Interface 0
                        bLength = 0x0009
                        bDescriptorType = 0x0004
                        bInterfaceNumber = 0x0000
                        bAlternateSetting = 0x0000
                        bNumEndpoints = 0x0001
                        bInterfaceClass = 0x0002 <Communication device>
                        bInterfaceSubClass = 0x000e
                        bInterfaceProtocol = 0x0000
                        iInterface = 0x0001 <COM(comm_if)>
                        
                        Additional Descriptor
                        
                        bLength = 0x05
                        bDescriptorType = 0x24
                        bDescriptorSubType = 0x00
                        RAW dump:
                        0x00 | 0x05, 0x24, 0x00, 0x10, 0x01
                        
                        
                        Additional Descriptor
                        
                        bLength = 0x05
                        bDescriptorType = 0x24
                        bDescriptorSubType = 0x06
                        RAW dump:
                        0x00 | 0x05, 0x24, 0x06, 0x00, 0x01
                        
                        
                        Additional Descriptor
                        
                        bLength = 0x0c
                        bDescriptorType = 0x24
                        bDescriptorSubType = 0x1b
                        RAW dump:
                        0x00 | 0x0c, 0x24, 0x1b, 0x00, 0x01, 0x00, 0x02, 0x10,
                        0x08 | 0x40, 0xdc, 0x05, 0x20
                        
                        
                        Endpoint 0
                        bLength = 0x0007
                        bDescriptorType = 0x0005
                        bEndpointAddress = 0x0088 <IN>
                        bmAttributes = 0x0003 <INTERRUPT>
                        wMaxPacketSize = 0x0040
                        bInterval = 0x0001
                        bRefresh = 0x0000
                        bSynchAddress = 0x0000
                        
                        
                        Interface 1
                        bLength = 0x0009
                        bDescriptorType = 0x0004
                        bInterfaceNumber = 0x0001
                        bAlternateSetting = 0x0000
                        bNumEndpoints = 0x0000
                        bInterfaceClass = 0x000a <CDC-data>
                        bInterfaceSubClass = 0x0000
                        bInterfaceProtocol = 0x0002
                        iInterface = 0x0002 <COM(data_if)>
                        
                        
                        Interface 1 Alt 1
                        bLength = 0x0009
                        bDescriptorType = 0x0004
                        bInterfaceNumber = 0x0001
                        bAlternateSetting = 0x0001
                        bNumEndpoints = 0x0002
                        bInterfaceClass = 0x000a <CDC-data>
                        bInterfaceSubClass = 0x0000
                        bInterfaceProtocol = 0x0002
                        iInterface = 0x0000 <no string>
                        
                        Endpoint 0
                        bLength = 0x0007
                        bDescriptorType = 0x0005
                        bEndpointAddress = 0x0081 <IN>
                        bmAttributes = 0x0002 <BULK>
                        wMaxPacketSize = 0x0200
                        bInterval = 0x0000
                        bRefresh = 0x0000
                        bSynchAddress = 0x0000
                        
                        Endpoint 1
                        bLength = 0x0007
                        bDescriptorType = 0x0005
                        bEndpointAddress = 0x0001 <OUT>
                        bmAttributes = 0x0002 <BULK>
                        wMaxPacketSize = 0x0200
                        bInterval = 0x0000
                        bRefresh = 0x0000
                        bSynchAddress = 0x0000
                        
                        
                        Interface 2
                        bLength = 0x0009
                        bDescriptorType = 0x0004
                        bInterfaceNumber = 0x0002
                        bAlternateSetting = 0x0000
                        bNumEndpoints = 0x0003
                        bInterfaceClass = 0x00ff <Vendor specific>
                        bInterfaceSubClass = 0x0002
                        bInterfaceProtocol = 0x0001
                        iInterface = 0x0003 <COM(comm_if)>
                        
                        Additional Descriptor
                        
                        bLength = 0x05
                        bDescriptorType = 0x24
                        bDescriptorSubType = 0x00
                        RAW dump:
                        0x00 | 0x05, 0x24, 0x00, 0x10, 0x01
                        
                        
                        Additional Descriptor
                        
                        bLength = 0x04
                        bDescriptorType = 0x24
                        bDescriptorSubType = 0x02
                        RAW dump:
                        0x00 | 0x04, 0x24, 0x02, 0x0f
                        
                        
                        Additional Descriptor
                        
                        bLength = 0x05
                        bDescriptorType = 0x24
                        bDescriptorSubType = 0x06
                        RAW dump:
                        0x00 | 0x05, 0x24, 0x06, 0x02, 0x03
                        
                        
                        Additional Descriptor
                        
                        bLength = 0x05
                        bDescriptorType = 0x24
                        bDescriptorSubType = 0x01
                        RAW dump:
                        0x00 | 0x05, 0x24, 0x01, 0x03, 0x03
                        
                        
                        Endpoint 0
                        bLength = 0x0007
                        bDescriptorType = 0x0005
                        bEndpointAddress = 0x0087 <IN>
                        bmAttributes = 0x0003 <INTERRUPT>
                        wMaxPacketSize = 0x0040
                        bInterval = 0x0003
                        bRefresh = 0x0000
                        bSynchAddress = 0x0000
                        
                        Endpoint 1
                        bLength = 0x0007
                        bDescriptorType = 0x0005
                        bEndpointAddress = 0x0082 <IN>
                        bmAttributes = 0x0002 <BULK>
                        wMaxPacketSize = 0x0200
                        bInterval = 0x0000
                        bRefresh = 0x0000
                        bSynchAddress = 0x0000
                        
                        Endpoint 2
                        bLength = 0x0007
                        bDescriptorType = 0x0005
                        bEndpointAddress = 0x0002 <OUT>
                        bmAttributes = 0x0002 <BULK>
                        wMaxPacketSize = 0x0200
                        bInterval = 0x0000
                        bRefresh = 0x0000
                        bSynchAddress = 0x0000
                        
                        
                        Interface 3
                        bLength = 0x0009
                        bDescriptorType = 0x0004
                        bInterfaceNumber = 0x0003
                        bAlternateSetting = 0x0000
                        bNumEndpoints = 0x0002
                        bInterfaceClass = 0x00ff <Vendor specific>
                        bInterfaceSubClass = 0x0000
                        bInterfaceProtocol = 0x0000
                        iInterface = 0x0005 <COM(data_if)>
                        
                        Endpoint 0
                        bLength = 0x0007
                        bDescriptorType = 0x0005
                        bEndpointAddress = 0x0083 <IN>
                        bmAttributes = 0x0002 <BULK>
                        wMaxPacketSize = 0x0200
                        bInterval = 0x0000
                        bRefresh = 0x0000
                        bSynchAddress = 0x0000
                        
                        Endpoint 1
                        bLength = 0x0007
                        bDescriptorType = 0x0005
                        bEndpointAddress = 0x0003 <OUT>
                        bmAttributes = 0x0002 <BULK>
                        wMaxPacketSize = 0x0200
                        bInterval = 0x0000
                        bRefresh = 0x0000
                        bSynchAddress = 0x0000
                        
                        
                        Interface 4
                        bLength = 0x0009
                        bDescriptorType = 0x0004
                        bInterfaceNumber = 0x0004
                        bAlternateSetting = 0x0000
                        bNumEndpoints = 0x0002
                        bInterfaceClass = 0x00ff <Vendor specific>
                        bInterfaceSubClass = 0x0000
                        bInterfaceProtocol = 0x0000
                        iInterface = 0x0006 <COM(data_if)>
                        
                        Endpoint 0
                        bLength = 0x0007
                        bDescriptorType = 0x0005
                        bEndpointAddress = 0x0084 <IN>
                        bmAttributes = 0x0002 <BULK>
                        wMaxPacketSize = 0x0200
                        bInterval = 0x0000
                        bRefresh = 0x0000
                        bSynchAddress = 0x0000
                        
                        Endpoint 1
                        bLength = 0x0007
                        bDescriptorType = 0x0005
                        bEndpointAddress = 0x0004 <OUT>
                        bmAttributes = 0x0002 <BULK>
                        wMaxPacketSize = 0x0200
                        bInterval = 0x0000
                        bRefresh = 0x0000
                        bSynchAddress = 0x0000
                        
                        
                        Interface 5
                        bLength = 0x0009
                        bDescriptorType = 0x0004
                        bInterfaceNumber = 0x0005
                        bAlternateSetting = 0x0000
                        bNumEndpoints = 0x0002
                        bInterfaceClass = 0x00ff <Vendor specific>
                        bInterfaceSubClass = 0x0000
                        bInterfaceProtocol = 0x0000
                        iInterface = 0x0007 <COM(data_if)>
                        
                        Endpoint 0
                        bLength = 0x0007
                        bDescriptorType = 0x0005
                        bEndpointAddress = 0x0085 <IN>
                        bmAttributes = 0x0002 <BULK>
                        wMaxPacketSize = 0x0200
                        bInterval = 0x0000
                        bRefresh = 0x0000
                        bSynchAddress = 0x0000
                        
                        Endpoint 1
                        bLength = 0x0007
                        bDescriptorType = 0x0005
                        bEndpointAddress = 0x0005 <OUT>
                        bmAttributes = 0x0002 <BULK>
                        wMaxPacketSize = 0x0200
                        bInterval = 0x0000
                        bRefresh = 0x0000
                        bSynchAddress = 0x0000
                        
                        
                        Interface 6
                        bLength = 0x0009
                        bDescriptorType = 0x0004
                        bInterfaceNumber = 0x0006
                        bAlternateSetting = 0x0000
                        bNumEndpoints = 0x0002
                        bInterfaceClass = 0x0008 <Mass storage>
                        bInterfaceSubClass = 0x0006
                        bInterfaceProtocol = 0x0050
                        iInterface = 0x0008 <Mass Storage >
                        
                        Endpoint 0
                        bLength = 0x0007
                        bDescriptorType = 0x0005
                        bEndpointAddress = 0x0086 <IN>
                        bmAttributes = 0x0002 <BULK>
                        wMaxPacketSize = 0x0200
                        bInterval = 0x0000
                        bRefresh = 0x0000
                        bSynchAddress = 0x0000
                        
                        Endpoint 1
                        bLength = 0x0007
                        bDescriptorType = 0x0005
                        bEndpointAddress = 0x0006 <OUT>
                        bmAttributes = 0x0002 <BULK>
                        wMaxPacketSize = 0x0200
                        bInterval = 0x0000
                        bRefresh = 0x0000
                        bSynchAddress = 0x0000
                        
                        1 Reply Last reply Reply Quote 0
                        • C Offline
                          chedxb @stephenw10
                          last edited by

                          @stephenw10 said in D-Link DWM-157 USB Stock not recognized:

                          Yes, only interfaces 2 and 3 would otherwise be available if u3g attached to them.

                          The usbconfig output should show those interfaces though even if no driver does attach.

                          I have upvoted some of your posts which should stop akismet triggering but it does seem have a mind of it's own. We have almost no control over it.

                          Steve

                          it worked now, I just posted the log

                          1 Reply Last reply Reply Quote 0
                          • stephenw10S Online
                            stephenw10 Netgate Administrator
                            last edited by

                            Yep, it really looks like that is a C1 device mislabelled. But that is still not recognised by u3g even is the most recent FreeBSD. https://github.com/freebsd/freebsd/blob/master/sys/dev/usb/usbdevs

                            It's probably relatively easy to add it. The serial interfaces are there they just need to be attached but that's not something I can do. To add new devices requires rebuilding the kernel and hence it's only really practical to do in FreeBSD rather then in pfSense. Those changes usually happen there first and are brought into pfSense though it does happen the other way on occasion.

                            It's still easier to use a different modem.

                            Steve

                            1 Reply Last reply Reply Quote 0
                            • C Offline
                              chedxb
                              last edited by

                              Thanks Steve, how can I ask FreeBSD community to add this device? For some reason, this is/used to be a popular device in the region I live (middle east) and it would be nice to add it for the future users. Meanwhile I will try with a Huawei E173.

                              1 Reply Last reply Reply Quote 0
                              • stephenw10S Online
                                stephenw10 Netgate Administrator
                                last edited by

                                There are examples of people having done it for other devices. I would start by looking on the FreeBSD forums for other threads. And then opening your own thread if it's not obvious.
                                Ultimately you would be looking to make a patch against udbdevs and u3g and then issue a pull request for it.

                                It would be much easier to test if u3g was a loadable kernel module but I don't think that s possible.

                                Steve

                                1 Reply Last reply Reply Quote 0
                                • C Offline
                                  chedxb
                                  last edited by

                                  I found this, https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=196362

                                  I will post shortly with the experience we had here.

                                  C 1 Reply Last reply Reply Quote 0
                                  • C Offline
                                    chedxb @chedxb
                                    last edited by

                                    @chedxb said in D-Link DWM-157 USB Stock not recognized:

                                    I found this, https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=196362

                                    I will post shortly with the experience we had here.

                                    As explained here, I tried
                                    usb_modeswitch -v 2001 -p a407 -m 1 -M 555342431234567800000000000003f0010300000000000000000000000000 -R 1

                                    and I got this,

                                    Apr 16 16:51:21 kernel da0: quirks=0x2<NO_6_BYTE>
                                    Apr 16 16:51:21 kernel da0: Attempt to query device size failed: ILLEGAL REQUEST, Invalid field in CDB
                                    Apr 16 16:51:21 kernel da0: 40.000MB/s transfers
                                    Apr 16 16:51:21 kernel da0: <HSPA USB SCSI CD-ROM 6225> Removable Direct Access SCSI device
                                    Apr 16 16:51:21 kernel da0 at umass-sim0 bus 0 scbus2 target 0 lun 0
                                    Apr 16 16:51:21 kernel umass0: <Mass Storage > on usbus4
                                    Apr 16 16:51:21 kernel umass0 on uhub1
                                    Apr 16 16:51:21 kernel ue0: Ethernet address: 02:00:ff:aa:aa:aa
                                    Apr 16 16:51:21 kernel ue0: <USB Ethernet> on cdce0

                                    Apr 16 16:51:21 kernel cdce0: <COMcommif> on usbus4
                                    Apr 16 16:51:21 kernel cdce0 on uhub1
                                    Apr 16 16:51:21 kernel ugen4.2: <D-Link,Inc D-Link DWM-157> at usbus4
                                    Apr 16 16:51:19 kernel ugen4.2: <D-Link,Inc D-Link DWM-157> at usbus4 (disconnected)
                                    Apr 16 16:51:19 kernel umass0: detached
                                    Apr 16 16:51:19 kernel (cd0:umass-sim0:0:0:0): Periph destroyed
                                    Apr 16 16:51:19 kernel cd0: <HSPA USB SCSI CD-ROM 6225> s/n 531399703502680 detached
                                    Apr 16 16:51:19 kernel cd0 at umass-sim0 bus 0 scbus2 target 0 lun 0
                                    Apr 16 16:51:19 kernel umass0: at uhub1, port 1, addr 2 (disconnected)

                                    I see it under Available network ports: as well. I will test in the evening if it works or not.

                                    1 Reply Last reply Reply Quote 0
                                    • stephenw10S Online
                                      stephenw10 Netgate Administrator
                                      last edited by

                                      Ah, OK that's mostly all done then. Nice!

                                      So yeah you can see that's a two line change to two files. Should be easy enough to replicate for the new ID.

                                      Can you try this against your modem?
                                      https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=196362#c9

                                      Does it then show up as ue0 as shown there?

                                      Steve

                                      1 Reply Last reply Reply Quote 0
                                      • stephenw10S Online
                                        stephenw10 Netgate Administrator
                                        last edited by stephenw10

                                        Ah cross posted I see you did! Yeah see what happens when you assign it.

                                        FreeBSD/pfSense handles serial port modems much better but the speed is limited there.

                                        It would be interesting to see hoe usbconfig sees the modem when it's in Ethernet mode like that.

                                        Steve

                                        1 Reply Last reply Reply Quote 0
                                        • C Offline
                                          chedxb
                                          last edited by

                                          I assigned as a new interface and then added usb_modeswitch -v 2001 -p a407 -m 1 -M 555342431234567800000000000003f0010300000000000000000000000000 -R 1 on
                                          Shellcmd Configuration as earlyshellcmd and rebooted. So far so good :) I just need a SIM card to test the data connection.

                                          1 Reply Last reply Reply Quote 0
                                          • stephenw10S Online
                                            stephenw10 Netgate Administrator
                                            last edited by

                                            The big problem with USB Ethernet type devices is that pfSense does not have any way to handle them disconnecting. If you reboot and unplug the modem pfSense will stop booting at the interfaces assign screen at the console because ue0 is no9 longer present on the system but is assigned in the config. There are workarounds but they are all hacky....

                                            What speeds do you expect to get from that device?

                                            Steve

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.