[haiku-commits] haiku: hrev50122 - src/apps/serialconnect build/scripts

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 4 Mar 2016 20:03:58 +0100 (CET)

hrev50122 adds 3 changesets to branch 'master'
old head: 319328002a2d4b09d3c86d0190e21bf2c658b2cc
new head: d958d336a84bf5e87d6e36637548c447cf48d19f
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=d958d336a84b+%5E319328002a2d

----------------------------------------------------------------------------

3b4f50d3fbdc: Style fix.
  
  Thanks to axel for watching!

96e59cca3c60: SerialConnect: allow custom baudrates from the GUI

d958d336a84b: Try to fix the ARM cross-tools build
  
  * Gcc5 does not allow both --with-arch and --with-cpu anymore, so use just 
--with-cpu.

                             [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

8 files changed, 134 insertions(+), 15 deletions(-)
build/scripts/build_cross_tools_gcc4        |  4 +-
src/apps/serialconnect/CustomRateWindow.cpp | 68 +++++++++++++++++++++++++
src/apps/serialconnect/CustomRateWindow.h   | 28 ++++++++++
src/apps/serialconnect/Jamfile              |  2 +
src/apps/serialconnect/SerialApp.cpp        |  8 +++
src/apps/serialconnect/SerialApp.h          | 11 ++--
src/apps/serialconnect/SerialWindow.cpp     | 24 +++++++--
src/system/libroot/posix/termios.c          |  4 --

############################################################################

Commit:      3b4f50d3fbdcce4b90991a90346504461ac8a8a6
URL:         http://cgit.haiku-os.org/haiku/commit/?id=3b4f50d3fbdc
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Sun Feb 28 11:51:58 2016 UTC

Style fix.

Thanks to axel for watching!

----------------------------------------------------------------------------

diff --git a/src/system/libroot/posix/termios.c 
b/src/system/libroot/posix/termios.c
index f9191da..07851e9 100644
--- a/src/system/libroot/posix/termios.c
+++ b/src/system/libroot/posix/termios.c
@@ -106,9 +106,7 @@ speed_t
 cfgetispeed(const struct termios *termios)
 {
        if (termios->c_cflag & CBAUD == CBAUD)
-       {
                return termios->c_ispeed;
-       }
 
        return termios->c_cflag & CBAUD;
 }
@@ -137,9 +135,7 @@ speed_t
 cfgetospeed(const struct termios *termios)
 {
        if (termios->c_cflag & CBAUD == CBAUD)
-       {
                return termios->c_ospeed;
-       }
 
        return termios->c_cflag & CBAUD;
 }

############################################################################

Commit:      96e59cca3c60f3444b120daa31d124f49a5acbc8
URL:         http://cgit.haiku-os.org/haiku/commit/?id=96e59cca3c60
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Sun Feb 28 13:19:35 2016 UTC

SerialConnect: allow custom baudrates from the GUI

----------------------------------------------------------------------------

diff --git a/src/apps/serialconnect/CustomRateWindow.cpp 
b/src/apps/serialconnect/CustomRateWindow.cpp
new file mode 100644
index 0000000..53eb5e4
--- /dev/null
+++ b/src/apps/serialconnect/CustomRateWindow.cpp
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2016, Adrien Destugues, pulkomandy@xxxxxxxxxxxxx
+ * Distributed under terms of the MIT license.
+ */
+
+
+#include "CustomRateWindow.h"
+
+#include "SerialApp.h"
+
+#include <Button.h>
+#include <Catalog.h>
+#include <GroupLayoutBuilder.h>
+#include <Spinner.h>
+
+
+#define B_TRANSLATION_CONTEXT "Custom baudrate window"
+
+
+static const uint32 kOkButtonMsg = 'ok';
+
+CustomRateWindow::CustomRateWindow(int baudrate)
+       : BWindow(BRect(100, 100, 200, 150), B_TRANSLATE("Custom baudrate"),
+               B_FLOATING_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE | 
B_CLOSE_ON_ESCAPE
+                       | B_AUTO_UPDATE_SIZE_LIMITS)
+{
+       BGroupLayout* layout = new BGroupLayout(B_HORIZONTAL);
+       SetLayout(layout);
+
+       BGroupView* root = new BGroupView(B_VERTICAL);
+       AddChild(root);
+
+       BGroupLayoutBuilder(root)
+               .SetInsets(B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING,
+                       B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING)
+               .AddGroup(B_HORIZONTAL)
+                       .Add(fSpinner = new BSpinner("spin", 
B_TRANSLATE("Baudrate:"), NULL))
+               .End()
+               .AddGroup(B_HORIZONTAL)
+                       .AddGlue()
+                       .Add(new BButton("ok", B_TRANSLATE("Ok"), new 
BMessage(kOkButtonMsg)))
+                       .Add(new BButton("cancel", B_TRANSLATE("Cancel"),
+                               new BMessage(B_QUIT_REQUESTED)))
+               .End()
+       .End();
+
+       fSpinner->SetMinValue(50);
+       fSpinner->SetMaxValue(3000000);
+       fSpinner->SetValue(baudrate);
+
+       CenterOnScreen();
+}
+
+
+void
+CustomRateWindow::MessageReceived(BMessage* message)
+{
+       if (message->what == kOkButtonMsg)
+       {
+               BMessage* settings = new BMessage(kMsgSettings);
+               settings->AddInt32("baudrate", fSpinner->Value());
+               be_app->PostMessage(settings);
+               Quit();
+               return;
+       }
+
+       BWindow::MessageReceived(message);
+}
diff --git a/src/apps/serialconnect/CustomRateWindow.h 
b/src/apps/serialconnect/CustomRateWindow.h
new file mode 100644
index 0000000..cfa6939
--- /dev/null
+++ b/src/apps/serialconnect/CustomRateWindow.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2016, Adrien Destugues, pulkomandy@xxxxxxxxxxxxx
+ * Distributed under terms of the MIT license.
+ */
+
+
+#ifndef CUSTOMRATEWINDOW_H
+#define CUSTOMRATEWINDOW_H
+
+
+#include <Window.h>
+
+
+class BSpinner;
+
+
+class CustomRateWindow: public BWindow
+{
+       public:
+                                       CustomRateWindow(int baudrate);
+               void            MessageReceived(BMessage* message);
+
+       private:
+               BSpinner*       fSpinner;
+};
+
+
+#endif /* !CUSTOMRATEWINDOW_H */
diff --git a/src/apps/serialconnect/Jamfile b/src/apps/serialconnect/Jamfile
index 953b0c9..1a63ae4 100644
--- a/src/apps/serialconnect/Jamfile
+++ b/src/apps/serialconnect/Jamfile
@@ -1,10 +1,12 @@
 SubDir HAIKU_TOP src apps serialconnect ;
 
 SubDirSysHdrs [ FDirName $(HAIKU_TOP) src apps serialconnect libvterm include 
] ;
+SubDirSysHdrs [ FDirName $(HAIKU_TOP) headers private interface ] ;
 
 SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src apps serialconnect libvterm src ] 
