Linux 内核 3.16 上的 Moxa RealTTY 模块编译错误

Moxa RealTTY module compilation error on Linux kernel 3.16

我在内核为 3.2 的 Debian 7.0 上使用了 MOXA 设备。我能够为这个内核成功编译 Moxa RealTTY 驱动程序,但是在我升级到内核 3.16 的 Debian 8.0 之后我无法编译它。 我向 MOXA 询问最新的驱动程序,但到目前为止没有答案。最新的驱动程序是从这个 link http://mtsc.moxa.com:8888/Software/DN/NPort/Driver/RealTTY/ 下载的,但是这个 link 不再工作了。

当我 运行 ./mxinst 它因这个错误而崩溃: ================================================ ============================= 版权所有 (C) 2002-2014 Moxa Inc. 保留所有权利。

MOXA NPort Server Real TTY Driver V1.18.33 Installation.
System Information: Kernel 3.16.0-4-amd64; Machine x86_64.
===============================================================================


Tar files, please wait ... OK!  
Building driver...

If you want to use secure communication with target,
you might choose [y] to enable the SSL function.
Note: This function support RealCOM with secure mode only.
Do you want to enable secure function? [y/N].
n
make -C /lib/modules/3.16.0-4-amd64/build SUBDIRS=/opt/moxa.git/npreal2 modules
make[1]: Entering directory '/usr/src/linux-headers-3.16.0-4-amd64'
Makefile:10: *** mixed implicit and normal rules: deprecated syntax
make[1]: Entering directory `/usr/src/linux-headers-3.16.0-4-amd64'
  CC [M]  /opt/moxa.git/npreal2/npreal2.o
/opt/moxa.git/npreal2/npreal2.c: In function ‘npreal_wait_command_completed’:
/opt/moxa.git/npreal2/npreal2.c:4744:13: error: implicit declaration of function ‘interruptible_sleep_on_timeout’ [-Werror=implicit-function-declaration]
             interruptible_sleep_on_timeout(&nd->cmd_rsp_wait,timeout);
             ^
cc1: some warnings being treated as errors
/usr/src/linux-headers-3.16.0-4-common/scripts/Makefile.build:268: recipe for target '/opt/moxa.git/npreal2/npreal2.o' failed
make[4]: *** [/opt/moxa.git/npreal2/npreal2.o] Error 1
/usr/src/linux-headers-3.16.0-4-common/Makefile:1350: recipe for target '_module_/opt/moxa.git/npreal2' failed
make[3]: *** [_module_/opt/moxa.git/npreal2] Error 2
Makefile:181: recipe for target 'sub-make' failed
make[2]: *** [sub-make] Error 2 
Makefile:8: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-3.16.0-4-amd64'
Makefile:67: recipe for target 'module' failed
make: *** [module] Error 2
Check Driver...
FAILED !!!

Install Not Completed !

我已将最新的驱动程序上传到 GitHub (https://github.com/rchovan/npreal2)。有人可以帮我修复这个模块以在 Linux 内核 3.16 和最新版本上编译它吗?

谢谢

函数 interruptible_sleep_on_timeout 已在内核版本 3.15 中删除。

缺失函数的解决方法可以在许多补丁中找到,例如这个 lm-sensors patch:

-           timeout = interruptible_sleep_on_timeout(&w1_control_wait, timeout);
+           prepare_to_wait(&w1_control_wait, &wait, TASK_INTERRUPTIBLE);
+           timeout = schedule_timeout(timeout);
+           finish_wait(&w1_control_wait, &wait);

我根据这个解决方案修补了 moxa 驱动程序,并在您的 github 仓库中发出了拉取请求。请测试一下。