Huawei E392 USB LTE modem on FreeBSD

The Huawei E392 comes with an intergrated Micro SD card reader. When you connect that USB LTE modem, FreeBSD just recognizes it as an USB mass storage device. Neither the u3g(4) nor the ucom(4) driver picks it up in this mode. To disable the storage device part for the time the USB modem is connected to your computer, you'll need usb_modeswitch:

# pkg install usb_modeswitch
Then, create a file called e392.conf:
Note that DefaultVendor and DefaultProduct have to match the vendor and product id of your modem, respectively. If in doubt, first call usbconfig without any option to get a list of all connected USB devices. Then, call usbconfig with the device which represents your modem to get detailed info, e.g.:
# usbconfig -d ugen6.2 dump_device_desc
Now call usb_modeswitch:
# usb_modeswitch -c e392.conf
In order to have usb_modeswitch being called whenever you connect your USB modem, create the file /etc/devd/huawei.conf like so:
attach 100 {
  match  "vendor"    "0x12d1";
  match  "product"   "0x151a";
  action "sleep 2 && /usr/local/sbin/usb_modeswitch -c /usr/local/etc/e392.conf";
The sleep 2 in the configuration above is crucial. I had some difficulties without it like usb_modeswitch or usbconfig hanging forever. Then restart devd:
# service devd restart
If you now connect your LTE modem, the u3g(4) should get loaded and will allocate some /dev/cuaUX.Y devices. You can check this by calling sysctl:
# sysctl dev.u3g
dev.u3g.0.ttyports: 3
dev.u3g.0.ttyname: U0
Remember the ttyname from the above output. It's important for the device within your PPP configuration. Just add something like this to /etc/ppp/ppp.conf (replace the string YOUR.APN by your ISP's actual APN!):
        set device /dev/cuaU0.0
        enable echo
        set reconnect 10 7200
        set redial 10 0
        set timeout 0
        set ifaddr
	set default HISADDR
        \"\" \
        ATH OK ATZ OK \
        ATE1 OK-AT-OK \
        AT+CGDCONT=1,\\\"ip\\\",\\\"YOUR.APN\\\" OK \
        ATDT*99\# TIMEOUT 30 CONNECT"
Now start ppp:
# service ppp start Some-Mobile-Provider
That's it!