[haiku-commits] haiku: hrev48416 - in src: system/kernel/device_manager preferences/screen add-ons/kernel/drivers/disk/usb

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 2 Dec 2014 11:41:05 +0100 (CET)

hrev48416 adds 4 changesets to branch 'master'
old head: c37e6238d583741824f4bcc901e42a8b24055acd
new head: a2cb1737d8fda3e34f1701638a45bda7fa36c546
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=a2cb173+%5Ec37e623

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

38ec030: FileDevice: implement icon ioctls
  
  Fixes #9320.

0cd7643: usb_disk, usb_floppy: missing const.

8b46ee2: Screen prefs: move driver info to main window
  
  * Fixes relevant part of #5125
  * The remaining information (serial number, frequency ranges) is
  "advanced" and can be hidden in the tooltip. However, the video driver
  used may be important important information, if you want to know if you
  are using VESA, or if you have multiple video cards (Optimus for
  example).

a2cb173: Screen prefs: force weight of the two boxes
  
  Depending on the locale and string length the layout could leave only a
  small part of the window for the rightmost part, which is the important
  thing. Force the weight of each side so we have a more balanced window.

                                 [ Adrien Destugues <pulkomandy@xxxxxxxxx> ]

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

5 files changed, 94 insertions(+), 22 deletions(-)
.../drivers/disk/usb/usb_disk/usb_disk.cpp       |  2 +-
.../drivers/disk/usb/usb_floppy/usb_disk.cpp     |  2 +-
src/preferences/screen/ScreenWindow.cpp          | 47 ++++++++------
src/preferences/screen/ScreenWindow.h            |  1 +
src/system/kernel/device_manager/FileDevice.cpp  | 64 ++++++++++++++++++++

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

Commit:      38ec030acea301f4753364c54ecb19a3d6433cc7
URL:         http://cgit.haiku-os.org/haiku/commit/?id=38ec030
Author:      Adrien Destugues <pulkomandy@xxxxxxxxx>
Date:        Tue Dec  2 07:38:51 2014 UTC

Ticket:      https://dev.haiku-os.org/ticket/9320

FileDevice: implement icon ioctls

Fixes #9320.

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

diff --git a/src/system/kernel/device_manager/FileDevice.cpp 
b/src/system/kernel/device_manager/FileDevice.cpp
index 3522db5..826eb31 100644
--- a/src/system/kernel/device_manager/FileDevice.cpp
+++ b/src/system/kernel/device_manager/FileDevice.cpp
@@ -19,6 +19,43 @@
 
 static const uint32 kBlockSize = 512;
 
