Hacking exfathax.h - no error fix

mrdude

Developer
OP
Developer
Joined
Dec 11, 2015
Messages
3,071
Trophies
1
Age
56
XP
8,238
@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,238
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,238
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,238
@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,238
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,238
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,238
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,238
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,238
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
  • Julie_Pilgrim @ Julie_Pilgrim:
    oh man, that always goes great!
  • Julie_Pilgrim @ Julie_Pilgrim:
    im sure half the responses won't be literal racial slurs or "drop table" jokes
  • Veho @ Veho:
    Look, it's China. They know what it's like when you give a poll to half a billion trolls.
    +1
  • K3Nv2 @ K3Nv2:
    How much dollar do you think it is?
  • Veho @ Veho:
    ONE MILLION DOLLA
    +1
  • Veho @ Veho:
    I know the pricing of electronics nowadays isn't "how much it actually costs" but "how much we can get away with", but putting up a poll is just cynical.
    +1
  • K3Nv2 @ K3Nv2:
    Probably $150 someone said Anbernic said around the same price as rg556
  • Julie_Pilgrim @ Julie_Pilgrim:
    you know which game i wish they would rerelease
  • Julie_Pilgrim @ Julie_Pilgrim:
    sonic unleashed
  • K3Nv2 @ K3Nv2:
    Make it a happy meal toy
  • Julie_Pilgrim @ Julie_Pilgrim:
    that game's engine is really fucking intensive so it runs like literal shit on xbox 360 and ps3
  • Veho @ Veho:
    Nah I'm getting value creep again. I look at a $50 console "but for just a few more dollars you could get XYZ" and I end up considering the Steam Deck.
    +1
  • Julie_Pilgrim @ Julie_Pilgrim:
    like the lighting in that game was genuinely so good
  • Veho @ Veho:
    Not getting dragged into that again.
  • Julie_Pilgrim @ Julie_Pilgrim:
    i dont get why they didn't port the one game that ran the worst on consoles, to pc
  • Julie_Pilgrim @ Julie_Pilgrim:
    like you port everything to pc except the one game where it would make the most sense. why. what do you gain from this
  • Julie_Pilgrim @ Julie_Pilgrim:
    is sega just personally fucking with me? are they laughing while watching me through my kinect camera as i get up to restart my xbox for the third time because the game froze again
  • K3Nv2 @ K3Nv2:
    Buy handhelds from five below better quality
  • K3Nv2 @ K3Nv2:
    Valve probably going to do another refresh of the deck this fall with rog ally like specs tbh
    +1
  • Veho @ Veho:
    A smaller form factor would be nice too.
    +1
  • K3Nv2 @ K3Nv2:
    A shield portable 2 would be nice aye Nvidia
    +2
  • Psionic Roshambo @ Psionic Roshambo:
    The big leap in all things tech is when carbon based chips start hitting.
  • Psionic Roshambo @ Psionic Roshambo:
    Longer battery life cooler temps and faster! What's not to like lol (probably expensive as hell)
    Psionic Roshambo @ Psionic Roshambo: Longer battery life cooler temps and faster! What's not to like lol (probably expensive as hell)