Hacking exfathax.h - no error fix

mrdude

Developer
OP
Developer
Joined
Dec 11, 2015
Messages
3,071
Trophies
1
Age
56
XP
8,237
@mrdude @Leeful
Thanks for your suggestions, for USB I am pretty sure it is flashed properly, as it works for more than one year since 9.00 JB has been released. To make sure I flashed it and test again with online web hosts and worked as expected. Also I flashed with main (4 MB) and Pico (few KB) and moded file of mrdude (which is not bringing pop-up notification), and for all the results were same, working fine im online host, but not working in ESP madule.

Then, for change sketch to be working as direct USB, unfortunately I don't have enough skill to do, if you help me how to code it I would be thankful :bow:
Just create a simple sketch like this:
Code:
int usbPin = D2; //set up whatever pin you have usb connected to here

void setup(void)
{
pinMode(usbPin, OUTPUT);
digitalWrite(usbPin, HIGH);
}

void loop(void) {
}

That way your esp32 will act as a USB drive, use the online host to see if it works. I imagine you have a problem with your soldering/circuit or you don't have the usb pin assigned properly - that's why I told you to connect an LED to the pin that powers the USB drive to see if it lights up when the USB drive is meant to be activated.
 
Last edited by mrdude,

PAYAMiN

Member
Newcomer
Joined
Jan 13, 2023
Messages
14
Trophies
0
Age
41
XP
48
Country
Iran
Dear @mrdude
As I mentioned before, I am using USB-C/USB-A OTG, and in hoostage code also there is a phrase related to USB PIN CONTROL and I think the issue may related to this part.

I checked USB-C pinout, as well as USB-A ones and OTG pinout, and what I found is USB-A using two pin for voltage and ground and two for data, while the USB-C is using something else.

So, do you have any idea about which USB PIN shall I use?
 

mrdude

Developer
OP
Developer
Joined
Dec 11, 2015
Messages
3,071
Trophies
1
Age
56
XP
8,237
Dear @mrdude
As I mentioned before, I am using USB-C/USB-A OTG, and in hoostage code also there is a phrase related to USB PIN CONTROL and I think the issue may related to this part.

I checked USB-C pinout, as well as USB-A ones and OTG pinout, and what I found is USB-A using two pin for voltage and ground and two for data, while the USB-C is using something else.

So, do you have any idea about which USB PIN shall I use?
Ask the person that made the sketch you are using, I have no intention of looking at that code as it's outside the scope of this thread, I have already told you what you need to do and you haven't done those things yet or you would already know if you had a hardware fault and what pins to use.

See here for your chips pinout:

https://www.espressif.com/sites/def...-s2-wrover_esp32-s2-wrover-i_datasheet_en.pdf
 
Last edited by mrdude,
  • Like
Reactions: PAYAMiN

PAYAMiN

Member
Newcomer
Joined
Jan 13, 2023
Messages
14
Trophies
0
Age
41
XP
48
Country
Iran
Dear @mrdude
I gave up about using preinstalled port on my board and did the wiring per instruction to mount USB, but even with wiring I recieved the same error. So I tooke advantage of your advice to test on/off of USB by LED.
As I checked, LED is always on, before, while and after the EXFATHAX trigger! So itvis meaning no any on/off signal is sending toward the board.
Do you have any idea?
 

mrdude

Developer
OP
Developer
Joined
Dec 11, 2015
Messages
3,071
Trophies
1
Age
56
XP
8,237
Dear @mrdude
I gave up about using preinstalled port on my board and did the wiring per instruction to mount USB, but even with wiring I recieved the same error. So I tooke advantage of your advice to test on/off of USB by LED.
As I checked, LED is always on, before, while and after the EXFATHAX trigger! So itvis meaning no any on/off signal is sending toward the board.
Do you have any idea?
You willl need to set the pin low in the sketch if it's always on, it should only be set high when the code to enable the usb is activated.
 

mrdude

Developer
OP
Developer
Joined
Dec 11, 2015
Messages
3,071
Trophies
1
Age
56
XP
8,237
@PAYAMiN

I hope you are not trying to use a USB drive attached to your board, you don't need that if your chip is esp32-s2 based, because you can just send a usb image instead. If you are using Arduino to flash the chip you need to disable some stuff on the board settings. Example for some different boards:

