1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// This file is part of fpgad, an application to manage FPGA subsystem together with device-tree and kernel modules.
//
// Copyright 2025 Canonical Ltd.
//
// SPDX-License-Identifier: GPL-3.0-only
//
// fpgad is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published by the Free Software Foundation.
//
// fpgad is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
//! XlnxSys command implementation for the FPGA CLI.
//!
//! This module provides direct access to the daemon's `xlnx_sys` read/write interface,
//! allowing low-level control of FPGA manager sysfs properties and flags without needing
//! a platform-specific subcommand.
//!
//! # Subcommands
//!
//! ## Read
//! One of `read_property` or `read_flags` — see
//! [`ReadSubCommand`](https://docs.rs/fpgad/latest/fpgad/platforms/xlnx_sys/enum.ReadSubCommand.html)
//! ```shell
//! fpgad xlnx-sys read read_property /sys/class/fpga_manager/fpga0/name
//! fpgad xlnx-sys read read_flags fpga0
//! ```
//!
//! ## Write
//! One of `write_flags`, `write_property`, `write_property_bytes` — see
//! [`WriteSubCommand`](https://docs.rs/fpgad/latest/fpgad/platforms/xlnx_sys/enum.WriteSubCommand.html)
//!
//! ```shell
//! fpgad xlnx-sys write write_flags fpga0 0x20
//! fpgad xlnx-sys write write_property /sys/class/fpga_manager/fpga0/key VALUE
//! fpgad xlnx-sys write write_property_bytes /sys/class/fpga_manager/fpga0/key BYTES
//! ```
use crateXlnxSysSubcommand;
use ;
use ;
/// Sends the `xlnx_sys` read command to the daemon's status interface.
///
/// # Arguments
///
/// * `sub_cmd` - One of `read_property` or `read_flags` — see
/// [`ReadSubCommand`](https://docs.rs/fpgad/latest/fpgad/platforms/xlnx_sys/enum.ReadSubCommand.html)
/// * `path` - Sysfs property path for `read_property`, or device handle for `read_flags`
///
/// # Returns: `Result<String, zbus::Error>`
/// * `Ok(String)` - Result from the daemon
/// * `Err(zbus::Error)` - DBus communication error or FpgadError.
/// See [Error Handling](../index.html#error-handling) for details.
async
/// Sends the `xlnx_sys` write command to the daemon's control interface.
///
/// # Arguments
///
/// * `sub_cmd` - One of `write_flags`, `write_property`, `write_property_bytes` — see
/// [`WriteSubCommand`](https://docs.rs/fpgad/latest/fpgad/platforms/xlnx_sys/enum.WriteSubCommand.html)
/// * `path` - Device handle for `write_flags`, or sysfs property path for property writes
/// * `value` - Value to write
///
/// # Returns: `Result<String, zbus::Error>`
/// * `Ok(String)` - Success message from the daemon
/// * `Err(zbus::Error)` - DBus communication error or FpgadError.
/// See [Error Handling](../index.html#error-handling) for details.
async
/// Main handler for the xlnx_sys command.
///
/// Dispatches to the appropriate read or write call based on the subcommand.
///
/// # Arguments
///
/// * `sub_command` - The xlnx_sys subcommand (read or write) with its arguments
///
/// # Returns: `Result<String, zbus::Error>`
/// * `Ok(String)` - Result from the daemon
/// * `Err(zbus::Error)` - DBus communication error or FpgadError.
/// See [Error Handling](../index.html#error-handling) for details.
pub async