SRA Lab Open Source Code


libmodbus v3.0.5 and v3.1.1

libmodbus 3.0.5 (2013-10-06)

libmodbus v3.0.x branch has been updated to include important fixes backported from v3.1.1.

  • Fix remote buffer overflow vulnerability
  • Fix receiving of incorrect queries in write_single

libmodbus 3.1.1 (2013-10-06)

More robust to exploits, more compliant and better handling of connect/close sequences. Windows support still broken.

  • New unit tests
  • Fix remote buffer overflow vulnerability (closes #25, #105)
  • Explain how to define response timeouts when many RTU slaves
  • Fix receiving of incorrect queries in write_single and mask_write_register
    Thanks to James Nutaro.
  • Check return value of autoreconf.
    Thanks to Lauri Nurmi
  • Constant for broacast and test ordering
  • Fix the fix of device string check
  • Various changes to try to improve *broken* Windows support
  • Try to fix MinGW compilation
  • Portable use of bswap_32
  • Improve support of MacOS X
  • Fix socket value on init/close
  • Returns -1 on invalid mode in modbus_rtu_set_rts
  • Protect all public functions against invalid context
  • Sleep for delay of response timeout before reconnect (closes #77).
    Thanks to Karl Palsson.
  • Baud rate until 4,000,000 (POSIX), 1,000,000 (Windows) (closes #93)
  • New modbus_get|set_float_dcba to get|set float in inversed byte order
  • Remove unsupported -Wtype-limits for GCC < 4.3.5 (closes #109) />
  • Enable out-of-source build. Thanks to Yegor Yefremov.
  • Fix alignment problem on ARMv5 platform
  • Improvement to Debian package. Thanks to Alexander Klauer.
  • Improve support of VS 2005. Thanks to Petr Gladkiy.
  • Add documentation for modbus_mask_write_register (closes #91).
    Thanks to Martijn de Gouw.
  • Avoid C99 declaration in win32 section code (closes #92).
    Thanks to oldfaber and endrelovas.
  • Add a windows scripting host configure file.
    Thanks to oldfaber and Stéphane Raimbault.
  • Fix typo in modbus_strerror documentation. Thanks to Mirko Rajkovaca.
  • Rename reserved C++ keywords of modbus_mask_write_register.
    Thanks Tobias Doerffel.
  • Another quick workaround for deficient OS (closes #63)
  • Add support for Mask Write Register
  • Fix missing close on socket in random-test-server.
    Thanks to Damian Zieliński.
  • Use nonblocking sockets on Win32 and OS X/iOS too.
    Thanks to Julian Raschke.
  • Fix all compilations warnings spotted by new compilation flags
  • Major update of build system
  • Calculate RTS activation time by send length
  • Dynamic memory allocation of device name (closes #11)
  • Add unit tests for modbus_mapping_new
  • Add Visual Studio 2008 project files by oldfaber
  • Fix missing argument in synopsis section of modbus_rtu_set_serial_mode
  • Fix wrong constant names to create version number
  • More compilation fixes for Windows by oldfaber.
  • Fix wrong constant names to create version number.
    Thanks to Denis Davydov.

Very late announce of libmodbus v3.1.0

OK last year, I've silently released libmodbus v3.1.0 and it's never too late to announce it!

libmodbus 3.1.0 (2012-05-22)

Major changes to handle many slaves in RTU mode, non blocking connections and
RTS flow control.

  • Fixes for Microsoft Visual C++ compiler
  • Fixes for Windows. Thanks to oldfaber
  • Return value of _modbus_tcp_pi_connect() on failure (closes #61)
  • Avoid ioctl call on non-RS485 ports. Thanks to Michael Haberler
  • Display node and service in PI and port in IPv4 at connection
  • Return -1 on getaddrinfo error and print error in debug mode
  • More robust way to establish the connection in non blocking mode
  • TCP - Socket in non blocking mode by default. Thanks to Thomas Stalder
  • Apply CLOEXEC flag for TCP protocol independent too (IPv6)
  • New RTU receive() to ignore confirmation from other slaves (closes #18)
  • Move RTU filtering in CRC check to avoid useless call to modbus_reply
  • Unique transaction identifier by TCP connection
  • Use accept4 with SOCK_CLOEXEC when available (Linux)
  • Open fd and socket with the CLOEXEC flag when available
  • Exception response on report slave ID wasn't detected (closes #27)
  • Provides a way to disable the byte timeout (Alex Stapleton)
  • Added slave ID check for response messages (Alex Stapleton)
  • RTS flow control with modbus_rtu_set_rts and modbus_rtu_get_rts functions by Torello Querci and Stéphane Raimbault.

Download libmodbus v3.1.0


New libmodbus v3.0.4

New stable release v3.0.4:

  • creates symlinks instead of copies
  • Add missing m4 directory (closes #103)
  • Fix alignment problem on ARMv5 platform. Thanks to Alexander Dahl.
  • Remove useless test on error_recovery argument. Thanks to Carlos Tangerino.

Download libmodbus v3.0.4.


New libmodbus v3.0.3

This new bugfix release contains the following changes:

  • Fix another Visual C++ 2008/2010 deficiency (closes #53)
  • Add -lsocket to compile on QNX
  • Fix TCP PI init under Windows.
    Thanks to oldfaber.
  • Fix a missing free in random-test-client.
    Thanks again to Stefan Finzel.
  • Fix OMG bug in modbus_mapping_free not freeing memory.
    Thanks to Stefan Finzel for the bug report.
  • Fix semicolon typo and unistd.h include under Windows.
    Thanks to Andrew Kravchuk.

Download libmodbus v3.0.3.


Fork me, I’m famous!

The modbus library finds its way into the official repositories Fedora (packaged by Stéphane Raimbault), Debian and Ubuntu (packaged by Ivo De Decker).

Of course, we'll happy to support other distributions!

To improve the communication and ease the subscription process, the libmodbus project as moved from Launchpad list to Google Groups

Update: Julien Boibessot integrated libmodbus into Buildroot.


libmodbus v3.0.2

Yet another stable release with minor fixes.

libmodbus 3.0.2 (2012-01-16)

  • Update Debian package.
  • Documentation fixes and additions.
  • Add missing C++ macros in public headers. Thanks to Bernhard Agthe.
  • Protects modbus_mapping_free against NULL argument. Thanks to Andrea Mattia.
  • Fix check on file doc/libmodbus.7 in acinclude.m4 (closes #28)
  • Close file descriptor when the settings don't apply in RTU. Original patch provided by Thomas Stalder.
  • unit-test.h is now generated to avoid config.h dependency.
  • Request for Windows Sockets specification version 2.2 instead of 2.0. Thanks to Pavel Mazniker for the report.

Feedback on GNOME 3.0

After 5 months with GNOME 3.0, I'm really happy with the experience. At the end of work day,
my mind is no more exhausted of windows placement fighting and application finding.

GNOME 3.0 is really stable, except with the Open Source driver on my Radeon 5870 (4 crashes in 2 months).

I really like the behavior of dual-head where the secondary screen has only one virtual screen.
For me, there are just 3 annoying points:

  • Ctrl + Del to remove a file in Nautilus, may be it's a Fedora settings but this change is just @!# I've already a Trash to undo my mistakes (
  • Alt key to shutdown, no I don't want to waste energy for days and my PC boots quickly.
  • only vertical virtual screens, I found a bit painful to move down two screens when the screen is reachable with one move with a 2x2 layout but I understand this layout doesn't fit well with the GNOME 3 design.

To have a good experience with GNOME 3, I use:

  • Windows key + type to launch everything
  • Ctrl + Shift + Alt + arrows to move the application between the virtual screen
  • Ctrl + click in the launcher when I really want a new instance (the default behavior is perfect)
  • snap à la Windows 7 is great
  • Alt + Tab then the arrow keys to select an app

Don't forget to read or the Help (System key + 'Help').

It's not specific to GNOME 3 but you can change the volume when your mouse is over the applet (don't click, think hover) and a mouse scroll.
With GTK+, do you know you can reach the end of scrolled area with a left click on the arrow and a specific position by middle click?

I'm impressed by the new features of GNOME 3.2 and I'm waiting for Fedora 17 to enjoy it!


Incredible coincidence

The day I discovered that Firefox does not behave like Chrome/IE on Ajax redirects, Firefox 7.0 is out with the fix!

PS: a simple request.is_ajax () after a redirect() in Django highlights the problem.

Filed under: Django 1 Comment

coreutils is a really active project

I'm impressed by the activity of the coreutils project (unix commands such as ls, df, etc). At first glance, you might think command line tools are written for good and only few changes are applied to ensure compatibility with the platforms. With several releases a year and new features for each, it's really an active project indeed.

coreutils 8.13 release note.

You want to show the local time for 9AM next Friday on the west coast of the US, it's possible:

$ date --date='TZ="America/Los_Angeles" 09:00 next Fri'

The maintainers/contributors (Pádraig Brady, Jim Meyering and Eric Blake) are nice and quick to commit your patches.
So don't be intimidated it's not the glibc project!

PS: I'm waiting for the tag on to be able to push the latest French translation.


Tip for python-mode with Emacs

If you expect 'Alt + d' wil only remove the first part 'foo_' of 'foo_bar' with the great python-mode, you can make this change to python-mode.el:

- (modify-syntax-entry ?\_ "w" py-mode-syntax-table)
+ (modify-syntax-entry ?\_ "_" py-mode-syntax-table)

Thank you Ivan.

Update with python-mode v6.0.4, add this line to python-mode-syntax-table (line 153):

(modify-syntax-entry ?\_ "_" table)