From 8078d7b1801ec3ed549051e41d2e011b58529686 Mon Sep 17 00:00:00 2001 From: fiadosau <61759453+fiadosau@users.noreply.github.com> Date: Tue, 3 Mar 2020 23:59:05 +0300 Subject: [PATCH] rtl8188eu: Add new device and fix build for kernel 5.6 Signed-off-by: Larry Finger --- os_dep/rtw_proc.c | 70 +++++++++++++++++++++++++++++++++++++++++++++-- os_dep/usb_intf.c | 1 + 2 files changed, 69 insertions(+), 2 deletions(-) diff --git a/os_dep/rtw_proc.c b/os_dep/rtw_proc.c index 2124d82..cdf24a2 100644 --- a/os_dep/rtw_proc.c +++ b/os_dep/rtw_proc.c @@ -52,12 +52,19 @@ inline struct proc_dir_entry *rtw_proc_create_dir(const char *name, struct proc_ return entry; } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)) +inline struct proc_dir_entry *rtw_proc_create_entry(const char *name, struct proc_dir_entry *parent, + const struct proc_ops *fops, void * data) +#else inline struct proc_dir_entry *rtw_proc_create_entry(const char *name, struct proc_dir_entry *parent, const struct file_operations *fops, void * data) +#endif { struct proc_dir_entry *entry; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)) + entry = proc_create_data(name, S_IFREG | S_IRUGO | S_IWUGO, parent, fops, data); +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)) entry = proc_create_data(name, S_IFREG | S_IRUGO | S_IWUGO, parent, fops, data); #else entry = create_proc_entry(name, S_IFREG | S_IRUGO | S_IWUGO, parent); @@ -203,6 +210,15 @@ static ssize_t rtw_drv_proc_write(struct file *file, const char __user *buffer, return -EROFS; } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)) +static const struct proc_ops rtw_drv_proc_seq_fops = { + .proc_open = rtw_drv_proc_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_release = seq_release, + .proc_write = rtw_drv_proc_write, +}; +#else static const struct file_operations rtw_drv_proc_seq_fops = { .owner = THIS_MODULE, .open = rtw_drv_proc_open, @@ -211,7 +227,17 @@ static const struct file_operations rtw_drv_proc_seq_fops = { .release = seq_release, .write = rtw_drv_proc_write, }; +#endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)) +static const struct proc_ops rtw_drv_proc_sseq_fops = { + .proc_open = rtw_drv_proc_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_release = single_release, + .proc_write = rtw_drv_proc_write, +}; +#else static const struct file_operations rtw_drv_proc_sseq_fops = { .owner = THIS_MODULE, .open = rtw_drv_proc_open, @@ -220,6 +246,7 @@ static const struct file_operations rtw_drv_proc_sseq_fops = { .release = single_release, .write = rtw_drv_proc_write, }; +#endif int rtw_drv_proc_init(void) { @@ -2516,6 +2543,15 @@ static ssize_t rtw_adapter_proc_write(struct file *file, const char __user *buff return -EROFS; } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)) +static const struct proc_ops rtw_adapter_proc_seq_fops = { + .proc_open = rtw_adapter_proc_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_release = seq_release, + .proc_write = rtw_adapter_proc_write, +}; +#else static const struct file_operations rtw_adapter_proc_seq_fops = { .owner = THIS_MODULE, .open = rtw_adapter_proc_open, @@ -2524,7 +2560,17 @@ static const struct file_operations rtw_adapter_proc_seq_fops = { .release = seq_release, .write = rtw_adapter_proc_write, }; +#endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)) +static const struct proc_ops rtw_adapter_proc_sseq_fops = { + .proc_open = rtw_adapter_proc_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_release = single_release, + .proc_write = rtw_adapter_proc_write, +}; +#else static const struct file_operations rtw_adapter_proc_sseq_fops = { .owner = THIS_MODULE, .open = rtw_adapter_proc_open, @@ -2533,7 +2579,7 @@ static const struct file_operations rtw_adapter_proc_sseq_fops = { .release = single_release, .write = rtw_adapter_proc_write, }; - +#endif static int proc_get_odm_force_igi_lb(struct seq_file *m, void *v) { @@ -2815,6 +2861,15 @@ static ssize_t rtw_odm_proc_write(struct file *file, const char __user *buffer, return -EROFS; } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)) +static const struct proc_ops rtw_odm_proc_seq_fops = { + .proc_open = rtw_odm_proc_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_release = seq_release, + .proc_write = rtw_odm_proc_write, +}; +#else static const struct file_operations rtw_odm_proc_seq_fops = { .owner = THIS_MODULE, .open = rtw_odm_proc_open, @@ -2823,7 +2878,17 @@ static const struct file_operations rtw_odm_proc_seq_fops = { .release = seq_release, .write = rtw_odm_proc_write, }; +#endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)) +static const struct proc_ops rtw_odm_proc_sseq_fops = { + .proc_open = rtw_odm_proc_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_release = single_release, + .proc_write = rtw_odm_proc_write, +}; +#else static const struct file_operations rtw_odm_proc_sseq_fops = { .owner = THIS_MODULE, .open = rtw_odm_proc_open, @@ -2832,6 +2897,7 @@ static const struct file_operations rtw_odm_proc_sseq_fops = { .release = single_release, .write = rtw_odm_proc_write, }; +#endif static struct proc_dir_entry *rtw_odm_proc_init(struct net_device *dev) { diff --git a/os_dep/usb_intf.c b/os_dep/usb_intf.c index dcd07a5..2ff8521 100644 --- a/os_dep/usb_intf.c +++ b/os_dep/usb_intf.c @@ -123,6 +123,7 @@ static struct usb_device_id rtw_usb_id_tbl[] = { {USB_DEVICE(0x056E, 0x4008), .driver_info = RTL8188E}, /* Elecom WDC-150SU2M */ {USB_DEVICE(0x2357, 0x010c), .driver_info = RTL8188E}, /* TP-Link TL-WN722N v2 */ {USB_DEVICE(0x2357, 0x0111), .driver_info = RTL8188E}, /* TP-Link TL-WN727N v5.21 */ + {USB_DEVICE(0x2C4E, 0x0102), .driver_info = RTL8188E}, /* MERCUSYS MW150US v2 */ {} /* Terminating entry */ };