canonical-hardware-api-7bedc4f/0000755000175000017500000000000015040433217016432 5ustar nadzeyanadzeyacanonical-hardware-api-7bedc4f/Cargo.toml0000644000175000017500000000105115037740715020371 0ustar nadzeyanadzeya[workspace] members = ["hwctl", "hwlib"] resolver = "2" [workspace.package] version = "0.9.3" edition = "2021" authors = [ "Canonical Hardware Certification ", "Nadzeya Hutsko ", "Matias Piipari ", ] documentation = "https://github.com/canonical/hardware-api/" homepage = "https://github.com/canonical/hardware-api/" repository = "https://github.com/canonical/hardware-api/" [workspace.dependencies] anyhow = "~1.0.0" serde_json = "~1.0.0" canonical-hardware-api-7bedc4f/hwctl/0000755000175000017500000000000015037740715017565 5ustar nadzeyanadzeyacanonical-hardware-api-7bedc4f/hwctl/LICENSE0000644000175000017500000010451515037740715020600 0ustar nadzeyanadzeya GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 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 . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . canonical-hardware-api-7bedc4f/hwctl/Cargo.toml0000644000175000017500000000112415037740715021513 0ustar nadzeyanadzeya[package] name = "hwctl" description = "CLI tool to check hardware certification status" license = "GPL-3.0-only" version.workspace = true edition.workspace = true authors.workspace = true documentation.workspace = true homepage.workspace = true repository.workspace = true [package.metadata.vendor-filter] platforms = ["*-unknown-linux-gnu"] tier = "2" all-features = false [target.'cfg(target_os = "linux")'.dependencies] hwlib = { path = "../hwlib" } serde_json = { workspace = true } anyhow = { workspace = true } [dependencies] clap = { version = "4.5.41", features = ["derive", "env"] } canonical-hardware-api-7bedc4f/hwctl/src/0000755000175000017500000000000015037740715020354 5ustar nadzeyanadzeyacanonical-hardware-api-7bedc4f/hwctl/src/main.rs0000644000175000017500000000464515037740715021657 0ustar nadzeyanadzeya/* Copyright 2024 Canonical Ltd. * * This program 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. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY 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 . * * Written by: * Canonical Ltd * Nadzeya Hutsko */ use anyhow::{Context, Result}; use clap::Parser; use std::process::ExitCode; use hwlib::models::request_validators::{CertificationStatusRequest, Paths}; use hwlib::send_certification_status_request; /// CLI tool to check hardware certification status. /// /// The utility checks the Ubuntu Hardware Certification status of your /// system. It verifies whether your exact machine model or a similar system has been /// certified and displays which Ubuntu releases the certification covers for it. /// /// For more information about the Ubuntu Hardware Certification Program, visit /// the certification website: https://ubuntu.com/certified /// /// Note that root privileges are typically required to run this command. #[derive(Parser, Debug)] #[command(version, about, long_about, verbatim_doc_comment)] struct Args { #[arg( long = "server", env = "HW_API_URL", default_value = "https://hw.ubuntu.com", help = "API server URL" )] hw_api_url: String, } fn main() -> ExitCode { let args = Args::parse(); match run(args.hw_api_url) { Ok(_) => ExitCode::SUCCESS, Err(e) => { eprintln!("ERROR: {e:?}"); ExitCode::FAILURE } } } fn run(server_url: String) -> Result<()> { let cert_status_request = CertificationStatusRequest::new(Paths::default()).context("cannot collect system data")?; let response = send_certification_status_request(server_url, &cert_status_request) .context("cannot send certification status request")?; let response_json = serde_json::to_string_pretty(&response).context("cannot serialize response as JSON")?; println!("{response_json}"); Ok(()) } canonical-hardware-api-7bedc4f/CONTRIBUTING.md0000644000175000017500000000451415037740715020701 0ustar nadzeyanadzeya# Contributing to the Hardware API Client This document provides the information needed to contribute to the Hardware API Client. For basic usage of the `hardware-api` client, refer to the client [readme](./README.md). For general contribution guidelines for the `hardware-api` project, refer to the [contribution guide](../CONTRIBUTING.md). ## Snap Package `hwctl` is packaged as a [snap]. To build the snap package locally, install [`snapcraft`][snapcraft] and run the following command: ```shell snapcraft pack ``` The above command will create a file in the form of `hwctl__.snap`. To install the snap locally, run the following command: ```shell sudo snap install --dangerous hwctl__.snap # The following interfaces are required to run the snap package # They are not automatically connected when installing a local package sudo snap connect hwctl:hardware-observe sudo snap connect hwctl:kenrel-module-observe sudo snap connect hwctl:system-observe ``` ## Use Python Bindings The `hwlib` library can be used in Python code as well. We're using the [`pyo3`][pyo3] library to create Python bindings; to build them, you need to have [`maturin`][maturin] installed on your system. It requires a virtual environment to be configured to work with it: ```shell virtualenv venv source venv/bin/activate pip install maturin ``` Then run the following commands: ```shell cd hwlib maturin develop ``` Now you can use the library in your Python code. The library requires root access since we collect the hardware information using SMBIOS data. If you're running it on a device that doesn't have SMBIOS data available, root privileges are not required. ```python $ sudo /path/to/venv/bin/python3 # or `python3` >>> import hwlib >>> hwlib.get_certification_status("https://hw.ubuntu.com") ``` ## Test Since we're using Python bindings, this library contains tests for both Rust and Python code. To execute them, run the following commands in the `hwlib/` directory: - Run Rust tests: `$ cargo test` - Run Python tests: You need to have [`tox`][tox] (`pip install tox`). Then you can run Python tests with `$ tox` [snap]: https://snapcraft.io/hwctl [snapcraft]: https://github.com/canonical/snapcraft [pyo3]: https://github.com/PyO3/pyo3 [maturin]: https://github.com/PyO3/maturin [tox]: https://github.com/tox-dev/tox canonical-hardware-api-7bedc4f/hwlib/0000755000175000017500000000000015037740715017551 5ustar nadzeyanadzeyacanonical-hardware-api-7bedc4f/hwlib/LICENSE0000644000175000017500000001674415037740715020572 0ustar nadzeyanadzeya GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. canonical-hardware-api-7bedc4f/hwlib/tox.ini0000644000175000017500000000044415037740715021066 0ustar nadzeyanadzeya[tox] envlist = py skipsdist = true [testenv] deps = black ruff pytest maturin commands_pre = {envbindir}/maturin develop commands = {envbindir}/python -m black --check pytests/ {envbindir}/python -m ruff check pytests/ {envbindir}/python -m pytest pytests/ canonical-hardware-api-7bedc4f/hwlib/Cargo.toml0000644000175000017500000000170215037740715021501 0ustar nadzeyanadzeya[package] name = "hwlib" description = "Collects and sends hardware information to hwapi to find testing status of the device model" license = "LGPL-3.0-only" version.workspace = true edition.workspace = true authors.workspace = true documentation.workspace = true homepage.workspace = true repository.workspace = true [lib] name = "hwlib" crate-type = ["cdylib", "rlib"] [dependencies] anyhow = { workspace = true } minreq = { version = "2.14.0", features = ["native-tls", "json-using-serde"], default-features = false } os-release = { version = "0.1.0" } pyo3 = { version = "0.25.0", features = ["extension-module"] } serde = { version = "~1.0.0", features = ["derive"] } serde_json = { workspace = true } smbios-lib = "0.9.0" [dev-dependencies] simple_test_case = "1.2.0" pretty_assertions = "1.4.1" [package.metadata.deb] maintainer = "Canonical Hardware Certification " copyright = "Copyright 2024 Canonical Ltd." canonical-hardware-api-7bedc4f/hwlib/pytests/0000755000175000017500000000000015037740715021264 5ustar nadzeyanadzeyacanonical-hardware-api-7bedc4f/hwlib/pytests/test_cert_status.py0000644000175000017500000000164015037740715025236 0ustar nadzeyanadzeya# Copyright 2024 Canonical Ltd. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License version # 3, as published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY 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 . # # Written by: # Nadzeya Hutsko def test_send_certification_request(): """Verify that we can import and call the library in the python code""" import hwlib assert hasattr(hwlib, "send_certification_request") assert callable(hwlib.send_certification_request) canonical-hardware-api-7bedc4f/hwlib/src/0000755000175000017500000000000015037740715020340 5ustar nadzeyanadzeyacanonical-hardware-api-7bedc4f/hwlib/src/helpers.rs0000644000175000017500000000660115037740715022353 0ustar nadzeyanadzeya/* Copyright 2024 Canonical Ltd. * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 3, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Written by: * Nadzeya Hutsko */ use std::path::PathBuf; pub(crate) fn append_to_pathbuf(p: PathBuf, s: &str) -> PathBuf { let mut p = p.into_os_string(); p.push(s); p.into() } #[cfg(test)] pub(crate) mod test_utils { use crate::collectors::os_info::CommandRunner; use anyhow::{anyhow, bail, Result}; use std::{collections::HashMap, env, fs::read_dir, path::PathBuf}; type SystemCommand<'args> = (&'args str, Vec<&'args str>); pub(crate) struct MockCommandRunner<'args> { calls: HashMap, Result<&'args str>>, } impl<'args> MockCommandRunner<'args> { pub(crate) fn new(calls: Vec<(SystemCommand<'args>, Result<&'args str>)>) -> Self { let calls = calls.into_iter().collect(); Self { calls } } } impl CommandRunner for MockCommandRunner<'_> { fn run_command(&self, cmd: &str, args: &[&str]) -> Result { match self.calls.get(&(cmd, args.to_vec())) { Some(res) => match res { Ok(output) => Ok(output.to_string()), Err(e) => Err(anyhow!(e.to_string())), }, None => Err(anyhow!(format!("missing mock: cmd={cmd:?} args={args:?}"))), } } } pub(crate) fn get_test_filepath(file_name: &str) -> PathBuf { let mut path = get_project_root().unwrap(); let test_data_path = path.join("test_data"); if !test_data_path.is_dir() { // If test_data/ is not found, we're in the client root path.extend(["hwlib"]); } path.extend(["test_data", file_name]); path } fn get_project_root() -> Result { let path = env::current_dir()?; let path_ancestors = path.as_path().ancestors(); for p in path_ancestors { let has_cargo_lock = read_dir(p)? .flat_map(|entry| entry.ok()) .any(|entry| entry.file_name() == "Cargo.lock"); if has_cargo_lock { return Ok(PathBuf::from(p)); } } bail!("ran out of places to find Cargo.lock") } /// Reads data from the specified JSON file and substitutes /// placeholders with actual values provided in /// `vars`. Placeholders in the JSON file should follow the shell /// vars style format, like `${FOO}`. /// `vars is A list of key-value pairs, where each key corresponds /// to a placeholder name, and each value is the replacement /// string. pub(crate) fn apply_vars(mut content: String, vars: &[(&str, &str)]) -> String { for (k, v) in vars { content = content.replace(&format!("${k}"), v); } content } } canonical-hardware-api-7bedc4f/hwlib/src/lib.rs0000644000175000017500000000266115037740715021461 0ustar nadzeyanadzeya/* Copyright 2024 Canonical Ltd. * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 3, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Written by: * Canonical Ltd * Nadzeya Hutsko */ #[cfg(test)] #[macro_use] extern crate pretty_assertions; pub mod collectors; mod constants; mod helpers; pub mod models; pub mod py_bindings; use anyhow::Result; use constants::CERT_STATUS_ENDPOINT; use models::{ request_validators::CertificationStatusRequest, response_validators::CertificationStatusResponse, }; pub fn send_certification_status_request( url: String, request: &CertificationStatusRequest, ) -> Result { let mut server_url = url.clone(); server_url.push_str(CERT_STATUS_ENDPOINT); let response = minreq::post(&server_url) .with_json(request)? .send()? .json()?; Ok(response) } canonical-hardware-api-7bedc4f/hwlib/src/constants.rs0000644000175000017500000000233415037740715022724 0ustar nadzeyanadzeya/* Copyright 2024 Canonical Ltd. * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 3, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Written by: * Nadzeya Hutsko */ pub const CERT_STATUS_ENDPOINT: &str = "/v1/certification/status"; pub const CPU_MAX_FREQ_FILE_PATH: &str = "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq"; pub const PROC_CPUINFO_FILE_PATH: &str = "/proc/cpuinfo"; pub const PROC_DEVICE_TREE_DIR_PATH: &str = "/proc/device-tree/"; pub const PROC_VERSION_FILE_PATH: &str = "/proc/version"; // The os-release file path is defined in build.rs at build time pub const OS_RELEASE_FILE_PATH: &str = env!("OS_RELEASE_FILE_PATH"); pub const LSMOD: &str = "/usr/bin/lsmod"; canonical-hardware-api-7bedc4f/hwlib/src/py_bindings.rs0000644000175000017500000000413115037740715023212 0ustar nadzeyanadzeya/* Copyright 2024 Canonical Ltd. * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 3, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Written by: * Nadzeya Hutsko */ use crate::{ models::request_validators::{CertificationStatusRequest, Paths}, send_certification_status_request as native_send_certification_status_request, }; use pyo3::{ exceptions::PyRuntimeError, prelude::*, types::PyString, wrap_pyfunction, {PyObject, PyResult, Python}, }; use serde_json; /// This function creates and sends the certification status request to the specified /// hardware-api server URL. #[pyfunction] fn send_certification_request(py: Python, url: String) -> PyResult { let request_body = CertificationStatusRequest::new(Paths::default()) .map_err(|e| PyRuntimeError::new_err(format!("failed to create request: {e}")))?; let response = native_send_certification_status_request(url, &request_body); match response { Ok(response_value) => { let json_str = serde_json::json!(response_value).to_string(); let json: PyObject = PyString::new(py, &json_str).into(); let json_module = py.import("json")?; let json_object: PyObject = json_module.call_method1("loads", (json,))?.into(); Ok(json_object) } Err(e) => Err(PyErr::new::(format!( "Request failed: {e}" ))), } } #[pymodule] fn hwlib(m: &Bound<'_, PyModule>) -> PyResult<()> { m.add_function(wrap_pyfunction!(send_certification_request, m)?)?; Ok(()) } canonical-hardware-api-7bedc4f/hwlib/src/collectors/0000755000175000017500000000000015037740715022511 5ustar nadzeyanadzeyacanonical-hardware-api-7bedc4f/hwlib/src/collectors/os_info.rs0000644000175000017500000001165615037740715024524 0ustar nadzeyanadzeya/* Copyright 2024 Canonical Ltd. * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 3, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Written by: * Nadzeya Hutsko */ use anyhow::{anyhow, Context, Result}; use os_release::OsRelease; use std::{fs::read_to_string, path::Path, process::Command}; use crate::{ constants::LSMOD, models::software::{KernelPackage, OS}, }; pub(crate) trait CommandRunner { fn run_command(&self, cmd: &str, args: &[&str]) -> Result; } pub(crate) struct SystemCommandRunner; impl CommandRunner for SystemCommandRunner { fn run_command(&self, cmd: &str, args: &[&str]) -> Result { let output = Command::new(cmd).args(args).output()?; let stdout = String::from_utf8(output.stdout)?; Ok(stdout) } } impl OS { pub(crate) fn try_new( os_release_filepath: &Path, proc_version_filepath: &Path, runner: &impl CommandRunner, ) -> Result { let release = OsRelease::new_from(os_release_filepath).with_context(|| { format!("cannot read OS release information from: {os_release_filepath:?}",) })?; let OsRelease { version_codename: codename, name: distributor, version_id: version, .. } = release; let kernel = KernelPackage::try_new(proc_version_filepath, runner)?; Ok(OS { codename, distributor, version, kernel, }) } } impl KernelPackage { pub(crate) fn try_new( proc_version_filepath: &Path, runner: &impl CommandRunner, ) -> Result { let kernel_version = read_to_string(proc_version_filepath).with_context(|| { format!( "cannot read kernel version from: {:?}", proc_version_filepath.display() ) })?; let kernel_version = kernel_version .split_whitespace() .nth(2) .unwrap_or_default() .to_string(); let loaded_modules_str = runner .run_command(LSMOD, &[]) .with_context(|| "cannot get loaded kernel modules using lsmod")?; let loaded_modules: Vec = loaded_modules_str .lines() .skip(1) // skip the header .map(|line| line.split_whitespace().next().unwrap_or("").to_string()) .collect(); Ok(KernelPackage { name: Some("Linux".to_string()), version: kernel_version, signature: None, // Signature is not available easily, so we set it to None for now. loaded_modules, }) } } pub(crate) fn to_debian_architecture(arch: &str) -> Result<&str> { let deb_arch = match arch.trim() { "aarch64" => "arm64", "arm" => "armhf", "loongarch64" => "loong64", "m68k" => "m68k", "mips" => "mips", "mips32r6" => "mipsr6", "mips64" => "mips64", "mips64r6" => "mips64r6", "powerpc" => "powerpc", "powerpc64" => "ppc64el", "riscv64" => "riscv64", "s390x" => "s390x", "sparc" => "sparc", "sparc64" => "sparc64", "x86" => "i386", "x86_64" => "amd64", _ => return Err(anyhow!("cannot convert {arch:?} to debian architecture")), }; Ok(deb_arch) } #[cfg(test)] mod tests { use super::*; use crate::helpers::test_utils::{get_test_filepath, MockCommandRunner}; #[test] fn test_to_debian_architecture() { let result = to_debian_architecture("x86_64"); assert!(result.is_ok()); assert_eq!(result.unwrap(), "amd64"); let result = to_debian_architecture("fake_arch"); assert!(result.is_err()) } #[test] fn test_os_try_new() { let mock_calls = vec![((LSMOD, Vec::new()), Ok("Module Size Used\nsnd 61440 1\n"))]; let mock_runner = MockCommandRunner::new(mock_calls); let result = OS::try_new( get_test_filepath("arm64/rpi4b8g/os-release").as_path(), get_test_filepath("arm64/rpi4b8g/version").as_path(), &mock_runner, ); let os = result.unwrap(); assert_eq!(os.codename, "focal"); assert_eq!(os.distributor, "Ubuntu"); assert_eq!(os.version, "20.04"); assert_eq!(os.kernel.version, "5.4.0-1119-raspi"); assert_eq!(os.kernel.loaded_modules, vec!["snd".to_string()]); } } canonical-hardware-api-7bedc4f/hwlib/src/collectors/hardware_info.rs0000644000175000017500000003024115037740715025667 0ustar nadzeyanadzeya/* Copyright 2024 Canonical Ltd. * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 3, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Written by: * Nadzeya Hutsko */ use anyhow::{anyhow, Context, Result}; use smbioslib::{ SMBiosBaseboardInformation, SMBiosData, SMBiosEntryPoint32, SMBiosEntryPoint64, SMBiosInformation, SMBiosProcessorInformation, SMBiosSystemChassisInformation, SMBiosSystemInformation, SMBiosVersion, }; use std::{ fs::read_to_string, io::{Error as IoError, ErrorKind}, path::Path, }; use crate::{ collectors::cpuinfo::{CpuFrequency, CpuInfo}, helpers::append_to_pathbuf, models::devices::{Bios, Board, Chassis, Processor}, }; impl TryFrom<&SMBiosInformation<'_>> for Bios { type Error = anyhow::Error; fn try_from(bios_info: &SMBiosInformation) -> Result { let release_date = bios_info.release_date().to_string(); let firmware_revision = match ( bios_info.system_bios_major_release(), bios_info.system_bios_minor_release(), ) { (Some(major), Some(minor)) => Some(format!("{major}.{minor}")), _ => None, }; Ok(Self { firmware_revision, release_date: Some(release_date), revision: Some(bios_info.version().to_string()), vendor: bios_info.vendor().to_string(), version: bios_info.version().to_string(), }) } } /// Retrieve CPU information from SMBIOS impl TryFrom<(&SMBiosProcessorInformation<'_>, &Path)> for Processor { type Error = anyhow::Error; fn try_from(value: (&SMBiosProcessorInformation, &Path)) -> Result { let (processor_info, max_cpu_frequency_filepath) = value; let cpu_identifier = processor_info .processor_id() .ok_or_else(|| anyhow!("processor ID cannot be retrieved"))?; let cpu_freq = CpuFrequency::from_k_hz_file(max_cpu_frequency_filepath)?.get_m_hz(); Ok(Processor { identifier: Some(*cpu_identifier), frequency: cpu_freq, manufacturer: processor_info.processor_manufacturer().to_string(), version: processor_info.processor_version().to_string(), }) } } /// Retrieve CPU information from cpuinfo file impl TryFrom<(&Path, &Path)> for Processor { type Error = anyhow::Error; fn try_from(value: (&Path, &Path)) -> Result { let (cpuinfo_filepath, max_cpu_frequency_filepath) = value; let cpu_info = CpuInfo::from_file(cpuinfo_filepath)?; let cpu_freq = CpuFrequency::from_k_hz_file(max_cpu_frequency_filepath)?.get_m_hz(); Ok(Processor { identifier: None, frequency: cpu_freq, manufacturer: cpu_info.cpu_type, version: cpu_info.model, }) } } impl TryFrom<&SMBiosSystemChassisInformation<'_>> for Chassis { type Error = anyhow::Error; fn try_from(chassis_info: &SMBiosSystemChassisInformation) -> Result { let chassis_type = chassis_info .chassis_type() .ok_or("failed to get chassis type") .unwrap() .to_string(); let manufacturer = chassis_info.manufacturer().ok().unwrap_or_default(); let sku = chassis_info.sku_number().ok().unwrap_or_default(); let version = chassis_info.version().ok().unwrap_or_default(); Ok(Chassis { chassis_type, manufacturer, sku, version, }) } } impl TryFrom<&SMBiosBaseboardInformation<'_>> for Board { type Error = anyhow::Error; fn try_from(board_info: &SMBiosBaseboardInformation) -> Result { let manufacturer = board_info.manufacturer().ok().unwrap_or_default(); let product_name = board_info.product().ok().unwrap_or_default(); let version = board_info.version().ok().unwrap_or_default(); Ok(Board { manufacturer, product_name, version, }) } } impl TryFrom<&Path> for Board { type Error = anyhow::Error; fn try_from(device_tree_filepath: &Path) -> Result { let try_read = |file| { read_to_string(file) .as_ref() .map(|s| s.trim()) .unwrap_or("Unknown") .to_string() }; // Since it's still not clear how to fetch the manufacturer in such case, // we set the 'Unknown' value to it. let manufacturer = String::from("Unknown"); let product_name = try_read(append_to_pathbuf( device_tree_filepath.to_path_buf(), "model", )); let version = try_read(append_to_pathbuf( device_tree_filepath.to_path_buf(), "compatible", )); Ok(Board { manufacturer, product_name, version, }) } } pub struct SystemInfo { pub product_name: String, pub manufacturer: String, } impl SystemInfo { pub fn try_from_smbios(system_data: &SMBiosSystemInformation) -> Result { Ok(SystemInfo { product_name: system_data.product_name().ok().unwrap_or_default(), manufacturer: system_data.manufacturer().ok().unwrap_or_default(), }) } } #[cfg(target_os = "linux")] /// Overwrite smbioslib::table_load_from_device to use parameters for files /// so we can test our code without reading smbios data from the machine that /// runs the test. pub(crate) fn table_load_from_device( entry_file: &Path, table_file: &Path, ) -> Result { let version = SMBiosEntryPoint64::try_load_from_file(entry_file) .with_context(|| format!("cannot load SMBIOS entry from: {:?}", entry_file.display())) .map(|entry_point| SMBiosVersion { major: entry_point.major_version(), minor: entry_point.minor_version(), revision: 0, }) .or_else(|err| { if let Some(io_err) = err.downcast_ref::() { if io_err.kind() != ErrorKind::InvalidData { return Err(err); } SMBiosEntryPoint32::try_load_from_file(entry_file) .with_context(|| { format!("cannot load SMBIOS entry from: {:?}", entry_file.display()) }) .map(|entry_point| SMBiosVersion { major: entry_point.major_version(), minor: entry_point.minor_version(), revision: 0, }) } else { Err(err) } })?; SMBiosData::try_load_from_file(table_file.to_str().unwrap(), Some(version)) .with_context(|| format!("cannot load SMBIOS table from: {:?}", table_file.display())) } #[cfg(test)] mod tests { use super::*; use crate::helpers::test_utils::get_test_filepath; #[test] fn test_table_load_from_device() { let result = table_load_from_device( &get_test_filepath("amd64/dgx_station/smbios_entry_point"), &get_test_filepath("amd64/dgx_station/DMI"), ); assert!(result.is_ok()); } #[test] fn test_bios_from_smbios() { let smbios_data = table_load_from_device( &get_test_filepath("amd64/dgx_station/smbios_entry_point"), &get_test_filepath("amd64/dgx_station/DMI"), ) .unwrap(); let bios_info_vec = smbios_data.collect::(); let bios_info = bios_info_vec.first().unwrap(); let bios = Bios::try_from(bios_info).unwrap(); assert!(bios.firmware_revision.is_some()); assert!(bios.release_date.is_some()); assert!(bios.revision.is_some()); assert_eq!(bios.vendor, "American Megatrends Inc."); assert_eq!(bios.version, "0406"); assert_eq!(bios.release_date.unwrap(), "08/27/2018"); assert_eq!(bios.firmware_revision.unwrap(), "5.11"); assert_eq!(bios.revision.unwrap(), "0406"); } #[test] fn test_bios_release_date_smbios() { let smbios_data = table_load_from_device( &get_test_filepath("amd64/questing_vm/smbios_entry_point"), &get_test_filepath("amd64/questing_vm/DMI"), ) .unwrap(); let bios_info_vec = smbios_data.collect::(); let bios_info = bios_info_vec.first().unwrap(); let bios = Bios::try_from(bios_info).unwrap(); assert_eq!(bios.release_date.unwrap(), "2/2/98"); } #[test] fn test_processor_from_smbios() { let smbios_data = table_load_from_device( &get_test_filepath("amd64/dgx_station/smbios_entry_point"), &get_test_filepath("amd64/dgx_station/DMI"), ) .unwrap(); let processor_info_vec = smbios_data.collect::(); let processor_info = processor_info_vec.first().unwrap(); let processor = Processor::try_from(( processor_info, get_test_filepath("amd64/dgx_station/cpuinfo_max_freq").as_path(), )) .unwrap(); assert_eq!( processor.identifier, Some([0xf1, 0x6, 0x4, 0x0, 0xff, 0xfb, 0xeb, 0xbf]) // Broadwell ID ); assert_eq!(processor.frequency, 800); assert_eq!(processor.manufacturer, "Intel"); assert_eq!( processor.version, "Intel(R) Xeon(R) CPU E5-2698 v4 @ 2.20GHz" ); } #[test] fn test_collect_chassis_info() { let smbios_data = table_load_from_device( &get_test_filepath("amd64/dgx_station/smbios_entry_point"), &get_test_filepath("amd64/dgx_station/DMI"), ) .unwrap(); let chassis_info_vec = smbios_data.collect::(); let chassis_info = chassis_info_vec.first().unwrap(); let chassis = Chassis::try_from(chassis_info).unwrap(); assert_eq!(chassis.chassis_type, "Desktop"); assert_eq!(chassis.manufacturer, "EMPTY"); assert_eq!(chassis.sku, "Default string"); assert_eq!(chassis.version, "Default string"); } #[test] fn test_collect_motherboard_info() { let smbios_data = table_load_from_device( &get_test_filepath("amd64/dgx_station/smbios_entry_point"), &get_test_filepath("amd64/dgx_station/DMI"), ) .unwrap(); let board_info_vec = smbios_data.collect::(); let board_info = board_info_vec.first().unwrap(); let board = Board::try_from(board_info).unwrap(); assert_eq!(board.manufacturer, "EMPTY"); assert_eq!(board.product_name, "X99-E-10G WS"); assert_eq!(board.version, "Rev 1.xx"); } #[test] fn test_collect_motherboard_info_from_device_tree() { let board = Board::try_from(get_test_filepath("arm64/rpi4b8g/device-tree/").as_path()).unwrap(); assert_eq!(board.manufacturer, "Unknown"); assert_eq!(board.product_name, "Raspberry Pi 4 Model B Rev 1.5"); assert_eq!(board.version, "raspberrypi,4-model-bbrcm,bcm2711"); } #[test] fn test_get_system_info() { let smbios_data = table_load_from_device( &get_test_filepath("amd64/dgx_station/smbios_entry_point"), &get_test_filepath("amd64/dgx_station/DMI"), ) .unwrap(); let system_data_vec = smbios_data.collect::(); let system_data = system_data_vec.first().unwrap(); let system_info = SystemInfo::try_from_smbios(system_data).unwrap(); assert_eq!(system_info.product_name, "DGX Station"); assert_eq!(system_info.manufacturer, "NVIDIA"); } } canonical-hardware-api-7bedc4f/hwlib/src/collectors/cpuinfo.rs0000644000175000017500000001423315037740715024525 0ustar nadzeyanadzeya/* Copyright 2024 Canonical Ltd. * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 3, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Written by: * Nadzeya Hutsko */ use anyhow::{Context, Result}; use std::{collections::HashMap, fs::read_to_string, io::ErrorKind::NotFound, path::Path}; #[derive(Debug)] pub struct CpuInfo { pub platform: String, pub cores_count: usize, pub cpu_type: String, pub model: String, pub model_number: String, pub model_version: String, pub model_revision: String, pub cache: Option, pub bogomips: Option, pub speed: u64, } impl CpuInfo { /// Parse cpuinfo file the same way it's done in checkbox: /// pub fn from_file(cpuinfo_filepath: &Path) -> Result { let mut attributes: HashMap<&str, &str> = HashMap::new(); let mut cores_count = 0; let raw_cpuinfo = read_to_string(cpuinfo_filepath).with_context(|| { format!("cannot read CPU info file {:?}", cpuinfo_filepath.display()) })?; for line in raw_cpuinfo.lines() { let trimmed_line = line.trim(); if trimmed_line.is_empty() { continue; } if let Some((key, value)) = trimmed_line.split_once(':') { let key = key.trim_end(); if key == "processor" { cores_count += 1; } attributes.insert(key, value.trim_start()); } } let arch = std::env::consts::ARCH; let speed_str = attributes.get("cpu MHz").copied(); let speed = speed_str .map(CpuSpeed::try_from) .transpose()? .unwrap_or_default() .get_m_hz_as_int(); let platform = arch.to_string(); let model = attributes .get("Model") .or_else(|| attributes.get("model name")) .unwrap_or(&arch) .to_string(); let cpu_type = attributes.get("vendor_id").unwrap_or(&arch).to_string(); let model_number = attributes .remove("cpu family") .unwrap_or_default() .to_string(); let model_version = attributes.remove("model").unwrap_or_default().to_string(); let model_revision = attributes .remove("stepping") .unwrap_or_default() .to_string(); let cache = attributes .remove("cache size") .map(parse_cache_size) .transpose()?; let bogomips = attributes .remove("bogomips") .map(parse_bogomips) .transpose()?; Ok(CpuInfo { platform, cores_count, cpu_type, model, model_number, model_version, model_revision, cache, bogomips, speed, }) } } #[derive(Debug, Default)] pub struct CpuFrequency { m_hz: u64, } impl CpuFrequency { /// Read max CPU frequency from file and parse it in MHz as it's done in checkbox. /// pub fn from_k_hz_file(max_cpu_frequency_filepath: &Path) -> Result { match read_to_string(max_cpu_frequency_filepath) { Ok(raw_freq) => { let k_hz: u64 = raw_freq.trim().parse()?; Ok(Self::from_k_hz(k_hz)) } Err(e) if e.kind() == NotFound => Ok(Self::from_m_hz(0)), Err(e) => Err(e).with_context(|| { format!( "cannot read CPU frequency file: {:?}", max_cpu_frequency_filepath.display() ) }), } } /// Create a CpuFrequency from a frequency in kHz pub const fn from_k_hz(k_hz: u64) -> Self { Self { m_hz: k_hz / 1000 } // Convert kHz to MHz } /// Create a CpuFrequency from a frequency in MHz pub const fn from_m_hz(m_hz: u64) -> Self { Self { m_hz } } pub const fn get_m_hz(&self) -> u64 { self.m_hz } } #[derive(Debug, Default)] struct CpuSpeed { m_hz: f64, } impl CpuSpeed { /// Get the frequency in MHz as a rounded integer fn get_m_hz_as_int(&self) -> u64 { self.m_hz.round() as u64 } } impl TryFrom<&str> for CpuSpeed { type Error = anyhow::Error; fn try_from(raw: &str) -> Result { Ok(CpuSpeed { m_hz: raw.parse::()?, }) } } fn parse_cache_size(cache_size: &str) -> Result { Ok(cache_size .strip_suffix(" KB") .unwrap_or(cache_size) .parse::()?) } fn parse_bogomips(bogomips: &str) -> Result { let bogo_str = bogomips.replace(' ', ""); Ok(bogo_str.parse::().map(|b| b.round() as u64)?) } #[cfg(test)] mod tests { use super::{CpuFrequency, CpuInfo}; use crate::helpers::test_utils::get_test_filepath; #[test] fn test_parsing_cpuinfo() { let cpuinfo = CpuInfo::from_file(&get_test_filepath("arm64/rpi4b8g/cpuinfo")).unwrap(); assert_eq!(cpuinfo.platform, std::env::consts::ARCH); assert_eq!(cpuinfo.cores_count, 4); assert_eq!(cpuinfo.cpu_type, std::env::consts::ARCH); assert_eq!(cpuinfo.model, "Raspberry Pi 4 Model B Rev 1.4"); } #[test] fn test_read_max_cpu_frequency() { let cpu_freq = CpuFrequency::from_k_hz_file(&get_test_filepath("arm64/rpi4b8g/cpuinfo_max_freq")) .unwrap(); assert_eq!(cpu_freq.m_hz, 600); } } canonical-hardware-api-7bedc4f/hwlib/src/collectors/mod.rs0000644000175000017500000000140715037740715023640 0ustar nadzeyanadzeya/* Copyright 2024 Canonical Ltd. * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 3, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Written by: * Nadzeya Hutsko */ pub mod cpuinfo; pub mod hardware_info; pub mod os_info; canonical-hardware-api-7bedc4f/hwlib/src/models/0000755000175000017500000000000015037740715021623 5ustar nadzeyanadzeyacanonical-hardware-api-7bedc4f/hwlib/src/models/software.rs0000644000175000017500000000220215037740715024017 0ustar nadzeyanadzeya/* Copyright 2024 Canonical Ltd. * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 3, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Written by: * Nadzeya Hutsko */ use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug, PartialEq, Eq)] pub struct KernelPackage { pub name: Option, pub version: String, pub signature: Option, pub loaded_modules: Vec, } #[derive(Serialize, Deserialize, Debug, PartialEq, Eq)] pub struct OS { pub codename: String, pub distributor: String, pub version: String, pub kernel: KernelPackage, } canonical-hardware-api-7bedc4f/hwlib/src/models/devices.rs0000644000175000017500000000573715037740715023627 0ustar nadzeyanadzeya/* Copyright 2024 Canonical Ltd. * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 3, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Written by: * Nadzeya Hutsko */ use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug, PartialEq, Eq)] pub struct Audio { pub identifier: String, pub model: String, pub vendor: String, } #[derive(Serialize, Deserialize, Debug, PartialEq, Eq)] pub struct Bios { pub firmware_revision: Option, pub release_date: Option, pub revision: Option, pub vendor: String, pub version: String, } #[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Default)] pub struct Board { pub manufacturer: String, pub product_name: String, pub version: String, } #[derive(Serialize, Deserialize, Debug, PartialEq, Eq)] pub struct Chassis { pub chassis_type: String, pub manufacturer: String, pub sku: String, pub version: String, } #[derive(Serialize, Deserialize, Debug, PartialEq, Eq)] pub struct GPU { pub codename: Option, pub identifier: String, pub manufacturer: String, pub status: Option, pub version: String, } #[derive(Serialize, Deserialize, Debug, PartialEq, Eq)] pub struct NetworkAdapter { pub bus: String, pub capacity: i32, pub identifier: String, pub model: String, pub vendor: String, } #[derive(Serialize, Deserialize, Debug, PartialEq, Eq)] pub struct PCIPeripheral { pub pci_id: String, pub name: String, pub status: Option, pub vendor: String, } #[derive(Serialize, Deserialize, Debug, PartialEq, Eq)] pub struct Processor { pub identifier: Option<[u8; 8]>, pub frequency: u64, pub manufacturer: String, pub version: String, } #[derive(Serialize, Deserialize, Debug, PartialEq, Eq)] pub struct USBPeripheral { pub usb_id: String, pub name: String, pub status: Option, pub vendor: String, } #[derive(Serialize, Deserialize, Debug, PartialEq, Eq)] pub struct VideoCapture { pub identifier: String, pub model: String, pub status: Option, pub vendor: String, } #[derive(Serialize, Deserialize, Debug, PartialEq, Eq)] pub struct WirelessAdapter { pub identifier: String, pub model: String, pub status: Option, pub vendor: String, } #[derive(Serialize, Deserialize, Debug, PartialEq, Eq)] pub enum DeviceStatus { Working, Breaking, } canonical-hardware-api-7bedc4f/hwlib/src/models/request_validators.rs0000644000175000017500000002455715037740715026126 0ustar nadzeyanadzeya/* Copyright 2024 Canonical Ltd. * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 3, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Written by: * Nadzeya Hutsko */ use anyhow::{anyhow, Context, Result}; use serde::{Deserialize, Serialize}; use std::env::consts::ARCH; use std::path::PathBuf; use crate::{ collectors::{ hardware_info::{table_load_from_device, SystemInfo}, os_info::{to_debian_architecture, CommandRunner, SystemCommandRunner}, }, constants, models::{ devices::{Bios, Board, Chassis, PCIPeripheral, Processor, USBPeripheral}, software::OS, }, }; #[cfg(target_arch = "x86_64")] use smbioslib::{ SMBiosBaseboardInformation, SMBiosInformation, SMBiosProcessorInformation, SMBiosSystemChassisInformation, SMBiosSystemInformation, }; #[cfg(not(target_arch = "x86_64"))] use crate::collectors::cpuinfo::CpuInfo; #[derive(Debug, Clone)] pub struct Paths { pub smbios_entry_filepath: PathBuf, pub smbios_table_filepath: PathBuf, pub cpuinfo_filepath: PathBuf, pub max_cpu_frequency_filepath: PathBuf, pub device_tree_dirpath: PathBuf, pub os_release_filepath: PathBuf, pub proc_version_filepath: PathBuf, } impl Default for Paths { fn default() -> Self { let smbios_entry_filepath = PathBuf::from(smbioslib::SYS_ENTRY_FILE); let smbios_table_filepath = PathBuf::from(smbioslib::SYS_TABLE_FILE); let cpuinfo_filepath = PathBuf::from(constants::PROC_CPUINFO_FILE_PATH); let max_cpu_frequency_filepath = PathBuf::from(constants::CPU_MAX_FREQ_FILE_PATH); let device_tree_dirpath = PathBuf::from(constants::PROC_DEVICE_TREE_DIR_PATH); let os_release_filepath = PathBuf::from(constants::OS_RELEASE_FILE_PATH); let proc_version_filepath = PathBuf::from(constants::PROC_VERSION_FILE_PATH); Self { smbios_entry_filepath, smbios_table_filepath, cpuinfo_filepath, max_cpu_frequency_filepath, device_tree_dirpath, os_release_filepath, proc_version_filepath, } } } #[derive(Serialize, Deserialize, Debug)] pub struct CertificationStatusRequest { pub architecture: String, pub bios: Option, pub board: Board, pub chassis: Option, pub model: String, pub os: OS, pub pci_peripherals: Vec, pub processor: Processor, pub usb_peripherals: Vec, pub vendor: String, } impl CertificationStatusRequest { pub fn new(paths: Paths) -> Result { Self::new_with_runner(paths, &SystemCommandRunner) } pub(crate) fn new_with_runner(paths: Paths, runner: &impl CommandRunner) -> Result { Self::from(paths, runner) } #[cfg(target_arch = "x86_64")] fn from(paths: Paths, runner: &impl CommandRunner) -> Result { let Paths { smbios_entry_filepath, smbios_table_filepath, max_cpu_frequency_filepath, os_release_filepath, proc_version_filepath, .. } = paths; let data = table_load_from_device(&smbios_entry_filepath, &smbios_table_filepath)?; let bios_info_vec = data.collect::(); let bios_info = bios_info_vec .first() .ok_or_else(|| anyhow!("failed to load BIOS data"))?; let bios = Some(Bios::try_from(bios_info)?); let processor_info_vec = data.collect::(); let processor_info = processor_info_vec .first() .ok_or_else(|| anyhow!("failed to load processor data"))?; let processor = Processor::try_from((processor_info, max_cpu_frequency_filepath.as_path()))?; let chassis_info_vec = data.collect::(); let chassis = chassis_info_vec .first() .and_then(|info| Chassis::try_from(info).ok()); let board_info_vec = data.collect::(); let board = board_info_vec .first() .map(Board::try_from) .transpose()? .unwrap_or_else(Board::default); let system_data_vec = data.collect::(); let system_data = system_data_vec.first().unwrap(); let system_info = SystemInfo::try_from_smbios(system_data)?; let model = system_info.product_name; let vendor = system_info.manufacturer; let architecture = to_debian_architecture(ARCH) .with_context(|| format!("cannot parse architecture {ARCH:?}"))? .to_owned(); let os = OS::try_new( os_release_filepath.as_path(), proc_version_filepath.as_path(), runner, ) .context("cannot read OS release information")?; let pci_peripherals = Vec::new(); let usb_peripherals = Vec::new(); Ok(Self { architecture, bios, board, chassis, model, os, pci_peripherals, processor, usb_peripherals, vendor, }) } #[cfg(not(target_arch = "x86_64"))] fn from(paths: Paths, runner: &impl CommandRunner) -> Result { let Paths { cpuinfo_filepath, max_cpu_frequency_filepath, device_tree_dirpath, os_release_filepath, proc_version_filepath, .. } = paths; let cpu_info = CpuInfo::from_file(&cpuinfo_filepath.clone())?; let architecture = to_debian_architecture(ARCH) .with_context(|| format!("cannot parse architecture {ARCH:?}"))? .to_owned(); let bios = None; let board = Board::try_from(device_tree_dirpath.as_path())?; let chassis = None; let model = cpu_info.model; let os = OS::try_new( os_release_filepath.as_path(), proc_version_filepath.as_path(), runner, )?; let pci_peripherals = Vec::new(); let processor = Processor::try_from(( cpuinfo_filepath.as_path(), max_cpu_frequency_filepath.as_path(), ))?; let usb_peripherals = Vec::new(); let vendor = String::from("Unknown"); Ok(Self { architecture, bios, board, chassis, model, os, pci_peripherals, processor, usb_peripherals, vendor, }) } } #[cfg(test)] mod tests { use crate::{ constants, helpers::test_utils::{apply_vars, get_test_filepath, MockCommandRunner}, models::request_validators::{CertificationStatusRequest, Paths}, }; use serde_json::Value; use simple_test_case::test_case; use std::{fs::read_to_string, path::PathBuf}; /// Test how certification request is prepared for the data collected /// from SMBios #[test_case( "amd64/dgx_station", "jammy", "22.04", "5.4.0-192-generic", &["nvme", "intel_lpss_pci", "intel_ish_ipc", "idma64"]; "jammy_dgx_station" )] #[test_case( "amd64/dell_xps13", "noble", "24.04", "6.8.0-1013-oem", &["zfs", "spl", "nvme_tcp"]; "noble_dell_xps13" )] #[test_case( "amd64/thinkstation_p620", "focal", "20.04", "5.15.0-125-generic", &["xt_tcpudp", "nft_chain_nat"]; "focal_thinkstation" )] #[test] fn test_smbios_certification_request( dir_path: &str, codename: &str, release: &str, kernel_version: &str, kernel_modules: &[&str], ) { let paths = Paths { smbios_entry_filepath: get_test_filepath( format!("{dir_path}/smbios_entry_point").as_str(), ), smbios_table_filepath: get_test_filepath(format!("{dir_path}/DMI").as_str()), max_cpu_frequency_filepath: get_test_filepath( format!("{dir_path}/cpuinfo_max_freq").as_str(), ), os_release_filepath: get_test_filepath(format!("{dir_path}/os-release").as_str()), proc_version_filepath: get_test_filepath(format!("{dir_path}/version").as_str()), cpuinfo_filepath: PathBuf::from("./none"), device_tree_dirpath: PathBuf::from("./none"), }; let lsmod_output: String = std::iter::once("Module Size Used by\n".to_owned()) .chain( kernel_modules .iter() .map(|module| format!("{module} 456092 0\n")), ) .collect::(); let mock_calls = vec![((constants::LSMOD, Vec::new()), Ok(lsmod_output.as_str()))]; let mock_runner = MockCommandRunner::new(mock_calls); let quoted_kernel_modules: Vec<_> = kernel_modules .iter() .map(|module| format!("\"{module}\"")) .collect(); let kernel_modules_str = format!("[{}]", quoted_kernel_modules.join(", ")); let content = read_to_string(get_test_filepath( format!("{dir_path}/request.json").as_str(), )) .unwrap(); let expected_result = apply_vars( content, &[ ("CODENAME", codename), ("KERNEL_VERSION", kernel_version), ("KERNEL_MODULES", kernel_modules_str.as_str()), ("RELEASE", release), ], ); let cert_status_request_json = serde_json::to_value( CertificationStatusRequest::new_with_runner(paths, &mock_runner).unwrap(), ) .unwrap(); let expected_json: Value = serde_json::from_str(expected_result.as_str()).expect("JSON was not well formatted"); assert_eq!(cert_status_request_json, expected_json); } } canonical-hardware-api-7bedc4f/hwlib/src/models/response_validators.rs0000644000175000017500000000375315037740715026267 0ustar nadzeyanadzeya/* Copyright 2024 Canonical Ltd. * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 3, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Written by: * Nadzeya Hutsko */ use serde::{Deserialize, Serialize}; use crate::models::{ devices::{ Audio, Bios, Board, Chassis, NetworkAdapter, PCIPeripheral, USBPeripheral, VideoCapture, WirelessAdapter, GPU, }, software::OS, }; #[derive(Serialize, Deserialize, Debug)] #[serde(tag = "status")] pub enum CertificationStatusResponse { Certified { architecture: String, available_releases: Vec, bios: Bios, board: Board, chassis: Option, }, #[serde(rename = "Not Seen")] NotSeen, #[serde(rename = "Certified Image Exists")] CertifiedImageExists { architecture: String, bios: Bios, board: Board, available_releases: Vec, chassis: Option, }, #[serde(rename = "Related Certified System Exists")] RelatedCertifiedSystemExists { architecture: String, board: Board, bios: Bios, chassis: Option, gpu: Option>, audio: Option>, video: Option>, network: Option>, wireless: Option>, pci_peripherals: Vec, usb_peripherals: Vec, available_releases: Vec, }, } canonical-hardware-api-7bedc4f/hwlib/src/models/mod.rs0000644000175000017500000000145215037740715022752 0ustar nadzeyanadzeya/* Copyright 2024 Canonical Ltd. * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 3, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Written by: * Nadzeya Hutsko */ pub mod devices; pub mod request_validators; pub mod response_validators; pub mod software; canonical-hardware-api-7bedc4f/hwlib/build.rs0000644000175000017500000000032115037740715021212 0ustar nadzeyanadzeyafn main() { let os_release_file_path = std::env::var("OS_RELEASE_FILE_PATH").unwrap_or("/etc/os-release".to_owned()); println!("cargo:rustc-env=OS_RELEASE_FILE_PATH={os_release_file_path}"); } canonical-hardware-api-7bedc4f/hwlib/test_data/0000755000175000017500000000000015037740715021521 5ustar nadzeyanadzeyacanonical-hardware-api-7bedc4f/hwlib/test_data/amd64/0000755000175000017500000000000015037740715022434 5ustar nadzeyanadzeyacanonical-hardware-api-7bedc4f/hwlib/test_data/amd64/thinkstation_p620/0000755000175000017500000000000015037740715025722 5ustar nadzeyanadzeyacanonical-hardware-api-7bedc4f/hwlib/test_data/amd64/thinkstation_p620/smbios_entry_point0000644000175000017500000000003015037740715031564 0ustar nadzeyanadzeya_SM3_LŁŕśşcanonical-hardware-api-7bedc4f/hwlib/test_data/amd64/thinkstation_p620/version0000644000175000017500000000030115037740715027324 0ustar nadzeyanadzeyaLinux version 5.15.0-125-generic (buildd@lcy02-amd64-040) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #135~20.04.1-Ubuntu SMP Mon Oct 7 13:56:22 UTC 2024 canonical-hardware-api-7bedc4f/hwlib/test_data/amd64/thinkstation_p620/os-release0000644000175000017500000000061715037740715027710 0ustar nadzeyanadzeyaPRETTY_NAME="Ubuntu 20.04.2 LTS" NAME="Ubuntu" VERSION_ID="20.04" VERSION="20.04.2 LTS (Focal Fossa)" VERSION_CODENAME=focal ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" UBUNTU_CODENAME=focal LOGO=ubuntu-logo canonical-hardware-api-7bedc4f/hwlib/test_data/amd64/thinkstation_p620/response.json0000644000175000017500000000112615037740715030453 0ustar nadzeyanadzeya{ "status": "Certified", "architecture": "amd64", "bios": { "vendor": "Lenovo", "version": "S07KT41A", "revision": null, "firmware_revision": "1.19", "release_date": null }, "board": { "manufacturer": "Lenovo", "product_name": "1046", "version": "Not Defined" }, "chassis": null, "available_releases": [ { "distributor": "Ubuntu", "version": "20.04", "codename": "focal", "kernel": { "name": null, "version": "5.15.0-48-generic", "signature": null, "loaded_modules": [] } } ] } canonical-hardware-api-7bedc4f/hwlib/test_data/amd64/thinkstation_p620/DMI0000644000175000017500000001064315037740715026262 0ustar nadzeyanadzeyađ˙€˜ű A LENOVOS07KT41A11/29/2021˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙LENOVOThinkStation P620ThinkStation P620000000000000LENOVO_MT_Thin_BU_Think_FM_ThinkStation P620+INVALID  LENOVO1046Not Defined Default stringLENOVONone Default string ƒ To Be Filled By O.E.M. LENOVO ThinkStation Embedded Controller -[S07ES13A-1.13]-LENOVO ThinkStation BIOS Boot Block Revision 1.41INVALIDINVALIDINVALIDINVALIDINVALIDINVALIDINVALIDINVALIDINVALIDINVALIDINVALIDINVALIDINVALID scre++SMI:00B2C000 " LM78-1 g€€€€€€VTT g€€€€€€3VCC g€€€€€€5VCC g€€€€€€12VCCg€€€€€€3VSBc€€€€€€CPU_Sensorc€€€€€€CPU_VR_Sensorg€€€€€€Ambientg€€€€€€IO Hubg€€€€€€PCIE_ZONE1_SENSORg€€€€€€PCIE_ZONE2_SENSORg€€€€€€PCIE_ZONE3_SENSORg€€€€€€M2_Sensorj€€€€€€PSU_Sensor˙˙g€Cooling Dev 1j€€€€€€ABC'€˘˙˙To Be Filled By O.E.M.To Be Filled By O.E.M.To Be Filled By O.E.M.To Be Filled By O.E.M.To Be Filled By O.E.M.To Be Filled By O.E.M.To Be Filled By O.E.M., ˙˙ +IFXUËTPM 2.0INFINEON€L1 - CacheL2 - Cache ‚„„€€L3 - Cache0!kƒ˙ű‹‹d0<A7  ük SP3Advanced Micro Devices, Inc.AMD Ryzen Threadripper PRO 3945WX 12-Cores UnknownUnknownUnknown"€€€#@"$˙˙/#%@˙˙#&€€€\'#&˙˙˙˙DIMM5BANK4UnknownUnknownUnknownUnknown(€€€\)#(˙˙˙˙DIMM6BANK5UnknownUnknownUnknownUnknown*€€€\+#*H@@ € € € °°°€­DIMM7BANK6Hynix00000000HMA82GR7CJR8N-XN Unknown#,˙˙˙+%˙˙˙-€€€\.#-H@@ € € € °°°€­DIMM8BANK7Hynix00000000HMA82GR7CJR8N-XN Unknown#/˙˙˙.%˙˙˙0€€€\1#0˙˙˙˙DIMM4BANK3UnknownUnknownUnknownUnknown2€€€\3#2˙˙˙˙DIMM3BANK2UnknownUnknownUnknownUnknown4€€€\5#4˙˙˙˙DIMM2BANK1UnknownUnknownUnknownUnknown6€€€\7#6˙˙˙˙DIMM1BANK0UnknownUnknownUnknownUnknown…=KHOIHGIUCCHHIIŒ>LENOVO ˛MS Œ?LENOVO S07ES13A06/18/2021 @J1603USB3.1 G2 TypeA AJ1602USB3.1 G2 TypeC BJ1601USB3.1 G2 TypeC CJ1600USB3.1 G2 TypeA DJ1300USB3.1 G2 E J1300RJ45 F J2000RJ45 GJ1503USB3.1 G2 HJ1502USB3.1 G2 IJ2100Audio Jack J˙˙J4306 - MEM FAN K˙˙J3000 - ATX PWR L˙˙J4300 - SYSTEM FAN M˙˙J4305 - CPU FAN N˙˙J3001 - ATX 12V PWR O˙˙J4301 - MEM FAN P˙˙J3002 - ATX 24PIN PWR Q˙ J1800 - iSATA R˙ J1801 - iSATA S˙ J1802 - iSATA T˙ J1803 - iSATA U˙˙J604 - SMA100M_CLKIN_N SMA Jack V˙˙J4304 - X570/X590 FAN W˙˙J202 - LPC HDR XŞ   J6009 Y  J6006 Z  J6005 [  J6007 \  J6008 ]Ş   J3603 ^Ş   J6001 _Ş  @ J6002 `Ş  @J6000 aŞ  ` J3601 b  `J6004 c  `J6003ƒd€TVT-EnablementIe€ÇŻ   ˙ŕŕáá fen|US|iso8859-1fr|FR|iso8859-1zh|CN|unicodehcanonical-hardware-api-7bedc4f/hwlib/test_data/amd64/thinkstation_p620/request.json0000644000175000017500000000205715037740715030311 0ustar nadzeyanadzeya{ "architecture": "amd64", "bios": { "firmware_revision": "1.65", "release_date": "11/29/2021", "revision": "S07KT41A", "vendor": "LENOVO", "version": "S07KT41A" }, "board": { "manufacturer": "LENOVO", "product_name": "1046", "version": "Not Defined " }, "chassis": { "chassis_type": "Desktop", "manufacturer": "LENOVO", "sku": "Default string", "version": "None" }, "model": "ThinkStation P620", "os": { "codename": "$CODENAME", "distributor": "Ubuntu", "kernel": { "loaded_modules": $KERNEL_MODULES, "name": "Linux", "signature": null, "version": "$KERNEL_VERSION" }, "version": "$RELEASE" }, "pci_peripherals": [], "processor": { "frequency": 4402, "identifier": [ 16, 15, 131, 0, 255, 251, 139, 23 ], "manufacturer": "Advanced Micro Devices, Inc.", "version": "AMD Ryzen Threadripper PRO 3945WX 12-Cores " }, "usb_peripherals": [], "vendor": "LENOVO" } canonical-hardware-api-7bedc4f/hwlib/test_data/amd64/thinkstation_p620/cpuinfo_max_freq0000644000175000017500000000001015037740715031161 0ustar nadzeyanadzeya4402734 canonical-hardware-api-7bedc4f/hwlib/test_data/amd64/dell_xps13/0000755000175000017500000000000015037740715024412 5ustar nadzeyanadzeyacanonical-hardware-api-7bedc4f/hwlib/test_data/amd64/dell_xps13/smbios_entry_point0000644000175000017500000000003715037740715030263 0ustar nadzeyanadzeya_SM_ŻĘ_DMI_úKPĎMf6canonical-hardware-api-7bedc4f/hwlib/test_data/amd64/dell_xps13/version0000644000175000017500000000032415037740715026021 0ustar nadzeyanadzeyaLinux version 6.8.0-1013-oem (buildd@lcy02-amd64-046) (x86_64-linux-gnu-gcc-13 (Ubuntu 13.2.0-23ubuntu4) 13.2.0, GNU ld (GNU Binutils for Ubuntu) 2.42) #13-Ubuntu SMP PREEMPT_DYNAMIC Fri Sep 6 14:37:50 UTC 2024 canonical-hardware-api-7bedc4f/hwlib/test_data/amd64/dell_xps13/os-release0000644000175000017500000000062015037740715026372 0ustar nadzeyanadzeyaPRETTY_NAME="Ubuntu 24.04.2 LTS" NAME="Ubuntu" VERSION_ID="24.04" VERSION="24.04.2 LTS (Noble Numbat)" VERSION_CODENAME=noble ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" UBUNTU_CODENAME=noble LOGO=ubuntu-logo canonical-hardware-api-7bedc4f/hwlib/test_data/amd64/dell_xps13/response.json0000644000175000017500000000110515037740715027140 0ustar nadzeyanadzeya{ "status": "Certified", "architecture": "amd64", "bios": { "vendor": "Dell", "version": "1.7.0", "revision": null, "firmware_revision": "1.9", "release_date": null }, "board": { "manufacturer": "Dell", "product_name": "02395C", "version": "X04" }, "chassis": null, "available_releases": [ { "distributor": "Ubuntu", "version": "24.04", "codename": "noble", "kernel": { "name": null, "version": "6.8.0-1009-oem", "signature": null, "loaded_modules": [] } } ] } canonical-hardware-api-7bedc4f/hwlib/test_data/amd64/dell_xps13/DMI0000644000175000017500000001551315037740715024753 0ustar nadzeyanadzeyaÚűÚ˛|˙śP""##(())**++˙˙,,˙˙PPUUmm}}˙˙‘‘’’››œœŸŸ  ĄĄŁŁŃŃŇŇííđđ  ++,,55˙8899DDEEJJKKLLRR˙˙˙˙ÚűÚ˛|˙śPSShhii€€‰‰ŠŠ››œœŢŢßßččééęęëëKKLLddeeffgghhiillmm……††§§¨¨˝˝žžăăääĺĺ˙˙˙˙ÚűÚ˛|˙śP  &&++,,AABBCCFFGGHHII˙˙JJ˙˙MMNNOOPPaabbddeegg˙˙llmmnn˙˙ttuu˙˙˙˙ÚűÚ˛|˙śPxxyy˘˘ŁŁžž˙˙ĆĆÇÇČČÉÉĘĘËË˙˙ÍÍÎÎÓÓ˙˙ÖÖ××öö÷÷11˙˙223366778899@@AABBCCDDEEFFGGKKLL˙˙˙˙ÚűÚ˛|˙śPMMNNOOQQ˙˙RR˙˙SSTTaabb{{||€€‡‡ˆˆ˜˜˙˙™™››œœžžŸŸ  ĄĄ˘˘ŁŁŹŹ­­ŽŽŻŻÜÜ˙˙ććççěěíí˙˙˙˙˙˙ÚűÚ˛|˙śP,,˙˙0011GGHHNNOOXXYYZZ[[\\]]^^__``˙˙ee˙˙mmnnrrssttww˙˙€€˙˙‡‡ˆˆ‰‰‘‘’’J@J@K@K@L@L@˙˙O@O@P@P@˙˙˙˙ÚMÚ˛|˙śP€€€€€€€€€€˙˙€€˙˙€€€€    ˙˙˙˙ÚqÚ˛|˙śPńńńńńńńń ń ń"ń"ń0ń0ń2ń2ń@ń@ńBńBńPńPńRńRńöööööööö˙˙˙˙˙€š <ƒ @Dell Inc.1.7.006/12/2024DELLT9€SšŔO9Y3XPSDell Inc.XPS 13 93400C870000000  Dell Inc.02395CX04/0000000/00000000000000/ Dell Inc.0000000Notebook2¤ ˙ű뿉dŔŰAüU3E1Intel(R) CorporationIntel(R) Core(TM) Ultra 7 155H €     L1 Cache€€€ €€L1 Cache00 00L2 Cache‚``  ``L3 Cache€@@ @@L1 Cache€€€ €€L1 Cache L2 Cache‚``  ``L3 Cache  KeyboardNone MouseNone NoneUSB1 NoneUSB2 ˙˙J9A1 - TPM/PORT 80None ˙˙J8E1 - SPI ProgramNone ˙˙J5J1 - FP HeaderNone ˙˙J1H2 - BATT ANone ˙˙J2G1 - CPU FanNone ˙˙J4C1 - FAN PWRNone  Ş ŕPCI-Express 0  ĽáPCI-Express 1  ĽâPCI-Express 2  ĽăPCI-Express 3  ĽäPCI-Express 4  ĽĺPCI-Express 5  ĽćPCI-Express 6  Dell System1[0C87]3[1.0]12[www.dell.com]14[1]15[0]27[21360995931]34[Feature - 100]  J6H1:1-X Boot with Default; J8H1:1-X BIOS RECOVERY  enUSË$MEIÍÍÍÍÍÍÍÍÍÍÍÍÍÍFirmware Version Infoţ˙\ţ˙ #€++ôÎMotherboardBANK 0 K3KLALA0CM-MGCT \ţ˙ #€++ôÎMotherboardBANK 1 K3KLALA0CM-MGCT \ţ˙ #€++ôÎMotherboardBANK 2 K3KLALA0CM-MGCT \ţ˙ #€++ôÎMotherboardBANK 3 K3KLALA0CM-MGCT \ţ˙ #€++ôÎMotherboardBANK 0 K3KLALA0CM-MGCT \ţ˙ #€++ôÎMotherboardBANK 1 K3KLALA0CM-MGCT \ţ˙ #€++ôÎMotherboardBANK 2 K3KLALA0CM-MGCT \ţ˙ #€++ôÎMotherboardBANK 3 K3KLALA0CM-MGCT ˙˙˙%-Ę%W Sys. Battery BayBYD09/05/202300CADELL TR7FC3951.0LiPCN0TR7FCBDS00395506UA00  ˙˙cÝxProcessor Fan˙˙cÝLVideo Fan e€Cooling Device 1 q€Cooling Device 2iö ű耀ÜdCPUgö ű耀ÜdSKINhö ű耀ÜdDIMM Agö ű耀ÜdSKINgö ű耀ÜdSKINgö ű耀ÜdSKIN ''€ ) )ƒ ) )ţ ) )ű ) ) ¸ ++NTCTPM 2.0, ManufacturerID: NTC , Firmware Version: 0x00070002.0x0‚‚$AMTĽď€ƒ@ƒ5ř~1 ]&vPro…,…ů´•xM’ A–98b˛Šc†€ &†€arWˆˆą ą˛\˛ ; < = >&?@ABCH˙˙P˙˙˙˙˙˙˙˙˙ ˙!˙"˙ łł1[0000000000000000000000000000000000000000000000000000000000000000]ËjËU”i0ś€€MEI1MEI2MEI3MEI4Í ÍĘBIOS GuardÍ Í˙˙˙˙˙FSP Binary Version0D.00.0097.0010ÍÍ —Reference Code - CPUuCode VersionTXT ACM versionÍÍ —]˙˙˙˙˙Reference Code - MEME Firmware VersionCorporate SKUISSE Version03E8.0000.0005.0733Í/Í —˙˙˙˙˙˙˙˙ ˙˙˙ FReference Code - PCHPCH-CRID StatusDisabledPCH-CRID Original ValuePCH-CRID New ValueOPROM - RST - RAIDPCH Hsio VersionÍRÍ  — —˙˙˙˙˙˙˙˙˙˙ 0 e  ˙˙˙˙˙Reference Code - SA - System AgentReference Code - MRCSA - PCIe VersionSA-CRID StatusDisabledSA-CRID Original ValueSA-CRID New ValueOPROM - VBIOSIO Manageability Engine FW VersionPHY Build VersionThunderbolt(TM) FW VersionSystem Agent Manageability Engine FW VersionÍuÍ˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙ ˙˙˙˙˙ ˙˙˙˙  "5 ˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙Lan Phy VersionSensor Firmware VersionDebug Mode StatusDisabledPerformance Mode StatusDisabledDebug Use USB(Disabled:Serial)DisabledICC Overclocking VersionUNDI VersionEC FW VersionGOP VersionRoyal Park VersionPlatform VersionTCSS PD0 VersionTCSS PD1 VersionTCSS Retimer0 VersionTCSS Retimer1 VersionTCSS Retimer2 VersionĐĐţ‡ 2023102520231030Ř Řˆ"Intel Corp.""2089"ŮŮUS-101ProprietaryÜÜńńÜÜńńÜÜ ń"ńÜÜ0ń2ńÜÜ@ńBńÜÜPńRńÝÝööÝÝööŢŢ$˙_SIDARmihAmyVZaZ0C87˙ţcanonical-hardware-api-7bedc4f/hwlib/test_data/amd64/dell_xps13/request.json0000644000175000017500000000176115037740715027002 0ustar nadzeyanadzeya{ "architecture": "amd64", "bios": { "firmware_revision": "1.7", "release_date": "06/12/2024", "revision": "1.7.0", "vendor": "Dell Inc.", "version": "1.7.0" }, "board": { "manufacturer": "Dell Inc.", "product_name": "02395C", "version": "X04" }, "chassis": { "chassis_type": "Notebook", "manufacturer": "Dell Inc.", "sku": "Notebook", "version": "" }, "model": "XPS 13 9340", "os": { "codename": "$CODENAME", "distributor": "Ubuntu", "kernel": { "loaded_modules": $KERNEL_MODULES, "name": "Linux", "signature": null, "version": "$KERNEL_VERSION" }, "version": "$RELEASE" }, "pci_peripherals": [], "processor": { "frequency": 4500, "identifier": [ 164, 6, 10, 0, 255, 251, 235, 191 ], "manufacturer": "Intel(R) Corporation", "version": "Intel(R) Core(TM) Ultra 7 155H" }, "usb_peripherals": [], "vendor": "Dell Inc." } canonical-hardware-api-7bedc4f/hwlib/test_data/amd64/dell_xps13/cpuinfo_max_freq0000644000175000017500000000001015037740715027651 0ustar nadzeyanadzeya4500000 canonical-hardware-api-7bedc4f/hwlib/test_data/amd64/questing_vm/0000755000175000017500000000000015037740715024775 5ustar nadzeyanadzeyacanonical-hardware-api-7bedc4f/hwlib/test_data/amd64/questing_vm/smbios_entry_point0000644000175000017500000000003015037740715030637 0ustar nadzeyanadzeya_SM3_Vœ‘?canonical-hardware-api-7bedc4f/hwlib/test_data/amd64/questing_vm/DMI0000644000175000017500000000063215037740715025332 0ustar nadzeyanadzeya8Íů™ŰôA¸ww ,$šQEMUStandard PC (Q35 + ICH9, 2009)pc-q35-8.2 Canonical Ltd.LXDpc-q35-8.2QEMUpc-q35-8.20A§˙ű‹ĐĐA˙˙˙˙˙˙CPU 0QEMUpc-q35-8.2ţ˙(ţ˙˙˙˙˙ DIMM 0QEMU˙˙ č˙˙EDK IIunknown2/2/98˙ţcanonical-hardware-api-7bedc4f/hwlib/test_data/amd64/dgx_station/0000755000175000017500000000000015037740715024757 5ustar nadzeyanadzeyacanonical-hardware-api-7bedc4f/hwlib/test_data/amd64/dgx_station/smbios_entry_point0000644000175000017500000000003015037740715030621 0ustar nadzeyanadzeya_SM3_:ŮĐľcanonical-hardware-api-7bedc4f/hwlib/test_data/amd64/dgx_station/version0000644000175000017500000000023115037740715026363 0ustar nadzeyanadzeyaLinux version 5.4.0-192-generic (buildd@lcy02-amd64-036) (gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2)) #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 canonical-hardware-api-7bedc4f/hwlib/test_data/amd64/dgx_station/os-release0000644000175000017500000000062315037740715026742 0ustar nadzeyanadzeyaPRETTY_NAME="Ubuntu 22.04.2 LTS" NAME="Ubuntu" VERSION_ID="22.04" VERSION="22.04.2 LTS (Jammy Jellyfish)" VERSION_CODENAME=jammy ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" UBUNTU_CODENAME=jammy LOGO=ubuntu-logo canonical-hardware-api-7bedc4f/hwlib/test_data/amd64/dgx_station/response.json0000644000175000017500000000211015037740715027502 0ustar nadzeyanadzeya{ "status": "Certified", "architecture": "amd64", "bios": { "vendor": "American Megatrends Inc.", "version": "0406", "revision": null, "firmware_revision": null, "release_date": null }, "board": { "manufacturer": "empty", "product_name": "X99-E-10G WS", "version": "Rev 1.xx" }, "chassis": null, "available_releases": [ { "distributor": "Ubuntu", "version": "22.04", "codename": "jammy", "kernel": { "name": null, "version": "5.15.0-1028-nvidia", "signature": null, "loaded_modules": [] } }, { "distributor": "Ubuntu", "version": "20.04", "codename": "focal", "kernel": { "name": null, "version": "5.4.0-26-generic", "signature": null, "loaded_modules": [] } }, { "distributor": "Ubuntu", "version": "18.04", "codename": "bionic", "kernel": { "name": null, "version": "5.3.0-51-generic", "signature": null, "loaded_modules": [] } } ] } canonical-hardware-api-7bedc4f/hwlib/test_data/amd64/dgx_station/DMI0000644000175000017500000001064115037740715025315 0ustar nadzeyanadzeyađ˙€œ‹?  ˙˙American Megatrends Inc.040608/27/2018E  `[ańC$ŕ,MTGn#NVIDIADGX StationSystem Version0000000000000920-22587-2510-000DGX  EMPTYX99-E-10G WSRev 1.xx000000000000000Default stringDefault stringEMPTYDefault stringDefault stringDefault stringDefault string USB3_E12USB3_E12 USB3_E34USB3_E34 USB7~10USB7~10 USB3.1_EA34USB3.1_EA34 USB3.1_EA1USB3.1_EA1 USB3.1_EC2USB3.1_EC2  LAN1LAN1  LAN2LAN2 ˙AUDIOAUDIO " SATA6G_12 " SATA6G_34 " SATA6G_56 " SATA6G_78 " SATA6G_9 " SATA6G_10 " SATAEXPRESS_1 " SATAEXPRESS_E1 " M.2(SOCKET3) " U.2_1 " U.2_2 USB3_12 USB3_34 USB1112 ˙˙TPM ˙˙SPDIF_OUT AAFP ˙˙CPU_FAN ˙˙CPU_OPT ˙˙CHA_FAN1 !˙˙CHA_FAN2 "˙˙EXT_FAN #˙˙H_AMP_FAN $˙˙W_PUMP %˙˙TB_HEADER &˙˙RGB_HEADER 'ą   PCIEX16_1 (ą ˙PCIEX1_1 )ą  ˙PCIEX16_2 *ą  PCIEX16_3 +ą  ˙PCIEX16_4 ,ą  ˙PCIEX16_5 -ƒ To Be Filled By O.E.M. .Default stringDefault stringDefault stringDefault string /Default string 0" 1UNKNOWN2€€€€€€LM78A$3# 4112Default string5€€€€€€LM78A$6# 7145Default string85€Cooling Dev 1$9# :178Default string;5€$<# =1:;Default string>€€€€€€ABC$?€€€€€€# @1=;Default string"AUNKNOWN-2B€€€€€€LM78B$C # DAABDefault stringE€€€€€€LM78B$F # GADEDefault stringH€€€€€€LM78B$I# JAGHDefault stringKH€Cooling Dev 2$L# MAJKDefault stringN€€€€€€LM78B$O# PAMNDefault stringQN€Cooling Dev 2$R# SAPQDefault stringT€€€€€€DEF$U€€€€€€# VASQDefault stringW€€€€€€GHI$X€€€€€€# YAVQDefault stringZj€€€€€€LM78A[j€€€€€€LM78A\[g€Cooling Dev 1]j€€€€€€ABC'^€˘Z\]To Be Filled By O.E.M.To Be Filled By O.E.M.To Be Filled By O.E.M.To Be Filled By O.E.M.To Be Filled By O.E.M.To Be Filled By O.E.M.To Be Filled By O.E.M.) _ƒ Onboard IGD) `…Č Onboard LAN) aâ Onboard 1394bţ˙c˙˙˙b(dbţ˙HH˙ €` €` DIMM_A1NODE 1Samsung00000000DIMM_A1_AssetTagM393A4K40BB1-CRC #e˙˙˙dc(fbţ˙HH˙ €` €` DIMM_A2NODE 1Samsung00000000DIMM_A2_AssetTagM393A4K40BB1-CRC #g˙˙˙fc(hbţ˙HH˙ €` €` DIMM_B1NODE 1Samsung00000000DIMM_B1_AssetTagM393A4K40BB1-CRC #i˙˙˙hc(jbţ˙HH˙ €` €` DIMM_B2NODE 1Samsung00000000DIMM_B2_AssetTagM393A4K40BB1-CRC #k˙˙˙jclţ˙m˙˙˙l(nlţ˙HH˙ €` €` DIMM_C1NODE 2Samsung00000000DIMM_C1_AssetTagM393A4K40BB1-CRC #o˙˙˙ nm(plţ˙HH˙ €` €` DIMM_C2NODE 2Samsung00000000DIMM_C2_AssetTagM393A4K40BB1-CRC #q ˙˙˙ pm(rlţ˙HH˙ €` €` DIMM_D1NODE 2Samsung00000000DIMM_D1_AssetTagM393A4K40BB1-CRC #s ˙˙˙ rm(tlţ˙HH˙ €` €` DIMM_D2NODE 2Samsung00000000DIMM_D2_AssetTagM393A4K40BB1-CRC #u˙˙˙tmv€CPU Internal L1wCPU Internal L2x‚ ƒ ƒCPU Internal L3*yłń˙űëżŒd ˜A+vwx(üłSOCKET 2011IntelIntel(R) Xeon(R) CPU E5-2698 v4 @ 2.20GHz‚z$AMTĽ/ƒ@{řG ę%Č˙˙vPro | en|US|iso8859-1fr|FR|iso8859-1zh|CNT|unicodezh|CNS|unicodeja|JP|unicodede|DE|iso8859-1es|ES|iso8859-1ru|RU|iso8859-5ko|KR|unicode}canonical-hardware-api-7bedc4f/hwlib/test_data/amd64/dgx_station/request.json0000644000175000017500000000201415037740715027337 0ustar nadzeyanadzeya{ "architecture": "amd64", "bios": { "firmware_revision": "5.11", "release_date": "08/27/2018", "revision": "0406", "vendor": "American Megatrends Inc.", "version": "0406" }, "board": { "manufacturer": "EMPTY", "product_name": "X99-E-10G WS", "version": "Rev 1.xx" }, "chassis": { "chassis_type": "Desktop", "manufacturer": "EMPTY", "sku": "Default string", "version": "Default string" }, "model": "DGX Station", "os": { "codename": "$CODENAME", "distributor": "Ubuntu", "kernel": { "loaded_modules": $KERNEL_MODULES, "name": "Linux", "signature": null, "version": "$KERNEL_VERSION" }, "version": "$RELEASE" }, "pci_peripherals": [], "processor": { "frequency": 800, "identifier": [ 241, 6, 4, 0, 255, 251, 235, 191 ], "manufacturer": "Intel", "version": "Intel(R) Xeon(R) CPU E5-2698 v4 @ 2.20GHz" }, "usb_peripherals": [], "vendor": "NVIDIA" } canonical-hardware-api-7bedc4f/hwlib/test_data/amd64/dgx_station/cpuinfo_max_freq0000644000175000017500000000000715037740715030224 0ustar nadzeyanadzeya800000 canonical-hardware-api-7bedc4f/hwlib/test_data/README.md0000644000175000017500000000660715037740715023011 0ustar nadzeyanadzeya# Test Data Directory This example data serves two purposes: - provides a comprehensive set of example data against which unit and/or component tests can be run - serve as a means of demonstrating to interested parties exactly what data the library collects and is transmitted to the hardware API server. All fields should be non-uniquely indentifiable to ensure that they tracking or tracing of machines interacting with service is possible Currently, the project uses test data of the following machines: - NVIDIA DGX-Station: [ubuntu.com/certified/201711-25989](https://ubuntu.com/certified/201711-25989) - Lenovo ThinkStation P620: [ubuntu.com/certified/202203-30052](https://ubuntu.com/certified/202203-30052) - Dell XPS 13 9340: [ubuntu.com/certified/202405-34051](https://ubuntu.com/certified/202405-34051) - Raspberry Pi 4 Model B 8 GB: [ubuntu.com/certified/202004-27865](https://ubuntu.com/certified/202004-27865) ## Structure Overview The `test_data` directory has the following structure: ``` ├── │   ├── │   │   ├── │   │   └── request.json ``` Key Files: - `cpuinfo_max_freq` — Contains maximum CPU frequency data. Can be fetched from `/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq` - `DMI` — DMI table data, can be retrieved from the `/sys/firmware/dmi/tables/` directory. - `smbios_entry_point` — SMBIOS entry point details. Is located in the `/sys/firmware/dmi/tables/` directory. - `version` — Kernel version file (`/proc/version`). - `request.json` — Expected request body that should be constructed. - `cpuinfo` — CPU information, see `/proc/cpuinfo`. If used only for non-amd64 machine. - `device-tree/` (dir) — arm64 specific directory with system information. See `/proc/device-tree`. ## Adding New Test Cases 1. Create a new directory under `amd64/` or `generic/` based on your test requirements. 2. Populate it with the necessary files (`cpuinfo_max_freq`, `DMI`, etc.). **Make sure you replace all the sensitive data like serial numbers with zeroes.** You can use the [`sed`](https://man7.org/linux/man-pages/man1/sed.1.html) tool for it. 3. Add `request.json` with anticipated values to validate against. Replace the values that you want to use variable with placeholders, for example: ``` "os": { "codename": "$CODENAME", "distributor": "Ubuntu", "kernel": { "loaded_modules": $KERNEL_MODULES, "name": "Linux", "signature": null, "version": "$KERNEL_VERSION" }, "version": "$RELEASE" } ``` In this example, we replace values in the quotes with strings defined in the test cases, and `$KERNEL_MODULES` gets replaced with a dict. This is how the test case is defined (see tests in the [models/request_validators.rs](../src/models/request_validators.rs) for more): ```rust #[test_case( "amd64/thinkstation_p620", // dir name "focal", // Ubuntu release codename "20.04", // The release itself "5.15.0-125-generic", // kernel version from the {dir_name}/version file &["xt_tcpudp", "nft_chain_nat"]; // kernel modules "focal_thinkstation" // test case name )] ``` 4. If you're adding a test case for a certified machine, update this document to include link to the machine on [ubuntu.com/certified](https://ubuntu.com/certified). canonical-hardware-api-7bedc4f/hwlib/test_data/arm64/0000755000175000017500000000000015037740715022452 5ustar nadzeyanadzeyacanonical-hardware-api-7bedc4f/hwlib/test_data/arm64/rpi4b8g/0000755000175000017500000000000015037740715023731 5ustar nadzeyanadzeyacanonical-hardware-api-7bedc4f/hwlib/test_data/arm64/rpi4b8g/cpuinfo0000644000175000017500000000223315037740715025317 0ustar nadzeyanadzeyaprocessor : 0 model name : ARMv7 Processor rev 3 (v7l) BogoMIPS : 108.00 Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xd08 CPU revision : 3 processor : 1 model name : ARMv7 Processor rev 3 (v7l) BogoMIPS : 108.00 Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xd08 CPU revision : 3 processor : 2 model name : ARMv7 Processor rev 3 (v7l) BogoMIPS : 108.00 Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xd08 CPU revision : 3 processor : 3 model name : ARMv7 Processor rev 3 (v7l) BogoMIPS : 108.00 Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xd08 CPU revision : 3 Hardware : BCM2711 Revision : d03114 Serial : 0000000000000000 Model : Raspberry Pi 4 Model B Rev 1.4canonical-hardware-api-7bedc4f/hwlib/test_data/arm64/rpi4b8g/version0000644000175000017500000000024115037740715025336 0ustar nadzeyanadzeyaLinux version 5.4.0-1119-raspi (buildd@bos03-arm64-044) (gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2)) #131-Ubuntu SMP PREEMPT Thu Oct 10 17:30:47 UTC 2024 canonical-hardware-api-7bedc4f/hwlib/test_data/arm64/rpi4b8g/os-release0000644000175000017500000000061715037740715025717 0ustar nadzeyanadzeyaPRETTY_NAME="Ubuntu 20.04.2 LTS" NAME="Ubuntu" VERSION_ID="20.04" VERSION="20.04.2 LTS (Focal Fossa)" VERSION_CODENAME=focal ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" UBUNTU_CODENAME=focal LOGO=ubuntu-logo canonical-hardware-api-7bedc4f/hwlib/test_data/arm64/rpi4b8g/device-tree/0000755000175000017500000000000015037740715026125 5ustar nadzeyanadzeyacanonical-hardware-api-7bedc4f/hwlib/test_data/arm64/rpi4b8g/device-tree/compatible0000644000175000017500000000004115037740715030162 0ustar nadzeyanadzeyaraspberrypi,4-model-bbrcm,bcm2711canonical-hardware-api-7bedc4f/hwlib/test_data/arm64/rpi4b8g/device-tree/model0000644000175000017500000000003615037740715027147 0ustar nadzeyanadzeyaRaspberry Pi 4 Model B Rev 1.5canonical-hardware-api-7bedc4f/hwlib/test_data/arm64/rpi4b8g/cpuinfo_max_freq0000644000175000017500000000000615037740715027175 0ustar nadzeyanadzeya600000canonical-hardware-api-7bedc4f/hwctl.10000644000175000017500000000272315037740715017653 0ustar nadzeyanadzeya.Dd December 5, 2024 .Dt HWCTL 1 .Os Ubuntu .Sh NAME .Nm hwctl .Nd CLI tool to check hardware certification status .Sh SYNOPSIS .Nm .Pp .Nm .Op Fl h | \-help .Op Fl V | \-version .Op Fl \-server Ar URL .Sh DESCRIPTION The .Nm utility checks the .Em Ubuntu Hardware Certification status of your system. .Pp .Nm verifies whether your exact machine model or a similar system has been certified and displays which Ubuntu releases the certification covers for it. For more information about the .Em Ubuntu Hardware Certification Program , visit .Lk https://ubuntu.com/certified "the certification website" . .Pp Note that root privileges are typically required to run this command. .Sh OPTIONS .Bl -tag -width ".Fl \-server" .It Fl h , \-help Print help information and exit. .It Fl V , \-version Print version information and exit. .It Fl \-server Ar URL Specify the API server URL. This overrides the default value and the .Ev HW_API_URL environment variable. .El .Sh ENVIRONMENT .Bl -tag -width "HW_API_URL" -compact .It Ev HW_API_URL Specifies the hardware-api server URL that .Nm uses for certification queries. The default value is .Lk https://hw.ubuntu.com . .El .Sh SEE ALSO .Xr dmidecode 8 , .Xr lshw 1 .Sh AUTHORS Written by .An Nadzeya Hutsko Aq Mt nadzeya.hutsko@canonical.com . .Sh BUGS Only amd64 architecture is currently supported. .Pp For information about open bugs, visit .Lk https://github.com/canonical/hardware-api/issues/ . .Sh COPYRIGHT Copyright \(co 2024 Canonical Ltd. canonical-hardware-api-7bedc4f/README.md0000644000175000017500000000413215037740715017723 0ustar nadzeyanadzeya# Hardware API Client [![Snapcraft][snapcraft-badge]][snapcraft-site] [![Test client lib and CLI tool][test-badge]][test-site] The **Hardware API Client** is the tool to check the certification status of hardware configurations. It consists of both the `hwlib` library and `hwctl` CLI tool. - [`hwlib`](./hwlib): Rust library for communicating with [the API server](../server/). - [`hwctl`](./hwctl): CLI tool leveraging the `hwlib` library. ## Basic Usage To check the machine certification status, simply run `hwctl` with root[^sudo] privileges: ```shell sudo hwctl ``` To send the request to a different server than the [default][hw-server], specify the `HW_API_URL` environment variable: ```shell sudo HW_API_URL=https://your.server.url hwctl ``` ## Installation `hwctl` is available on all major Linux distributions. On snap-ready systems, you can install it on the command-line with: ```shell sudo snap install hwctl ``` On Questing Quokka (25.10), you can also install it using `apt`: ```shell sudo apt-get install hwctl ``` ## Community and Support You can report any issues, bugs, or feature requests on the project's [GitHub repository][github-issues]. ## Contribute to the Hardware API Client The Hardware API Client is open source. Contributions are welcome. If you're interested, start with the [client contribution guide](./CONTRIBUTING.md). ## License and Copyright The Hardware API Client is released under the following licenses: - `hwlib` is released under the [LGPL-3.0 license](./hwlib/LICENSE). - `hwctl` is released under the [GPL-3.0 license](./hwctl/LICENSE). Š 2025 Canonical Ltd. [^sudo]: The client requires root access since we collect the hardware information using SMBIOS data. [snapcraft-badge]: https://snapcraft.io/hwctl/badge.svg [snapcraft-site]: https://snapcraft.io/hwctl [test-badge]: https://github.com/canonical/hardware-api/actions/workflows/test_client.yaml/badge.svg [test-site]: https://github.com/canonical/hardware-api/actions/workflows/test_client.yaml [hw-server]: https://hw.ubuntu.com [github-issues]: https://github.com/canonical/hardware-api/issues canonical-hardware-api-7bedc4f/Cargo.lock0000644000175000017500000005564015037740715020363 0ustar nadzeyanadzeya# This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 4 [[package]] name = "anstream" version = "0.6.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "301af1932e46185686725e0fad2f8f2aa7da69dd70bf6ecc44d6b703844a3933" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", "is_terminal_polyfill", "utf8parse", ] [[package]] name = "anstyle" version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" [[package]] name = "anstyle-parse" version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c8bdeb6047d8983be085bab0ba1472e6dc604e7041dbf6fcd5e71523014fae9" dependencies = [ "windows-sys 0.59.0", ] [[package]] name = "anstyle-wincon" version = "3.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "403f75924867bb1033c59fbf0797484329750cfbe3c4325cd33127941fabc882" dependencies = [ "anstyle", "once_cell_polyfill", "windows-sys 0.59.0", ] [[package]] name = "anyhow" version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" [[package]] name = "autocfg" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "bitflags" version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" [[package]] name = "cc" version = "1.2.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "deec109607ca693028562ed836a5f1c4b8bd77755c4e132fc5ce11b0b6211ae7" dependencies = [ "shlex", ] [[package]] name = "cfg-if" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" [[package]] name = "clap" version = "4.5.41" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be92d32e80243a54711e5d7ce823c35c41c9d929dc4ab58e1276f625841aadf9" dependencies = [ "clap_builder", "clap_derive", ] [[package]] name = "clap_builder" version = "4.5.41" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "707eab41e9622f9139419d573eca0900137718000c517d47da73045f54331c3d" dependencies = [ "anstream", "anstyle", "clap_lex", "strsim", ] [[package]] name = "clap_derive" version = "4.5.41" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef4f52386a59ca4c860f7393bcf8abd8dfd91ecccc0f774635ff68e92eeef491" dependencies = [ "heck", "proc-macro2", "quote", "syn", ] [[package]] name = "clap_lex" version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" [[package]] name = "colorchoice" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" [[package]] name = "core-foundation" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", "libc", ] [[package]] name = "core-foundation" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" dependencies = [ "core-foundation-sys", "libc", ] [[package]] name = "core-foundation-sys" version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "diff" version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" [[package]] name = "errno" version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad" dependencies = [ "libc", "windows-sys 0.60.2", ] [[package]] name = "fastrand" version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "foreign-types" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" dependencies = [ "foreign-types-shared", ] [[package]] name = "foreign-types-shared" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "getopts" version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cba6ae63eb948698e300f645f87c70f76630d505f23b8907cf1e193ee85048c1" dependencies = [ "unicode-width", ] [[package]] name = "getrandom" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" dependencies = [ "cfg-if", "libc", "r-efi", "wasi", ] [[package]] name = "heck" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hwctl" version = "0.9.3" dependencies = [ "anyhow", "clap", "hwlib", "serde_json", ] [[package]] name = "hwlib" version = "0.9.3" dependencies = [ "anyhow", "minreq", "os-release", "pretty_assertions", "pyo3", "serde", "serde_json", "simple_test_case", "smbios-lib", ] [[package]] name = "indoc" version = "2.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd" [[package]] name = "io-kit-sys" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "617ee6cf8e3f66f3b4ea67a4058564628cde41901316e19f559e14c7c72c5e7b" dependencies = [ "core-foundation-sys", "mach2", ] [[package]] name = "is_terminal_polyfill" version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "itoa" version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "lazy_static" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" version = "0.2.174" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" [[package]] name = "linux-raw-sys" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" [[package]] name = "log" version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] name = "mach2" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d640282b302c0bb0a2a8e0233ead9035e3bed871f0b7e81fe4a1ec829765db44" dependencies = [ "libc", ] [[package]] name = "memchr" version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "memoffset" version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" dependencies = [ "autocfg", ] [[package]] name = "minreq" version = "2.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84885312a86831bff4a3cb04a1e54a3f698407e3274c83249313f194d3e0b678" dependencies = [ "log", "native-tls", "serde", "serde_json", ] [[package]] name = "native-tls" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" dependencies = [ "libc", "log", "openssl", "openssl-probe", "openssl-sys", "schannel", "security-framework", "security-framework-sys", "tempfile", ] [[package]] name = "once_cell" version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "once_cell_polyfill" version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" [[package]] name = "openssl" version = "0.10.73" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8" dependencies = [ "bitflags", "cfg-if", "foreign-types", "libc", "once_cell", "openssl-macros", "openssl-sys", ] [[package]] name = "openssl-macros" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "openssl-probe" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" [[package]] name = "openssl-sys" version = "0.9.109" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90096e2e47630d78b7d1c20952dc621f957103f8bc2c8359ec81290d75238571" dependencies = [ "cc", "libc", "pkg-config", "vcpkg", ] [[package]] name = "os-release" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82f29ae2f71b53ec19cc23385f8e4f3d90975195aa3d09171ba3bef7159bec27" dependencies = [ "lazy_static", ] [[package]] name = "pkg-config" version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "portable-atomic" version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" [[package]] name = "pretty_assertions" version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ae130e2f271fbc2ac3a40fb1d07180839cdbbe443c7a27e1e3c13c5cac0116d" dependencies = [ "diff", "yansi", ] [[package]] name = "proc-macro2" version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" dependencies = [ "unicode-ident", ] [[package]] name = "pyo3" version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8970a78afe0628a3e3430376fc5fd76b6b45c4d43360ffd6cdd40bdde72b682a" dependencies = [ "indoc", "libc", "memoffset", "once_cell", "portable-atomic", "pyo3-build-config", "pyo3-ffi", "pyo3-macros", "unindent", ] [[package]] name = "pyo3-build-config" version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "458eb0c55e7ece017adeba38f2248ff3ac615e53660d7c71a238d7d2a01c7598" dependencies = [ "once_cell", "target-lexicon", ] [[package]] name = "pyo3-ffi" version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7114fe5457c61b276ab77c5055f206295b812608083644a5c5b2640c3102565c" dependencies = [ "libc", "pyo3-build-config", ] [[package]] name = "pyo3-macros" version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8725c0a622b374d6cb051d11a0983786448f7785336139c3c94f5aa6bef7e50" dependencies = [ "proc-macro2", "pyo3-macros-backend", "quote", "syn", ] [[package]] name = "pyo3-macros-backend" version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4109984c22491085343c05b0dbc54ddc405c3cf7b4374fc533f5c3313a572ccc" dependencies = [ "heck", "proc-macro2", "pyo3-build-config", "quote", "syn", ] [[package]] name = "quote" version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] [[package]] name = "r-efi" version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" [[package]] name = "rustix" version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8" dependencies = [ "bitflags", "errno", "libc", "linux-raw-sys", "windows-sys 0.60.2", ] [[package]] name = "ryu" version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "schannel" version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" dependencies = [ "windows-sys 0.59.0", ] [[package]] name = "security-framework" version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ "bitflags", "core-foundation 0.9.4", "core-foundation-sys", "libc", "security-framework-sys", ] [[package]] name = "security-framework-sys" version = "2.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" dependencies = [ "core-foundation-sys", "libc", ] [[package]] name = "serde" version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "serde_json" version = "1.0.141" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30b9eff21ebe718216c6ec64e1d9ac57087aad11efc64e32002bce4a0d4c03d3" dependencies = [ "itoa", "memchr", "ryu", "serde", ] [[package]] name = "shlex" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "simple_test_case" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6909e2382b73068b0172c9c28726b6fb9efeef51742ecfd05b9260c62c42bb8e" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "smbios-lib" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c18320ad3d997a100cb948fc020111936c530eddfde947f467083730e39e72" dependencies = [ "core-foundation 0.10.1", "core-foundation-sys", "getopts", "io-kit-sys", "libc", "mach2", "serde", "serde_json", ] [[package]] name = "strsim" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" version = "2.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] [[package]] name = "target-lexicon" version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e502f78cdbb8ba4718f566c418c52bc729126ffd16baee5baa718cf25dd5a69a" [[package]] name = "tempfile" version = "3.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1" dependencies = [ "fastrand", "getrandom", "once_cell", "rustix", "windows-sys 0.59.0", ] [[package]] name = "unicode-ident" version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "unicode-width" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a1a07cc7db3810833284e8d372ccdc6da29741639ecc70c9ec107df0fa6154c" [[package]] name = "unindent" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3" [[package]] name = "utf8parse" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "vcpkg" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "wasi" version = "0.14.2+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" dependencies = [ "wit-bindgen-rt", ] [[package]] name = "windows-sys" version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ "windows-targets 0.52.6", ] [[package]] name = "windows-sys" version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ "windows-targets 0.53.2", ] [[package]] name = "windows-targets" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ "windows_aarch64_gnullvm 0.52.6", "windows_aarch64_msvc 0.52.6", "windows_i686_gnu 0.52.6", "windows_i686_gnullvm 0.52.6", "windows_i686_msvc 0.52.6", "windows_x86_64_gnu 0.52.6", "windows_x86_64_gnullvm 0.52.6", "windows_x86_64_msvc 0.52.6", ] [[package]] name = "windows-targets" version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c66f69fcc9ce11da9966ddb31a40968cad001c5bedeb5c2b82ede4253ab48aef" dependencies = [ "windows_aarch64_gnullvm 0.53.0", "windows_aarch64_msvc 0.53.0", "windows_i686_gnu 0.53.0", "windows_i686_gnullvm 0.53.0", "windows_i686_msvc 0.53.0", "windows_x86_64_gnu 0.53.0", "windows_x86_64_gnullvm 0.53.0", "windows_x86_64_msvc 0.53.0", ] [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_gnullvm" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_aarch64_msvc" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" [[package]] name = "windows_i686_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnu" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_gnullvm" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_i686_msvc" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnu" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_gnullvm" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" [[package]] name = "windows_x86_64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "windows_x86_64_msvc" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" [[package]] name = "wit-bindgen-rt" version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" dependencies = [ "bitflags", ] [[package]] name = "yansi" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049"