用于 USB 转以太网适配器的 Linux 驱动程序 DM9621A 无法编译

用于 USB 转以太网适配器的 Linux 驱动程序 DM9621A 无法编译

我正在使用带有 Linux 内核 4.18.0-18-generic 的 xubuntu 18.04。

最近我为我的笔记本买了一个 USB 2.0 转以太网适配器,但是在安装 DM9621 驱动程序时遇到了一些问题。因为内置驱动程序是 DM9601,所以我从供应商那里获取源代码进行编译。但是当我尝试运行 make 时,出现了一些错误:

$ make
make -C /lib/modules/4.18.0-18-generic/build M=/home/shootingstar/Downloads/Linux/Linux/lnx_dm9620  
make[1]: Entering directory '/usr/src/linux-headers-4.18.0-18-generic'
  CC [M]  /home/shootingstar/Downloads/Linux/Linux/lnx_dm9620/dm9620.o
/home/shootingstar/Downloads/Linux/Linux/lnx_dm9620/dm9620.c:557:18: error: ‘usbnet_get_settings’ undeclared here (not in a function); did you mean ‘usbnet_get_stats64’?
  .get_settings = usbnet_get_settings,
                  ^~~~~~~~~~~~~~~~~~~
                  usbnet_get_stats64
/home/shootingstar/Downloads/Linux/Linux/lnx_dm9620/dm9620.c:558:18: error: ‘usbnet_set_settings’ undeclared here (not in a function); did you mean ‘usbnet_get_settings’?
  .set_settings = usbnet_set_settings,
                  ^~~~~~~~~~~~~~~~~~~
                  usbnet_get_settings
/home/shootingstar/Downloads/Linux/Linux/lnx_dm9620/dm9620.c: In function ‘dm9620_bind’:
/home/shootingstar/Downloads/Linux/Linux/lnx_dm9620/dm9620.c:712:2: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation]
  else
  ^~~~
/home/shootingstar/Downloads/Linux/Linux/lnx_dm9620/dm9620.c:715:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
   printk("++++++[dm962]+++++  [Analysis.2] 0xF2, D[7] %d %s\n", tmp>>7, (tmp&(1<<7))? "Err: RX Unexpected condition": "OK" );
   ^~~~~~
scripts/Makefile.build:330: recipe for target '/home/shootingstar/Downloads/Linux/Linux/lnx_dm9620/dm9620.o' failed
make[2]: *** [/home/shootingstar/Downloads/Linux/Linux/lnx_dm9620/dm9620.o] Error 1
Makefile:1534: recipe for target '_module_/home/shootingstar/Downloads/Linux/Linux/lnx_dm9620' failed
make[1]: *** [_module_/home/shootingstar/Downloads/Linux/Linux/lnx_dm9620] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.18.0-18-generic'
Makefile:37: recipe for target 'default' failed
make: *** [default] Error 2

驱动程序源代码可以在这里下载:DM9621A Linux_USB-以太网.exe

我不熟悉 Linux 驱动程序和 C 编程,如何解决这些问题?

答案1

您要构建的驱动程序是 2009 年编写的——现在已经有近十年的历史了,并且与当前版本的 Linux 内核不兼容。更新它以在现代内核上构建(并工作!)超出了本网站的范围。

尽管名称不匹配,内核中存在的 dm9601 驱动程序应该可以处理 DM9621 设备。(它实际上处理一小部分 Davicom DM96xx USB 网络设备。)如果您无法让此驱动程序正常工作,请提出一个新问题,详细说明您遇到的问题。

相关内容