| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // NOTE: this file is translated from gpio_setup.py | 5 // NOTE: this file is translated from gpio_setup.py |
| 6 // | 6 // |
| 7 // A script to create symlinks to platform specific GPIO pins. | 7 // A script to create symlinks to platform specific GPIO pins. |
| 8 // | 8 // |
| 9 // This script creates a set of symlinks pointing at the sys fs files returning | 9 // This script creates a set of symlinks pointing at the sys fs files returning |
| 10 // the appropriate GPIO pin values. Each symlink is named to represent the | 10 // the appropriate GPIO pin values. Each symlink is named to represent the |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 #include <ctype.h> | 50 #include <ctype.h> |
| 51 #include <getopt.h> | 51 #include <getopt.h> |
| 52 #include <glob.h> | 52 #include <glob.h> |
| 53 | 53 |
| 54 #include <string> | 54 #include <string> |
| 55 #include <vector> | 55 #include <vector> |
| 56 #include <map> | 56 #include <map> |
| 57 | 57 |
| 58 #define GPIO_ROOT "/sys/class/gpio" | 58 #define GPIO_ROOT "/sys/class/gpio" |
| 59 #define GPIO_DEVICE_ROOT GPIO_ROOT "/gpiochip" | 59 #define GPIO_DEVICE_ROOT GPIO_ROOT "/gpiochip" |
| 60 #define GPIO_ENABLE_FILE GPIO_ROOT "export" | 60 #define GPIO_ENABLE_FILE GPIO_ROOT "/export" |
| 61 | 61 |
| 62 // Can be changed using --pci_address command line option. | 62 // Can be changed using --pci_address command line option. |
| 63 #define DEFAULT_GPIO_DEVICE_PCI_ADDRESS "0000:00:1f.0" | 63 #define DEFAULT_GPIO_DEVICE_PCI_ADDRESS "0000:00:1f.0" |
| 64 | 64 |
| 65 // Can be changed using --acpi_root command line option. | 65 // Can be changed using --acpi_root command line option. |
| 66 #define DEFAULT_ACPI_ROOT "/sys/bus/platform/devices/chromeos_acpi" | 66 #define DEFAULT_ACPI_ROOT "/sys/bus/platform/devices/chromeos_acpi" |
| 67 | 67 |
| 68 // can be changed using --symlink_root command line option. | 68 // can be changed using --symlink_root command line option. |
| 69 #define DEFAULT_SYMLINK_ROOT "/home/gpio" | 69 #define DEFAULT_SYMLINK_ROOT "/home/gpio" |
| 70 | 70 |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 if (optind != argc) | 455 if (optind != argc) |
| 456 usage_help_exit(1); | 456 usage_help_exit(1); |
| 457 | 457 |
| 458 GpioChip gpioc(cmd_line_options.pci_address); | 458 GpioChip gpioc(cmd_line_options.pci_address); |
| 459 gpioc.Attach(); | 459 gpioc.Attach(); |
| 460 CreateGpioSymlinks( | 460 CreateGpioSymlinks( |
| 461 ParseAcpiMappings(cmd_line_options.acpi_root), | 461 ParseAcpiMappings(cmd_line_options.acpi_root), |
| 462 gpioc, cmd_line_options.symlink_root.c_str()); | 462 gpioc, cmd_line_options.symlink_root.c_str()); |
| 463 return 0; | 463 return 0; |
| 464 } | 464 } |
| OLD | NEW |