# FreeBSD 11 / rpi-B: external USB ethernet adapter cannot be configured



## giorgiob (Jul 21, 2017)

I am running FreeBSD 11 on a raspberrypi-B. The built-in ethernet adapter is working fine with no extra configuration. I have bought an external USB ethernet adapter and trying to get it to work.

The external adapter is recognized by the kernel: in /var/run/dmesg.boot there are the following lines:

```
ugen0.3: <vendor 0x0424> at usbus0
smsc0: <vendor 0x0424 product 0xec00, rev 2.00/2.00, addr 3> on usbus0
smsc0: chip 0xec00, rev. 0002
miibus0: <MII bus> on smsc0
ukphy0: <Generic IEEE 802.3u media interface> PHY 1 on miibus0
ukphy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
ue0: <USB Ethernet> on smsc0
ue0: Ethernet address: b8:27:eb:3a:47:29
ugen0.4: <DAVICOM> at usbus0
ugen0.5: <Iomega> at usbus0
umass0: <MSC Bulk-Only Transfer> on usbus0
Trying to mount root from ufs:/dev/ufs/rootfs [rw]...
da0 at umass-sim0 bus 0 scbus0 target 0 lun 0
da0: <ST350082 0AS > Fixed Direct Access SCSI-2 device
da0: Serial Number 955FFFFFFFFF
da0: 40.000MB/s transfers
da0: 476940MB (976773168 512 byte sectors)
da0: quirks=0x2<NO_6_BYTE>
warning: no time-of-day clock registered, system time will not be set accurately
random: unblocking device.
smsc0: chip 0xec00, rev. 0002
ue0: link state changed to DOWN
ue0: link state changed to UP
cdce0: <DAVICOM DM9621A USB To FastEther, class 2/0, rev 2.00/1.01, addr 4> on usbus0
ue1: <USB Ethernet> on cdce0
ue1: Ethernet address: 00:60:6e:b3:5e:2e
```
As you can see, the built-in ethernet adapter is recognized as ue0, whereas the external one (DAVICOM DM9621A) is ue1.

However, when I try
`sudo ifconfig ue0` I get

```
ue0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
   options=80009<RXCSUM,VLAN_MTU,LINKSTATE>
   ether b8:27:eb:3a:47:29
   inet 192.168.2.108 netmask 0xffffff00 broadcast 192.168.2.255
   media: Ethernet autoselect (100baseTX <full-duplex>)
   status: active
   nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
```
while `sudo ifconfig ue1` gives

```
ue1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
   ether 00:60:6e:b3:5e:2e
   nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
```
Notice that there is no media and no status line.
Also, if I plug the network cable into the external adapter and restart the network, ue1 stays in the above state, with no media / status information.

I have tested the adapter in the shop (on Windows) and on my desktop (Debian GNU/Linux) and it works. Do I need a special driver? Do you have any hints?


----------



## giorgiob (Jul 21, 2017)

Phishfry said:


> FreeBSD uses a file for all the USB devices to be detected.
> Take a look at /usr/src/sys/dev/usb/usbdevs. This file has both VendorID and ProductID for all supported devices.
> Search the list for your devices VID and PID. If not found add them. Then you will need to compile a kernel with them.
> 
> ...


Thanks for the hint. I found the vendor but not the product in that file. Does this mean that this device is not supported? I also wonder why the kernel would create a network interface for this device if it were not supported.


----------



## Phishfry (Jul 21, 2017)

Yes I just noticed that. There is no accompanying product ID in the file.

I do see OpenBSD usbdevs lists it.

I retracted my post because it seems with a ue1 device showing you probably are OK.
With no product ID I have to wonder.

The few posts I found don't sound good. That said it is a USB-1.1 era device and maybe there is some quirk needed.


----------



## Phishfry (Jul 21, 2017)

I don't think you have anything to lose. Try adding your productID to the list and compile a custom kernel to try.

I also wonder about the cdce class it is showing up as. cdce ethernet is what 3G modems use traditionally.
That could change with the adding of the product ID.


----------



## giorgiob (Jul 22, 2017)

Phishfry said:


> I don't think you have anything to lose. Try adding your productID to the list and compile a custom kernel to try.
> 
> I also wonder about the cdce class it is showing up as. cdce ethernet is what 3G modems use traditionally.
> That could change with the adding of the product ID.


You mean I should just add a new entry and compile the kernel? I have compiled the Linux kernel before but I have no experience with the FreeBSD kernel.

Also, I have tested the device on my desktop (also FreeBSD 11) and I have the same behaviour. So I will first compile the kernel for the desktop and, if it works, I will try it on the raspberrypi.


----------



## Jov (Jul 22, 2017)

giorgiob said:


> You mean I should just add a new entry and compile the kernel? I have compiled the Linux kernel before but I have no experience with the FreeBSD kernel.
> 
> Also, I have tested the device on my desktop (also FreeBSD 11) and I have the same behaviour. So I will first compile the kernel for the desktop and, if it works, I will try it on the raspberrypi.


You may not need to recompile the kernel, just use usb_quirk(4), more info is here: https://forums.freebsd.org/threads/57299/


----------



## Phishfry (Jul 22, 2017)

There is also devd for no compile adding devices at startup.


----------



## giorgiob (Jul 25, 2017)

Jov said:


> You may not need to recompile the kernel, just use usb_quirk(4), more info is here: https://forums.freebsd.org/threads/57299/


I tried `sudo usbconfig -d ugen0.2 add_quirk UQ_CFG_INDEX_0` through `sudo usbconfig -d ugen0.2 add_quirk UQ_CFG_INDEX_4`, where the device was listed as

```
Bus /dev/usb Device /dev/ugen0.2: ID 0a46:1269 Davicom Semiconductor, Inc.
```
but still no result.

Then I have added all possible quirks one after another with no success.

I have also compiled the standard 11.0 kernel after adding the lines

```
/* Davicom products */
product DAVICOM DM9621A         0x1269  DM9621A USB To FastEther DAVICOM
```
to /usr/src/sys/dev/usb/usbdevs.

I have booted the new kernel but the problem is still there.
I have also verified that the kernel module for the device (if_udav) is loaded.

-------------------------

Can it be that I have to set some permissions on the device or configure it in some way? I had a similar problem under Linux with a USB scanner: I had to set permissions on the device file that is created when the scanner is attached. Is there something like this on FreeBSD?


----------

