Editing Talk:SC Communication

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
== The easy peasy lemon squeasy way (UART) (CXR/CXRF/SW) ==
== The easy peasy lemon squeasy way (UART) (CXR/CXRF/SW) ==


{{boxcode|height=400px|title=SysconAUTH.py|code=<syntaxhighlight lang=python>
<syntaxhighlight lang="Python">  
# Python 2 + 3 compatible
 
from binascii import unhexlify as uhx
from binascii import unhexlify as uhx
from Crypto.Cipher import AES # pycryptodome
from Crypto.Cipher import AES # pycryptodome
Line 73: Line 71:
             if(length >= 0x40):
             if(length >= 0x40):
                 if(self.command('SETCMDLONG FF FF')[0] != 0):
                 if(self.command('SETCMDLONG FF FF')[0] != 0):
                     return (0xFFFFFFFF, ['Setcmdlong'])         
                     return ('Setcmdlong', [])         
             checksum = sum(bytearray(com, 'ascii')) % 0x100
             checksum = sum(bytearray(com, 'ascii')) % 0x100
             self.send('{}:{:02X}\r\n'.format(com, checksum))
             self.send('{}:{:02X}\r\n'.format(com, checksum))
Line 87: Line 85:
             answer = answer.split(':')
             answer = answer.split(':')
             if(len(answer) != 3):
             if(len(answer) != 3):
                 return (0xFFFFFFFF, ['Answer length'])
                 return ('Answer length', [])
             checksum = sum(bytearray(answer[2], 'ascii')) % 0x100
             checksum = sum(bytearray(answer[2], 'ascii')) % 0x100
             if(answer[0] != 'R' and answer[0] != 'E'):
             if(answer[0] != 'R' and answer[0] != 'E'):
                 return (0xFFFFFFFF, ['Magic'])
                 return ('Magic', [])
             if(answer[1] != '{:02X}'.format(checksum)):
             if(answer[1] != '{:02X}'.format(checksum)):
                 return (0xFFFFFFFF, ['Checksum'])     
                 return ('Checksum', [])     
             data = answer[2].split(' ')
             data = answer[2].split(' ')
             if(answer[0] == 'R' and len(data) < 2 or answer[0] == 'E' and len(data) != 2):
             if(answer[0] == 'R' and len(data) < 2 or answer[0] == 'E' and len(data) != 2):
                 return (0xFFFFFFFF, ['Data length'])
                 return ('Data length', [])
             if(data[0] != 'OK' or len(data) < 2):
             if(data[0] != 'OK' or len(data) < 2):
                 return (int(data[1], 16), [])
                 return (int(data[1], 16), [])
Line 105: Line 103:
                 answer[i] = answer[i].replace('\n', '').rsplit(':', 1)
                 answer[i] = answer[i].replace('\n', '').rsplit(':', 1)
                 if(len(answer[i]) != 2):
                 if(len(answer[i]) != 2):
                     return (0xFFFFFFFF, ['Answer length'])
                     return ('Answer length', [])
                 checksum = sum(bytearray(answer[i][0], 'ascii')) % 0x100
                 checksum = sum(bytearray(answer[i][0], 'ascii')) % 0x100
                 if(answer[i][1] != '{:02X}'.format(checksum)):
                 if(answer[i][1] != '{:02X}'.format(checksum)):
                     return (0xFFFFFFFF, ['Checksum'])
                     return ('Checksum', [])
                 answer[i][0] += '\n'
                 answer[i][0] += '\n'
             ret = answer[-1][0].replace('\n', '').split(' ')
             ret = answer[-1][0].replace('\n', '').split(' ')
Line 190: Line 188:
                 print('{:08X}'.format(ret[0]) + '\n' + ''.join(ret[1]))
                 print('{:08X}'.format(ret[0]) + '\n' + ''.join(ret[1]))
         else:
         else:
             print(ret[1][0])
             print(ret[1][0].decode('ascii'))
                  
                  
if __name__ == '__main__':
if __name__ == '__main__':
     main(len(sys.argv), sys.argv)
     main(len(sys.argv), sys.argv)
</syntaxhighlight>}}
 
</syntaxhighlight>


