tools/crypto/ccp/dbc_cli.py
Source file repositories/reference/linux-study-clean/tools/crypto/ccp/dbc_cli.py
File Facts
- System
- Linux kernel
- Corpus path
tools/crypto/ccp/dbc_cli.py- Extension
.py- Size
- 4637 bytes
- Lines
- 135
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: tools
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
#!/usr/bin/python3
# SPDX-License-Identifier: GPL-2.0
import argparse
import binascii
import os
import errno
from dbc import *
ERRORS = {
errno.EACCES: "Access is denied",
errno.E2BIG: "Excess data provided",
errno.EINVAL: "Bad parameters",
errno.EAGAIN: "Bad state",
errno.ENOENT: "Not implemented or message failure",
errno.EBUSY: "Busy",
errno.ENFILE: "Overflow",
errno.EPERM: "Signature invalid",
}
messages = {
"get-fmax-cap": PARAM_GET_FMAX_CAP,
"set-fmax-cap": PARAM_SET_FMAX_CAP,
"get-power-cap": PARAM_GET_PWR_CAP,
"set-power-cap": PARAM_SET_PWR_CAP,
"get-graphics-mode": PARAM_GET_GFX_MODE,
"set-graphics-mode": PARAM_SET_GFX_MODE,
"get-current-temp": PARAM_GET_CURR_TEMP,
"get-fmax-max": PARAM_GET_FMAX_MAX,
"get-fmax-min": PARAM_GET_FMAX_MIN,
"get-soc-power-max": PARAM_GET_SOC_PWR_MAX,
"get-soc-power-min": PARAM_GET_SOC_PWR_MIN,
"get-soc-power-cur": PARAM_GET_SOC_PWR_CUR,
}
def _pretty_buffer(ba):
return str(binascii.hexlify(ba, " "))
def parse_args():
parser = argparse.ArgumentParser(
description="Dynamic Boost control command line interface"
)
parser.add_argument(
"command",
choices=["get-nonce", "get-param", "set-param", "set-uid"],
help="Command to send",
)
parser.add_argument("--device", default="/dev/dbc", help="Device to operate")
parser.add_argument("--signature", help="File containing signature for command")
parser.add_argument("--message", choices=messages.keys(), help="Message index")
parser.add_argument("--data", help="Argument to pass to message")
parser.add_argument("--uid", help="File containing UID to pass")
return parser.parse_args()
def pretty_error(code):
if code in ERRORS:
print(ERRORS[code])
else:
print("failed with return code %d" % code)
if __name__ == "__main__":
args = parse_args()
data = 0
sig = None
uid = None
if not os.path.exists(args.device):
raise IOError("Missing device {device}".format(device=args.device))
Annotation
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.