aboutsummaryrefslogtreecommitdiffstats
path: root/usbh/src/usbproto.rs
diff options
context:
space:
mode:
Diffstat (limited to 'usbh/src/usbproto.rs')
-rw-r--r--usbh/src/usbproto.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/usbh/src/usbproto.rs b/usbh/src/usbproto.rs
index 246a9a4..97d1839 100644
--- a/usbh/src/usbproto.rs
+++ b/usbh/src/usbproto.rs
@@ -347,7 +347,7 @@ mod test {
#[test]
fn dev_desc_serialize() {
- let desc = USBDeviceDescriptor {
+ let mut desc = USBDeviceDescriptor {
b_length: 18,
b_descriptor_type: USBDescriptor::Device,
bcd_usb: 0x0110,
@@ -363,7 +363,7 @@ mod test {
i_serial_number: 0xa2,
b_num_configurations: 1,
};
- let db = DataBuf::from(&desc);
+ let db = DataBuf::from(&mut desc);
assert_eq!(db.len, 18);
let want = [
0x12, 0x01, 0x10, 0x01, 0x02, 0x03, 0x04, 64, 0xad, 0xde, 0xef, 0xbe, 0x32, 0x54, 0xa0,
@@ -375,7 +375,7 @@ mod test {
#[test]
fn config_desc_serialize() {
- let desc = USBConfigurationDescriptor {
+ let mut desc = USBConfigurationDescriptor {
b_length: 18,
b_descriptor_type: USBDescriptor::Configuration,
w_total_length: 0x20,
@@ -385,7 +385,7 @@ mod test {
bm_attributes: 0x40,
b_max_power: 0xfa,
};
- let db = DataBuf::from(&desc);
+ let db = DataBuf::from(&mut desc);
assert_eq!(db.len, 9);
let want = [0x12, 0x02, 0x20, 0x00, 0x05, 0x0a, 0x01, 0x40, 0xfa];
let got = unsafe { core::slice::from_raw_parts(db.ptr, db.len) };
@@ -394,7 +394,7 @@ mod test {
#[test]
fn interface_desc_serialize() {
- let desc = USBInterfaceDescriptor {
+ let mut desc = USBInterfaceDescriptor {
b_length: 18,
b_descriptor_type: USBDescriptor::Interface,
b_interface_number: 2,
@@ -405,7 +405,7 @@ mod test {
b_interface_protocol: 0x33,
i_interface: 10,
};
- let db = DataBuf::from(&desc);
+ let db = DataBuf::from(&mut desc);
assert_eq!(db.len, 9);
let want = [0x12, 0x04, 0x02, 0xaa, 0x05, 0x11, 0x22, 0x33, 0x0a];
let got = unsafe { core::slice::from_raw_parts(db.ptr, db.len) };
@@ -414,7 +414,7 @@ mod test {
#[test]
fn endpoint_desc_serialize() {
- let desc = USBEndpointDescriptor {
+ let mut desc = USBEndpointDescriptor {
b_length: 18,
b_descriptor_type: USBDescriptor::Endpoint,
b_endpoint_address: 1,
@@ -422,7 +422,7 @@ mod test {
w_max_packet_size: 0xdead,
b_interval: 0x33,
};
- let db = DataBuf::from(&desc);
+ let db = DataBuf::from(&mut desc);
assert_eq!(db.len, 7);
let want = [0x12, 0x05, 0x01, 0x22, 0xad, 0xde, 0x33];
let got = unsafe { core::slice::from_raw_parts(db.ptr, db.len) };
@@ -431,14 +431,14 @@ mod test {
#[test]
fn setup_packet_serialize() {
- let setup_packet = USBSetupPacket {
+ let mut setup_packet = USBSetupPacket {
bm_request_type: BMRequestType::get_descr(),
b_request: USBRequest::GetDescriptor,
w_value: WValue::from((0x00, 0x01)),
w_index: 0xbeef,
w_length: 18,
};
- let db = DataBuf::from(&setup_packet);
+ let db = DataBuf::from(&mut setup_packet);
assert_eq!(db.len, 8);
let want = [0x80, 0x06, 0x00, 0x01, 0xef, 0xbe, 0x012, 0x00];
let got = unsafe { core::slice::from_raw_parts(db.ptr, db.len) };