summaryrefslogtreecommitdiffstats
path: root/oncology/dpfhack_display/fw/detect.py
diff options
context:
space:
mode:
authorMomo <momorientes@online.de>2011-09-01 12:17:21 +0200
committerMomo <momorientes@online.de>2011-09-01 12:17:21 +0200
commitff0030cd7fe92a09173c16bf7b483cde638dab46 (patch)
tree33c1cd58756ea023eb304a1504b3a079a7eae63a /oncology/dpfhack_display/fw/detect.py
parent77d4efad2e89fe9357b10b1bd173fbded82468fe (diff)
parentabf8674a3fc02f172768be911c6e719290bf6bd5 (diff)
Merge branch 'master' of https://github.com/krebscode/painload
Diffstat (limited to 'oncology/dpfhack_display/fw/detect.py')
-rwxr-xr-xoncology/dpfhack_display/fw/detect.py94
1 files changed, 0 insertions, 94 deletions
diff --git a/oncology/dpfhack_display/fw/detect.py b/oncology/dpfhack_display/fw/detect.py
deleted file mode 100755
index e667ae5f..00000000
--- a/oncology/dpfhack_display/fw/detect.py
+++ /dev/null
@@ -1,94 +0,0 @@
-# Simple detection module for AX206 based DPF hardware
-# (c) 2011 <hackfin@section5.ch>
-#
-# Run with argument:
-#
-# - generic scsi device, e.g. /dev/sg1
-# or:
-# - "usb0" for hacked device
-#
-# NOTE: The LCD detection will only work on a hacked device
-
-import struct
-import sys
-sys.path.append("./Debug")
-import dpf
-
-g_spansion_types = {
- 0x13: ("s25fl008", 16, 0x10000)
-}
-
-g_stm_types = {
- 0x14: ("m25p80", 16, 0x10000),
- 0x15: ("m25p16", 32, 0x10000),
- 0x16: ("m25p32", 64, 0x10000)
-}
-
-g_amic_types = {
- 0x13: ("a25l080", 16, 0x10000),
-}
-
-g_vendors = {
- 0x00: ("ST legacy", g_stm_types),
- 0x01: ("Spansion", g_spansion_types),
- 0x20: ("ST/Numonyx", g_stm_types),
- 0x1c: ("EON", g_stm_types),
- 0x37: ("AMIC", g_amic_types),
- 0xc2: ("Macronix", g_stm_types),
- 0xc8: ("Apple", g_stm_types),
- 0xef: ("Winbond", g_stm_types)
-}
-
-g_lcdmanu = {
- 0x45: "Philips/NXP",
- 0x5c: "Sitronix",
- 0x54: "Ilitek"
-}
-
-g_lcdctrl = {
- 0x66: "ILI9163B",
- 0xf0: "ST7735R"
-}
-
-
-def detect_lcd(d):
- d.writeMemory("app_detect.ihx")
- d.run(0x18a0)
- buf = d.readMemory(0x1900, 4)
-
- v = struct.unpack("BBBB", buf)
-
- if v[1] != 0xff:
- try:
- manu = g_lcdmanu[v[1]]
- print "Manufacturer:", manu
- print "Module/driver version:", hex(v[2])
- print "Identified module:", g_lcdctrl[v[3]]
- except KeyError:
- print "Unknown module id", hex(v[1]), hex(v[2]), hex(v[3])
- else:
- print "Does not support RDID"
-
-def detect_flash(d):
- manu, dev0, dev1 = d.probeFlash()
- try:
- print "Manufacturer: %s" % g_vendors[manu][0]
- f = g_vendors[manu][1][dev1]
- except KeyError:
- print "Unknown Manufacturer"
- print "Got id[3]: %x, %x, %x" % (manu, dev0, dev1)
- try:
- f = g_stm_types[1][dev1]
- print "Compatible : %s" % f[0]
- except KeyError:
- print "Unable to detect flash, just assuming 2MB size"
- f = ("m25p16", 32, 0x10000)
- bytes = f[1] * f[2]
- print "Size : %d MB" % (bytes / (1024 * 1024))
- return bytes
-
-if __name__ == "__main__":
- d = dpf.open(sys.argv[1])
- detect_flash(d)
- detect_lcd(d)
- d.close()