+static const uint8 kDeviceIcon[] = {
+       0x6e, 0x63, 0x69, 0x66, 0x08, 0x05, 0x00, 0x04, 0x00, 0x54, 0x02, 0x00,
+       0x06, 0x02, 0x3b, 0x01, 0x9b, 0x3a, 0xa2, 0x35, 0xbc, 0x24, 0x3e, 0x3c,
+       0x71, 0xd2, 0x48, 0xd1, 0x7c, 0x49, 0x84, 0x91, 0x00, 0xe7, 0xbb, 0x8f,
+       0xff, 0xc9, 0x98, 0x67, 0x02, 0x00, 0x06, 0x02, 0x3b, 0xa7, 0x11, 0x38,
+       0xd0, 0xc8, 0xbb, 0xf4, 0xb8, 0x3e, 0x90, 0xe6, 0x4a, 0xed, 0x7c, 0x48,
+       0x5b, 0xd7, 0x00, 0x8a, 0x56, 0x1d, 0xff, 0xb5, 0x7a, 0x3a, 0x02, 0x00,
+       0x06, 0x02, 0xbb, 0x6f, 0xcb, 0xb8, 0xd4, 0xc8, 0x39, 0xaa, 0x71, 0xbc,
+       0x39, 0x92, 0x49, 0x2f, 0xf1, 0x48, 0xd9, 0x6a, 0x00, 0xff, 0xc7, 0x90,
+       0xff, 0xff, 0xf4, 0xea, 0x03, 0x66, 0x33, 0x00, 0x03, 0xff, 0xdf, 0xc0,
+       0x03, 0xad, 0x72, 0x38, 0x11, 0x0a, 0x06, 0x26, 0x54, 0x3a, 0x46, 0x4c,
+       0x45, 0x5c, 0x4b, 0x4c, 0x60, 0x3e, 0x60, 0x0a, 0x06, 0x38, 0x22, 0x26,
+       0x2e, 0x26, 0x4f, 0x3c, 0x5a, 0x4e, 0x48, 0x4e, 0x2a, 0x0a, 0x04, 0x26,
+       0x2e, 0x26, 0x4f, 0x3c, 0x5a, 0x3c, 0x37, 0x0a, 0x04, 0x3c, 0x37, 0x3c,
+       0x5a, 0x4e, 0x48, 0x4e, 0x2a, 0x0a, 0x04, 0x38, 0x22, 0x26, 0x2e, 0x3c,
+       0x37, 0x4e, 0x2a, 0x0a, 0x04, 0x28, 0x32, 0x28, 0x4e, 0x3a, 0x57, 0x3a,
+       0x39, 0x0a, 0x04, 0x2a, 0x4d, 0x2b, 0x46, 0x38, 0x49, 0x2a, 0x43, 0x0a,
+       0x04, 0x2a, 0x4d, 0x36, 0x52, 0x38, 0x49, 0x2b, 0x46, 0x0a, 0x04, 0x2a,
+       0x4d, 0x38, 0x54, 0x38, 0x49, 0x36, 0x52, 0x0a, 0x04, 0x2e, 0x4c, 0xbb,
+       0x2b, 0xc5, 0xd3, 0xbb, 0x2b, 0xc5, 0x07, 0x2e, 0x4a, 0x0a, 0x04, 0x2c,
+       0x49, 0x34, 0x4d, 0x34, 0x4b, 0x2c, 0x47, 0x0a, 0x04, 0x2a, 0x35, 0x2a,
+       0x40, 0x2b, 0x38, 0x38, 0x3b, 0x0a, 0x04, 0x36, 0x44, 0x2a, 0x40, 0x38,
+       0x46, 0x38, 0x3b, 0x0a, 0x04, 0x2b, 0x38, 0x2a, 0x40, 0x36, 0x44, 0x38,
+       0x3b, 0x0a, 0x04, 0x2e, 0xbe, 0x67, 0x2e, 0xbf, 0x33, 0xbb, 0x2d, 0xc0,
+       0x3f, 0xbb, 0x2d, 0xbf, 0x73, 0x0a, 0x04, 0x2c, 0xbd, 0x29, 0x2c, 0xbd,
+       0xf5, 0x34, 0x3f, 0x34, 0x3d, 0x08, 0x02, 0x2a, 0x4e, 0x2a, 0x54, 0x0e,
+       0x0a, 0x01, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x01, 0x10, 0x10, 0x01, 0x17,
+       0x84, 0x20, 0x04, 0x0a, 0x00, 0x01, 0x10, 0x30, 0x30, 0x29, 0x01, 0x17,
+       0x84, 0x20, 0x04, 0x0a, 0x00, 0x01, 0x10, 0x30, 0x40, 0x1b, 0x01, 0x17,
+       0x84, 0x20, 0x04, 0x0a, 0x00, 0x01, 0x01, 0x10, 0x01, 0x17, 0x84, 0x00,
+       0x04, 0x0a, 0x02, 0x01, 0x02, 0x00, 0x0a, 0x03, 0x01, 0x03, 0x00, 0x0a,
+       0x04, 0x01, 0x04, 0x00, 0x0a, 0x05, 0x01, 0x05, 0x00, 0x0a, 0x06, 0x02,
+       0x0b, 0x06, 0x00, 0x0a, 0x02, 0x02, 0x07, 0x0d, 0x00, 0x0a, 0x07, 0x02,
+       0x0c, 0x08, 0x00, 0x0a, 0x03, 0x02, 0x09, 0x0e, 0x08, 0x15, 0xff, 0x0a,
+       0x00, 0x02, 0x0a, 0x0f, 0x08, 0x15, 0xff
+};
+
 
 struct FileDevice::Cookie {
        int     fd;
@@ -248,6 +285,33 @@ FileDevice::Control(void* _cookie, int32 op, void* buffer, 
size_t length)
                case B_GET_ICON:
                        return B_UNSUPPORTED;
 
+               case B_GET_ICON_NAME:
+                       return user_strlcpy((char *)buffer, 
"devices/device-volume",
+                               B_FILE_NAME_LENGTH);
+                       break;
+
+               case B_GET_VECTOR_ICON:
+               {
+                       if (length != sizeof(device_icon)) {
+                               return B_BAD_VALUE;
+                       }
+
+                       device_icon iconData;
+                       if (user_memcpy(&iconData, buffer, sizeof(device_icon)) 
!= B_OK) {
+                               return B_BAD_ADDRESS;
+                       }
+
+                       if (iconData.icon_size >= (int32)sizeof(kDeviceIcon)) {
+                               if (user_memcpy(iconData.icon_data, kDeviceIcon,
+                                               sizeof(kDeviceIcon)) != B_OK) {
+                                       return B_BAD_ADDRESS;
+                               }
+                       }
+
+                       iconData.icon_size = sizeof(kDeviceIcon);
+                       return user_memcpy(buffer, &iconData, 
sizeof(device_icon));
+               }
+
                case B_GET_GEOMETRY:
                case B_GET_BIOS_GEOMETRY:
                {

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

Commit:      0cd7643bd3699954e22c4c0bb49437bcd1c12ef7
URL:         http://cgit.haiku-os.org/haiku/commit/?id=0cd7643
Author:      Adrien Destugues <pulkomandy@xxxxxxxxx>
Date:        Tue Dec  2 08:15:26 2014 UTC

usb_disk, usb_floppy: missing const.

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

diff --git a/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp 
b/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp
index 093ad2a..6bdbdb0 100644
--- a/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp
+++ b/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp
@@ -45,7 +45,7 @@ static uint32 gLunCount = 0;
 static mutex gDeviceListLock;
 static char **gDeviceNames = NULL;
 
-static uint8 kDeviceIcon[] = {
+static const uint8 kDeviceIcon[] = {
        0x6e, 0x63, 0x69, 0x66, 0x0a, 0x04, 0x01, 0x73, 0x05, 0x01, 0x02, 0x01,
        0x06, 0x02, 0xb1, 0xf8, 0x5d, 0x3a, 0x2f, 0xbf, 0xbe, 0xdb, 0x67, 0xb6,
        0x98, 0x06, 0x4b, 0x22, 0x15, 0x47, 0x13, 0x02, 0x00, 0xed, 0xed, 0xed,
diff --git a/src/add-ons/kernel/drivers/disk/usb/usb_floppy/usb_disk.cpp 
b/src/add-ons/kernel/drivers/disk/usb/usb_floppy/usb_disk.cpp
index 3f5380c..5dda4df 100644
--- a/src/add-ons/kernel/drivers/disk/usb/usb_floppy/usb_disk.cpp
+++ b/src/add-ons/kernel/drivers/disk/usb/usb_floppy/usb_disk.cpp
@@ -39,7 +39,7 @@ static uint32 gLunCount = 0;
 static mutex gDeviceListLock;
 static char **gDeviceNames = NULL;
 
-static uint8 kDeviceIcon[] = {
+static const uint8 kDeviceIcon[] = {
        0x6e, 0x63, 0x69, 0x66, 0x0d, 0x03, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00,
        0x00, 0x6a, 0x02, 0x00, 0x16, 0x02, 0x38, 0x6a, 0xad, 0x38, 0xeb, 0x7a,
        0xbb, 0x77, 0x73, 0x3a, 0xde, 0x88, 0x48, 0xce, 0xdc, 0x4a, 0x75, 0xed,

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

Commit:      8b46ee25ac1409929f9a11efb254525e19b9b0bf
URL:         http://cgit.haiku-os.org/haiku/commit/?id=8b46ee2
Author:      Adrien Destugues <pulkomandy@xxxxxxxxx>
Date:        Tue Dec  2 10:17:58 2014 UTC

Ticket:      https://dev.haiku-os.org/ticket/5125

Screen prefs: move driver info to main window

* Fixes relevant part of #5125
* The remaining information (serial number, frequency ranges) is
"advanced" and can be hidden in the tooltip. However, the video driver
used may be important important information, if you want to know if you
are using VESA, or if you have multiple video cards (Optimus for
example).

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

diff --git a/src/preferences/screen/ScreenWindow.cpp 
b/src/preferences/screen/ScreenWindow.cpp
index 76e317d..ed840f7 100644
--- a/src/preferences/screen/ScreenWindow.cpp
+++ b/src/preferences/screen/ScreenWindow.cpp
@@ -221,6 +221,10 @@ ScreenWindow::ScreenWindow(ScreenSettings* settings)
        fMonitorInfo->SetAlignment(B_ALIGN_CENTER);
        screenBox->AddChild(fMonitorInfo);
 
+       fDeviceInfo = new BStringView("monitor info", "");
+       fDeviceInfo->SetAlignment(B_ALIGN_CENTER);
+       screenBox->AddChild(fDeviceInfo);
+
        fMonitorView = new MonitorView(BRect(0.0, 0.0, 80.0, 80.0),
                "monitor", screen.Frame().IntegerWidth() + 1,
                screen.Frame().IntegerHeight() + 1);
@@ -1255,6 +1259,25 @@ ScreenWindow::_UpdateMonitor()
                        fMonitorInfo->Hide();
        }
 
+       // Add info about the graphics device
+
+       accelerant_device_info deviceInfo;
+
+       if (fScreenMode.GetDeviceInfo(deviceInfo) == B_OK) {
+               BString deviceString;
+
+               if (deviceInfo.name[0] && deviceInfo.chipset[0]) {
+                       deviceString.SetToFormat("%s (%s)", deviceInfo.name,
+                               deviceInfo.chipset);
+               } else if (deviceInfo.name[0] || deviceInfo.chipset[0]) {
+                       deviceString
+                               = deviceInfo.name[0] ? deviceInfo.name : 
deviceInfo.chipset;
+               }
+
+               fDeviceInfo->SetText(deviceString);
+       }
+
+
        char text[512];
        size_t length = 0;
        text[0] = 0;
@@ -1279,23 +1302,7 @@ ScreenWindow::_UpdateMonitor()
                                && length < sizeof(text)) {
                                length += snprintf(text + length, sizeof(text) 
- length,
                                        " (%u/%u)", info.produced.week, 
info.produced.year);
-                       }
-               }
-       }
-
-       // Add info about the graphics device
-
-       accelerant_device_info deviceInfo;
-       if (fScreenMode.GetDeviceInfo(deviceInfo) == B_OK
-               && length < sizeof(text)) {
-               if (deviceInfo.name[0] && deviceInfo.chipset[0]) {
-                       length += snprintf(text + length, sizeof(text) - length,
-                               "%s%s (%s)", length != 0 ? "\n\n" : "", 
deviceInfo.name,
-                               deviceInfo.chipset);
-               } else if (deviceInfo.name[0] || deviceInfo.chipset[0]) {
-                       length += snprintf(text + length, sizeof(text) - length,
-                               "%s%s", length != 0 ? "\n\n" : "", 
deviceInfo.name[0]
-                                       ? deviceInfo.name : deviceInfo.chipset);
+                       }
                }
        }
 
diff --git a/src/preferences/screen/ScreenWindow.h 
b/src/preferences/screen/ScreenWindow.h
index aa90542..1d24134 100644
--- a/src/preferences/screen/ScreenWindow.h
+++ b/src/preferences/screen/ScreenWindow.h
@@ -70,6 +70,7 @@ private:
                        bool                    fBootWorkspaceApplied;
 
                        BStringView*    fMonitorInfo;
+                       BStringView*    fDeviceInfo;
                        MonitorView*    fMonitorView;
                        BMenuItem*              fAllWorkspacesItem;
 

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

Revision:    hrev48416
Commit:      a2cb1737d8fda3e34f1701638a45bda7fa36c546
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a2cb173
Author:      Adrien Destugues <pulkomandy@xxxxxxxxx>
Date:        Tue Dec  2 10:40:14 2014 UTC

Screen prefs: force weight of the two boxes

Depending on the locale and string length the layout could leave only a
small part of the window for the rightmost part, which is the important
thing. Force the weight of each side so we have a more balanced window.

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

diff --git a/src/preferences/screen/ScreenWindow.cpp 
b/src/preferences/screen/ScreenWindow.cpp
index ed840f7..511ed9a 100644
--- a/src/preferences/screen/ScreenWindow.cpp
+++ b/src/preferences/screen/ScreenWindow.cpp
@@ -515,7 +515,7 @@ ScreenWindow::ScreenWindow(ScreenSettings* settings)
        fApplyButton->SetEnabled(false);
        BLayoutBuilder::Group<>(outerControlsView)
                .AddGlue()
-                       .AddGroup(B_HORIZONTAL)
+               .AddGroup(B_HORIZONTAL)
                        .AddGlue()
                        .Add(fApplyButton);
 
@@ -525,11 +525,11 @@ ScreenWindow::ScreenWindow(ScreenSettings* settings)
 
        BLayoutBuilder::Group<>(this, B_VERTICAL, B_USE_DEFAULT_SPACING)
                .AddGroup(B_HORIZONTAL)
-                       .AddGroup(B_VERTICAL, 0)
+                       .AddGroup(B_VERTICAL, 0, 1)
                                
.AddStrut(floorf(controlsBox->TopBorderOffset()) - 1)
                                .Add(screenBox)
                                .End()
-                       .Add(controlsBox)
+                       .Add(controlsBox, 2)
                        .End()
                .AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING)
                        .Add(fRevertButton)


Other related posts: