We needed a Linux serial device driver for the Moxa U1250 series multi-port USB to Serial adaptors. The released driver on the Moxa web site only works with Ubuntu Linux up to version 11 and with Fedora Linux up to version 16, so you need a Virtual Machine of the right version for it. Otherwise, ask Moxa support for a Beta version of their driver for the newer kernels.
The Fedora distribution is part of the Red Hat family.
Each of these families has their own incompatible code packaging systems. Each distribution has its own set of file servers and when you install a system, it will be configured to look at those servers for updates. These servers are distributed all over the world at universities and large corporations. Because they are perfect copies of each other, the servers are also known as 'mirrors'.
The update program used by Ubuntu is known as 'apt'. To get a program from a mirror, you run a program called 'apt-get'.
To install stuff, you need super user (administrator) privileges. You can elevate your permissions temporarily using a program called 'sudo' (set user do). So therefore the command to get all system updates is:
$ sudo apt-get update
Similarly, to install a program, you would run:
$ sudo apt-get install programname
Apt keeps a database of installation data, so you can also use apt to remove a program, or upgrade an installed program to the latest version. The graphical software wizard, is simply a nice looking front end for apt.
Low level programs such as device drivers, are operating system kernel modules that can be loaded and unloaded at run time - on the fly. When you plug a new thing in, the system will automatically load the required driver if it is available, For that to work, the driver needs to match your running kernel exactly.
The Linux system is changing all the time. It has a very rapid development cycle. Therefore, most drivers are distributed as C source code and you have to compile it on your system before you can use it.
$ sudo apt-get install linux-headers(versionnumber)
$ sudo apt-get install build-essential
The kernel version number can be displayed with the 'uname' command. The command 'uname -a' will show all version parameters of the current running kernel. The command 'uname -r' will show only the version number, so one can make a generic install command like this:
$ sudo apt-get install linux-headers-$(uname -r) build-essential
Compile and installation of any program usually follows a simple recipe, explained in the README and INSTALL files that come with each package. The recipe is usually the same, but once in a blue moon it isn't, so it is always a good idea to read the readme file and in this case it is indeed different from the norm:
$ make driver_make
************************************************************************
Ubuntu 12.04.2 LTS
\l 3.5.0-23-generic
MOXA UPort 1200/1400/1600 series driver ver 1.2.5
Release Date: 2013/04/03
************************************************************************
If and only if there are no errors above:
$ sudo make install
[sudo] password for herman:
************************************************************************
Ubuntu 12.04.2 LTS
\l 3.5.0-23-generic
MOXA UPort 1200/1400/1600 series driver ver 1.2.5
Release Date: 2013/04/03
************************************************************************
************************************************************************
MOXA UPort 1200/1400/1600 series driver ver 1.2.5 installed successfully.
************************************************************************
Configure the device for RS232:
# setserial /dev/ttyMXUSB0 port 0x0
or for RS422:
# setserial /dev/ttyMXUSB0 port 0x2
and for RS485 2-wire:
# setserial /dev/ttyMXUSB0 port 0x1
It is all explained in the readme.txt file and I recommend you use it with Cutecom.
La voila.
Ubuntu Software Installer
There are basically three Linux development streams:- Slackware
- Debian
- Red Hat
The Fedora distribution is part of the Red Hat family.
Each of these families has their own incompatible code packaging systems. Each distribution has its own set of file servers and when you install a system, it will be configured to look at those servers for updates. These servers are distributed all over the world at universities and large corporations. Because they are perfect copies of each other, the servers are also known as 'mirrors'.
The update program used by Ubuntu is known as 'apt'. To get a program from a mirror, you run a program called 'apt-get'.
To install stuff, you need super user (administrator) privileges. You can elevate your permissions temporarily using a program called 'sudo' (set user do). So therefore the command to get all system updates is:
$ sudo apt-get update
Similarly, to install a program, you would run:
$ sudo apt-get install programname
Apt keeps a database of installation data, so you can also use apt to remove a program, or upgrade an installed program to the latest version. The graphical software wizard, is simply a nice looking front end for apt.
Low level programs such as device drivers, are operating system kernel modules that can be loaded and unloaded at run time - on the fly. When you plug a new thing in, the system will automatically load the required driver if it is available, For that to work, the driver needs to match your running kernel exactly.
The Linux system is changing all the time. It has a very rapid development cycle. Therefore, most drivers are distributed as C source code and you have to compile it on your system before you can use it.
Software Development Tools
To do software development and compile device drivers for example, you need GCC (the GNU Compiler Collection) and the interface definition for your kernel version (the kernel header files). These can be installed using apt. The command is something like:$ sudo apt-get install linux-headers(versionnumber)
$ sudo apt-get install build-essential
The kernel version number can be displayed with the 'uname' command. The command 'uname -a' will show all version parameters of the current running kernel. The command 'uname -r' will show only the version number, so one can make a generic install command like this:
$ sudo apt-get install linux-headers-$(uname -r) build-essential
Compile and Install
After the above, one can download and compile the U1250 Linux device driver from http://www.moxa.com (or email their support guys for a Beta version).Compile and installation of any program usually follows a simple recipe, explained in the README and INSTALL files that come with each package. The recipe is usually the same, but once in a blue moon it isn't, so it is always a good idea to read the readme file and in this case it is indeed different from the norm:
$ make driver_make
************************************************************************
Ubuntu 12.04.2 LTS
\l 3.5.0-23-generic
MOXA UPort 1200/1400/1600 series driver ver 1.2.5
Release Date: 2013/04/03
************************************************************************
If and only if there are no errors above:
$ sudo make install
[sudo] password for herman:
************************************************************************
Ubuntu 12.04.2 LTS
\l 3.5.0-23-generic
MOXA UPort 1200/1400/1600 series driver ver 1.2.5
Release Date: 2013/04/03
************************************************************************
************************************************************************
MOXA UPort 1200/1400/1600 series driver ver 1.2.5 installed successfully.
************************************************************************
Configure the Port
Now, when you plug the Moxa U1250 in, it should show up in /dev as ttyMXUSB0 and ttyMXUSB1.Configure the device for RS232:
# setserial /dev/ttyMXUSB0 port 0x0
or for RS422:
# setserial /dev/ttyMXUSB0 port 0x2
and for RS485 2-wire:
# setserial /dev/ttyMXUSB0 port 0x1
It is all explained in the readme.txt file and I recommend you use it with Cutecom.
La voila.
This is error we get after entering the below command.
ReplyDeletechandana@root:~/moxa/mxuport$ make
#==========================================
# MOXA UPort series driver v1.0
# for Linux kernel 2.6.x
#
# release date : 04/03/2008
#==========================================
Building driver...
make EXTRA_CFLAGS= -C /lib/modules/3.2.0-23-generic-pae/build SUBDIRS=/home/chandana/moxa/mxuport modules
make[1]: Entering directory `/usr/src/linux-headers-3.2.0-23-generic-pae'
CC [M] /home/chandana/moxa/mxuport/mxuport/mx-uport.o
/home/chandana/moxa/mxuport/mxuport/mx-uport.c: In function ‘mxuport_open’:
/home/chandana/moxa/mxuport/mxuport/mx-uport.c:624:25: error: ‘struct tty_driver’ has no member named ‘flush_buffer’
/home/chandana/moxa/mxuport/mxuport/mx-uport.c:625:26: error: ‘struct tty_driver’ has no member named ‘flush_buffer’
/home/chandana/moxa/mxuport/mxuport/mx-uport.c: In function ‘mxuport_close’:
/home/chandana/moxa/mxuport/mxuport/mx-uport.c:790:16: error: ‘struct tty_driver’ has no member named ‘flush_buffer’
/home/chandana/moxa/mxuport/mxuport/mx-uport.c:791:14: error: ‘struct tty_driver’ has no member named ‘flush_buffer’
/home/chandana/moxa/mxuport/mxuport/mx-uport.c: In function ‘mxuport_ioctl’:
/home/chandana/moxa/mxuport/mxuport/mx-uport.c:1140:69: warning: passing argument 2 of ‘user_termios_to_kernel_termios’ from incompatible pointer type [enabled by default]
include/asm-generic/termios.h:115:19: note: expected ‘struct termios2 *’ but argument is of type ‘struct termios *’
/home/chandana/moxa/mxuport/mxuport/mx-uport.c:1170:69: warning: passing argument 2 of ‘user_termios_to_kernel_termios’ from incompatible pointer type [enabled by default]
include/asm-generic/termios.h:115:19: note: expected ‘struct termios2 *’ but argument is of type ‘struct termios *’
/home/chandana/moxa/mxuport/mxuport/mx-uport.c:1248:38: error: ‘struct tty_driver’ has no member named ‘flush_buffer’
/home/chandana/moxa/mxuport/mxuport/mx-uport.c:1249:42: error: ‘struct tty_driver’ has no member named ‘flush_buffer’
/home/chandana/moxa/mxuport/mxuport/mx-uport.c:1272:38: error: ‘struct tty_driver’ has no member named ‘flush_buffer’
/home/chandana/moxa/mxuport/mxuport/mx-uport.c:1273:42: error: ‘struct tty_driver’ has no member named ‘flush_buffer’
/home/chandana/moxa/mxuport/mxuport/mx-uport.c: In function ‘mxuport_init’:
/home/chandana/moxa/mxuport/mxuport/mx-uport.c:3632:2: error: implicit declaration of function ‘info’ [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
make[3]: *** [/home/chandana/moxa/mxuport/mxuport/mx-uport.o] Error 1
make[2]: *** [/home/chandana/moxa/mxuport/mxuport] Error 2
make[1]: *** [_module_/home/chandana/moxa/mxuport] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.2.0-23-generic-pae'
make: *** [modules] Error 2
Hi Shreyansh,
ReplyDeleteThe software is for kernel 2.6, which is rather ancient and it won't compile on a kernel 3.2 system.
Please email the Moxa Support guys and ask for a Beta version of the device driver at "support-at-moxa-dot-com". (obfuscated as an anti-spam courtesy to Moxa). You should get a response from Germany within a few hours. The Beta version worked for me on Fedora 18.
Regards,
Herman