Bug 239495 - if_urndis does not support newer HMD Global devices
Summary: if_urndis does not support newer HMD Global devices
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: usb (show other bugs)
Version: 12.0-RELEASE
Hardware: amd64 Any
: --- Affects Some People
Assignee: Hans Petter Selasky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-28 13:13 UTC by id
Modified: 2020-03-29 01:11 UTC (History)
2 users (show)

See Also:


Attachments
dump_device_desc dump_curr_config_desc (3.14 KB, text/plain)
2019-07-28 17:29 UTC, id
no flags Details
Patch (573 bytes, patch)
2019-07-28 19:45 UTC, Hans Petter Selasky
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description id 2019-07-28 13:13:00 UTC
It seems that HMD global has changed the USB interface that they use for tethering on new devices. While if_urndis works with devices from other manufacturers, enabling tethering on a Nokia 7 Plus is not get picked up by my system.

I've found some ([1],[2]) resources on the project that ships the tethering drivers for OS X, which highlight the changes that they had to implement. However, it's not clear to me how easy it would be to port here.

Let me know what logs I can provide regarding this issue, as i can't find anything useful in dmesg; the only thing that gets written there after turning on tethering is "ugen1.3: <HMD Global Nokia 7 plus> at usbus1".


[1] https://github.com/jwise/HoRNDIS/issues/88
[2] https://github.com/jwise/HoRNDIS/commit/f5dcecf9ce3a3a69d6a2f9d1e66e24d5241b5d0b
Comment 1 Hans Petter Selasky freebsd_committer freebsd_triage 2019-07-28 14:01:35 UTC
Hi,

if_urndis likely needs some new device match-entries it looks like:

https://github.com/jwise/HoRNDIS/commit/f4ac3df2c7fc477b7a8e635b7d4aaa06c603b27a

What does usbconfig say about your device, when you add:

dump_device_desc dump_curr_config_desc

--HPS
Comment 2 id 2019-07-28 17:29:26 UTC
Created attachment 206123 [details]
dump_device_desc dump_curr_config_desc
Comment 3 Hans Petter Selasky freebsd_committer freebsd_triage 2019-07-28 19:45:09 UTC
You need to modify this table in if_urndis.c to make it attach:

static const STRUCT_USB_HOST_ID urndis_host_devs[] = {
        /* Generic RNDIS class match */
        {USB_IFACE_CLASS(UICLASS_CDC),
                USB_IFACE_SUBCLASS(UISUBCLASS_ABSTRACT_CONTROL_MODEL),
                USB_IFACE_PROTOCOL(0xff)},
        {USB_IFACE_CLASS(UICLASS_WIRELESS), USB_IFACE_SUBCLASS(UISUBCLASS_RF),
                USB_IFACE_PROTOCOL(UIPROTO_RNDIS)},
        {USB_IFACE_CLASS(UICLASS_IAD), USB_IFACE_SUBCLASS(UISUBCLASS_SYNC),
                USB_IFACE_PROTOCOL(UIPROTO_ACTIVESYNC)},
        /* HP-WebOS */
        {USB_VENDOR(USB_VENDOR_PALM), USB_IFACE_CLASS(UICLASS_CDC),
                USB_IFACE_SUBCLASS(UISUBCLASS_ABSTRACT_CONTROL_MODEL),
                USB_IFACE_PROTOCOL(0xff)},
};

Using these values:

      bInterfaceClass = 0x00ef  <Miscellaneous device>
      bInterfaceSubClass = 0x0004 
      bInterfaceProtocol = 0x0001 

Can you try the attached patch?

--HPS
Comment 4 Hans Petter Selasky freebsd_committer freebsd_triage 2019-07-28 19:45:36 UTC
Created attachment 206130 [details]
Patch
Comment 5 id 2019-07-28 20:10:26 UTC
Applying the patch, rebuilding /usr/src/sys/modules/usb/urndis and reloading if_urndis.ko was not enough. Is there some other part of base that would need to be rebuilt?
Comment 6 Hans Petter Selasky freebsd_committer freebsd_triage 2019-07-28 20:23:31 UTC
Is anything printed in dmesg?

When you re-built the module, did you specify KMODDIR=/boot/kernel , else it will be installed in /boot/modules which won't work.

--HPS
Comment 7 id 2019-07-28 20:41:02 UTC
Ah, you are right. I forgot that there was still the module in /boot/kernel. kldload /boot/modules/if_urndis.ko did the job.
Comment 8 Hans Petter Selasky freebsd_committer freebsd_triage 2019-07-28 21:03:30 UTC
Can you show the resulting dmesg?

Does the network device work?

--HPS
Comment 9 id 2019-07-28 21:17:56 UTC
These are the corresponding dmesg lines from when I turned on the USB tethering:

ugen0.6: <HMD Global Nokia 7 plus> at usbus0 (disconnected)
umass0: at uhub2, port 2, addr 6 (disconnected)
cd0 at umass-sim0 bus 0 scbus4 target 0 lun 0
cd0: <Linux File-CD Gadget 0404>  detached
(cd0:umass-sim0:0:0:0): Periph destroyed
umass0: detached
ugen0.6: <HMD Global Nokia 7 plus> at usbus0
urndis0 on uhub2
urndis0: <RNDIS Communications Control> on usbus0
ue0: <USB Ethernet> on urndis0
ue0: Ethernet address: c6:4d:fa:1d:97:b9

The device indeed works. As a matter of fact, my last comment was submitted over that network interface.
Comment 10 commit-hook freebsd_committer freebsd_triage 2019-07-28 21:48:05 UTC
A commit references this bug:

Author: hselasky
Date: Sun Jul 28 21:47:05 UTC 2019
New revision: 350396
URL: https://svnweb.freebsd.org/changeset/base/350396

Log:
  Add support for tethering with Nokia 7 plus and the alike.

  PR:		239495
  MFC after:	1 week
  Sponsored by:	Mellanox Technologies

Changes:
  head/sys/dev/usb/net/if_urndis.c
Comment 11 commit-hook freebsd_committer freebsd_triage 2019-08-14 09:40:57 UTC
A commit references this bug:

Author: hselasky
Date: Wed Aug 14 09:40:12 UTC 2019
New revision: 351013
URL: https://svnweb.freebsd.org/changeset/base/351013

Log:
  MFC r350396:
  Add support for tethering with Nokia 7 plus and the alike.

  PR:		239495
  Sponsored by:	Mellanox Technologies

Changes:
_U  stable/12/
  stable/12/sys/dev/usb/net/if_urndis.c
Comment 12 commit-hook freebsd_committer freebsd_triage 2019-08-14 09:41:58 UTC
A commit references this bug:

Author: hselasky
Date: Wed Aug 14 09:41:31 UTC 2019
New revision: 351015
URL: https://svnweb.freebsd.org/changeset/base/351015

Log:
  MFC r350396:
  Add support for tethering with Nokia 7 plus and the alike.

  PR:		239495
  Sponsored by:	Mellanox Technologies

Changes:
_U  stable/11/
  stable/11/sys/dev/usb/net/if_urndis.c
Comment 13 commit-hook freebsd_committer freebsd_triage 2019-08-14 09:42:59 UTC
A commit references this bug:

Author: hselasky
Date: Wed Aug 14 09:42:27 UTC 2019
New revision: 351017
URL: https://svnweb.freebsd.org/changeset/base/351017

Log:
  MFC r350396:
  Add support for tethering with Nokia 7 plus and the alike.

  PR:		239495
  Sponsored by:	Mellanox Technologies

Changes:
_U  stable/10/
  stable/10/sys/dev/usb/net/if_urndis.c