• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Firmware of Silead Touchscreen Controller for Jumper EZpad 6 Pro.


Commit MetaInfo

Révision61506a39f4ed6708eadafb4373a3871c72f059f7 (tree)
l'heure2016-02-10 02:45:58
AuteurGregor Riepl <onitake@gmai...>
CommiterGregor Riepl

Message de Log

Added automatic conversion script (for fwtool)

Change Summary

Modification

--- a/tools/AUTHORS.md
+++ b/tools/AUTHORS.md
@@ -1,2 +1,2 @@
11 fw_extractor is (c) 2013-2014 by Joe Burmeister <joe.a.burmeister@gmail.com>
2-fwtool, unscramble and untscfg are (c) 2015-2016 by Gregor Riepl <onitake@gmail.com>
\ No newline at end of file
2+fwtool, unscramble, untscfg and autoconvert are (c) 2015-2016 by Gregor Riepl <onitake@gmail.com>
\ No newline at end of file
--- /dev/null
+++ b/tools/autoconvert
@@ -0,0 +1,82 @@
1+#!/usr/bin/perl
2+
3+use strict;
4+use warnings;
5+use IO::File;
6+use IO::Dir;
7+use File::Basename;
8+use File::Spec::Functions qw(rel2abs catdir catfile);
9+
10+our $mydir = dirname(rel2abs(__FILE__));
11+our $basedir = catdir($mydir, '..', 'firmware');
12+our $fwtool = catfile($mydir, 'fwtool');
13+
14+my $root = IO::Dir->new($basedir) or die("Can't access $basedir: $!");
15+for (my $vendor = $root->read(); defined($vendor); $vendor = $root->read()) {
16+ if ($vendor !~ /^(.|..)$/) {
17+ my $vendordir = catdir($basedir, $vendor);
18+ my $devices = IO::Dir->new($vendordir);
19+ if (defined($devices)) {
20+ for (my $device = $devices->read(); defined($device); $device = $devices->read()) {
21+ if ($device !~ /^(.|..)$/) {
22+ my $devicedir = catdir($vendordir, $device);
23+ if (-d $devicedir) {
24+ print("Processing $vendor/$device...\n");
25+ my $readme = catfile($devicedir, 'README.md');
26+ my $sileadts = catfile($devicedir, 'silead_ts.fw');
27+ if (-e $readme) {
28+ my $overwrite;
29+ if (-e $sileadts) {
30+ print("silead_ts.fw found, overwrite? (y/N)");
31+ my $answer = readline();
32+ $overwrite = ($answer =~ /^[yY]/);
33+ } else {
34+ $overwrite = 1;
35+ }
36+ if ($overwrite) {
37+ my $firmware = catfile($devicedir, 'firmware.fw');
38+ my $model = '1680';
39+ my $width = 4095;
40+ my $height = 4095;
41+ my $points = 10;
42+ my %flags = ( xflip => 0, yflip => 0, swap => 0, track => 0 );
43+
44+ my $table = IO::File->new($readme, 'r') or warn("Error opening README.md");
45+ while (my $line = <$table>) {
46+ if ($line =~ /Touch controller\s*\|[ \ta-zA-Z]*([0-9]{4})/) {
47+ $model = $1;
48+ } elsif ($line =~ /Extracted firmware\s*\|[^(]*\(([a-zA-Z0-9_.]+)\)/) {
49+ $firmware = catfile($devicedir, $1);
50+ } elsif ($line =~ /Touch panel resolution\s*\|[^0-9]*([0-9]+)[ \t\/xX,]+([0-9]+)/) {
51+ $width = $1;
52+ $height = $2;
53+ } elsif ($line =~ /Multitouch support\s*\|[^0-9]*([0-9]+)/) {
54+ $points = $1;
55+ } elsif ($line =~ /Finger tracking\s*\|\W*[Nn]/) {
56+ $flags{track} = 1;
57+ } elsif ($line =~ /Mirrored horizontally\s*\|\W*[Yy]/) {
58+ $flags{xflip} = 1;
59+ } elsif ($line =~ /Mirrored vertically\s*\|\W*[Yy]/) {
60+ $flags{yflip} = 1;
61+ } elsif ($line =~ /Axes swapped\s*\|\W*[Yy]/) {
62+ $flags{swap} = 1;
63+ }
64+ }
65+
66+ if (-e $firmware) {
67+ my $flagstring = join(',', map({ $flags{$_} ? "$_" : "no$_" } keys(%flags)));
68+ print("Running: fwtool -c $firmware -1 -m $model -w $width -h $height -t $points -f $flagstring $sileadts\n");
69+ system($fwtool, '-c', $firmware, '-1', '-m', $model, '-w', $width, '-h', $height, '-t', $points, '-f', $flagstring, $sileadts);
70+ } else {
71+ print("Firmware $firmware found.\n");
72+ }
73+ }
74+ } else {
75+ print("No README.md found.\n");
76+ }
77+ }
78+ }
79+ }
80+ }
81+ }
82+}