oHlEBeP.png


V0ttAPg.png


If you don't disable the USB stuff the usb image will never be sent and you'll get a trigger warning straight after the glitch when the exfat image is supposed to be mounted.
 
Last edited by mrdude,
  • Like
Reactions: PAYAMiN and peteruk

PAYAMiN

Member
Newcomer
Joined
Jan 13, 2023
Messages
14
Trophies
0
Age
41
XP
48
Country
Iran
Thank you dude, my issue resolved by using CH340 Port and change the option "Upload Mode" to "UART0", I used "ESP32" port to connect to PS4 and use "CH340" port to connect to USB flash.

Thank you very much for your follow up and help ❤️
 
  • Like
Reactions: mrdude

PS4User

Member
Newcomer
Joined
Apr 13, 2023
Messages
7
Trophies
0
Age
38
XP
31
Country
Italy
After what seems like about a million attempts, I have finally fixed the file system error message for those running chips that can send a usb image....

Replace the included exfathax.h included in the attachment for what you have in your arduino sketches and change your onread function to this:

Enjoy!

Hi mrdude,
I'm using the stooged server (stooged/ESP32-Server-900u) with a chinese ESP32-2
Dongle-USB-U-disk-per-sistema-P4-9-0-scheda-modulo-Wifi-ESP32-con-porta-seriale.jpg_Q90.jpg_.jpg

When i'm try to load your modified version of exfathax.h i have error when compiling (something relative to the RAM i think, if do you need the complete error i'll post it) but the stooged one work fine. Yes i have changed the function in the sketch.
Some advice? Thanks

P.S. I have try also with your edited complete sketch (900u-hex), same result i can't compile
 
Last edited by PS4User,

mrdude

Developer
OP
Developer
Joined
Dec 11, 2015
Messages
3,071
Trophies
1
Age
56
XP
8,237
Hi mrdude,
I'm using the stooged server (stooged/ESP32-Server-900u) with a chinese ESP32-2
View attachment 364668
When i'm try to load your modified version of exfathax.h i have error when compiling (something relative to the RAM i think, if do you need the complete error i'll post it) but the stooged one work fine. Yes i have changed the function in the sketch.
Some advice? Thanks

P.S. I have try also with your edited complete sketch (900u-hex), same result i can't compile
Change the line in exfathax.h file to use progmem instead of SRAM:

Code:
static const uint8_t exfathax[129][512] PROGMEM = {

You can't store it in SRAM if your SRAM is too small.
 
  • Like
Reactions: PS4User

PS4User

Member
Newcomer
Joined
Apr 13, 2023
Messages
7
Trophies
0
Age
38
XP
31
Country
Italy
Now it compile! Thanks!
I have a little more question for you, if is not a problem. I want to translate all the strings of the HTML but i have see not everything is inside the .ino file. I think they are inside variable in Pages.h like:
Code:
static const uint8_t index_gz[] PROGMEM = {
  31, 139, 8, 8, etc...
};
So the question is: how to convert those "arrays" into plain HTML/CSS text and "re-convert" to array after the changes? There is a python code, or maybe an online service i can use?
 

mrdude

Developer
OP
Developer
Joined
Dec 11, 2015
Messages
3,071
Trophies
1
Age
56
XP
8,237
Now it compile! Thanks!
I have a little more question for you, if is not a problem. I want to translate all the strings of the HTML but i have see not everything is inside the .ino file. I think they are inside variable in Pages.h like:
Code:
static const uint8_t index_gz[] PROGMEM = {
  31, 139, 8, 8, etc...
};
So the question is: how to convert those "arrays" into plain HTML/CSS text and "re-convert" to array after the changes? There is a python code, or maybe an online service i can use?
You need to write a program that goes through the array and converts those decimals into bytes. Then save the raw bytes to a file called file.tar.gz, once you do that you can use 7zip to extract the compressed files from it.
 
  • Like
Reactions: PS4User

PS4User

Member
Newcomer
Joined
Apr 13, 2023
Messages
7
Trophies
0
Age
38
XP
31
Country
Italy
I have some problems. I have try i think 6 times. 2 of them the PS4 is crashed (one during exfat, one during loading goldhen), 2 instead I have see leaf error so I have close the browser and reopen. Is normal? I have put the USB time to 10000. There is something I can do for "increase" the success time?
 

mrdude

Developer
OP
Developer
Joined
Dec 11, 2015
Messages
3,071
Trophies
1
Age
56
XP
8,237
I have some problems. I have try i think 6 times. 2 of them the PS4 is crashed (one during exfat, one during loading goldhen), 2 instead I have see leaf error so I have close the browser and reopen. Is normal? I have put the USB time to 10000. There is something I can do for "increase" the success time?
In your sketch change the enableUSB void to this line:

dev.begin(1024, 512); //mounts a smaller usb device.

This will mount a smaller exfat partition and let you decrease the USB time to about 2000 > 2500 which is faster. Also clear your web browser cache. Changing USB time only stops you getting a "trigger" warning if it's set to low. It's normal for the ps4 to sometimes crash during the glitch and when sending goldhen - you need to boot your ps4 and leave if for about a minute once booted to let firmware stuff load/run in the background - if you try and glitch before the ps4 firmware is fully loaded you get memory errors and unsuccessful glitching.
 
Last edited by mrdude,
  • Like
Reactions: PS4User

PS4User

Member
Newcomer
Joined
Apr 13, 2023
Messages
7
Trophies
0
Age
38
XP
31
Country
Italy
Ok. So now i have:
Code:
//Auto Usb Wait(milliseconds)
int USB_WAIT = 3000;

And:
Code:
void enableUSB() {
  dev.vendorID("PS4");
  dev.productID("ESP32 Server");
  dev.productRevision("1.0");
  dev.onRead(onRead);
  dev.mediaPresent(true);
  dev.begin(1024, 512);
  USB.begin();
  enTime = millis();
  hasEnabled = true;
}

So the correct\best procedure is:
1) Turn on the PS4
2) Wait 1 minute (o maybe i can put this "sleep" inside the sketch?)
3) Open the browser

