Changeset 1390 for trunk


Ignore:
Timestamp:
07/26/11 02:54:42 (10 months ago)
Author:
stefanct
Message:

be more refined regarding DMI chassis types

we had broken laptops in the past that were not detected as such because
their DMI chassis-type was either undefined/out-of-spec, or set to
'other' or 'unknown'.

this patch tries to mitigate this problem as follows:

  • if the DMI chassis-type clearly identifies the system as laptop/notebook/mobile platform then nothing changes: the user gets the laptop warning without a hint to the force switch.
  • if the DMI chassis-type is not specific enough, we warn the user similarly, but tell them the switch.

to reduce the number of false positives i have added a few new
chassis types that we have encountered in the last months to the list.

Signed-off-by: Stefan Tauner <stefan.tauner@…>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@…>

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/dmi.c

    r1367 r1390  
    5555}; 
    5656 
    57 /* A full list of chassis types can be found in the System Management BIOS 
     57/* This list is used to identify supposed laptops. The is_laptop field has the 
     58 * following meaning: 
     59 *      - 0: in all likelihood not a laptop 
     60 *      - 1: in all likelihood a laptop 
     61 *      - 2: chassis-type is not specific enough 
     62 * A full list of chassis types can be found in the System Management BIOS 
    5863 * (SMBIOS) Reference Specification 2.7.0 section 7.4.1 "Chassis Types" at 
    5964 * http://www.dmtf.org/sites/default/files/standards/documents/DSP0134_2.7.0.pdf 
     
    6570        const char *name; 
    6671} dmi_chassis_types[] = { 
    67         {0x01, 0, "Other"}, 
    68         {0x02, 0, "Unknown"}, 
     72        {0x01, 2, "Other"}, 
     73        {0x02, 2, "Unknown"}, 
    6974        {0x03, 0, "Desktop",}, 
     75        {0x06, 0, "Mini Tower"}, 
     76        {0x07, 0, "Tower"}, 
    7077        {0x08, 1, "Portable"}, 
    7178        {0x09, 1, "Laptop"}, 
     
    7380        {0x0b, 1, "Hand Held"}, 
    7481        {0x0e, 1, "Sub Notebook"}, 
     82        {0x11, 0, "Main Server Chassis"}, 
     83        {0x17, 0, "Rack Mount Chassis"}, 
    7584}; 
    7685 
     
    153162 
    154163        chassis_type = get_dmi_string("chassis-type"); 
    155         if (chassis_type) { 
    156                 for (i = 0; i < ARRAY_SIZE(dmi_chassis_types); i++) { 
    157                         if (!strcasecmp(chassis_type, 
    158                                         dmi_chassis_types[i].name) && 
    159                             dmi_chassis_types[i].is_laptop) { 
    160                                 msg_pdbg("Laptop detected via DMI\n"); 
    161                                 is_laptop = 1; 
    162                         } 
     164        if (chassis_type == NULL) 
     165                return; 
     166 
     167        is_laptop = 2; 
     168        for (i = 0; i < ARRAY_SIZE(dmi_chassis_types); i++) { 
     169                if (strcasecmp(chassis_type, dmi_chassis_types[i].name) == 0) { 
     170                        is_laptop = dmi_chassis_types[i].is_laptop; 
     171                        break; 
    163172                } 
     173        } 
     174 
     175        switch (is_laptop) { 
     176        case 1: 
     177                msg_pdbg("Laptop detected via DMI.\n"); 
     178                break; 
     179        case 2: 
     180                msg_pdbg("DMI chassis-type is not specific enough.\n"); 
     181                break; 
    164182        } 
    165183        free(chassis_type); 
  • trunk/internal.c

    r1371 r1390  
    231231        /* Warn if a non-whitelisted laptop is detected. */ 
    232232        if (is_laptop && !laptop_ok) { 
    233                 msg_perr("========================================================================\n" 
    234                          "WARNING! You seem to be running flashrom on an unsupported laptop.\n" 
    235                          "Laptops, notebooks and netbooks are difficult to support and we recommend\n" 
    236                          "to use the vendor flashing utility. The embedded controller (EC) in these\n" 
    237                          "machines often interacts badly with flashing.\n" 
     233                msg_perr("========================================================================\n"); 
     234                if (is_laptop == 1) { 
     235                        msg_perr("WARNING! You seem to be running flashrom on an unsupported laptop.\n"); 
     236                } else { 
     237                        msg_perr("WARNING! You may be running flashrom on an unsupported laptop. We could\n" 
     238                                 "not detect this for sure because your vendor has not setup the SMBIOS\n" 
     239                                 "tables correctly. You can enforce execution by adding\n" 
     240                                 "'-p internal:laptop=force_I_want_a_brick' to the command line, but\n" 
     241                                 "please read the following warning if you are not sure.\n\n"); 
     242                } 
     243                msg_perr("Laptops, notebooks and netbooks are difficult to support and we\n" 
     244                         "recommend to use the vendor flashing utility. The embedded controller\n" 
     245                         "(EC) in these machines often interacts badly with flashing.\n" 
    238246                         "See http://www.flashrom.org/Laptops for details.\n\n" 
    239247                         "If flash is shared with the EC, erase is guaranteed to brick your laptop\n" 
     
    243251                         "You have been warned.\n" 
    244252                         "========================================================================\n"); 
     253 
    245254                if (force_laptop) { 
    246255                        msg_perr("Proceeding anyway because user specified " 
Note: See TracChangeset for help on using the changeset viewer.