From: Kyle Markley Subject: Support 0bda:818c Realtek NIC To: tech@openbsd.org Date: Sun, 5 May 2024 21:32:56 -0700 Hello, Long time user, first time code contributor, please be gentle. I have a USB wireless NIC that is unsupported in the GENERIC kernel, for which I offer a patch. dmesg describes this as: MAC/BB RTL8192EU, RF 6052 2T2R [MAC omitted] usbdevs describes this as: 0bda:818c Realtek, 802.11n NIC high speed, self powered, config 1, rev 2.00, iSerial [MAC omitted] Following some advice I found given in a similar situation to another person (https://www.reddit.com/r/openbsd/comments/ujbfh0/comment/i7mx7rf/) I was able to build a kernel for which the NIC works.  Here is the patch.  I believe that only the changes to if_urtwn.c and usbdevs are manual, and the changes to usbdevs.h and usbdevs_data.h are generated automatically by the build process. Index: if_urtwn.c =================================================================== RCS file: /cvs/src/sys/dev/usb/if_urtwn.c,v retrieving revision 1.108 diff -u -p -u -p -r1.108 if_urtwn.c --- if_urtwn.c    12 Jun 2023 11:27:30 -0000    1.108 +++ if_urtwn.c    6 May 2024 04:20:26 -0000 @@ -344,6 +344,7 @@ static const struct urtwn_type {      /* URTWN_RTL8192EU */      URTWN_DEV_8192EU(DLINK,        DWA131E1),      URTWN_DEV_8192EU(REALTEK,    RTL8192EU), +    URTWN_DEV_8192EU(REALTEK,    RTL8192EU_2),      URTWN_DEV_8192EU(TPLINK,    RTL8192EU),      URTWN_DEV_8192EU(TPLINK,    RTL8192EU_2),      URTWN_DEV_8192EU(TPLINK,    RTL8192EU_3) Index: usbdevs =================================================================== RCS file: /cvs/src/sys/dev/usb/usbdevs,v retrieving revision 1.760 diff -u -p -u -p -r1.760 usbdevs --- usbdevs    27 Nov 2023 20:03:50 -0000    1.760 +++ usbdevs    6 May 2024 04:20:26 -0000 @@ -3808,6 +3808,7 @@ product REALTEK RTL8187        0x8187 RTL8187  product REALTEK RTL8187B_0    0x8189    RTL8187B  product REALTEK RTL8188CUS    0x818a    RTL8188CUS  product REALTEK RTL8192EU    0x818b    RTL8192EU +product REALTEK RTL8192EU_2    0x818c    RTL8192EU_2  product REALTEK RTL8188CU_3    0x8191    RTL8188CU  product REALTEK RTL8192U    0x8192    RTL8192U  product REALTEK RTL8187B_1    0x8197    RTL8187B Index: usbdevs.h =================================================================== RCS file: /cvs/src/sys/dev/usb/usbdevs.h,v retrieving revision 1.772 diff -u -p -u -p -r1.772 usbdevs.h --- usbdevs.h    27 Nov 2023 20:04:07 -0000    1.772 +++ usbdevs.h    6 May 2024 04:20:26 -0000 @@ -1,4 +1,4 @@ -/*    $OpenBSD: usbdevs.h,v 1.772 2023/11/27 20:04:07 miod Exp $    */ +/*    $OpenBSD$    */  /*   * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT. @@ -3815,6 +3815,7 @@  #define    USB_PRODUCT_REALTEK_RTL8187B_0    0x8189        /* RTL8187B */  #define    USB_PRODUCT_REALTEK_RTL8188CUS    0x818a        /* RTL8188CUS */  #define    USB_PRODUCT_REALTEK_RTL8192EU    0x818b        /* RTL8192EU */ +#define    USB_PRODUCT_REALTEK_RTL8192EU_2    0x818c        /* RTL8192EU_2 */  #define    USB_PRODUCT_REALTEK_RTL8188CU_3    0x8191        /* RTL8188CU */  #define    USB_PRODUCT_REALTEK_RTL8192U    0x8192        /* RTL8192U */  #define    USB_PRODUCT_REALTEK_RTL8187B_1    0x8197        /* RTL8187B */ Index: usbdevs_data.h =================================================================== RCS file: /cvs/src/sys/dev/usb/usbdevs_data.h,v retrieving revision 1.766 diff -u -p -u -p -r1.766 usbdevs_data.h --- usbdevs_data.h    27 Nov 2023 20:04:07 -0000    1.766 +++ usbdevs_data.h    6 May 2024 04:20:26 -0000 @@ -1,4 +1,4 @@ -/*    $OpenBSD: usbdevs_data.h,v 1.766 2023/11/27 20:04:07 miod Exp $    */ +/*    $OpenBSD$    */  /*   * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT. @@ -9516,6 +9516,10 @@ const struct usb_known_product usb_known      {          USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8192EU,          "RTL8192EU", +    }, +    { +        USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8192EU_2, +        "RTL8192EU_2",      },      {          USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188CU_3, -- Kyle Markley