I need to clear the cache everytime before the glitch?
 

mrdude

Developer
OP
Developer
Joined
Dec 11, 2015
Messages
3,071
Trophies
1
Age
56
XP
8,237
Ok. So now i have:
Code:
//Auto Usb Wait(milliseconds)
int USB_WAIT = 3000;

And:
Code:
void enableUSB() {
  dev.vendorID("PS4");
  dev.productID("ESP32 Server");
  dev.productRevision("1.0");
  dev.onRead(onRead);
  dev.mediaPresent(true);
  dev.begin(1024, 512);
  USB.begin();
  enTime = millis();
  hasEnabled = true;
}

So the correct\best procedure is:
1) Turn on the PS4
2) Wait 1 minute (o maybe i can put this "sleep" inside the sketch?)
3) Open the browser

I need to clear the cache everytime before the glitch?
You don't need to clear the cache everytime, just once to clean old old files if they have been cached in the ps4 web browser, if you haven't used any online glitch servers or your chip firmware hasn't got cached features enabled you don't need to do this. Howver it's best to do it at least once to clear the broser cache to eliminate any issues.

Also you don't need to open the browser - just go to settings and click on the user guide.
 
  • Like
Reactions: PS4User

PS4User

Member
Newcomer
Joined
Apr 13, 2023
Messages
7
Trophies
0
Age
38
XP
31
Country
Italy
Waiting before glitch increase the success rate, thanks! Do you know why sometime i have "no payload data" error? I have set to true the internal hen and I'm using the golden.h converted from bin. Is the glitch or the sketch?

A little last thing. When the esp32 goes to sleep mode after x minute (i have set it, i know goes to sleep mode since the PS4 lost the connection) the esp LED is still on. Is possibile, and i think is possible, to set it off? Where?

Thanks again for your support and your work!
 
Last edited by PS4User,

mrdude

Developer
OP
Developer
Joined
Dec 11, 2015
Messages
3,071
Trophies
1
Age
56
XP
8,237
Waiting before glitch increase the success rate, thanks! Do you know why sometime i have "no payload data" error? I have set to true the internal hen and I'm using the golden.h converted from bin. Is the glitch or the sketch?

A little last thing. When the esp32 goes to sleep mode after x minute (i have set it, i know goes to sleep mode since the PS4 lost the connection) the esp LED is still on. Is possibile, and i think is possible, to set it off? Where?

