-
Notifications
You must be signed in to change notification settings - Fork 36
Description
I'm quite newbie in what comes to USB, and as an exercise I was trying to clone the behavior of a USB full-speed HID device I have at home using a STM32F411 device.
However, I encounter a difficulty in the fact that the device I was trying to mimic sends interrupt transfers to the host of 65 bytes. I wasn't able to imitate that same behavior with the current implementation of this library, because it seems that the number of packets that will be used for any IN transfer is hardcoded to 1 here when setting PKTCNT always to 1.
Increasing the FIFO TX size to a higher number greater than max_packet_size and properly setting up the PKTCNT based on the max_packet_size and the length of the buffer to be transmitted could remove this limitation:
#[cfg(feature = "fs")]
{
let pktcnt = ((buf.len() - 1 + self.descriptor.max_packet_size as usize) / self.descriptor.max_packet_size as usize) as u32;
write_reg!(endpoint_in, ep, DIEPTSIZ, PKTCNT: pktcnt, XFRSIZ: buf.len() as u32);
}
Since I'm not quite familiar about USB in general, is there any reason why it has been decided to hardcode the packet count to be 1? Is there any possibility to increase it in future releases?