1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

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.
This commit is contained in:
Marian Buschsieweke 2023-05-20 22:16:09 +02:00
parent 7ac0b6f821
commit 28c1630f54
No known key found for this signature in database
GPG Key ID: CB8E3238CE715A94

View File

@ -163,9 +163,9 @@ static void _scsi_read_format_capacities(usbus_handler_t *handler, uint8_t lun)
pkt->type = SCSI_READ_FMT_CAPA_TYPE_FORMATTED;
/* Manage endianness, bytes 11..9 -> LSB..MSB */
pkt->blk_len[0] = (block_size >> 16) && 0xFF;
pkt->blk_len[1] = (block_size >> 8) && 0xFF;
pkt->blk_len[2] = block_size && 0xFF;
pkt->blk_len[0] = (block_size >> 16) & 0xFF;
pkt->blk_len[1] = (block_size >> 8) & 0xFF;
pkt->blk_len[2] = block_size & 0xFF;
/* copy into ep buffer */
usbdev_ep_xmit(msc->ep_in->ep, (uint8_t *)pkt, sizeof(msc_read_fmt_capa_pkt_t));