;
 
 Application SerialConnect :
+       CustomRateWindow.cpp
        SerialApp.cpp
        SerialWindow.cpp
        TermView.cpp
diff --git a/src/apps/serialconnect/SerialApp.cpp 
b/src/apps/serialconnect/SerialApp.cpp
index dfce199..3ee9246 100644
--- a/src/apps/serialconnect/SerialApp.cpp
+++ b/src/apps/serialconnect/SerialApp.cpp
@@ -15,6 +15,7 @@
 #include <FindDirectory.h>
 #include <Path.h>
 
+#include "CustomRateWindow.h"
 #include "SerialWindow.h"
 
 
@@ -146,6 +147,13 @@ void SerialApp::MessageReceived(BMessage* message)
                                debugger("Invalid BMessage received");
                        return;
                }
+               case kMsgCustomBaudrate:
+               {
+                       // open the custom baudrate selector window
+                       CustomRateWindow* window = new 
CustomRateWindow(fSerialPort.DataRate());
+                       window->Show();
+                       return;
+               }
                case kMsgSettings:
                {
                        int32 baudrate;
diff --git a/src/apps/serialconnect/SerialApp.h 
b/src/apps/serialconnect/SerialApp.h
index 03f83d7..8aff941 100644
--- a/src/apps/serialconnect/SerialApp.h
+++ b/src/apps/serialconnect/SerialApp.h
@@ -52,11 +52,12 @@ class SerialApp: public BApplication
 
 
 enum messageConstants {
-       kMsgDataRead  = 'dare',
-       kMsgDataWrite = 'dawr',
-       kMsgLogfile   = 'logf',
-       kMsgOpenPort  = 'open',
-       kMsgSettings  = 'stty',
+       kMsgCustomBaudrate  = 'cust',
+       kMsgDataRead        = 'dard',
+       kMsgDataWrite       = 'dawr',
+       kMsgLogfile         = 'logf',
+       kMsgOpenPort        = 'open',
+       kMsgSettings        = 'stty',
 };
 
 #endif
diff --git a/src/apps/serialconnect/SerialWindow.cpp 
b/src/apps/serialconnect/SerialWindow.cpp
index d47c05c..9737603 100644
--- a/src/apps/serialconnect/SerialWindow.cpp
+++ b/src/apps/serialconnect/SerialWindow.cpp
@@ -174,6 +174,10 @@ SerialWindow::SerialWindow()
                fBaudrateMenu->AddItem(item);
        }
 
