hdt: Fixing latency indentation
[profile/ivi/syslinux.git] / com32 / hdt / hdt-menu-pxe.c
1 /* ----------------------------------------------------------------------- *
2  *
3  *   Copyright 2009 Erwan Velu - All Rights Reserved
4  *
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
12  *   conditions:
13  *
14  *   The above copyright notice and this permission notice shall
15  *   be included in all copies or substantial portions of the Software.
16  *
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.
25  *
26  * -----------------------------------------------------------------------
27  */
28
29 #include "hdt-menu.h"
30
31 /* Main Kernel menu */
32 void compute_PXE(struct s_my_menu *menu, struct s_hardware *hardware)
33 {
34   char buffer[SUBMENULEN + 1];
35   char infobar[STATLEN + 1];
36
37   if (hardware->is_pxe_valid == false)
38     return;
39
40   menu->menu = add_menu(" PXE ", -1);
41   menu->items_count = 0;
42   set_menu_pos(SUBMENU_Y, SUBMENU_X);
43
44   struct s_pxe *p = &hardware->pxe;
45
46   if ((hardware->pci_ids_return_code == -ENOPCIIDS) || (p->pci_device==NULL))  {
47     snprintf(buffer, sizeof buffer, "PCI Vendor    : %d",
48        p->vendor_id);
49     snprintf(infobar, sizeof infobar, "PCI Vendor    : %d",
50        p->vendor_id);
51     add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
52     menu->items_count++;
53
54     snprintf(buffer, sizeof buffer, "PCI Product   : %d",
55        p->vendor_id);
56     snprintf(infobar, sizeof infobar, "PCI Product   : %d",
57        p->vendor_id);
58     add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
59     menu->items_count++;
60
61     snprintf(buffer, sizeof buffer, "PCI SubVendor  : %d",
62        p->subvendor_id);
63     snprintf(infobar, sizeof infobar, "PCI SubVendor  : %d",
64        p->subvendor_id);
65     add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
66     menu->items_count++;
67
68     snprintf(buffer, sizeof buffer, "PCI SubProduct : %d",
69        p->subproduct_id);
70     snprintf(infobar, sizeof infobar, "PCI SubProduct : %d",
71        p->subproduct_id);
72     add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
73     menu->items_count++;
74
75     snprintf(buffer, sizeof buffer, "PCI Revision   : %d", p->rev);
76     snprintf(infobar, sizeof infobar, "PCI Revision   : %d",
77        p->rev);
78     add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
79     menu->items_count++;
80
81     snprintf(buffer, sizeof buffer,
82        "PCI Bus Pos.   : %02x:%02x.%02x", p->pci_bus,
83        p->pci_dev, p->pci_func);
84     snprintf(infobar, sizeof infobar,
85        "PCI Bus Pos.   : %02x:%02x.%02x", p->pci_bus,
86        p->pci_dev, p->pci_func);
87     add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
88     menu->items_count++;
89
90   } else {
91
92     snprintf(buffer, sizeof buffer, "Manufacturer : %s",
93        p->pci_device->dev_info->vendor_name);
94     snprintf(infobar, sizeof infobar, "Manufacturer : %s",
95        p->pci_device->dev_info->vendor_name);
96     add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
97     menu->items_count++;
98
99     snprintf(buffer, sizeof buffer, "Product      : %s",
100        p->pci_device->dev_info->product_name);
101     snprintf(infobar, sizeof infobar, "Product      : %s",
102        p->pci_device->dev_info->product_name);
103     add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
104     menu->items_count++;
105   }
106
107   snprintf(buffer, sizeof buffer, "MAC Address  : %s", p->mac_addr);
108   snprintf(infobar, sizeof infobar, "MAC Address  : %s", p->mac_addr);
109   add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
110   menu->items_count++;
111
112   snprintf(buffer, sizeof buffer, "IP Address   : %d.%d.%d.%d",
113      p->ip_addr[0], p->ip_addr[1], p->ip_addr[2], p->ip_addr[3]);
114   snprintf(infobar, sizeof infobar, "IP Address   : %d.%d.%d.%d",
115      p->ip_addr[0], p->ip_addr[1], p->ip_addr[2], p->ip_addr[3]);
116   add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
117   menu->items_count++;
118
119   printf("MENU: PXE menu done (%d items)\n", menu->items_count);
120 }