From bbe39cad2ea8b4c0735f7f49206ae2dab083fffc Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Sun, 18 Sep 2022 19:51:39 +0200 Subject: [PATCH] usbd_gs_can: remove unused USBD_GS_CAN_HandleTypeDef::host_config The GS_USB_BREQ_HOST_FORMAT has never been supported by the candleLight firmware, and since Linux v5.10 the gs_usb driver works on Big Endian Linux systems, too. So remove host_config handling from the firmware. This saves some bytes: | add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-16 (-16) | Function old new delta | USBD_GS_CAN_EP0_RxReady 640 624 -16 | Total: Before=17382, After=17366, chg -0.09% --- src/usbd_gs_can.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/usbd_gs_can.c b/src/usbd_gs_can.c index 167f799..c07bf2f 100644 --- a/src/usbd_gs_can.c +++ b/src/usbd_gs_can.c @@ -50,7 +50,6 @@ typedef struct { USBD_SetupReqTypedef last_setup_request; - struct gs_host_config host_config; queue_t *q_frame_pool; queue_t *q_from_host; @@ -379,8 +378,15 @@ static uint8_t USBD_GS_CAN_EP0_RxReady(USBD_HandleTypeDef *pdev) { switch (req->bRequest) { case GS_USB_BREQ_HOST_FORMAT: - // TODO process host data (expect 0x0000beef in byte_order) - memcpy(&hcan->host_config, hcan->ep0_buf, sizeof(hcan->host_config)); + /* The firmware on the original USB2CAN by Geschwister Schneider + * Technologie Entwicklungs- und Vertriebs UG exchanges all data + * between the host and the device in host byte order. This is done + * with the struct gs_host_config::byte_order member, which is sent + * first to indicate the desired byte order. + * + * The widely used open source firmware candleLight doesn't support + * this feature and exchanges the data in little endian byte order. + */ break; case GS_USB_BREQ_IDENTIFY: