From 1938150d5839636b865b56732d1ac8e75824ee7d Mon Sep 17 00:00:00 2001 From: Anton Lazarev Date: Sat, 25 May 2024 20:03:23 -0700 Subject: [PATCH 1/2] add fido alliance page --- macros/src/spec.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/macros/src/spec.rs b/macros/src/spec.rs index fd78d26..798e4a0 100644 --- a/macros/src/spec.rs +++ b/macros/src/spec.rs @@ -176,6 +176,7 @@ pub fn try_resolve_constant(key_name: String, path: String) -> Option { ("usage_page", "DIGITIZER") => Some(0x0D), ("usage_page", "ALPHANUMERIC_DISPLAY") => Some(0x14), ("usage_page", "BARCODE_SCANNER") => Some(0x8C), + ("usage_page", "FIDO_ALLIANCE") => Some(0xF1D0), ("usage_page", "VENDOR_DEFINED_START") => Some(0xFF00), ("usage_page", "VENDOR_DEFINED_END") => Some(0xFFFF), @@ -228,6 +229,11 @@ pub fn try_resolve_constant(key_name: String, path: String) -> Option { ("usage", "GRAPHIC_EQUALIZER") => Some(0x06), ("usage", "AC_PAN") => Some(0x0238), + // FIDO Alliance usage_page + ("usage", "U2F_AUTHENTICATOR_DEVICE") => Some(0x1), + ("usage", "INPUT_REPORT_DATA") => Some(0x20), + ("usage", "OUTPUT_REPORT_DATA") => Some(0x21), + (_, _) => None, } } From 568ef3889a49a926b13bff0531c66d5e38d93637 Mon Sep 17 00:00:00 2001 From: Anton Lazarev Date: Sat, 25 May 2024 20:10:35 -0700 Subject: [PATCH 2/2] add CtapReport --- src/descriptor.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/descriptor.rs b/src/descriptor.rs index c1a8e0c..833c680 100644 --- a/src/descriptor.rs +++ b/src/descriptor.rs @@ -978,3 +978,21 @@ impl From for SystemControlKey { } } } + +/// CtapReport describes a report and its companion descriptor that can be +/// used to present a FIDO-compatible authenticator device to the host. +#[gen_hid_descriptor( + (collection = APPLICATION, usage_page = FIDO_ALLIANCE, usage = U2F_AUTHENTICATOR_DEVICE) = { + (usage = INPUT_REPORT_DATA, logical_min = 0x0) = { + #[item_settings data,variable,absolute] data_in=input; + }; + (usage = OUTPUT_REPORT_DATA, logical_min = 0x0) = { + #[item_settings data,variable,absolute] data_out=output; + }; + } +)] +#[allow(dead_code)] +pub struct CtapReport { + pub data_in: [u8; 64], + pub data_out: [u8; 64], +}