lifeforms
-
Posts
7 -
Joined
-
Last visited
Content Type
Profiles
Forums
Calendar
Posts posted by lifeforms
-
-
ОС: Linux linuxhost 2.6.38.6-26.rc1.fc15.i686.PAE #1 SMP Mon May 9 20:36:50 UTC 2011 i686 i686 i386 GNU/Linux
---------------------------------------------------------------------------------------------------------
Драйвер Moxa NPort5150:
Product: NPort Linux Real TTY Driver (V2)
Version: 1.17.3 Build 11060916
Date: 06/09/2011
Company: Moxa Inc.
Release Note:
=============
ver1.17.3 Build 11060916
1. Improve: Support Linux Kernel up to 2.6.39
--------------------------------------------------------------------------------------------------------
Простейшая программа отправки в устройство /dev/ttyr00 пропущу открытие дескриптора инициализацию и т.д.:
unsigned char buff[] = { 0x02, 0x03, 0x00, 0x43, 0x00, 0x01, 0xff, 0xff };
write(fd, buff, 8);
Отправляем пакет:
0x02 0x03 0x00 0x43 0x00 0x01 0x75 0xED
ответа от устройства нет.
tcpdump -w filename.dump ip host moxahost
tcpdump -r filename.dump -nn -xx
XX:XX:XX.090565 IP linuxhost.50463 > moxahost.950: Flags [P.], seq 3160517789:3160517797, ack 1810504621, win 14600, length 8
0x0000: 0090 e815 493a 0050 5683 001f 0800 4500
0x0010: 0030 0af2 4000 4006 b9ad c0a8 fa76 c0a8
0x0020: fa60 c51f 03b6 bc61 ac9d 6bea 1bad 5018
0x0030: 3908 6500 0000 0203 0043 0001 55cd
Разница в последних цифрах посыла на -32.
Отправляем пакет:
0x02 0x03 0x00 0x43 0x00 0x01 0x00 0x00
tcpdump -w filename.dump ip host moxahost
tcpdump -r filename.dump -nn -xx
XX:XX:XX.090589 IP linuxhost.50463 > moxahost.950: Flags [P.], seq 3160517789:3160517797, ack 1810504621, win 14600, length 8
0x0000: 0090 e815 493a 0050 5683 001f 0800 4500
0x0010: 0030 0af2 4000 4006 b9ad c0a8 fa76 c0a8
0x0020: fa60 c51f 03b6 bc61 ac9d 6bea 1bad 5018
0x0030: 3908 6500 0000 0203 0043 0001 0000
Отправляем пакет:
0x02 0x03 0x00 0x43 0x00 0x01 0xFF 0xFF
tcpdump -w filename.dump ip host moxahost
tcpdump -r filename.dump -nn -xx
XX:XX:XX.090632 IP linuxhost.50463 > moxahost.950: Flags [P.], seq 3160517789:3160517797, ack 1810504621, win 14600, length 8
0x0000: 0090 e815 493a 0050 5683 001f 0800 4500
0x0010: 0030 0af2 4000 4006 b9ad c0a8 fa76 c0a8
0x0020: fa60 c51f 03b6 bc61 ac9d 6bea 1bad 5018
0x0030: 3908 6500 0000 0203 0043 0001 dfdf
Вопрос собственно вот в чем: Почему так?
Уточню что посыл не от балды это команда Modbus и последние значения для меня важны поскольку CRC16 это.
-
Добрый день,
Попробуйте последнюю версию драйвера, он поддерживает ядро до 2.6.39.
Где его взять?
Файлы приложены вроде API.
-
Установил на Fedora 8:
Linux linuxhost 2.6.23.1-42.fc8 #1 SMP Tue Oct 30 13:55:12 EDT 2007 i686 i686 i386 GNU/Linux
npreal2_1.14_build_07062310
Установка прошла успешно.
Однако ttyr00 нет в /dev/.
Сконфигурировал:
cat npreal2d.cf
#=========================================================#
# This configuration file is created by Moxa NPort #
# Administrator Program automatically, please do not #
# modify this file by yourself. #
#=========================================================#
ttymajor=33
calloutmajor=38
#[Minor] [serverIP] [data] [cmd] [FIFO] [sSL] [ttyName] [coutName]
0 192.168.250.96 950 966 1 0 ttyr00 cur00
Запустил:
mxloadsvr 0
mknod -Z system_u:object_r:tty_device_t -m 666 ttyr00 c 33 0
mknod -Z system_u:object_r:tty_device_t -m 666 cur00 c 38 0
Complete.
ps -ef|grep npreal2|grep -v grep
root 1959 1 0 10:54 ? 00:00:00 /usr/lib/npreal2/driver/npreal2d -t 1
Как пользовать? Хотел чтобы Perl script опрашивал, так даже minicom не видит:
minicom -p ttyr00
minicom: WARNING: configuration file not found, using defaults
Device /dev/ttyr00 access failed: No such file or directory.
-
/tmp/moxa/npreal2.c:728:5: error: ‘struct tty_driver’ has no member named ‘open’
/tmp/moxa/npreal2.c:729:5: error: ‘struct tty_driver’ has no member named ‘close’
/tmp/moxa/npreal2.c:730:5: error: ‘struct tty_driver’ has no member named ‘write’
/tmp/moxa/npreal2.c:731:5: error: ‘struct tty_driver’ has no member named ‘put_char’
/tmp/moxa/npreal2.c:732:5: error: ‘struct tty_driver’ has no member named ‘flush_chars’
/tmp/moxa/npreal2.c:733:5: error: ‘struct tty_driver’ has no member named ‘write_room’
/tmp/moxa/npreal2.c:734:5: error: ‘struct tty_driver’ has no member named ‘chars_in_buffer’
/tmp/moxa/npreal2.c:735:5: error: ‘struct tty_driver’ has no member named ‘flush_buffer’
/tmp/moxa/npreal2.c:737:5: error: ‘struct tty_driver’ has no member named ‘ioctl’
/tmp/moxa/npreal2.c:738:5: error: ‘struct tty_driver’ has no member named ‘throttle’
/tmp/moxa/npreal2.c:739:5: error: ‘struct tty_driver’ has no member named ‘unthrottle’
/tmp/moxa/npreal2.c:740:5: error: ‘struct tty_driver’ has no member named ‘set_termios’
/tmp/moxa/npreal2.c:741:5: error: ‘struct tty_driver’ has no member named ‘stop’
/tmp/moxa/npreal2.c:742:5: error: ‘struct tty_driver’ has no member named ‘start’
/tmp/moxa/npreal2.c:743:5: error: ‘struct tty_driver’ has no member named ‘hangup’
/tmp/moxa/npreal2.c:745:5: error: ‘struct tty_driver’ has no member named ‘wait_until_sent’
/tmp/moxa/npreal2.c:747:5: error: ‘struct tty_driver’ has no member named ‘break_ctl’
/tmp/moxa/npreal2.c:794:20: error: ‘struct file_operations’ has no member named ‘ioctl’
tty_driver.h:
struct tty_driver {
<------>int<--->magic;<><------>/* magic number for this structure */
<------>struct kref kref;<----->/* Reference management */
<------>struct cdev cdev;
<------>struct module<->*owner;
<------>const char<---->*driver_name;
<------>const char<---->*name;
<------>int<--->name_base;<---->/* offset of printed name */
<------>int<--->major;<><------>/* major device number */
<------>int<--->minor_start;<-->/* start of minor device number */
<------>int<--->minor_num;<---->/* number of *possible* devices */
<------>int<--->num;<--><------>/* number of devices allocated */
<------>short<->type;<-><------>/* type of tty driver */
<------>short<->subtype;<------>/* subtype of tty driver */
<------>struct ktermios init_termios; /* Initial termios */
<------>int<--->flags;<><------>/* tty driver flags */
<------>struct proc_dir_entry *proc_entry; /* /proc fs entry */
<------>struct tty_driver *other; /* only used for the PTY driver */
<------>/*
<------> * Pointer to the tty data structures
<------> */
<------>struct tty_struct **ttys;
<------>struct ktermios **termios;
<------>struct ktermios **termios_locked;
<------>void *driver_state;
<------>/*
<------> * Driver methods
<------> */
<------>const struct tty_operations *ops;
<------>struct list_head tty_drivers;
};
Вынесли const struct tty_operations *ops;.
Блин проще более ранний дистриб взять. Вопрос снят. Можно ветку удалить.
-
/tmp/moxa/npreal2.c:512:2: warning: initialization from incompatible pointer type [enabled by default]
/tmp/moxa/npreal2.c:512:2: warning: (near initialization for ‘mpvar_ops.put_char’) [enabled by default]
Эти ошибки исправил, tty.h прописано put_char должен возвращать int.
-
Версия Linux:
uname -a
Linux linuxhost 2.6.38.6-26.rc1.fc15.i686.PAE #1 SMP Mon May 9 20:36:50 UTC 2011 i686 i686 i386 GNU/Linux
Версия драйвера:
npreal2_1.14_build_07062310.tgz
Попытка собрать:
mxinst SP1
===============================================================================
Copyright © 2002-2007 Moxa Technologies Co., Ltd.
All Rights Reserved.
MOXA NPort Server Real TTY Driver V1.14 Installation.
System Imformation: Kernel 2.6.38.6-26.rc1.fc15.i686.PAE; Machine i686.
===============================================================================
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/2.6.38.6-26.rc1.fc15.i686.PAE/build SUBDIRS=/tmp/moxa modules
make[1]: Entering directory `/usr/src/kernels/2.6.38.6-26.rc1.fc15.i686.PAE'
CC [M] /tmp/moxa/npreal2.o
/tmp/moxa/npreal2.c:512:2: warning: initialization from incompatible pointer type [enabled by default]
/tmp/moxa/npreal2.c:512:2: warning: (near initialization for ‘mpvar_ops.put_char’) [enabled by default]
/tmp/moxa/npreal2.c: In function ‘npreal_init_tty’:
/tmp/moxa/npreal2.c:595:5: error: implicit declaration of function ‘init_MUTEX’ [-Werror=implicit-function-declaration]
/tmp/moxa/npreal2.c:599:46: error: ‘proc_root’ undeclared (first use in this function)
/tmp/moxa/npreal2.c:599:46: note: each undeclared identifier is reported only once for each function it appears in
/tmp/moxa/npreal2.c:670:53: warning: operation on ‘tty_node->icount.dsr’ may be undefined [-Wsequence-point]
/tmp/moxa/npreal2.c: In function ‘npreal_init’:
/tmp/moxa/npreal2.c:728:5: error: ‘struct tty_driver’ has no member named ‘open’
/tmp/moxa/npreal2.c:729:5: error: ‘struct tty_driver’ has no member named ‘close’
/tmp/moxa/npreal2.c:730:5: error: ‘struct tty_driver’ has no member named ‘write’
/tmp/moxa/npreal2.c:731:5: error: ‘struct tty_driver’ has no member named ‘put_char’
/tmp/moxa/npreal2.c:732:5: error: ‘struct tty_driver’ has no member named ‘flush_chars’
/tmp/moxa/npreal2.c:733:5: error: ‘struct tty_driver’ has no member named ‘write_room’
/tmp/moxa/npreal2.c:734:5: error: ‘struct tty_driver’ has no member named ‘chars_in_buffer’
/tmp/moxa/npreal2.c:735:5: error: ‘struct tty_driver’ has no member named ‘flush_buffer’
/tmp/moxa/npreal2.c:737:5: error: ‘struct tty_driver’ has no member named ‘ioctl’
/tmp/moxa/npreal2.c:738:5: error: ‘struct tty_driver’ has no member named ‘throttle’
/tmp/moxa/npreal2.c:739:5: error: ‘struct tty_driver’ has no member named ‘unthrottle’
/tmp/moxa/npreal2.c:740:5: error: ‘struct tty_driver’ has no member named ‘set_termios’
/tmp/moxa/npreal2.c:741:5: error: ‘struct tty_driver’ has no member named ‘stop’
/tmp/moxa/npreal2.c:742:5: error: ‘struct tty_driver’ has no member named ‘start’
/tmp/moxa/npreal2.c:743:5: error: ‘struct tty_driver’ has no member named ‘hangup’
/tmp/moxa/npreal2.c:745:5: error: ‘struct tty_driver’ has no member named ‘wait_until_sent’
/tmp/moxa/npreal2.c:747:5: error: ‘struct tty_driver’ has no member named ‘break_ctl’
/tmp/moxa/npreal2.c:794:20: error: ‘struct file_operations’ has no member named ‘ioctl’
/tmp/moxa/npreal2.c: In function ‘npreal_do_softint’:
/tmp/moxa/npreal2.c:861:31: error: request for member ‘write_wakeup’ in something not a structure or union
/tmp/moxa/npreal2.c:862:28: error: request for member ‘write_wakeup’ in something not a structure or union
/tmp/moxa/npreal2.c: In function ‘npreal_open’:
/tmp/moxa/npreal2.c:970:19: warning: assignment makes integer from pointer without a cast [enabled by default]
/tmp/moxa/npreal2.c:971:5: error: implicit declaration of function ‘process_group’ [-Werror=implicit-function-declaration]
/tmp/moxa/npreal2.c: In function ‘npreal_close’:
/tmp/moxa/npreal2.c:1096:20: error: request for member ‘flush_buffer’ in something not a structure or union
/tmp/moxa/npreal2.c:1097:19: error: request for member ‘flush_buffer’ in something not a structure or union
/tmp/moxa/npreal2.c: In function ‘npreal_write’:
/tmp/moxa/npreal2.c:1111:23: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
/tmp/moxa/npreal2.c: In function ‘npreal_flush_buffer’:
/tmp/moxa/npreal2.c:1281:23: error: request for member ‘write_wakeup’ in something not a structure or union
/tmp/moxa/npreal2.c:1282:20: error: request for member ‘write_wakeup’ in something not a structure or union
/tmp/moxa/npreal2.c: In function ‘npreal_ldisc_flush_buffer’:
/tmp/moxa/npreal2.c:1323:23: error: request for member ‘write_wakeup’ in something not a structure or union
/tmp/moxa/npreal2.c:1324:20: error: request for member ‘write_wakeup’ in something not a structure or union
/tmp/moxa/npreal2.c: In function ‘npreal_ioctl’:
/tmp/moxa/npreal2.c:1380:27: error: request for member ‘flush_buffer’ in something not a structure or union
/tmp/moxa/npreal2.c:1381:27: error: request for member ‘flush_buffer’ in something not a structure or union
/tmp/moxa/npreal2.c:1384:27: error: request for member ‘flush_buffer’ in something not a structure or union
/tmp/moxa/npreal2.c:1385:27: error: request for member ‘flush_buffer’ in something not a structure or union
/tmp/moxa/npreal2.c: In function ‘npreal_block_til_ready’:
/tmp/moxa/npreal2.c:1728:32: warning: comparison between pointer and integer [enabled by default]
/tmp/moxa/npreal2.c: In function ‘npreal_flush_to_ldisc’:
/tmp/moxa/npreal2.c:3176:21: error: ‘struct tty_ldisc’ has no member named ‘receive_buf’
/tmp/moxa/npreal2.c: In function ‘npreal_net_read’:
/tmp/moxa/npreal2.c:3867:23: error: request for member ‘write_wakeup’ in something not a structure or union
/tmp/moxa/npreal2.c:3868:20: error: request for member ‘write_wakeup’ in something not a structure or union
cc1: some warnings being treated as errors
make[2]: *** [/tmp/moxa/npreal2.o] Error 1
make[1]: *** [_module_/tmp/moxa] Error 2
make[1]: Leaving directory `/usr/src/kernels/2.6.38.6-26.rc1.fc15.i686.PAE'
make: *** [module] Error 2
Check Driver...
FAILED !!!
Install Not Completed !
прошу помочь программное обеспечение под Linux
in Преобразователи RS-232/422/485 в Ethernet
Posted
Ошибка найдена. Инициализация /dev/ttyr00 должна быть в raw режим.
options.c_oflag &= ~OPOST;