+       message = new BMessage(kMsgCustomBaudrate);
+       BMenuItem* custom = new BMenuItem("custom" B_UTF8_ELLIPSIS, message);
+       fBaudrateMenu->AddItem(custom);
+
        fBaudrateMenu->SetTargetForItems(be_app);
 
        message = new BMessage(kMsgSettings);
@@ -351,13 +355,25 @@ void SerialWindow::MessageReceived(BMessage* message)
                        }
 
                        if (message->FindInt32("baudrate", &baudrate) == B_OK) {
-                               for (int i = 0; i < 
fBaudrateMenu->CountItems(); i++) {
-                                       BMenuItem* item = 
fBaudrateMenu->ItemAt(i);
-                                       int32 code;
+                               int i;
+                               BMenuItem* item = NULL;
+                               for (i = 0; i < fBaudrateMenu->CountItems(); 
i++) {
+                                       item = fBaudrateMenu->ItemAt(i);
+                                       int32 code = 0;
                                        item->Message()->FindInt32("baudrate", 
&code);
 
-                                       if (baudrate == code)
+                                       if (baudrate == code) {
                                                item->SetMarked(true);
+                                               break;
+                                       }
+                               }
+
+                               if (i == fBaudrateMenu->CountItems() && item != 
NULL) {
+                                       // Rate was not found, mark it as 
"custom".
+                                       // Since that is the last item in the 
menu, we still point
+                                       // to it.
+                                       item->SetMarked(true);
+                                       item->Message()->SetInt32("baudrate", 
baudrate);
                                }
                        }
 

############################################################################

Revision:    hrev50122
Commit:      d958d336a84bf5e87d6e36637548c447cf48d19f
URL:         http://cgit.haiku-os.org/haiku/commit/?id=d958d336a84b
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Fri Mar  4 19:04:41 2016 UTC

Try to fix the ARM cross-tools build

* Gcc5 does not allow both --with-arch and --with-cpu anymore, so use just 
--with-cpu.

----------------------------------------------------------------------------

diff --git a/build/scripts/build_cross_tools_gcc4 
b/build/scripts/build_cross_tools_gcc4
index 7fac834..a855f61 100755
--- a/build/scripts/build_cross_tools_gcc4
+++ b/build/scripts/build_cross_tools_gcc4
@@ -40,9 +40,9 @@ arm-*)
        # Multilib creates a lot of confusion as the wrong libs end up being 
linked.
        # For now, target Cortex-A8 devices.
        binutilsConfigureArgs="--disable-multilib --with-float=hard
-               --with-cpu=cortex-a8 --with-arch=armv7-a --with-fpu=vfpv3"
+               --with-cpu=cortex-a8 --with-fpu=vfpv3"
        gccConfigureArgs="--disable-multilib --with-float=hard
-               --with-cpu=cortex-a8 --with-arch=armv7-a --with-fpu=vfpv3"
+               --with-cpu=cortex-a8 --with-fpu=vfpv3"
 
        # TODO: Disable building with TLS support for ARM until implemented.
        binutilsConfigureArgs="$binutilsConfigureArgs --disable-tls"


Other related posts: