@@ -462,7 +462,8 @@ impl<'d, I: Instance, D: channel::Direction, T: channel::Type> Channel<'d, I, D,
462462 }
463463 }
464464
465- async fn write ( & mut self , buf : & [ u8 ] ) -> Result < ( ) , ChannelError > {
465+ //TODO: Emit a zero length packet when ensure_transaction_end is true and the packet is of max size
466+ async fn write ( & mut self , buf : & [ u8 ] , ensure_transaction_end : bool ) -> Result < ( ) , ChannelError > {
466467 self . write_data ( buf) ;
467468
468469 let index = self . index ;
@@ -577,7 +578,7 @@ impl<'d, I: Instance, T: channel::Type, D: channel::Direction> UsbChannel<T, D>
577578 epr_val. set_setup ( true ) ;
578579 epr0. write_value ( epr_val) ;
579580
580- self . write ( setup. as_bytes ( ) ) . await ?;
581+ self . write ( setup. as_bytes ( ) , false ) . await ?;
581582
582583 // data stage
583584 let count = self . read ( buf) . await ?;
@@ -586,7 +587,7 @@ impl<'d, I: Instance, T: channel::Type, D: channel::Direction> UsbChannel<T, D>
586587
587588 // Send 0 bytes
588589 let zero: [ u8 ; 0 ] = [ 0u8 ; 0 ] ;
589- self . write ( & zero) . await ?;
590+ self . write ( & zero, false ) . await ?;
590591
591592 Ok ( count)
592593 }
@@ -606,12 +607,12 @@ impl<'d, I: Instance, T: channel::Type, D: channel::Direction> UsbChannel<T, D>
606607 let mut epr_val = invariant ( epr0. read ( ) ) ;
607608 epr_val. set_setup ( true ) ;
608609 epr0. write_value ( epr_val) ;
609- self . write ( setup. as_bytes ( ) ) . await ?;
610+ self . write ( setup. as_bytes ( ) , false ) . await ?;
610611
611612 if buf. is_empty ( ) {
612613 // do nothing
613614 } else {
614- self . write ( buf) . await ?;
615+ self . write ( buf, false ) . await ?;
615616 }
616617
617618 // Status stage
@@ -654,11 +655,11 @@ impl<'d, I: Instance, T: channel::Type, D: channel::Direction> UsbChannel<T, D>
654655 self . read ( buf) . await
655656 }
656657
657- async fn request_out ( & mut self , buf : & [ u8 ] ) -> Result < ( ) , ChannelError >
658+ async fn request_out ( & mut self , buf : & [ u8 ] , ensure_transaction_end : bool ) -> Result < ( ) , ChannelError >
658659 where
659660 D : channel:: IsOut ,
660661 {
661- self . write ( buf) . await
662+ self . write ( buf, ensure_transaction_end ) . await
662663 }
663664
664665 async fn set_timeout ( & mut self , _: TimeoutConfig ) { }
0 commit comments