Jump to content
Форум по продукции MOXA

Драйверы для Linux, версия ядра 5+


Recommended Posts

root@server:~/temp/moxa/moxa/moxa# ./mxinst

===============================================================================
Copyright (C) 2002-2021  Moxa Inc.
All Rights Reserved.

MOXA NPort Server Real TTY Driver Ver5.1 Installation.
System Information: Kernel 5.15.0-43-generic; Machine x86_64.
===============================================================================

********************************WARNING**********************************
 MOXA NPort Server Real TTY Driver has been tested under kernel 5.13.4.
 That may not be compatible with Linux Kernel versions 5.15.0-43-generic .
 To download the available driver, please visit Moxa at: http://www.moxa.com
 If you have questions, please contact Moxa support at: support@moxa.com
*************************************************************************
Press enter to continue...


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].

make -C /lib/modules/5.15.0-43-generic/build M=/root/temp/moxa/moxa/moxa EXTRA_CFLAGS=" -DTTYNAME='"ttyr"'" modules
make[1]: Entering directory '/usr/src/linux-headers-5.15.0-43-generic'
  CC [M]  /root/temp/moxa/moxa/moxa/npreal2.o
/root/temp/moxa/moxa/moxa/npreal2.c:490:31: error: initialization of ‘unsigned int (*)(struct tty_struct *)’ from incompatible pointer type ‘int (*)(struct tty_struct *)’ [-Werror=incompatible-pointer-types]
  490 |                 .write_room = npreal_write_room,
      |                               ^~~~~~~~~~~~~~~~~
/root/temp/moxa/moxa/moxa/npreal2.c:490:31: note: (near initialization for ‘mpvar_ops.write_room’)
/root/temp/moxa/moxa/moxa/npreal2.c:491:36: error: initialization of ‘unsigned int (*)(struct tty_struct *)’ from incompatible pointer type ‘int (*)(struct tty_struct *)’ [-Werror=incompatible-pointer-types]
  491 |                 .chars_in_buffer = npreal_chars_in_buffer,
      |                                    ^~~~~~~~~~~~~~~~~~~~~~
/root/temp/moxa/moxa/moxa/npreal2.c:491:36: note: (near initialization for ‘mpvar_ops.chars_in_buffer’)
/root/temp/moxa/moxa/moxa/npreal2.c: In function ‘npreal2_module_exit’:
/root/temp/moxa/moxa/moxa/npreal2.c:570:9: error: implicit declaration of function ‘put_tty_driver’ [-Werror=implicit-function-declaration]
  570 |         put_tty_driver(DRV_VAR);
      |         ^~~~~~~~~~~~~~
/root/temp/moxa/moxa/moxa/npreal2.c: In function ‘npreal_init’:
/root/temp/moxa/moxa/moxa/npreal2.c:663:25: error: implicit declaration of function ‘alloc_tty_driver’ [-Werror=implicit-function-declaration]
  663 |         npvar_sdriver = alloc_tty_driver(NPREAL_PORTS+1);
      |                         ^~~~~~~~~~~~~~~~
/root/temp/moxa/moxa/moxa/npreal2.c:663:23: warning: assignment to ‘struct tty_driver *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
  663 |         npvar_sdriver = alloc_tty_driver(NPREAL_PORTS+1);
      |                       ^
/root/temp/moxa/moxa/moxa/npreal2.c: In function ‘npreal_close’:
/root/temp/moxa/moxa/moxa/npreal2.c:1065:34: error: ‘struct task_struct’ has no member named ‘state’; did you mean ‘__state’?
 1065 |                         current->state = TASK_INTERRUPTIBLE;
      |                                  ^~~~~
      |                                  __state
/root/temp/moxa/moxa/moxa/npreal2.c: In function ‘npreal_ldisc_flush_buffer’:
/root/temp/moxa/moxa/moxa/npreal2.c:1326:18: error: ‘struct task_struct’ has no member named ‘state’; did you mean ‘__state’?
 1326 |         current->state = TASK_INTERRUPTIBLE;
      |                  ^~~~~
      |                  __state
