Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Openzwave Open serial port hangs on newest kernels #22

Closed
GoogleCodeExporter opened this issue Mar 14, 2015 · 3 comments
Closed

Openzwave Open serial port hangs on newest kernels #22

GoogleCodeExporter opened this issue Mar 14, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Run the test program and it hangs after Open serial port /dev/ttyUSB0

I am running Fedora 14. Another user reported the same issue with the latest 
'Ubuntu Maverick kernel'.

It appears the newer kernels will block on the open waiting for a
carrier detect (DCD) to be asserted. To solve, I added a O_NDELAY to the open. 
However that implies nonblocking, so once I open it, I switch the socket to 
BLOCKING mode which open-zwave requires.

Here is the patch to get it to work:

===================================================================
--- SerialControllerImpl.cpp    (revision 215)
+++ SerialControllerImpl.cpp    (working copy)
@@ -75,7 +75,10 @@
 {
        Log::Write( "Open serial port %s",
_SerialControllerName.c_str() );

-       m_hSerialController = open( _SerialControllerName.c_str(),
O_RDWR | O_NOCTTY, 0 );
+       m_hSerialController = open( _SerialControllerName.c_str(),
O_RDWR | O_NOCTTY | O_NDELAY, 0 );
+       int flags;
+       flags = fcntl(m_hSerialController, F_GETFL);
+       fcntl(m_hSerialController, F_SETFL, flags & (~O_NONBLOCK));

        if( -1 == m_hSerialController )
        {


Original issue reported on code.google.com by krbvr...@gmail.com on 14 Feb 2011 at 3:15

@GoogleCodeExporter
Copy link
Author

Is this really still an issue?  I've used openzwave extensively on Ubuntu 
Maverick. May have been a transient kernel issue.

Original comment by pnau...@gmail.com on 17 Oct 2011 at 10:28

@GoogleCodeExporter
Copy link
Author

Thanks for your solution! I managed to get to work on Centos 6 finally!

Original comment by conrad.v...@gmail.com on 15 Jan 2012 at 10:24

@GoogleCodeExporter
Copy link
Author

Long since not an issue. 

Original comment by pnau...@gmail.com on 14 Aug 2012 at 3:04

  • Changed state: Verified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant