@@ -205,6 +205,53 @@ impl HidJob {
205205 }
206206 } ,
207207 ) ,
208+ HardwareSpec :: YuanconThree => Self :: new (
209+ state. clone ( ) ,
210+ 0x0518 ,
211+ 0x2022 ,
212+ 0x83 ,
213+ 0x03 ,
214+ * disable_air,
215+ |buf, input| {
216+ if buf. len != 46 { // real length is 46 but last 12 bytes are unused
217+ return ;
218+ }
219+
220+ input. ground . copy_from_slice ( & buf. data [ 2 ..34 ] ) ;
221+ input. flip_vert ( ) ;
222+
223+ let bits: Vec < u8 > = ( 0 ..8 ) . map ( |x| ( buf. data [ 0 ] >> x) & 1 ) . collect ( ) ;
224+ for i in 0 ..6 {
225+ input. air [ i ^ 1 ] = bits[ i] ;
226+ }
227+ input. extra [ 0 ..2 ] . copy_from_slice ( & bits[ 6 ..8 ] ) ;
228+ } ,
229+ WriteType :: Interrupt ,
230+ |buf, buf_two, lights| {
231+ buf. len = 61 ;
232+ buf. data [ 0 ] = 0 ;
233+ buf_two. len = 61 ;
234+ buf_two. data [ 0 ] = 1 ;
235+
236+ for ( buf_chunk, state_chunk) in buf. data [ 1 ..61 ]
237+ . chunks_mut ( 3 )
238+ . zip ( lights. ground . chunks ( 3 ) . skip ( 11 ) . take ( 20 ) . rev ( ) )
239+ {
240+ buf_chunk[ 0 ] = state_chunk[ 0 ] ;
241+ buf_chunk[ 1 ] = state_chunk[ 1 ] ;
242+ buf_chunk[ 2 ] = state_chunk[ 2 ] ;
243+ }
244+
245+ for ( buf_chunk, state_chunk) in buf_two. data [ 1 ..34 ]
246+ . chunks_mut ( 3 )
247+ . zip ( lights. ground . chunks ( 3 ) . take ( 11 ) . rev ( ) )
248+ {
249+ buf_chunk[ 0 ] = state_chunk[ 0 ] ;
250+ buf_chunk[ 1 ] = state_chunk[ 1 ] ;
251+ buf_chunk[ 2 ] = state_chunk[ 2 ] ;
252+ }
253+ } ,
254+ ) ,
208255 HardwareSpec :: Yubideck => Self :: new (
209256 state. clone ( ) ,
210257 0x1973 ,
@@ -323,8 +370,15 @@ impl HidJob {
323370 }
324371 info ! ( "Device setting configuration" ) ;
325372 handle. set_active_configuration ( 1 ) ?;
373+
374+ // A bit janky but Laverita v3 seems to require interface 3
326375 info ! ( "Device claiming interface" ) ;
327- handle. claim_interface ( 0 ) ?;
376+ if self . vid == 0x0518 && self . pid == 0x2022 {
377+ handle. claim_interface ( 3 ) ?;
378+ } else {
379+ handle. claim_interface ( 0 ) ?;
380+ }
381+
328382 self . handle = Some ( handle) ;
329383 Ok ( ( ) )
330384 }
0 commit comments