* Credits to M4j0r for the RE of this important info
* Credits to M4j0r for the RE of this important info
=== Example Scripts ===
{{boxcode|height=400px|title=SysconEEPdumpCXR.py|code=<syntaxhighlight lang=python>
# Python 2 compatible
if(len(sys.argv) < 3):
    print os.path.basename(__file__) + ' <serial port> <output file>'
    sys.exit(1)
ps3 = PS3UART(sys.argv[1], 'CXR')
print "Version: " + ps3.command("VER")[1][0]
print ps3.auth()
f = open(sys.argv[2], 'wb')
block_size = 0x40
print "Dumping NVS"
failed = []
for i in xrange(0x2C00, 0x7400, block_size): # 0x7400 for CXR713, 0x4400 for CXR714
    print "Reading 0x{:04X}".format(i)
    data = ps3.command("R8 {:08X} {:02X}".format(i, block_size))
    ret = data[0]
    if ret == 0:
        f.write((data[1][0]).decode('hex'))
    else:
        print "Failed: " + str(ret)
        failed += [i]
        f.write(("A"*block_size*2).decode('hex'))
   
f.close()
time.sleep(2)
print "\nRetrying failed offsets"
for i in failed:
    print "Reading 0x{:04X}".format(i)
    for j in xrange(0, block_size, block_size/4):
        while True:
            data = ps3.command("R8 {:08X} {:02X}".format(i+j, block_size/4))
            ret = data[0]
            if ret == 0:
                print data[1][0]
                break
            time.sleep(2)
</syntaxhighlight>}}
{{boxcode|height=400px|title=SysconEEPdumpCXRF.py|code=<syntaxhighlight lang=python>
# Python 2 + 3 compatible
if(len(sys.argv) < 3):
    print(os.path.basename(__file__) + ' <serial port> <output file>')
    sys.exit(1)
 
ps3 = PS3UART(sys.argv[1], 'CXRF')
print('Version: ' + ps3.command('version')[1][0].split('\n')[1])
print(ps3.auth())
f = open(sys.argv[2], 'wb')
block_size = 0x40
print('Dumping NVS')
for i in range(0x2C00, 0x7400, block_size):
    print('Reading 0x{:04X}'.format(i))
    data = ps3.command('r {:08X} {:02X}'.format(i, block_size))
    data = data[1][0].split('\n')
    if len(data) != 9:
        print('Failed')
        continue
    for i in range(3, 7):
        temp = data[i][0:-2].replace(' ', '')
        f.write(bytearray.fromhex(temp))
     
f.close()
</syntaxhighlight>}}
{{boxcode|height=400px|title=SysconEEPdumpSW.py|code=<syntaxhighlight lang=python>
# Python 2 + 3 compatible
if(len(sys.argv) < 3):
    print(os.path.basename(__file__) + ' <serial port> <output file>')
    sys.exit(1)
 
ps3 = PS3UART(sys.argv[1], 'SW')
print('Version: ' + ps3.command('VER')[1][0])
print(ps3.auth())
f = open(sys.argv[2], 'wb')
block_size = 0x40
print('Dumping NVS')
for i in range(0x0, 0x1400, block_size):
    print('Reading 0x{:04X}'.format(i))
    data = ps3.command('EEP GET {:08X} {:02X}'.format(i, block_size))
    ret = data[0]
    temp = ''
    if ret == 0:
        for i in range(2, len(data[1])):
            temp += data[1][i][2:-2].replace(' ', '')
        f.write(bytearray.fromhex(temp))
    else:
        print('Failed: ' + str(ret))
     
f.close()
</syntaxhighlight>}}
{{boxcode|height=400px|title=SysconEEPpatchCXR.py|code=<syntaxhighlight lang=python>
# Python 2 compatible
if(len(sys.argv) < 3):
    print os.path.basename(__file__) + ' <serial port> <patch file>'
    sys.exit(1)
ps3 = PS3UART(sys.argv[1], 'CXR')
f = open(sys.argv[2], 'rb')
patch = f.read()
f.close()
print "Version: " + ps3.command("VER")[1][0]
print ps3.auth()
patch_area_1 = 0x2800
patch_area_2 = 0x4400 # 0x7400 for CXR713, 0x4400 for CXR714
block_size = 0x40
print "First region"
for i in xrange(0, 0x400, block_size):
    print hex(ps3.command("EEP SET " + hex(i+patch_area_1)[2:] + " " + hex(block_size)[2:] + " " + patch[i:i+block_size].encode('hex'))[0])
print ""
print "Second region"
for i in xrange(0x400, 0x1000, block_size):
    print hex(ps3.command("EEP SET " + hex(i+patch_area_2-0x400)[2:] + " " + hex(block_size)[2:] + " " + patch[i:i+block_size].encode('hex'))[0])
</syntaxhighlight>}}


== IDs ==
== IDs ==
Line 368: Line 245:
</pre>
</pre>


* Although this service is not used on Slim and some Phat consoles anymore, it is working (only on consoles with a CXR (Mullion) Syscon).
* Although this service is not used on Slim and some Phat consoles anymore, it is working.
* It seems it have the same restrictions as NVS service.
* It seems it have the same restrictions as NVS service.


Line 387: Line 264:
</pre>
</pre>


* Although this service is not used on Slim and some Phat consoles anymore, it is working (only on consoles with a CXR (Mullion) Syscon).
* Although this service is not used on Slim and some Phat consoles anymore, it is working.
* It seems it have the same restrictions as NVS service.
* It seems it have the same restrictions as NVS service.


Line 818: Line 695:
See :
See :


* https://www.psdevwiki.com/ps3/File:C1kVeMD.png
* https://imgur.com/a/Iwv4d
* https://www.psdevwiki.com/ps3/File:NBkrqqZ.png
* https://imgur.com/a/48gsT
* database : https://www.sendspace.com/file/6awfi9
* database : https://www.sendspace.com/file/6awfi9


For proof
For proof
Please note that all contributions to PS3 Developer wiki are considered to be released under the GNU Free Documentation License 1.2 (see PS3 Developer wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following hCaptcha:

Cancel Editing help (opens in new window)

Template used on this page: