3.80 and Pandora

Well it looks like SCE have finally learned and have now removed the functions to read/write to the battery eeprom in 3.80 (they also took out the sceSysconBatteryAuth function too). So you can’t make a magic battery with 3.80, but nevermind, the hardware to do so is still there.

Here’s a compatible replacement:

C:
  1. int write_eeprom(u8 addr, u16 data)
  2. {
  3.     int res;
  4.     u8 param[0×60];
  5.  
  6.     if (addr>0x7F)
  7.         return(0×80000102);
  8.  
  9.     param[0x0C] = 0×73; // write battery eeprom command
  10.     param[0x0D] = 5; // tx packet length
  11.  
  12.     // tx data
  13.     param[0x0E] = addr;
  14.     param[0x0F] = data;
  15.     param[0×10] = data>>8;
  16.  
  17.     res = sceSysconCmdExec(param, 0);
  18.  
  19.     if (res<0)
  20.         return(res);
  21.  
  22.     return 0;
  23. }
  24.  
  25. int read_eeprom(u8 addr)
  26. {
  27.     int res;
  28.     u8 param[0×60];
  29.  
  30.     if (addr>0x7F)
  31.         return(0×80000102);
  32.  
  33.     param[0x0C] = 0×74; // read battery eeprom command
  34.     param[0x0D] = 3; // tx packet length
  35.  
  36.     // tx data
  37.     param[0x0E] = addr;
  38.  
  39.     res = sceSysconCmdExec(param, 0);
  40.  
  41.     if (res<0)
  42.         return(res);
  43.  
  44.     // rx data
  45.     return((param[0×21]<<8) | param[0×20]);
  46. }

EDIT:
Finally cracked the real names:

0x68ef0bef sceSysconBatteryReadNVM
0x1165c864 sceSysconBatteryWriteNVM

6 Responses to “3.80 and Pandora”

  1. Hi! :-)

    Might I ask for permission to use this code snippet in my “Pandora Installer for 3.xx Kernels”?

    I’d like to have that working on 3.80 as well ;-)

    Propper credits would be given, of course!

  2. Thanks SilverSpring, got the chance to use the code today with the release of 3.80M33 and it works like a charm.
    -
    u32 sceSysconCmdExec(void* param, int unk);
    -
    Was all I needed to create to make ‘im go.

  3. lol guys i wanna know how you work this out please help me… sorry for being a noob heheheh an a pain in the butt ^_^ sowwy Well hope i can get help

  4. On maxconsole i have posted a thread about i think something to do with:
    u32 sceSysconCmdExec(void* param, int unk);

    The tools from hellcat/cory1492 won’t work with my newest psp. And they use your work in there tools?

    http://forums.maxconsole.net/showthread.php?t=97428

    If you don’t like this link posting to maxconsole on your blog. please remove.
    greetz from the netherlands
    bagheera

  5. Hi Silverspring,

    Nice job and thank you for sharing.

    I have notice in the code of read_eeprom, may be a strange behavior if sceSysconCmdExec returns an error, the caller may not notice. I would suggest to do something like:
    int read_eeprom(u8 addr, u16 * value)
    {
    int res;
    u8 param[0x60];

    if (addr>0x7F) return(0×80000102);

    param[0x0C] = 0×74; // read battery eeprom command
    param[0x0D] = 3; // tx packet length

    // tx data
    param[0x0E] = addr;
    res = sceSysconCmdExec(param, 0);

    if (res

  6. silverspring Says:
    May 8th, 2008 at 6:01 pm

    What do you mean might not notice? If read_eeprom returns a negative number (which it would if sceSysconCmdExec failed) it means it failed. Any other value would mean it succeeded (and would have the correct value for the eeprom read).

    Anyway, it was meant to be a direct replacement for the sceSysconBatteryReadNVM/sceSysconBatteryWriteNVM functions which were taken out of the firmware starting from 3.80. Refer to http://forums.ps2dev.org/viewtopic.php?p=57634#57634 where nem posted the prototypes (the function names werent known when that post was made so they’re labelled sceSyscon_driver_68EF0BEF/sceSyscon_driver_1165C864).

    This code was meant for apps using the above functions to be able to work in 3.80+. Ie. pandora apps from cory1492, hellcat, et al. So I would have to make sure the prototypes stayed the same as the original functions and that the code functioned exactly the same as the originals.

Leave a Reply