mirror of
https://github.com/cecio/USBvalve.git
synced 2025-12-07 13:14:59 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8a0baa9f2 | ||
|
|
32a4a2d895 |
@@ -42,7 +42,7 @@ Adafruit_USBH_Host USBHost;
|
|||||||
// Define vars for OLED screen
|
// Define vars for OLED screen
|
||||||
#define I2C_ADDRESS 0x3C // 0X3C+SA0 - 0x3C or 0x3D
|
#define I2C_ADDRESS 0x3C // 0X3C+SA0 - 0x3C or 0x3D
|
||||||
#define RST_PIN -1 // Define proper RST_PIN if required.
|
#define RST_PIN -1 // Define proper RST_PIN if required.
|
||||||
#define OLED_HEIGHT 64 // 64 or 32 depending on the OLED
|
#define OLED_HEIGHT 32 // 64 or 32 depending on the OLED
|
||||||
#define OLED_LINES (OLED_HEIGHT / 8)
|
#define OLED_LINES (OLED_HEIGHT / 8)
|
||||||
SSD1306AsciiWire oled;
|
SSD1306AsciiWire oled;
|
||||||
|
|
||||||
@@ -74,12 +74,11 @@ bool activeState = false;
|
|||||||
//
|
//
|
||||||
// USBvalve globals
|
// USBvalve globals
|
||||||
//
|
//
|
||||||
#define VERSION "USBvalve - 0.9.0"
|
#define VERSION "USBvalve - 0.9.1"
|
||||||
boolean readme = false;
|
boolean readme = false;
|
||||||
boolean autorun = false;
|
boolean autorun = false;
|
||||||
boolean written = false;
|
boolean written = false;
|
||||||
boolean written_reported = false;
|
boolean written_reported = false;
|
||||||
int x = 2;
|
|
||||||
|
|
||||||
#define BLOCK_AUTORUN 102 // Block where Autorun.inf file is saved
|
#define BLOCK_AUTORUN 102 // Block where Autorun.inf file is saved
|
||||||
#define BLOCK_README 100 // Block where README.txt file is saved
|
#define BLOCK_README 100 // Block where README.txt file is saved
|
||||||
@@ -147,14 +146,14 @@ void setup() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
oled.setFont(Adafruit5x7);
|
oled.setFont(Adafruit5x7);
|
||||||
|
oled.setScrollMode(SCROLL_MODE_AUTO);
|
||||||
cls(); // Clear display
|
cls(); // Clear display
|
||||||
|
|
||||||
if (memcmp(computed_hash, valid_hash, WIDTH) == 0) {
|
if (memcmp(computed_hash, valid_hash, WIDTH) == 0) {
|
||||||
oled.println("[+] Selftest: OK");
|
oled.print("\n[+] Selftest: OK");
|
||||||
x++;
|
|
||||||
} else {
|
} else {
|
||||||
oled.println("[!] Selftest: KO");
|
oled.print("\n[!] Selftest: KO");
|
||||||
oled.println("[!] Stopping...");
|
oled.print("\n[!] Stopping...");
|
||||||
while (1) {
|
while (1) {
|
||||||
delay(1000); // Loop forever
|
delay(1000); // Loop forever
|
||||||
}
|
}
|
||||||
@@ -179,23 +178,17 @@ void setup1() {
|
|||||||
void loop() {
|
void loop() {
|
||||||
|
|
||||||
if (readme == true) {
|
if (readme == true) {
|
||||||
if (x == OLED_LINES) cls();
|
oled.print("\n[!] README (R)");
|
||||||
oled.println("[!] README (R)");
|
|
||||||
x++;
|
|
||||||
readme = false;
|
readme = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (autorun == true) {
|
if (autorun == true) {
|
||||||
if (x == OLED_LINES) cls();
|
oled.print("\n[+] AUTORUN (R)");
|
||||||
oled.println("[+] AUTORUN (R)");
|
|
||||||
x++;
|
|
||||||
autorun = false;
|
autorun = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (written == true && written_reported == false) {
|
if (written == true && written_reported == false) {
|
||||||
if (x == OLED_LINES) cls();
|
oled.print("\n[!] WRITING");
|
||||||
oled.println("[!] WRITING");
|
|
||||||
x++;
|
|
||||||
written = false;
|
written = false;
|
||||||
written_reported = true;
|
written_reported = true;
|
||||||
}
|
}
|
||||||
@@ -289,9 +282,8 @@ bool msc_ready_callback(void) {
|
|||||||
// Clear display
|
// Clear display
|
||||||
void cls(void) {
|
void cls(void) {
|
||||||
oled.clear();
|
oled.clear();
|
||||||
oled.println(VERSION);
|
oled.print(VERSION);
|
||||||
oled.println("----------------");
|
oled.print("\n----------------");
|
||||||
x = 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// HexDump
|
// HexDump
|
||||||
@@ -346,9 +338,7 @@ void tuh_hid_mount_cb(uint8_t dev_addr, uint8_t instance, uint8_t const* desc_re
|
|||||||
|
|
||||||
tuh_vid_pid_get(dev_addr, &vid, &pid);
|
tuh_vid_pid_get(dev_addr, &vid, &pid);
|
||||||
|
|
||||||
if (x == OLED_LINES) cls();
|
oled.print("\n[!!] HID Device");
|
||||||
oled.println("[++] HID Device");
|
|
||||||
x++;
|
|
||||||
|
|
||||||
SerialTinyUSB.printf("HID device address = %d, instance = %d mounted\r\n", dev_addr, instance);
|
SerialTinyUSB.printf("HID device address = %d, instance = %d mounted\r\n", dev_addr, instance);
|
||||||
SerialTinyUSB.printf("VID = %04x, PID = %04x\r\n", vid, pid);
|
SerialTinyUSB.printf("VID = %04x, PID = %04x\r\n", vid, pid);
|
||||||
@@ -370,9 +360,7 @@ void tuh_hid_report_received_cb(uint8_t dev_addr, uint8_t instance, uint8_t cons
|
|||||||
static bool kbd_printed = false;
|
static bool kbd_printed = false;
|
||||||
static bool mouse_printed = false;
|
static bool mouse_printed = false;
|
||||||
|
|
||||||
if (x == OLED_LINES) cls();
|
oled.print("\n[!!] HID Sending data");
|
||||||
oled.println("[!!] HID Sending data");
|
|
||||||
x++;
|
|
||||||
|
|
||||||
// Read the HID protocol
|
// Read the HID protocol
|
||||||
uint8_t const itf_protocol = tuh_hid_interface_protocol(dev_addr, instance);
|
uint8_t const itf_protocol = tuh_hid_interface_protocol(dev_addr, instance);
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user