OLD | NEW |
1 /* Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | 1 /* Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
4 */ | 4 */ |
5 | 5 |
6 #include <stdio.h> | 6 #include <stdio.h> |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "host_common.h" | 9 #include "host_common.h" |
10 | 10 |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 char *t, *saveptr; | 466 char *t, *saveptr; |
467 | 467 |
468 /* Try reading firmware type from BINF.3. */ | 468 /* Try reading firmware type from BINF.3. */ |
469 binf3 = ReadFileInt(ACPI_BINF_PATH ".3"); | 469 binf3 = ReadFileInt(ACPI_BINF_PATH ".3"); |
470 if (BINF3_RECOVERY == binf3) | 470 if (BINF3_RECOVERY == binf3) |
471 return 0; /* Recovery mode never allows debug. */ | 471 return 0; /* Recovery mode never allows debug. */ |
472 else if (BINF3_DEVELOPER == binf3) | 472 else if (BINF3_DEVELOPER == binf3) |
473 return 1; /* Developer firmware always allows debug. */ | 473 return 1; /* Developer firmware always allows debug. */ |
474 | 474 |
475 /* Normal new firmware, older ChromeOS firmware, or non-Chrome firmware. | 475 /* Normal new firmware, older ChromeOS firmware, or non-Chrome firmware. |
476 * For all these cases, check /proc/cmdline for cros_debug. */ | 476 * For all these cases, check /proc/cmdline for cros_[no]debug. */ |
477 f = fopen(KERNEL_CMDLINE_PATH, "rt"); | 477 f = fopen(KERNEL_CMDLINE_PATH, "rt"); |
478 if (f) { | 478 if (f) { |
479 if (NULL == fgets(buf, sizeof(buf), f)) | 479 if (NULL == fgets(buf, sizeof(buf), f)) |
480 *buf = 0; | 480 *buf = 0; |
481 fclose(f); | 481 fclose(f); |
482 } | 482 } |
483 for (t = strtok_r(buf, " ", &saveptr); t; t=strtok_r(NULL, " ", &saveptr)) { | 483 for (t = strtok_r(buf, " ", &saveptr); t; t=strtok_r(NULL, " ", &saveptr)) { |
484 if (0 == strcmp(t, "cros_debug")) | 484 if (0 == strcmp(t, "cros_debug")) |
485 return 1; | 485 return 1; |
| 486 else if (0 == strcmp(t, "cros_nodebug")) |
| 487 return 0; |
486 } | 488 } |
487 | 489 |
488 /* Normal new firmware or older Chrome OS firmware allows debug if the | 490 /* Normal new firmware or older Chrome OS firmware allows debug if the |
489 * dev switch is on. */ | 491 * dev switch is on. */ |
490 if (1 == ReadFileBit(ACPI_CHSW_PATH, CHSW_DEV_BOOT)) | 492 if (1 == ReadFileBit(ACPI_CHSW_PATH, CHSW_DEV_BOOT)) |
491 return 1; | 493 return 1; |
492 | 494 |
493 /* All other cases disallow debug. */ | 495 /* All other cases disallow debug. */ |
494 return 0; | 496 return 0; |
495 } | 497 } |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 | 647 |
646 | 648 |
647 /* Set a system property string. | 649 /* Set a system property string. |
648 * | 650 * |
649 * Returns 0 if success, -1 if error. */ | 651 * Returns 0 if success, -1 if error. */ |
650 int VbSetSystemPropertyString(const char* name, const char* value) { | 652 int VbSetSystemPropertyString(const char* name, const char* value) { |
651 | 653 |
652 /* TODO: support setting */ | 654 /* TODO: support setting */ |
653 return -1; | 655 return -1; |
654 } | 656 } |
OLD | NEW |