File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,11 @@ mod sizes {
2222 pub const INTERRUPT_ENDPOINT : u16 = 31 ;
2323}
2424
25- static mut CONTROL_BUFFER : UnsafeCell < [ u8 ; 256 ] > = UnsafeCell :: new ( [ 0 ; 256 ] ) ;
25+ pub struct ControlBuffer ( UnsafeCell < [ u8 ; 256 ] > ) ;
26+
27+ unsafe impl Sync for ControlBuffer { }
28+
29+ static CONTROL_BUFFER : ControlBuffer = ControlBuffer ( UnsafeCell :: new ( [ 0 ; 256 ] ) ) ;
2630
2731/// Test USB class for testing USB driver implementations. Supports various endpoint types and
2832/// requests for testing USB peripheral drivers on actual hardware.
@@ -115,7 +119,7 @@ impl<B: UsbBus> TestClass<'_, B> {
115119 usb_bus : & ' a UsbBusAllocator < B > ,
116120 ) -> UsbDeviceBuilder < ' a , B > {
117121 UsbDeviceBuilder :: new ( usb_bus, UsbVidPid ( VID , PID ) , unsafe {
118- CONTROL_BUFFER . get_mut ( )
122+ & mut * ( CONTROL_BUFFER . 0 . get ( ) )
119123 } )
120124 . strings ( & [ StringDescriptors :: default ( )
121125 . manufacturer ( MANUFACTURER )
You can’t perform that action at this time.
0 commit comments