hrev46577 adds 3 changesets to branch 'master' old head: edba5ea016c6d919184fdc80bebf9944ce86b17b new head: 92419037ccf2a475e0cc13b9813f2d52a0bc4453 overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=9241903+%5Eedba5ea ---------------------------------------------------------------------------- c516bac: Revert part of hrev24647 The baudrate constant for MIDI speed was after all the others in BeOS, and we have to keep them with the same values for things to work. Moreover, the constants in SerialPort.h were not changed, so everything was out of sync and all apps using BSerialPort ended up using the wrong speed. Add a comment in termios.h to make sure this doesn't happen again. e236727: SerialConnect: fix baudrate settings save. There was a mixup of using the baudrate value (eg 115200), constant (B_115200_BPS = 17) and position in the menu (18), leading to the baudrate setting not being saved and restored properly. 9241903: SerialConnect: fix rdef file * Declare icon the right way, * Also add version and app signature. [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ] ---------------------------------------------------------------------------- 5 files changed, 37 insertions(+), 72 deletions(-) headers/posix/termios.h | 13 ++++-- src/apps/serialconnect/SerialApp.cpp | 66 +-------------------------- src/apps/serialconnect/SerialConnect.rdef | 16 ++++++- src/apps/serialconnect/SerialWindow.cpp | 13 +++++- src/apps/serialconnect/SerialWindow.h | 1 + ############################################################################ Commit: c516bac9f41526e5c0b98929801c169ff88bcbd6 URL: http://cgit.haiku-os.org/haiku/commit/?id=c516bac Author: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> Date: Sat Dec 21 19:25:24 2013 UTC Revert part of hrev24647 The baudrate constant for MIDI speed was after all the others in BeOS, and we have to keep them with the same values for things to work. Moreover, the constants in SerialPort.h were not changed, so everything was out of sync and all apps using BSerialPort ended up using the wrong speed. Add a comment in termios.h to make sure this doesn't happen again. ---------------------------------------------------------------------------- diff --git a/headers/posix/termios.h b/headers/posix/termios.h index ccf13ea..451208a 100644 --- a/headers/posix/termios.h +++ b/headers/posix/termios.h @@ -106,11 +106,14 @@ struct termios { #define B4800 0x0C #define B9600 0x0D #define B19200 0x0E -#define B31250 0x0F /* for MIDI */ -#define B38400 0x10 -#define B57600 0x11 -#define B115200 0x12 -#define B230400 0x13 +#define B38400 0x0F +#define B57600 0x10 +#define B115200 0x11 +#define B230400 0x12 +#define B31250 0x13 /* for MIDI */ + // Yes, this last one is out of order. Don't change it, it would break ABI. + // If you change it anyway, make sure the constants in SerialPort.h are + // matching. #define CSIZE 0x20 /* character size */ #define CS5 0x00 /* only 7 and 8 bits supported */ ############################################################################ Commit: e2367275a8c1ac6fd49c3925f39ec48ea2a7ded5 URL: http://cgit.haiku-os.org/haiku/commit/?id=e236727 Author: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> Date: Sat Dec 21 19:30:47 2013 UTC SerialConnect: fix baudrate settings save. There was a mixup of using the baudrate value (eg 115200), constant (B_115200_BPS = 17) and position in the menu (18), leading to the baudrate setting not being saved and restored properly. ---------------------------------------------------------------------------- diff --git a/src/apps/serialconnect/SerialApp.cpp b/src/apps/serialconnect/SerialApp.cpp index 8b8c167..73ca7836 100644 --- a/src/apps/serialconnect/SerialApp.cpp +++ b/src/apps/serialconnect/SerialApp.cpp @@ -135,69 +135,7 @@ void SerialApp::MessageReceived(BMessage* message) fSerialPort.SetFlowControl(flowcontrol); if(message->FindInt32("baudrate", &baudrate) == B_OK) { - data_rate rate; - switch(baudrate) { - case 50: - rate = B_50_BPS; - break; - case 75: - rate = B_75_BPS; - break; - case 110: - rate = B_110_BPS; - break; - case 134: - rate = B_134_BPS; - break; - case 150: - rate = B_150_BPS; - break; - case 200: - rate = B_200_BPS; - break; - case 300: - rate = B_300_BPS; - break; - case 600: - rate = B_600_BPS; - break; - case 1200: - rate = B_1200_BPS; - break; - case 1800: - rate = B_1800_BPS; - break; - case 2400: - rate = B_2400_BPS; - break; - case 4800: - rate = B_4800_BPS; - break; - case 9600: - rate = B_9600_BPS; - break; - case 19200: - rate = B_19200_BPS; - break; - case 31250: - rate = B_31250_BPS; - break; - case 38400: - rate = B_38400_BPS; - break; - case 57600: - rate = B_57600_BPS; - break; - case 115200: - rate = B_115200_BPS; - break; - case 230400: - rate = B_230400_BPS; - break; - default: - rate = B_0_BPS; - break; - } + data_rate rate = (data_rate)baudrate; fSerialPort.SetDataRate(rate); } @@ -275,7 +213,7 @@ status_t SerialApp::PollSerial(void*) { ssize_t bytesRead; - bytesRead = application->fSerialPort.Read(buffer, 256); + bytesRead = application->fSerialPort.Read(buffer, sizeof(buffer)); if (bytesRead == B_FILE_ERROR) { // Port is not open - wait for it and start over diff --git a/src/apps/serialconnect/SerialWindow.cpp b/src/apps/serialconnect/SerialWindow.cpp index 06b1f3a..aa60936 100644 --- a/src/apps/serialconnect/SerialWindow.cpp +++ b/src/apps/serialconnect/SerialWindow.cpp @@ -24,6 +24,15 @@ const int SerialWindow::kBaudrates[] = { 50, 75, 110, 134, 150, 200, 300, 600, }; +// The values for these constants are not in the expected order, so we have to +// rely on this lookup table if we want to keep the menu items sorted. +const int SerialWindow::kBaudrateConstants[] = { B_50_BPS, B_75_BPS, B_110_BPS, + B_134_BPS, B_150_BPS, B_200_BPS, B_300_BPS, B_600_BPS, B_1200_BPS, + B_1800_BPS, B_2400_BPS, B_4800_BPS, B_9600_BPS, B_19200_BPS, B_31250_BPS, + B_38400_BPS, B_57600_BPS, B_115200_BPS, B_230400_BPS +}; + + const char* SerialWindow::kWindowTitle = "SerialConnect"; @@ -135,7 +144,7 @@ SerialWindow::SerialWindow() for (int i = sizeof(kBaudrates) / sizeof(char*); --i >= 0;) { message = new BMessage(kMsgSettings); - message->AddInt32("baudrate", kBaudrates[i]); + message->AddInt32("baudrate", kBaudrateConstants[i]); char buffer[7]; sprintf(buffer,"%d", kBaudrates[i]); @@ -323,7 +332,7 @@ void SerialWindow::MessageReceived(BMessage* message) int32 code; item->Message()->FindInt32("baudrate", &code); - if(code == kBaudrates[baudrate]) + if(baudrate == code) item->SetMarked(true); } } diff --git a/src/apps/serialconnect/SerialWindow.h b/src/apps/serialconnect/SerialWindow.h index 4bd3816..58fdaa2 100644 --- a/src/apps/serialconnect/SerialWindow.h +++ b/src/apps/serialconnect/SerialWindow.h @@ -32,5 +32,6 @@ class SerialWindow: public BWindow BFilePanel* fLogFilePanel; static const int kBaudrates[]; + static const int kBaudrateConstants[]; static const char* kWindowTitle; }; ############################################################################ Revision: hrev46577 Commit: 92419037ccf2a475e0cc13b9813f2d52a0bc4453 URL: http://cgit.haiku-os.org/haiku/commit/?id=9241903 Author: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> Date: Sat Dec 21 19:34:01 2013 UTC SerialConnect: fix rdef file * Declare icon the right way, * Also add version and app signature. ---------------------------------------------------------------------------- diff --git a/src/apps/serialconnect/SerialConnect.rdef b/src/apps/serialconnect/SerialConnect.rdef index c7459fc..fe9a822 100644 --- a/src/apps/serialconnect/SerialConnect.rdef +++ b/src/apps/serialconnect/SerialConnect.rdef @@ -1,5 +1,19 @@ -resource(0) #'VICN' array { +resource app_signature "application/x-vnd.haiku.SerialConnect"; + +resource app_version { + major = 0, + middle = 0, + minor = 1, + + variety = B_APPV_BETA, + internal = 0, + + short_info = "SerialConnect", + long_info = "SerialConnect ©2012-2013 Haiku, Inc." +}; + +resource vector_icon { $"6E6369660C0500020016023AE1E7AED7F03173CB3D7FE449031D420E2000F3FF" $"C4020016023B243D3CD85EBD486D3B9FF848FB27498BD200FFFFC3020016023A" $"A45F38DDFFBBD0B93D840B4A428549300400FFFF7904017E020016023B2AAD3C"