From 45f8f8d95ee958a73ad5adf4c42bfa08ba5c4e87 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 20 Aug 2011 23:54:39 +0200 Subject: oncology: update Makefile, write config --- oncology/Makefile | 8 ++ oncology/dpfhack_display/hackit.py | 150 ------------------------------------- 2 files changed, 8 insertions(+), 150 deletions(-) create mode 100644 oncology/Makefile delete mode 100644 oncology/dpfhack_display/hackit.py diff --git a/oncology/Makefile b/oncology/Makefile new file mode 100644 index 00000000..e90d3bc8 --- /dev/null +++ b/oncology/Makefile @@ -0,0 +1,8 @@ +install: /etc/lcd4linux.conf + #punani -Ei libtool automake autoconf zlib1g-dev libssl-dev python-dev libc6 libusb-dev libibus-dev subversion libgd2-noxpm-dev libgd2-noxpm + dpfhack_display/build-dpf-lcd4linux.sh + make -C dpfhack_display/lcd4linux/ install + +/etc/lcd4linux.conf: lcd4linux.conf + chown 0:0 lcd4linux.conf + cp -a lcd4linux.conf /etc/lcd4linux.conf diff --git a/oncology/dpfhack_display/hackit.py b/oncology/dpfhack_display/hackit.py deleted file mode 100644 index 1ad64f1b..00000000 --- a/oncology/dpfhack_display/hackit.py +++ /dev/null @@ -1,150 +0,0 @@ -import struct -import sys -sys.path.append("./Debug") -import dpf -import time -import binascii - -# DPF profiles -import profiles - -# If you are an expert, set this to 0 to avoid the warnings -paranoia_mode = 1 - -JUMPTABLE_OFFSET = 0x80 -HEXDIR = "hexfiles/" - -instructions = [ - """Press and hold MENU while USB is plugged in. -If successful, you will get the 'USB connect' message and the device -will appear as non-USB storage device""" -] - -ins_common = """To put the device back into (almost) original state working -as USB storage, press the RESET button.""" - -############################################################################ - -bswap = lambda x: ( (x >> 8) & 0xff ) | ((x << 8) & 0xff00) - -def dump_flash(d, fname, offset, size): - data = d.readFlash(offset, size) - f = open(fname, "wb") - f.write(data) - f.close() - -def find_dpf(version): - for i in profiles.KNOWN_DPFS: - v = i[0] - if v[0] == str(version[0]) and v[1] == str(version[1]) and v[2] == str(version[2]): - print "Found matching version info" - return i - return None - -def get_module(buf, n): - n *= 8 - start, end, flashaddr = struct.unpack("HHBH", b) - version = (buf[0x50:0x58], buf[0x60: 0x70], buf[0x80:0x88]) - - dpf = find_dpf(version) - if not dpf: - print "No DPF found. Create a record or look for one" - print version - else: - print "Identifier:", dpf[1] - di = dpf[3] - di['offset'] = offset - - return dpf - -def patch(d, dpf): - if (paranoia_mode): - print """Now patching. There is no 100% guarantee that your device will - work after doing this. You must never unplug the device from USB while - it is being updated. - Are you sure you take all risks and that you want to continue?""" - a = raw_input("Type 'yes' to continue > ") - if a != "yes": - print "Aborting." - return False - - p = dpf[4] - - buf = d.readFlash(JUMPTABLE_OFFSET, dpf[3]['offset']) - for i in p[2]: - if not patch_module(d, i, buf): - return False - - return True -# -# -# MAIN - -if len(sys.argv) != 2: - print "Usage: %s [ | usb0]" % sys.argv[0] - print "You may have to run this as root when accessing generic scsi devices" - sys.exit(-1) - -d = dpf.open(sys.argv[1]) - -dpf = recognize(d) -if dpf: - r = dpf[4] - ret = patch(d, dpf) - if ret: - print - print "Now disconnect the DPF from USB." - print "To activate the 'developer mode':" - print - print instructions[r[0]] - print - print ins_common - else: - print "DPF might not be completely patched." -d.close() -- cgit v1.2.3