/root/temp/moxa/moxa/moxa/npreal2.c: In function ‘npreal_ioctl’:
/root/temp/moxa/moxa/moxa/npreal2.c:1434:26: error: ‘struct task_struct’ has no member named ‘state’; did you mean ‘__state’?
 1434 |                 current->state = TASK_RUNNING;
      |                          ^~~~~
      |                          __state
/root/temp/moxa/moxa/moxa/npreal2.c: In function ‘npreal_block_til_ready’:
/root/temp/moxa/moxa/moxa/npreal2.c:1755:18: error: ‘struct task_struct’ has no member named ‘state’; did you mean ‘__state’?
 1755 |         current->state = TASK_RUNNING;
      |                  ^~~~~
      |                  __state
/root/temp/moxa/moxa/moxa/npreal2.c: In function ‘npreal_startup’:
/root/temp/moxa/moxa/moxa/npreal2.c:1792:18: error: ‘struct task_struct’ has no member named ‘state’; did you mean ‘__state’?
 1792 |         current->state = TASK_RUNNING;
      |                  ^~~~~
      |                  __state
/root/temp/moxa/moxa/moxa/npreal2.c:1939:34: error: ‘struct task_struct’ has no member named ‘state’; did you mean ‘__state’?
 1939 |                         current->state = TASK_INTERRUPTIBLE;
      |                                  ^~~~~
      |                                  __state
/root/temp/moxa/moxa/moxa/npreal2.c: In function ‘npreal_shutdown’:
/root/temp/moxa/moxa/moxa/npreal2.c:2052:26: error: ‘struct task_struct’ has no member named ‘state’; did you mean ‘__state’?
 2052 |                 current->state = TASK_INTERRUPTIBLE;
      |                          ^~~~~
      |                          __state
/root/temp/moxa/moxa/moxa/npreal2.c: In function ‘npreal_wait_and_set_command’:
/root/temp/moxa/moxa/moxa/npreal2.c:3935:34: error: ‘struct task_struct’ has no member named ‘state’; did you mean ‘__state’?
 3935 |                         current->state = TASK_INTERRUPTIBLE;
      |                                  ^~~~~
      |                                  __state
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:285: /root/temp/moxa/moxa/moxa/npreal2.o] Error 1
make[1]: *** [Makefile:1875: /root/temp/moxa/moxa/moxa] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.15.0-43-generic'
make: *** [Makefile:75: module] Error 2

FAILED !!! Please check above message.

 

# uname -a
Linux server 5.15.0-43-generic #46-Ubuntu SMP Tue Jul 12 10:30:17 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

 

# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.1 LTS
Release:        22.04
Codename:       jammy

 

Link to comment

Ещё один момент, у вас драйвер npreal2.ko грузится из каталога с ядром

 

#!/usr/bin/bash
modprobe npreal2 ttymajor=33 calloutmajor=38 verbose=0
if [ -e /usr/lib/npreal2/driver/state.start ]; then
    /usr/lib/npreal2/driver/mxloadsvr
fi

При обновлении ядра (что в убунте происходит довольно часто), приходится либо снова запускать скрипт установки, либо руками копировать файл драйвера.

Я просто поправил скрипт запуска и перенёс модуль в каталог с драйвером. После этого проблема снялась.

#!/bin/bash
/sbin/insmod /usr/lib/npreal2/driver/npreal2.ko ttymajor=33 calloutmajor=38 verbose=0
if [ -e /usr/lib/npreal2/driver/state.start ]; then
    /usr/lib/npreal2/driver/mxloadsvr
fi

 

Link to comment
12 hours ago, dima35 said:

Ещё один момент, у вас драйвер npreal2.ko грузится из каталога с ядром

 

#!/usr/bin/bash
modprobe npreal2 ttymajor=33 calloutmajor=38 verbose=0
if [ -e /usr/lib/npreal2/driver/state.start ]; then
    /usr/lib/npreal2/driver/mxloadsvr
fi

При обновлении ядра (что в убунте происходит довольно часто), приходится либо снова запускать скрипт установки, либо руками копировать файл драйвера.

Я просто поправил скрипт запуска и перенёс модуль в каталог с драйвером. После этого проблема снялась.

