Skip to content

Commit 28c1630

Browse files
committed
sys/usb/usbus_msc: fix typo in C expression
Rather than setting the correct blk_len, the code only wrote 1 and 0 into the three bytes due to the use of a logic and where a bitwise and should be used.
1 parent 7ac0b6f commit 28c1630

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sys/usb/usbus/msc/scsi.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,9 @@ static void _scsi_read_format_capacities(usbus_handler_t *handler, uint8_t lun)
163163
pkt->type = SCSI_READ_FMT_CAPA_TYPE_FORMATTED;
164164

165165
/* Manage endianness, bytes 11..9 -> LSB..MSB */
166-
pkt->blk_len[0] = (block_size >> 16) && 0xFF;
167-
pkt->blk_len[1] = (block_size >> 8) && 0xFF;
168-
pkt->blk_len[2] = block_size && 0xFF;
166+
pkt->blk_len[0] = (block_size >> 16) & 0xFF;
167+
pkt->blk_len[1] = (block_size >> 8) & 0xFF;
168+
pkt->blk_len[2] = block_size & 0xFF;
169169

170170
/* copy into ep buffer */
171171
usbdev_ep_xmit(msc->ep_in->ep, (uint8_t *)pkt, sizeof(msc_read_fmt_capa_pkt_t));

0 commit comments

Comments
 (0)