Commit b4aab6ba authored by Bernhard Nortmann's avatar Bernhard Nortmann
Browse files

fel: Use initializers for aw_usb_request and aw_fel_request



instead of memset() and strcpy() to clear / assign member fields.
Signed-off-by: default avatarBernhard Nortmann <bernhard.nortmann@web.de>
parent 49952996
...@@ -165,12 +165,13 @@ int get_image_type(const uint8_t *buf, size_t len) ...@@ -165,12 +165,13 @@ int get_image_type(const uint8_t *buf, size_t len)
void aw_send_usb_request(libusb_device_handle *usb, int type, int length) void aw_send_usb_request(libusb_device_handle *usb, int type, int length)
{ {
struct aw_usb_request req; struct aw_usb_request req = {
memset(&req, 0, sizeof(req)); .signature = "AWUC",
strcpy(req.signature, "AWUC"); .request = htole16(type),
req.length = req.length2 = htole32(length); .length = htole32(length),
req.request = htole16(type); .unknown1 = htole32(0x0c000000)
req.unknown1 = htole32(0x0c000000); };
req.length2 = req.length;
usb_bulk_send(usb, AW_USB_FEL_BULK_EP_OUT, &req, sizeof(req), false); usb_bulk_send(usb, AW_USB_FEL_BULK_EP_OUT, &req, sizeof(req), false);
} }
...@@ -210,11 +211,11 @@ static const int AW_FEL_1_READ = 0x103; ...@@ -210,11 +211,11 @@ static const int AW_FEL_1_READ = 0x103;
void aw_send_fel_request(libusb_device_handle *usb, int type, uint32_t addr, uint32_t length) void aw_send_fel_request(libusb_device_handle *usb, int type, uint32_t addr, uint32_t length)
{ {
struct aw_fel_request req; struct aw_fel_request req = {
memset(&req, 0, sizeof(req)); .request = htole32(type),
req.request = htole32(type); .address = htole32(addr),
req.address = htole32(addr); .length = htole32(length)
req.length = htole32(length); };
aw_usb_write(usb, &req, sizeof(req), false); aw_usb_write(usb, &req, sizeof(req), false);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment