1 /* ----------------------------------------------------------------------- *
3 * Copyright 2009 Pierre-Alexandre Meyer - All Rights Reserved
5 * Permission is hereby granted, free of charge, to any person
6 * obtaining a copy of this software and associated documentation
7 * files (the "Software"), to deal in the Software without
8 * restriction, including without limitation the rights to use,
9 * copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom
11 * the Software is furnished to do so, subject to the following
14 * The above copyright notice and this permission notice shall
15 * be included in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 * OTHER DEALINGS IN THE SOFTWARE.
26 * -----------------------------------------------------------------------
32 * compute_vpd - generate vpd menu
34 void compute_vpd(struct s_my_menu
*menu
, struct s_hardware
*hardware
)
36 char buffer
[SUBMENULEN
+ 1];
37 char statbuffer
[STATLEN
+ 1]; /* Status bar */
39 menu
->menu
= add_menu(" VPD ", -1);
40 menu
->items_count
= 0;
41 set_menu_pos(SUBMENU_Y
, SUBMENU_X
);
43 snprintf(buffer
, sizeof buffer
, "Address : %s",
44 hardware
->vpd
.base_address
);
45 snprintf(statbuffer
, sizeof statbuffer
, "Address: %s",
46 hardware
->cpu
.vendor
);
47 add_item(buffer
, statbuffer
, OPT_INACTIVE
, NULL
, 0);
50 if (strlen(hardware
->vpd
.bios_build_id
) > 0) {
51 snprintf(buffer
, sizeof buffer
, "Bios Build ID : %s",
52 hardware
->vpd
.bios_build_id
);
53 snprintf(statbuffer
, sizeof statbuffer
, "Bios Build ID: %s",
54 hardware
->vpd
.bios_build_id
);
55 add_item(buffer
, statbuffer
, OPT_INACTIVE
, NULL
, 0);
59 if (strlen(hardware
->vpd
.bios_release_date
) > 0) {
60 snprintf(buffer
, sizeof buffer
, "Bios Release Date : %s",
61 hardware
->vpd
.bios_release_date
);
62 snprintf(statbuffer
, sizeof statbuffer
, "Bios Release Date: %s",
63 hardware
->vpd
.bios_release_date
);
64 add_item(buffer
, statbuffer
, OPT_INACTIVE
, NULL
, 0);
68 if (strlen(hardware
->vpd
.bios_version
) > 0) {
69 snprintf(buffer
, sizeof buffer
, "Bios Version : %s",
70 hardware
->vpd
.bios_version
);
71 snprintf(statbuffer
, sizeof statbuffer
, "Bios Version: %s",
72 hardware
->vpd
.bios_version
);
73 add_item(buffer
, statbuffer
, OPT_INACTIVE
, NULL
, 0);
77 if (strlen(hardware
->vpd
.default_flash_filename
) > 0) {
78 snprintf(buffer
, sizeof buffer
, "Default Flash Filename : %s",
79 hardware
->vpd
.default_flash_filename
);
80 snprintf(statbuffer
, sizeof statbuffer
, "Default Flash Filename: %s",
81 hardware
->vpd
.default_flash_filename
);
82 add_item(buffer
, statbuffer
, OPT_INACTIVE
, NULL
, 0);
86 if (strlen(hardware
->vpd
.box_serial_number
) > 0) {
87 snprintf(buffer
, sizeof buffer
, "Box Serial Number : %s",
88 hardware
->vpd
.box_serial_number
);
89 snprintf(statbuffer
, sizeof statbuffer
, "Box Serial Number: %s",
90 hardware
->vpd
.box_serial_number
);
91 add_item(buffer
, statbuffer
, OPT_INACTIVE
, NULL
, 0);
95 if (strlen(hardware
->vpd
.motherboard_serial_number
) > 0) {
96 snprintf(buffer
, sizeof buffer
, "Motherboard Serial Number: %s",
97 hardware
->vpd
.motherboard_serial_number
);
98 snprintf(statbuffer
, sizeof statbuffer
, "Motherboard Serial Number: %s",
99 hardware
->vpd
.motherboard_serial_number
);
100 add_item(buffer
, statbuffer
, OPT_INACTIVE
, NULL
, 0);
104 if (strlen(hardware
->vpd
.machine_type_model
) > 0) {
105 snprintf(buffer
, sizeof buffer
, "Machine Type/Model : %s",
106 hardware
->vpd
.machine_type_model
);
107 snprintf(statbuffer
, sizeof statbuffer
, "Machine Type/Model: %s",
108 hardware
->vpd
.machine_type_model
);
109 add_item(buffer
, statbuffer
, OPT_INACTIVE
, NULL
, 0);
113 printf("MENU: VPD menu done (%d items)\n", menu
->items_count
);