4 Commits

Author SHA1 Message Date
cecio
5836ac7208 small comment 2026-04-18 23:43:31 +02:00
cecio
ae08d29897 PCB 1.3 added 2026-04-15 22:05:32 +02:00
cecio
f86712a8ed minor change in RAM disk read/write handling 2026-04-04 23:23:09 +02:00
cecio
b81e83e7e6 updated README 2026-03-30 18:23:57 +02:00
3 changed files with 14 additions and 12 deletions

Binary file not shown.

View File

@@ -5,7 +5,7 @@
>
> A complete rewrite of the application has been done:
> - moved away from Arduino IDE environment, now the code is written for the [Pi Pico SDK](https://github.com/raspberrypi/pico-sdk)
> - dependencies on external libraries has been reduced a lot
> - dependencies on external libraries have been reduced a lot
> - USB host support for Low Speed devices is now more robust (ATTiny85, EvilCrow, etc)
> - hardware and functionalities are almost unchanged, see the [notes](https://github.com/cecio/USBvalve#notes-about-bootsel-and-version--100) below for details
@@ -83,7 +83,7 @@ The polling of BOOTSEL was creating some issues to the *BADUSB* detection so thi
<img src="https://github.com/cecio/USBvalve/blob/main/pictures/reset_button.jpg" width="35%" height="35%" />
~~In `PCB` you'll find also a version `1.3` of the board, with some holes on pads 1 and 3 to facilitate the mount of the button. But as you can see, you can also use your old version~~. (still waiting the new printed PCB to test it before publishing)
In `PCB` you'll find also a version `1.3` of the board, with some holes on pads 1 and 3 to facilitate the mount of the button. But as you can see, you can also use your old version.
If you are not using the *BADUSB* functions or if you prefer to have less coverage on detection but keep BOOTSEL usage, I'm also providing a firmware created with *bootsel* enabled (see folder and releases).

View File

@@ -73,14 +73,17 @@ int32_t tud_msc_read10_cb(uint8_t lun, uint32_t lba, uint32_t offset,
flag_autorun = true;
}
// Protect memory: only read from real disk blocks
if (lba < DISK_BLOCK_NUM - 1) {
uint8_t const* addr = msc_disk[lba];
memcpy(buffer, addr, bufsize);
// Return data from ramdisk, or zeros for blocks beyond it.
// The disk reports FAKE_DISK_BLOCK_NUM sectors but only
// DISK_BLOCK_NUM exist in RAM, the rest must read as empty.
if (lba < DISK_BLOCK_NUM) {
memcpy(buffer, msc_disk[lba], bufsize);
} else {
memset(buffer, 0, bufsize);
}
serial_printf("Read LBA: %u Size: %u\r\n", (unsigned)lba, (unsigned)bufsize);
if (lba < DISK_BLOCK_NUM - 1) {
if (lba < DISK_BLOCK_NUM) {
hex_dump(msc_disk[lba], MAX_DUMP_BYTES);
}
@@ -105,14 +108,13 @@ int32_t tud_msc_write10_cb(uint8_t lun, uint32_t lba, uint32_t offset,
flag_written = true;
}
// Protect memory: only write to real disk blocks
if (lba < DISK_BLOCK_NUM - 1) {
uint8_t* addr = msc_disk[lba];
memcpy(addr, buffer, bufsize);
// Only write to real disk blocks; silently discard beyond ramdisk
if (lba < DISK_BLOCK_NUM) {
memcpy(msc_disk[lba], buffer, bufsize);
}
serial_printf("Write LBA: %u Size: %u\r\n", (unsigned)lba, (unsigned)bufsize);
if (lba < DISK_BLOCK_NUM - 1) {
if (lba < DISK_BLOCK_NUM) {
hex_dump(msc_disk[lba], MAX_DUMP_BYTES);
}