@@ -825,9 +825,8 @@ where
825825 let mut data = [ 0u8 ; 1 ] ;
826826
827827 // What do they want?
828- let rsp = match ( req. request_type , Command :: try_from ( req. register ) ) {
829- ( proto:: RequestType :: Read , Ok ( Command :: ProtocolVersion ) )
830- | ( proto:: RequestType :: ReadAlt , Ok ( Command :: ProtocolVersion ) ) => {
828+ let rsp = match ( req. request_type . flatten ( ) , Command :: try_from ( req. register ) ) {
829+ ( proto:: RequestType :: Read , Ok ( Command :: ProtocolVersion ) ) => {
831830 defmt:: trace!( "Reading ProtocolVersion" ) ;
832831 // They want the Protocol Version we support. Give them v0.1.1.
833832 let length = req. length_or_data as usize ;
@@ -838,8 +837,7 @@ where
838837 proto:: Response :: new_without_data ( proto:: ResponseResult :: BadLength )
839838 }
840839 }
841- ( proto:: RequestType :: Read , Ok ( Command :: FirmwareVersion ) )
842- | ( proto:: RequestType :: ReadAlt , Ok ( Command :: FirmwareVersion ) ) => {
840+ ( proto:: RequestType :: Read , Ok ( Command :: FirmwareVersion ) ) => {
843841 defmt:: trace!( "Reading FirmwareVersion" ) ;
844842 // They want the Firmware Version string.
845843 let length = req. length_or_data as usize ;
@@ -851,8 +849,7 @@ where
851849 proto:: Response :: new_without_data ( proto:: ResponseResult :: BadLength )
852850 }
853851 }
854- ( proto:: RequestType :: Read , Ok ( Command :: Ps2KbBuffer ) )
855- | ( proto:: RequestType :: ReadAlt , Ok ( Command :: Ps2KbBuffer ) ) => {
852+ ( proto:: RequestType :: Read , Ok ( Command :: Ps2KbBuffer ) ) => {
856853 defmt:: trace!( "Reading Ps2KbBuffer" ) ;
857854 let length = req. length_or_data as usize ;
858855 if length > 0 && length <= register_state. scratch . len ( ) {
@@ -882,6 +879,7 @@ where
882879 }
883880 ( proto:: RequestType :: ShortWrite , Ok ( Command :: SpeakerDuration ) ) => {
884881 defmt:: debug!( "Writing speaker duration ({})" , req. length_or_data) ;
882+ // This update actually causes the speaker to beep
885883 register_state
886884 . speaker
887885 . set_duration ( req. length_or_data as u16 * 10 ) ;
@@ -919,6 +917,11 @@ where
919917 }
920918 _ => {
921919 // Sorry, that register / request type is not supported
920+ defmt:: warn!(
921+ "Unknown register operation {:?} on 0x{:02x}" ,
922+ req. request_type,
923+ req. register
924+ ) ;
922925 proto:: Response :: new_without_data ( proto:: ResponseResult :: BadRegister )
923926 }
924927 } ;
0 commit comments