]> git.ozlabs.org Git - petitboot/blobdiff - ui/common/ps3.c
ui/ncurses: Implement F10-F12 for autoboot device control
[petitboot] / ui / common / ps3.c
index abe269200a988cb68099b476556c7f11933f69f3..c9b97b5d2ca9da734b8b934c5113cc7c5ae59e18 100644 (file)
@@ -16,7 +16,9 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#define _GNU_SOURCE
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
 
 #include <assert.h>
 #include <errno.h>
@@ -87,7 +89,7 @@ static int ps3_flash_open(struct ps3_flash_ctx *fc, const char *mode)
        result = os_area_fixed_read(&fc->header, &fc->params, fc->dev);
 
        if (result) {
-               pb_log("%s: os_area_fixed_read failed: %s\n", __func__);
+               pb_log("%s: os_area_fixed_read failed\n", __func__);
                goto fail;
        }
 
@@ -111,16 +113,10 @@ int ps3_flash_get_values(struct ps3_flash_values *values)
        struct ps3_flash_ctx fc;
        uint64_t tmp;
 
-       /* Set default values. */
-
-       values->default_item = 0;
-       values->timeout = ps3_timeout_forever;
-       values->video_mode = 1;
-
        result = ps3_flash_open(&fc, "r");
 
        if (result)
-               goto done;
+               goto fail;
 
        result = os_area_db_read(&fc.db, &fc.header, fc.dev);
 
@@ -129,7 +125,7 @@ int ps3_flash_get_values(struct ps3_flash_values *values)
        if (result) {
                pb_log("%s: os_area_db_read failed: %s\n", __func__,
                        strerror(errno));
-               goto done;
+               goto fail;
        }
 
        sum = result = os_area_db_get(&fc.db, &id_default_item, &tmp);
@@ -147,14 +143,13 @@ int ps3_flash_get_values(struct ps3_flash_values *values)
        if (!result)
                values->video_mode = (uint16_t)tmp;
 
-done:
-       pb_log("%s: default_item: %x\n", __func__,
+       pb_debug("%s: default_item: %x\n", __func__,
                (unsigned int)values->default_item);
-       pb_log("%s: timeout: %u\n", __func__,
+       pb_debug("%s: timeout: %u\n", __func__,
                (unsigned int)values->timeout);
-       pb_log("%s: video_mode:   %u\n", __func__,
+       pb_debug("%s: video_mode:   %u\n", __func__,
                (unsigned int)values->video_mode);
-
+fail:
        return (result || sum) ? -1 : 0;
 }
 
@@ -170,8 +165,8 @@ int ps3_flash_set_values(const struct ps3_flash_values *values)
        int result;
        struct ps3_flash_ctx fc;
 
-       pb_log("%s: default_item: %u\n", __func__, values->default_item);
-       pb_log("%s: video_mode:   %u\n", __func__, values->video_mode);
+       pb_debug("%s: default_item: %u\n", __func__, values->default_item);
+       pb_debug("%s: video_mode:   %u\n", __func__, values->video_mode);
 
        result = ps3_flash_open(&fc, "r+");
 
@@ -252,7 +247,7 @@ static int ps3_video_ioctl(int request, unsigned int *mode_id)
 
 int ps3_set_video_mode(unsigned int mode_id)
 {
-       pb_log("%s: %u\n", __func__, mode_id);
+       pb_debug("%s: %u\n", __func__, mode_id);
        return ps3_video_ioctl(PS3FB_IOCTL_SETMODE, &mode_id);
 }