Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help needed - SD card, Bootloader mode & run payload #15

Open
j0mand opened this issue Jul 3, 2022 · 4 comments
Open

Help needed - SD card, Bootloader mode & run payload #15

j0mand opened this issue Jul 3, 2022 · 4 comments

Comments

@j0mand
Copy link

j0mand commented Jul 3, 2022

Hi, I don't know if it is an issue or just my limited understanding. But, as there is no other help available, I would like to ask for your support here.

I use Cactus WHID and inserted SD card. I use WUD-Ducky for esp32-3.0.2-RC1.

  1. SD Card
    Even though reading through all articles here, I don't find a way to get SD card working in visible in Windows Explorer as USB drive. What am I missing / doing wrong? Do I need to adapt the code even?
  2. Bootloader mode
    I put WHID in Bootloader mode using magnet for hall sensor and reset button. I manage to upload the sketch. However, whenever I put the USB stick in any PC, it starts in bootloader mode. I have to press reset button before it starts correctly. How could I change?
  3. Run Payload automatically
    I would like to simulate autostart functionality. What do I need to do to provide a payload that starts automatically?

Please apologize if the topics would be misplaced here. Happy to get in contact with you (i.e., anybody who could support me) otherwise.

@tobozo
Copy link
Owner

tobozo commented Jul 13, 2022

hey @j0mand

  1. SD Card not visible in Windows Explorer

SD may fail on some Windows laptops, but I suspect it's more a consequence of another USB descriptor failing to load.
Since USB-CDC is supposedly disabled it can either be the keyboard or the mouse conflicting with an existing hybrid HID device (e.g. touchpad).

USBView may help identify the conflict.

whenever I put the USB stick in any PC, it starts in bootloader mode. I have to press reset button before it starts correctly.

Sounds like you did not remove the magnet from the hall sensor after flashing?

If you have to flash the WUD repeatedly I suggest you setup a ssid/pwd for the STA mode and use Arduino OTA update methode instead.

Setting up the ssid/pass can be done as a Ducky command:

SetSSID_STA your_router_ssid
SetPassword_STA your_router_pass

Run Payload automatically

This is in the roadmap and needs a few problems solved (logging race condition, SD mount/unmount detection) before implementation starts.

If you want to experiment, you can add this at the end of the setup() function:

   runpayload( SPIFFS, "/your_payload_file.quack.txt" );

@bomberman8
Copy link

'SPIFFS' was not declared in this scope :S

Sorry, I'm sure the solution is obvious, but I swear I've been trying to figure it out for a while.

  • Is there a way to set the default keyboard language so you don't have to change it every time?

@tobozo
Copy link
Owner

tobozo commented Mar 11, 2024

@bomberman8 try LittleFS instead of SPIFFS

@tobozo
Copy link
Owner

tobozo commented Mar 11, 2024

@bomberman8

Is there a way to set the default keyboard language so you don't have to change it every time?

a quick&dirty solution is to add this at the end of setup():

duckparser::parse( "LOCALE ES" ); // available language codes are in WiFiDuck/keyboard.cpp

a more comprehensive integration is to make the locale persistent using prefs::set() and prefs::get()

// called from setup()
char locale[8];
prefs::get( "locale", locale, 7, "US" ); // "US" is default if no pref exists, max 7 letters
String command = String("LOCALE ") + String(locale);
duckparser::parse( command.c_str() );
// WiFiDuck/keyboard.cpp
#include "keyboard.hpp"
#include "prefs.hpp" // <<<< add this include

namespace keyboard
{
  // modify setLocale() 
  void setLocale( hid_layout_t* layout )
  {
    locale     = layout->locale;
    localecode = layout->code;
    prefs::set("locale", layout->locale ); // <<< add this line
  }

  // ......

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants