BrickPi_C and current wiringPi library:-(

I don’t know since when, but it looks like the currently installed wiringPi library can’t handle the required Baud rate:-(

pi@dexter ~/src/wiringPi/wiringPi $ ls -l /usr/local/lib/libwiringPi*
lrwxrwxrwx 1 root staff    21 Jul 29 04:35 /usr/local/lib/libwiringPiDev.so -> libwiringPiDev.so.2.0
-rwxr-xr-x 1 root staff 23229 Jul 29 04:35 /usr/local/lib/libwiringPiDev.so.2.0
lrwxrwxrwx 1 root staff    18 Jul 29 04:35 /usr/local/lib/libwiringPi.so -> libwiringPi.so.2.0
-rwxr-xr-x 1 root staff 48107 Jul 29 04:35 /usr/local/lib/libwiringPi.so.2.0

When I try to do a BrickPiSetup(), everything seems fine, but the call to serialOpen() actually returns -2!! The BrickPiSetup() code only checks for -1, so it claims success:-(

The current code of serialOpen() (wiringPi/wiringSerial.c) shows clearly that it will return a -2 when it does not understand the Baud rate:-(
So, the question is, did you have a different wiringPi library at some point?

I’ll probably hack the lib source and see how far I get.

Thanks,
– Marco

OK, I patched the wiringPi library;-)


diff --git a/wiringPi/wiringSerial.c b/wiringPi/wiringSerial.c
index ca976a9..567e692 100644
--- a/wiringPi/wiringSerial.c
+++ b/wiringPi/wiringSerial.c
@@ -67,6 +67,42 @@ int serialOpen (const char *device, const int baud)
     case  57600:       myBaud =  B57600 ; break ;
     case 115200:       myBaud = B115200 ; break ;
     case 230400:       myBaud = B230400 ; break ;
+#ifdef B460800
+    case 460800:        myBaud = B460800 ; break ;
+#endif
+#ifdef B500000
+    case 500000:        myBaud = B500000 ; break ;
+#endif
+#ifdef B576000
+    case 576000:        myBaud = B576000 ; break ;
+#endif
+#ifdef B921600
+    case 921600:        myBaud = B921600 ; break ;
+#endif
+#ifdef B1000000
+    case 1000000:        myBaud = B1000000 ; break ;
+#endif
+#ifdef B1152000
+    case 1152000:        myBaud = B1152000 ; break ;
+#endif
+#ifdef B1500000
+    case 1500000:        myBaud = B1500000 ; break ;
+#endif
+#ifdef B2000000
+    case 2000000:        myBaud = B2000000 ; break ;
+#endif
+#ifdef B2500000
+    case 2500000:        myBaud = B2500000 ; break ;
+#endif
+#ifdef B3000000
+    case 3000000:        myBaud = B3000000 ; break ;
+#endif
+#ifdef B3500000
+    case 3500000:        myBaud = B3500000 ; break ;
+#endif
+#ifdef B4000000
+    case 4000000:        myBaud = B4000000 ; break ;
+#endif
 
     default:
       return -2 ;

I hope that helps somewhat;-)

Have fun,
– Marco