diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | src/device.rs | 19 |
2 files changed, 19 insertions, 2 deletions
@@ -10,6 +10,8 @@ development and supports: - connecting as a USB device with the Nitrokey Pro’s product and vendor ID - connecting as a HID class device +- using these Nitrokey commands: + - `GET_STATUS` ## Resources diff --git a/src/device.rs b/src/device.rs index 3b6cf46..960f698 100644 --- a/src/device.rs +++ b/src/device.rs @@ -69,8 +69,23 @@ impl Nitrokey { command_id: CommandId, data: &[u8], ) -> Result<[u8; 53], CommandStatus> { - let _ = (command_id, data); - Err(CommandStatus::UnknownCommand) + let _ = data; + match command_id { + CommandId::GetStatus => { + let mut data = [0u8; 53]; + data[0] = 1; // firmware_version_st.minor + data[1] = 0; // firmware_version_st.major + data[2] = 0; // card_serial[0] + data[3] = 0; // card_serial[1] + data[4] = 0; // card_serial[2] + data[5] = 0; // card_serial[3] + data[6] = 0; // numlock + data[7] = 0; // capslock + data[8] = 0; // enable_user_password + data[9] = 0; // delete_user_password + Ok(data) + } + } } } |