#!/bin/bash
/sbin/insmod /usr/lib/npreal2/driver/npreal2.ko ttymajor=33 calloutmajor=38 verbose=0
if [ -e /usr/lib/npreal2/driver/state.start ]; then
    /usr/lib/npreal2/driver/mxloadsvr
fi

 

:wub:

Link to comment
  • 1 month later...
make -C /lib/modules/5.17.4-200.fc35.x86_64/build M=***/moxa EXTRA_CFLAGS="-DOS_REDHAT  -DTTYNAME='"ttyr"' -DNP_TIMEOUT='10'" modules
make[1]: вход в каталог «/usr/src/kernels/5.17.4-200.fc35.x86_64»
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9)
  You are using:           gcc (GCC) 11.3.1 20220421 (Red Hat 11.3.1-2)
  CC [M]  ***/moxa/npreal2.o
***moxa/npreal2.c: В функции «npreal_net_open»:
***moxa/npreal2.c:3233:35: ошибка: неявная декларация функции «PDE_DATA»; имелось в виду «NODE_DATA»? [-Werror=implicit-function-declaration]
 3233 |         nd = (struct nd_struct *) PDE_DATA(inode);
      |                                   ^~~~~~~~
      |                                   NODE_DATA
***/moxa/npreal2.c:3233:14: предупреждение: приведение к типу указателя от целого другого размера [-Wint-to-pointer-cast]
 3233 |         nd = (struct nd_struct *) PDE_DATA(inode);
      |              ^
cc1: некоторые предупреждения считаются ошибками
make[2]: *** [scripts/Makefile.build:288: ***/moxa/npreal2.o] Ошибка 1
make[1]: *** [Makefile:1841: ***/moxa] Ошибка 2
make[1]: выход из каталога «/usr/src/kernels/5.17.4-200.fc35.x86_64»
make: *** [Makefile:77: module] Ошибка 2

FAILED !!! Please check above message.

Вот такое получаю при попытке собрать драйвер для Fedora 35. NPort 5150

Есть ли где-нибудь более свежий драйвер.

Если делаю что-то не так, подскажитите пожалуйста, я новичок в этих устройствах.

 

Link to comment
1 hour ago, avaava said:

Вот эту.

Надеюсь ничего не перепутал, и именно она мне нужна.

Я тоже на это надеюсь :) Более новой версии у меня нет, эта актуальная. Readme из архива с драйвером читали, в части Note1 и Note2?

Link to comment

Только что попробовал специально в виртуалке поставил систему с нуля (Fedora 36). Та же ошибка.

Этот PDE_DATA встречается в том файле ровно два раза. В этом месте и в закоментированной строке сильно выше по коду.

Link to comment

Сейчас только 35-я под пальцами. Вывод установки абсолютно аналогичный:

[root@localhost moxa]# ./mxinst SP1_m64

===============================================================================
Copyright (C) 2002-2022  Moxa Inc.
All Rights Reserved.

MOXA NPort Server Real TTY Driver Ver5.1.7 Installation.
System Information: Kernel 5.17.4-200.fc35.x86_64; Machine x86_64.
===============================================================================

********************************WARNING**********************************
 MOXA NPort Server Real TTY Driver has been tested under kernel 5.15.0.
 That may not be compatible with Linux Kernel versions 5.17.4-200.fc35.x86_64 .
 To download the available driver, please visit Moxa at: http://www.moxa.com
 If you have questions, please contact Moxa support at: support@moxa.com
*************************************************************************
Press enter to continue...


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/5.17.4-200.fc35.x86_64/build M=****/work/laser/moxa_new_2/moxa EXTRA_CFLAGS="-DOS_REDHAT  -DTTYNAME='"ttyr"' -DNP_TIMEOUT='10'" modules
make[1]: вход в каталог «/usr/src/kernels/5.17.4-200.fc35.x86_64»
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9)
  You are using:           gcc (GCC) 11.3.1 20220421 (Red Hat 11.3.1-2)
  CC [M]  ****/work/laser/moxa_new_2/moxa/npreal2.o
