File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed
samples/subsys/pmci/mctp/usb_endpoint Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -69,14 +69,14 @@ def disconnect(self):
6969
7070 print ("Sending message with size smaller than USB FS MPS (<64b)" )
7171 usb_dev .send_data (
72- b'\x1a \xb4 \x00 \x0f \x01 \x0a \x14 \xc0 \x48 \x65 \x6c \x6c \x6f \x2c \x20 \x4d \x43 \x58 \x00 '
72+ b'\x1a \xb4 \x00 \x13 \x01 \x0a \x14 \xc0 \x48 \x65 \x6c \x6c \x6f \x2c \x20 \x4d \x43 \x58 \x00 '
7373 )
7474 response = usb_dev .receive_data ()
7575 print ("Received:" , bytes (response ))
7676
7777 print ("Sending message spanning two USB FS packets (>64b)" )
7878 usb_dev .send_data (
79- b'\x1a \xb4 \x00 \x4c \x01 \x0a \x14 \xc0 \x48 \x65 \x6c \x6c \x6f \x2c \x20 \x4d \x43 \x58 \x2e \x20 '
79+ b'\x1a \xb4 \x00 \x50 \x01 \x0a \x14 \xc0 \x48 \x65 \x6c \x6c \x6f \x2c \x20 \x4d \x43 \x58 \x2e \x20 '
8080 b'\x4c \x65 \x74 \x27 \x73 \x20 \x74 \x65 \x73 \x74 \x20 \x61 \x20 \x6d \x75 \x6c \x74 \x69 \x2d \x70 '
8181 b'\x61 \x63 \x6b \x65 \x74 \x20 \x6d \x65 \x73 \x73 \x61 \x67 \x65 \x20 \x74 \x6f \x20 \x73 \x65 \x65 '
8282 b'\x20 \x68 \x6f \x77 \x20 \x79 \x6f \x75 \x20 \x68 \x61 \x6e \x64 \x6c \x65 \x20 \x69 \x74 \x2e \x00 '
@@ -86,8 +86,8 @@ def disconnect(self):
8686
8787 print ("Sending message with two MCTP messages in a single USB FS packet" )
8888 usb_dev .send_data (
89- b'\x1a \xb4 \x00 \x12 \x01 \x0a \x14 \xc0 \x48 \x65 \x6c \x6c \x6f \x2c \x20 \x4d \x43 \x58 \x2c \x20 '
90- b'\x31 \x00 \x1a \xb4 \x00 \x12 \x01 \x0a \x14 \xc0 \x48 \x65 \x6c \x6c \x6f \x2c \x20 \x4d \x43 \x58 '
89+ b'\x1a \xb4 \x00 \x16 \x01 \x0a \x14 \xc0 \x48 \x65 \x6c \x6c \x6f \x2c \x20 \x4d \x43 \x58 \x2c \x20 '
90+ b'\x31 \x00 \x1a \xb4 \x00 \x16 \x01 \x0a \x14 \xc0 \x48 \x65 \x6c \x6c \x6f \x2c \x20 \x4d \x43 \x58 '
9191 b'\x2c \x20 \x32 \x00 '
9292 )
9393 response = usb_dev .receive_data ()
Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ int mctp_usb_tx(struct mctp_binding *binding, struct mctp_pktbuf *pkt)
128128 usb -> tx_buf [0 ] = MCTP_USB_DMTF_0 ;
129129 usb -> tx_buf [1 ] = MCTP_USB_DMTF_1 ;
130130 usb -> tx_buf [2 ] = 0 ;
131- usb -> tx_buf [3 ] = len ;
131+ usb -> tx_buf [3 ] = len + MCTP_USB_HEADER_SIZE ;
132132
133133 memcpy ((void * )& usb -> tx_buf [MCTP_USB_HEADER_SIZE ], pkt -> data , len );
134134
@@ -244,7 +244,8 @@ static void mctp_usb_class_out_work(struct k_work *work)
244244 }
245245
246246 usb -> rx_data_idx = 0 ;
247- usb -> rx_pkt = mctp_pktbuf_alloc (& usb -> binding , ctx -> out_buf [i ]);
247+ usb -> rx_pkt = mctp_pktbuf_alloc (& usb -> binding ,
248+ ctx -> out_buf [i ] - MCTP_USB_HEADER_SIZE );
248249 if (usb -> rx_pkt == NULL ) {
249250 LOG_ERR ("Could not allocate PKT buffer" );
250251 mctp_usb_reset_rx_state (usb );
@@ -253,7 +254,7 @@ static void mctp_usb_class_out_work(struct k_work *work)
253254
254255 usb -> rx_state = STATE_DATA ;
255256
256- LOG_DBG ("Expecting LEN=%d" , (int )ctx -> out_buf [i ]);
257+ LOG_DBG ("Expecting LEN=%d" , (int )ctx -> out_buf [i ] - MCTP_USB_HEADER_SIZE );
257258
258259 break ;
259260 }
You can’t perform that action at this time.
0 commit comments