mirror of
https://github.com/cecio/USBvalve.git
synced 2026-09-05 21:34:06 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1fda9bb939 | ||
|
|
ab904e5ecd | ||
|
|
5836ac7208 | ||
|
|
ae08d29897 | ||
|
|
f86712a8ed | ||
|
|
b81e83e7e6 | ||
|
|
55e05a6a1e | ||
|
|
9bc181d14f |
Binary file not shown.
@@ -2,9 +2,10 @@
|
|||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> **USBvalve Version 1.0.0**
|
> **USBvalve Version 1.0.0**
|
||||||
|
>
|
||||||
> A complete rewrite of the application has been done:
|
> 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)
|
> - 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)
|
> - 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
|
> - hardware and functionalities are almost unchanged, see the [notes](https://github.com/cecio/USBvalve#notes-about-bootsel-and-version--100) below for details
|
||||||
|
|
||||||
@@ -82,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%" />
|
<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).
|
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).
|
||||||
|
|
||||||
@@ -198,16 +199,13 @@ I grouped most of the variables you may want to modify in this section of `usb_c
|
|||||||
//
|
//
|
||||||
// You can see here for inspiration: https://the-sz.com/products/usbid/
|
// You can see here for inspiration: https://the-sz.com/products/usbid/
|
||||||
//
|
//
|
||||||
// Example:
|
#define USB_VENDORID 0xCAFE
|
||||||
// 0x0951 0x16D5 VENDORID_STR: Kingston PRODUCTID_STR: DataTraveler
|
#define USB_PRODUCTID 0x1337
|
||||||
//
|
#define USB_DESCRIPTOR "DataStore"
|
||||||
#define USB_VENDORID 0x0951
|
#define USB_MANUF "USB Acme"
|
||||||
#define USB_PRODUCTID 0x16D5
|
|
||||||
#define USB_DESCRIPTOR "DataTraveler"
|
|
||||||
#define USB_MANUF "Kingston"
|
|
||||||
#define USB_SERIAL "123456789A"
|
#define USB_SERIAL "123456789A"
|
||||||
#define USB_VENDORID_STR "Kingston" // Up to 8 chars
|
#define USB_VENDORID_STR "Acme" // Up to 8 chars
|
||||||
#define USB_PRODUCTID_STR "DataTraveler" // Up to 16 chars
|
#define USB_PRODUCTID_STR "DataStore" // Up to 16 chars
|
||||||
#define USB_VERSION_STR "1.0" // Up to 4 chars
|
#define USB_VERSION_STR "1.0" // Up to 4 chars
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -219,6 +217,9 @@ Obviously you can also build your own firmware. To build you need the *Raspberry
|
|||||||
Basic recompile instructions:
|
Basic recompile instructions:
|
||||||
```
|
```
|
||||||
export PICO_SDK_PATH=</path/to/pico-sdk>
|
export PICO_SDK_PATH=</path/to/pico-sdk>
|
||||||
|
|
||||||
|
git clone --recursive https://github.com/cecio/USBvalve.git
|
||||||
|
cd USBvalve
|
||||||
mkdir build && cd build
|
mkdir build && cd build
|
||||||
cmake -DPICO_BOARD=pico .. # or pico2 for standard build
|
cmake -DPICO_BOARD=pico .. # or pico2 for standard build
|
||||||
make -j$(nproc)
|
make -j$(nproc)
|
||||||
|
|||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+7
-10
@@ -2,7 +2,7 @@
|
|||||||
#define USB_CONFIG_H
|
#define USB_CONFIG_H
|
||||||
|
|
||||||
// Project version
|
// Project version
|
||||||
#define VERSION "USBvalve - 1.0.0"
|
#define VERSION "USBvalve - 1.0.1"
|
||||||
|
|
||||||
// USB anti-detection settings
|
// USB anti-detection settings
|
||||||
//
|
//
|
||||||
@@ -12,16 +12,13 @@
|
|||||||
//
|
//
|
||||||
// You can see here for inspiration: https://the-sz.com/products/usbid/
|
// You can see here for inspiration: https://the-sz.com/products/usbid/
|
||||||
//
|
//
|
||||||
// Example:
|
#define USB_VENDORID 0xCAFE
|
||||||
// 0x0951 0x16D5 VENDORID_STR: Kingston PRODUCTID_STR: DataTraveler
|
#define USB_PRODUCTID 0x1337
|
||||||
//
|
#define USB_DESCRIPTOR "DataStore"
|
||||||
#define USB_VENDORID 0x0951
|
#define USB_MANUF "USB Acme"
|
||||||
#define USB_PRODUCTID 0x16D5
|
|
||||||
#define USB_DESCRIPTOR "DataTraveler"
|
|
||||||
#define USB_MANUF "Kingston"
|
|
||||||
#define USB_SERIAL "123456789A"
|
#define USB_SERIAL "123456789A"
|
||||||
#define USB_VENDORID_STR "Kingston" // Up to 8 chars
|
#define USB_VENDORID_STR "Acme" // Up to 8 chars
|
||||||
#define USB_PRODUCTID_STR "DataTraveler" // Up to 16 chars
|
#define USB_PRODUCTID_STR "DataStore" // Up to 16 chars
|
||||||
#define USB_VERSION_STR "1.0" // Up to 4 chars
|
#define USB_VERSION_STR "1.0" // Up to 4 chars
|
||||||
|
|
||||||
// Disk configuration
|
// Disk configuration
|
||||||
|
|||||||
+12
-10
@@ -73,14 +73,17 @@ int32_t tud_msc_read10_cb(uint8_t lun, uint32_t lba, uint32_t offset,
|
|||||||
flag_autorun = true;
|
flag_autorun = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Protect memory: only read from real disk blocks
|
// Return data from ramdisk, or zeros for blocks beyond it.
|
||||||
if (lba < DISK_BLOCK_NUM - 1) {
|
// The disk reports FAKE_DISK_BLOCK_NUM sectors but only
|
||||||
uint8_t const* addr = msc_disk[lba];
|
// DISK_BLOCK_NUM exist in RAM, the rest must read as empty.
|
||||||
memcpy(buffer, addr, bufsize);
|
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);
|
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);
|
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;
|
flag_written = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Protect memory: only write to real disk blocks
|
// Only write to real disk blocks; silently discard beyond ramdisk
|
||||||
if (lba < DISK_BLOCK_NUM - 1) {
|
if (lba < DISK_BLOCK_NUM) {
|
||||||
uint8_t* addr = msc_disk[lba];
|
memcpy(msc_disk[lba], buffer, bufsize);
|
||||||
memcpy(addr, buffer, bufsize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
serial_printf("Write LBA: %u Size: %u\r\n", (unsigned)lba, (unsigned)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);
|
hex_dump(msc_disk[lba], MAX_DUMP_BYTES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user