Re: udl(4) patch for SIIG USB 2.0 DVI/VGA Pro support

From: Archimedes Gaviola <archimedes.gaviola_at_gmail.com>
Date: Sat, 09 Sep 2023 05:25:02 UTC
On Tue, Sep 5, 2023 at 11:12 PM Archimedes Gaviola <
archimedes.gaviola@gmail.com> wrote:

> Hi,
>
> I would like to submit some patches below for the SIIG USB 2.0 DVI/VGA Pro
> device support for the udl(4) video driver. You can see actual device here
> https://www.siig.com/usb-2-0-to-dvi-vga-pro.html. This has been tested on
> both 14.0-ALPHA4 and 15.0-CURRENT in a compiled kernel and in the loadable
> module. Either way both are working. There are two files being patched (1)
> /usr/src/sys/dev/usb/usbdevs and (2) /usr/src/sys/dev/usb/video/udl.c.
> These changes apply for both 14.0-ALPHA4 and 15.0-CURRENT.
>
> root@fbsd14a4:~ # uname -a
> FreeBSD fbsd14a4 14.0-ALPHA4 FreeBSD 14.0-ALPHA4 amd64 1400097 #0
> stable/14-n265026-4c3f144478d4: Fri Sep  1 05:47:56 UTC 2023
> root@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC
> amd64
>
> root@fbsd15:~ # uname -a
> FreeBSD fbsd15 15.0-CURRENT FreeBSD 15.0-CURRENT i386 1500000 #0
> main-n265091-e04c4b4a369d: Thu Aug 31 03:48:01 UTC 2023
> root@releng3.nyi.freebsd.org:/usr/obj/usr/src/i386.i386/sys/GENERIC i386
>
> root@fbsd14a4:~ # diff -Nur /usr/src/sys/dev/usb/usbdevs.orig
> /usr/src/sys/dev/usb/usbdevs
> --- /usr/src/sys/dev/usb/usbdevs.orig   2023-09-03 04:16:01.453679000 +0800
> +++ /usr/src/sys/dev/usb/usbdevs        2023-09-03 09:23:33.848897000 +0800
> @@ -1808,6 +1808,7 @@
>  product DISPLAYLINK M01061     0x01e2  Lenovo DVI
>  product DISPLAYLINK SWDVI      0x024c  SUNWEIT DVI
>  product DISPLAYLINK NBDOCK     0x0215  VideoHome NBdock1920
> +product DISPLAYLINK AN2440D3   0x028f  SIIG USB 2.0 DVI/VGA Pro
>  product DISPLAYLINK LUM70      0x02a9  Lilliput UM-70
>  product DISPLAYLINK DVI_19     0x0360  USB to DVI-19
>  product DISPLAYLINK UM7X0      0x401a  nanovision MiMo
>
> root@fbsd14a4:~ # diff -Nur /usr/src/sys/dev/usb/video/udl.c.orig
> /usr/src/sys/dev/usb/video/udl.c
> --- /usr/src/sys/dev/usb/video/udl.c.orig       2023-09-03
> 04:15:21.204875000 +0800
> +++ /usr/src/sys/dev/usb/video/udl.c    2023-09-03 09:25:23.893228000 +0800
> @@ -179,6 +179,7 @@
>         {USB_VPI(USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_LT1421,
> DLUNK)},
>         {USB_VPI(USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_ITEC,
> DL165)},
>         {USB_VPI(USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_DVI_19,
> DL165)},
> +       {USB_VPI(USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_AN2440D3,
> DL195)},
>
> Some relevant info below upon detection of the device after patched (only
> 14.0-ALPHA4 is shown as 15.0-CURRENT is the same). Because the videomode
> driver is also a dependency to the udl(4) driver, it is also able to detect
> my Dell VGA monitor for available screen resolutions and video modes.
>
> root@fbsd14a4:~ # kldload udl
> root@fbsd14a4:~ # kldstat
> Id Refs Address                Size Name
>  1   10 0xffffffff80200000  1d339a8 kernel
>  2    1 0xffffffff8261f000     3690 udl.ko
>  3    1 0xffffffff82623000     5028 videomode.ko
>
> root@fbsd14a4:~ # kldstat -v -n kernel | grep udl
>                 107 udl/fbd
>                 282 uhub/udl
>
> root@fbsd14a4:~ # dmesg
> ugen0.2: <DisplayLink AN2440D3> at usbus0
> udl0 on uhub0
> udl0: <DisplayLink AN2440D3, class 0/0, rev 1.10/0.01, addr 2> on usbus0
> Vendor: [DEL] Dell
> Product: [2004] D1918H
> Serial number: GC2RW07C8PHX
> Manufactured 2019 Week 28
> EDID Version 1.3
> EDID Comment:
> Video Input: 68
>         Analog
>         -0.7, 0.0V
>         Separate syncs
> Gamma: 2.20
> Max Size: 41 cm x 23 cm
> Features: 2a
>         DPMS active-off
>         RGB
>         Preferred timing
> Chroma Info:
>         Red X: 0.635
>         Red Y: 0.635
>         Grn X: 0.330
>         Grn Y: 0.627
>         Blu X: 0.155
>         Blu Y: 0.046
>         Wht X: 0.313
>         Wht Y: 0.329
> Range:
>         Horizontal: 30 - 83 kHz
>         Vertical: 56 - 75 Hz
>         Max Dot Clock: 135 MHz
> Video modes:
>         720x400 @ 70Hz (28320 738 846 900 412 414 449 -H +V)
>         640x480 @ 60Hz (25175 656 752 800 490 492 525 -H -V)
>         640x480 @ 75Hz (31500 656 720 840 481 484 500 -H -V)
>         800x600 @ 60Hz (40000 840 968 1056 601 605 628 +H +V)
>         800x600 @ 75Hz (49500 816 896 1056 601 604 625 +H +V)
>         1024x768 @ 60Hz (65000 1048 1184 1344 771 777 806 -H -V)
>         1024x768 @ 75Hz (78750 1040 1136 1312 769 772 800 +H +V)
>         1280x1024 @ 75Hz (135000 1296 1440 1688 1025 1028 1066 +H +V)
>         1366x768 @ 60Hz (85500 1436 1579 1792 771 774 798 +H +V)
> Preferred mode: 1366x768 @ 60Hz
> Number of extension blocks: 0
> udl0: Mode selected 1280x1024 @ 75Hz
> fbd0 on udl0
>
> root@fbsd14a4:~ # usbconfig -d ugen0.2 dump_device_desc
> ugen0.2: <DisplayLink AN2440D3> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps)
> pwr=ON (500mA)
>
>   bLength = 0x0012
>   bDescriptorType = 0x0001
>   bcdUSB = 0x0110
>   bDeviceClass = 0x0000  <Probed by interface class>
>   bDeviceSubClass = 0x0000
>   bDeviceProtocol = 0x0000
>   bMaxPacketSize0 = 0x0040
>   idVendor = 0x17e9
>   idProduct = 0x028f
>   bcdDevice = 0x0001
>   iManufacturer = 0x0001  <DisplayLink>
>   iProduct = 0x0002  <AN2440D3>
>   iSerialNumber = 0x0003  <111018>
>   bNumConfigurations = 0x0001
>
> root@fbsd14a4:~ # sysctl -a | grep udl
> udl0 on uhub0
> udl0: <DisplayLink AN2440D3, class 0/0, rev 1.10/0.01, addr 2> on usbus0
> udl0: Mode selected 1280x1024 @ 75Hz
> fbd0 on udl0
> device  udl
> hw.usb.udl.fps: 25
> hw.usb.udl.debug: 0
> dev.fbd.0.%parent: udl0
> dev.udl.0.mode: 17
> dev.udl.0.mode_force: -1
> dev.udl.0.chipid: 4
> dev.udl.0.chipid_force: -1
> dev.udl.0.%parent: uhub0
> dev.udl.0.%pnpinfo: vendor=0x17e9 product=0x028f devclass=0x00
> devsubclass=0x00 devproto=0x00 sernum="111018" release=0x0001 mode=host
> intclass=0xff intsubclass=0x00 intprotocol=0x00
> dev.udl.0.%location: bus=0 hubaddr=1 port=1 devaddr=2 interface=0
> ugen=ugen0.2
> dev.udl.0.%driver: udl
> dev.udl.0.%desc: DisplayLink AN2440D3, class 0/0, rev 1.10/0.01, addr 2
> dev.udl.%parent:
>
> Lastly, I would also submit a patch for the udl(4) manual for update.
> First, there's a need to include DL-195 in the description since this model
> is the chipset of SIIG USB 2.0 DVI/VGA Pro which is working as tested.
> Second, the udl(4) driver must be accompanied with the videomode driver
> otherwise kernel compilation will fail and third, adding the SIIG USB 2.0
> DVI/VGA Pro device in the list.
>
> root@fbsd14a4:~ # diff -Nur udl-manual.orig udl-manual
> --- udl-manual.orig     2023-08-18 00:13:25.583021000 +0000
> +++ udl-manual  2023-08-18 15:06:41.896163000 +0000
> @@ -1,13 +1,14 @@
>  UDL(4)                 FreeBSD Kernel Interfaces Manual
> UDL(4)
>
>  NAME
> -     udl – DisplayLink DL-120 / DL-160 USB display devices
> +     udl – DisplayLink DL-120 / DL-160 / DL-195 USB display devices
>
>  SYNOPSIS
> -     To compile this driver into the kernel, place the following line in
> your
> +     To compile this driver into the kernel, place the following lines in
> your
>       kernel configuration file:
>
>             device udl
> +           device videomode
>
>       Alternatively, to load the driver as a module at boot time, place the
>       following line in loader.conf(5):
> @@ -16,7 +17,7 @@
>
>  DESCRIPTION
>       The udl driver supports USB display devices based on the DisplayLink
> -     DL-120 / DL-160 graphic chip.
> +     DL-120 / DL-160 / DL-195 graphic chip.
>
>  HARDWARE
>       The following devices should work:
> @@ -40,6 +41,7 @@
>             Unitek Y-2240 USB to DVI
>             VideoHome NBdock1920
>             i-tec USB 2.0 Docking Station (USBDVIDOCK)
> +           SIIG USB 2.0 DVI/VGA Pro
>
> Thanks,
> Archimedes
>

Hi,

By the way, should I post this patch to the Phabricator
https://reviews.freebsd.org for review? The other patch is related to the
manual, where to post it as well?

Thanks,
Archimedes