****/work/laser/moxa_new_2/moxa/npreal2.c: В функции «npreal_net_open»:
****/work/laser/moxa_new_2/moxa/npreal2.c:3233:35: ошибка: неявная декларация функции «PDE_DATA»; имелось в виду «NODE_DATA»? [-Werror=implicit-function-declaration]
 3233 |         nd = (struct nd_struct *) PDE_DATA(inode);
      |                                   ^~~~~~~~
      |                                   NODE_DATA
****/work/laser/moxa_new_2/moxa/npreal2.c:3233:14: предупреждение: приведение к типу указателя от целого другого размера [-Wint-to-pointer-cast]
 3233 |         nd = (struct nd_struct *) PDE_DATA(inode);
      |              ^
cc1: некоторые предупреждения считаются ошибками
make[2]: *** [scripts/Makefile.build:288: ****/work/laser/moxa_new_2/moxa/npreal2.o] Ошибка 1
make[1]: *** [Makefile:1841: ****/work/laser/moxa_new_2/moxa] Ошибка 2
make[1]: выход из каталога «/usr/src/kernels/5.17.4-200.fc35.x86_64»
make: *** [Makefile:77: module] Ошибка 2

FAILED !!! Please check above message.

[root@localhost moxa]#

Заменил пути с именем пользователя на ****

Link to comment

Вот от 36

[root@localhost moxa]# uname -a
Linux localhost.localdomain 5.19.11-200.fc36.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Sep 23 15:07:44 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

 

[root@localhost moxa]# uname -a
Linux localhost.localdomain 5.19.11-200.fc36.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Sep 23 15:07:44 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost moxa]# ./mxinst SP1_m64

===============================================================================
Copyright (C) 2002-2022  Moxa Inc.
All Rights Reserved.

MOXA NPort Server Real TTY Driver Ver5.1.7 Installation.
System Information: Kernel 5.19.11-200.fc36.x86_64; Machine x86_64.
===============================================================================

********************************WARNING**********************************
 MOXA NPort Server Real TTY Driver has been tested under kernel 5.15.0.
 That may not be compatible with Linux Kernel versions 5.19.11-200.fc36.x86_64 .
 To download the available driver, please visit Moxa at: http://www.moxa.com
 If you have questions, please contact Moxa support at: support@moxa.com
*************************************************************************
Press enter to continue...


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/5.19.11-200.fc36.x86_64/build M=/root/moxa EXTRA_CFLAGS="-DOS_REDHAT  -DTTYNAME='"ttyr"' -DNP_TIMEOUT='10'" modules
make[1]: вход в каталог «/usr/src/kernels/5.19.11-200.fc36.x86_64»
  CC [M]  /root/moxa/npreal2.o
/root/moxa/npreal2.c: В функции «npreal_net_open»:
/root/moxa/npreal2.c:3233:35: ошибка: неявная декларация функции «PDE_DATA»; имелось в виду «NODE_DATA»? [-Werror=implicit-function-declaration]
 3233 |         nd = (struct nd_struct *) PDE_DATA(inode);
      |                                   ^~~~~~~~
      |                                   NODE_DATA
/root/moxa/npreal2.c:3233:14: предупреждение: приведение к типу указателя от целого другого размера [-Wint-to-pointer-cast]
 3233 |         nd = (struct nd_struct *) PDE_DATA(inode);
      |              ^
cc1: некоторые предупреждения считаются ошибками
make[2]: *** [scripts/Makefile.build:249: /root/moxa/npreal2.o] Ошибка 1
make[1]: *** [Makefile:1850: /root/moxa] Ошибка 2
make[1]: выход из каталога «/usr/src/kernels/5.19.11-200.fc36.x86_64»
make: *** [Makefile:77: module] Ошибка 2

FAILED !!! Please check above message.

[root@localhost moxa]# 

 

Link to comment

Скомпилировалось!

Вот такой вывод в конце. Ошибок не высыпало. Спасибо.

===============================================================================
Installation process is completed.
The all driver files are installed on /usr/lib/npreal2/driver.
Now you can cd /usr/lib/npreal2/driver and run ./mxaddsvr to add tty port.
===============================================================================

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...