Thanks again for your support and your work!
You'll need to ask the person that made your sketch about that no payload data error but it's most likely a timing issue, and your board is not using usb3 - so not sending the payload (goldhen) fast enough, as for the led being on - each board uses it's own unique pinout so you need to tell the program which gpio's to use. Also you need to read on the esp32 website about how to put your chip into deepsleep mode and the different modes. This thread is just about exfathax.h file really so you're starting to derail the thread with non relevant questions.
 
Last edited by mrdude,

lillo2k1

New Member
Newbie
Joined
May 24, 2008
Messages
1
Trophies
1
XP
190
Country
Italy
You need to write a program that goes through the array and converts those decimals into bytes. Then save the raw bytes to a file called file.tar.gz, once you do that you can use 7zip to extract the compressed files from it.
Hi to all
Someone can explain better how to rebuild the .HTML file from .tar.gz or .h files?
Thank You

Anto
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • Quincy @ Quincy:
    Usually when such a big title leaks the Temp will be the first to report about it (going off of historical reports here, Pokemon SV being the latest one I can recall seeing pop up here)
  • K3Nv2 @ K3Nv2:
    I still like how a freaking mp3 file hacks webos all that security defeated by text yet again
  • BigOnYa @ BigOnYa:
    They have simulators for everything nowdays, cray cray. How about a sim that shows you playing the Switch.
  • K3Nv2 @ K3Nv2:
    That's called yuzu
    +1
  • BigOnYa @ BigOnYa:
    I want a 120hz 4k tv but crazy how more expensive the 120hz over the 60hz are. Or even more crazy is the price of 8k's.
  • K3Nv2 @ K3Nv2:
    No real point since movies are 30fps
  • BigOnYa @ BigOnYa:
    Not a big movie buff, more of a gamer tbh. And Series X is 120hz 8k ready, but yea only 120hz 4k games out right now, but thinking of in the future.
  • K3Nv2 @ K3Nv2:
    Mostly why you never see TV manufacturers going post 60hz
  • BigOnYa @ BigOnYa:
    I only watch tv when i goto bed, it puts me to sleep, and I have a nas drive filled w my fav shows so i can watch them in order, commercial free. I usually watch Married w Children, or South Park
  • K3Nv2 @ K3Nv2:
    Stremio ruined my need for nas
  • BigOnYa @ BigOnYa:
    I stream from Nas to firestick, one on every tv, and use Kodi. I'm happy w it, plays everything. (I pirate/torrent shows/movies on pc, and put on nas)
  • K3Nv2 @ K3Nv2:
    Kodi repost are still pretty popular
  • BigOnYa @ BigOnYa:
    What the hell is Kodi reposts? what do you mean, or "Wut?" -xdqwerty
  • K3Nv2 @ K3Nv2:
    Google them basically web crawlers to movie sites
  • BigOnYa @ BigOnYa:
    oh you mean the 3rd party apps on Kodi, yea i know what you mean, yea there are still a few cool ones, in fact watched the new planet of the apes movie other night w wifey thru one, was good pic surprisingly, not a cam
  • BigOnYa @ BigOnYa:
    Damn, only $2.06 and free shipping. Gotta cost more for them to ship than $2.06
    +1
  • BigOnYa @ BigOnYa:
    I got my Dad a firestick for Xmas and showed him those 3rd party sites on Kodi, he loves it, all he watches anymore. He said he has got 3 letters from AT&T already about pirating, but he says f them, let them shut my internet off (He wants out of his AT&T contract anyways)
  • K3Nv2 @ K3Nv2:
    That's where stremio comes to play never got a letter about it
  • BigOnYa @ BigOnYa:
    I just use a VPN, even give him my login and password so can use it also, and he refuses, he's funny.
  • BigOnYa @ BigOnYa:
    I had to find and get him an old style flip phone even without text, cause thats what he wanted. No text, no internet, only phone calls. Old, old school.
  • Psionic Roshambo @ Psionic Roshambo:
    @BigOnYa, Lol I bought a new USB card reader thing on AliExpress last month for I think like 87 cents. Free shipping from China... It arrived it works and honestly I don't understand how it was so cheap.
    +1
    Psionic Roshambo @ Psionic Roshambo: @BigOnYa, Lol I bought a new USB card reader thing on AliExpress last month for I think like 87... +1