Delete debug log message

This commit is contained in:
Schoumi 2016-11-07 02:10:22 +01:00
vanhempi 3c6d37efd1
commit 7ccf37b339
10 muutettua tiedostoa jossa 7 lisäystä ja 74 poistoa

Näytä tiedosto

@ -1,15 +1,15 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
compileSdkVersion 25
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "fr.mobdev.lpcprog"
minSdkVersion 14
targetSdkVersion 24
versionCode 1
versionName "1.0"
targetSdkVersion 25
versionCode 2
versionName "1.1"
}
buildTypes {
release {
@ -25,7 +25,7 @@ repositories {
dependencies {
compile files('src/main/libs/d2xx.jar')
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:design:25.0.0'
compile 'com.android.support:support-v4:25.0.0'
}

Näytä tiedosto

@ -81,7 +81,6 @@ public class BinariesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
if (holder instanceof SectionHolder) {
SectionHolder sectionHolder = (SectionHolder) holder;
int section = getSection(position);
System.out.println("pos " + position + " section " + section);
String sectionName = servers.get(section).url.toString();
sectionHolder.setupSection(sectionName);
} else if (holder instanceof BinaryHolder) {
@ -107,7 +106,6 @@ public class BinariesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
}
private int getRealPosition(int fakePosition) {
System.out.println("get real " + fakePosition);
fakePosition -= 1;
for (int i = 0; i < servers.size(); i++) {
int serverSize = servers.get(i).binaries.size();

Näytä tiedosto

@ -72,7 +72,6 @@ public class ServerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
if (holder instanceof SectionHolder) {
SectionHolder sectionHolder = (SectionHolder) holder;
int section = getSection(position);
System.out.println("pos " + position + " section " + section);
String sectionName = sections.get(section);
sectionHolder.setupSection(sectionName);
} else if (holder instanceof ServerHolder) {
@ -94,11 +93,9 @@ public class ServerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
}
}
count = size;
System.out.println("get count"+count);
}
private int getRealPosition(int fakePosition) {
System.out.println("get real " + fakePosition);
fakePosition -= 1;
for (int i = 0; i < sections.size(); i++) {
int serverSize = servers.get(i).size();
@ -128,7 +125,6 @@ public class ServerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
@Override
public int getItemCount() {
System.out.println("get count"+count);
return count;
}

Näytä tiedosto

@ -91,7 +91,6 @@ public class DeviceFragment extends Fragment {
for(USBDevice device : devices){
if(device.PID == pid && device.VID == vid){
dev = device;
System.out.println("device found");
break;
}
}
@ -206,7 +205,6 @@ public class DeviceFragment extends Fragment {
}
private void doUsb(){
System.out.println("doUsb");
new Thread(new Runnable() {
@Override
public void run() {
@ -282,7 +280,6 @@ public class DeviceFragment extends Fragment {
}
public void updateRepositories(View view){
System.out.println("Update Repo");
if(view == null)
view = getView();
final View v = view;
@ -309,7 +306,6 @@ public class DeviceFragment extends Fragment {
@Override
public void endServer(Server server) {
System.out.println(server.url.toString()+"empty "+server.binaries.isEmpty()+" "+server.binaries.size());
if(!server.binaries.isEmpty())
servers.add(server);
}

Näytä tiedosto

@ -42,7 +42,6 @@ import fr.mobdev.lpcprog.managers.UsbCommManager;
public class USBListFragment extends Fragment {
private List<USBDevice> devices;
private int value = 0;
private USBInteractionListener listener;
private UsbCommManager comm;
@ -82,7 +81,6 @@ public class USBListFragment extends Fragment {
if(v != null && gestureDetector.onTouchEvent(e)){
int pos = view.getChildAdapterPosition(v);
System.out.println("touch "+ ++value);
onItemClick(pos);
return true;
}

Näytä tiedosto

@ -208,7 +208,6 @@ public class DatabaseManager extends SQLiteOpenHelper {
whereArgs[0] = String.valueOf(id);
Cursor cursor = getReadableDatabase().query("binaries", null, whereClause, whereArgs, null, null, null);
while (cursor.moveToNext()){
System.out.println("Found a binary in db");
int col = 0;
Binary b = new Binary();
b.id = cursor.getLong(col++);
@ -244,7 +243,6 @@ public class DatabaseManager extends SQLiteOpenHelper {
}
void addBinary(Server server, Binary binary) {
System.out.println("add binary");
ContentValues values = new ContentValues();
values.put("server_id",server.id);
values.put("name",binary.name);
@ -268,7 +266,6 @@ public class DatabaseManager extends SQLiteOpenHelper {
String whereClause = "part_id = ?";
String[] whereArgs = new String[1];
whereArgs[0] = String.valueOf(part_id);
System.out.println("part_id "+part_id);
Cursor cursor = getReadableDatabase().query("definitions", null, whereClause, whereArgs, null, null, null);
if (cursor.moveToNext()) {
part = new Part();

Näytä tiedosto

@ -86,8 +86,6 @@ public class IspManager {
serialPort = device.device;
if (serialPort != null)
serialPort.resetDevice();
else
System.out.println("device is null fuck");
if (serialPort != null && serialPort.isOpen()) {
serialPort.setBaudRate(baudRate);
@ -108,7 +106,6 @@ public class IspManager {
serialPort.purge(D2xxManager.FT_PURGE_RX);
String[] uids = readUid();
if (uids == null) {
System.out.println("uids null fuck");
return false;
}
}
@ -130,18 +127,13 @@ public class IspManager {
int ret = sendCommand(READ_UID);
if (ret != 0) {
System.out.println("Send Command " + ret);
return null;
}
byte[] buf = new byte[REP_BUF];
int size = read(buf, 50, 500);
for (int i = 0; i < size; i++) {
System.out.println(String.format("%02x", buf[i]));
}
if (size <= 0) {
System.out.println("Send size " + size);
return null;
}
String[] uids = new String[4];
@ -158,7 +150,6 @@ public class IspManager {
buffer = buffer.substring(buffer.indexOf("\r") + 1);
}
}
System.out.println("uids ok");
return uids;
}
@ -186,7 +177,6 @@ public class IspManager {
return null;
int ret = sendCommand(READ_BOOT_VERSION);
if (ret != 0) {
System.out.println("Send Command " + ret);
return null;
}
byte[] buf = new byte[REP_BUF];
@ -194,7 +184,6 @@ public class IspManager {
int size = read(buf, 50, 500);
if (size <= 0) {
System.out.println("Receive " + size);
return null;
}
String[] version = new String[2];
@ -254,7 +243,6 @@ public class IspManager {
File file = new File(context.getApplicationInfo().dataDir + "/" + server.id + "/" + binary.path + binary.filename);
int size = copy_buffer(file, data, parts.flash_size);
if (size <= 0) {
System.out.println("Size " + size);
listener.onError(context.getString(R.string.copy_file),flashView);
return -5;
}
@ -315,7 +303,6 @@ public class IspManager {
serialPort.purge(D2xxManager.FT_PURGE_TX);
byte[] buf;
if (serialPort.write(SYNC_START) != SYNC_START.length) {
System.out.println("Start");
return false;
}
@ -325,11 +312,9 @@ public class IspManager {
String expected = new String(SYNC);
if (result.compareTo(expected) != 0) {
serialPort.write("\r\n".getBytes());
System.out.println("Start answer " + result);
return false;
}
if (serialPort.write(SYNC) != SYNC.length) {
System.out.println("SYNC write");
return false;
}
clearBuffer(SYNC.length);
@ -338,13 +323,11 @@ public class IspManager {
result = new String(buf);
expected = new String(SYNC_OK);
if (result.compareTo(expected) != 0) {
System.out.println("SYNC OK " + result);
return false;
}
String freq = String.valueOf(crystal_freq) + "\r\n";
if (serialPort.write(freq.getBytes()) != freq.length()) {
System.out.println("freq write");
return false;
}
@ -354,12 +337,10 @@ public class IspManager {
result = new String(buf);
expected = new String(SYNC_OK);
if (result.compareTo(expected) != 0) {
System.out.println("freq answer " + result);
return false;
}
if (serialPort.write(SYNC_ECHO_OFF) != SYNC_ECHO_OFF.length) {
System.out.println("Sync Echo Off write");
return false;
}
@ -439,17 +420,14 @@ public class IspManager {
String request = String.format(Locale.getDefault(),"%c %d %d %d\r\n",c,flash_addr,ram_addr,write_size);
len = serialPort.write(request.getBytes());
if(len != request.getBytes().length){
System.out.println("cmd addr write");
return -5;
}
len = read(buf,buf.length,500);
if (len <= 0) {
System.out.println("cmd addr read");
return -4;
}
ret = parseRetCode(buf);
System.out.println("cmd addr ret "+ret);
return ret;
}
@ -464,7 +442,6 @@ public class IspManager {
ret = sendCommand('W',ram_addr,write_size);
if(ret != 0){
System.out.println("ask for write to ram");
return -8;
}
if(!uuencode) {
@ -491,41 +468,27 @@ public class IspManager {
computed_checksum = calc_checksum(dataToSend,total_sent,data_size);
byte[] checksum = String.format(Locale.getDefault(),"%d\r\n", computed_checksum).getBytes();
System.out.println(String.format(Locale.getDefault(),"%d %08x",i,computed_checksum));
System.arraycopy(checksum,0,buf,encoded_size,checksum.length);
encoded_size+=checksum.length;
//buf[encoded_size]='\0';
//encoded_size++;
for(int j = 0; j < encoded_size; j++) {
System.out.print(String.format(Locale.getDefault(),"%02x",buf[j]));
if(j%10==0)
System.out.println("");
}
len = serialPort.write(buf,encoded_size);
if(len != encoded_size) {
System.out.println("write fail "+i);
return -8;
}
len = read(repbuf,REP_BUF,500);
if(len <= 0) {
System.out.println("read answer fail "+i);
return -9;
}
repbuf[len]='\0';
System.out.println("Length "+len);
for(int j = 0; j < len; j++) {
System.out.println(String.format(Locale.getDefault(),"%02x",repbuf[j]));
}
String result = new String(repbuf,0,len);
String expected = new String(DATA_BLOCK_OK);
System.out.println("result "+result+".");
if(result.compareTo(expected)==0){
total_sent += data_size;
resend_requested_for_block = 0;
} else {
resend_requested_for_block++;
if(resend_requested_for_block >= 3) {
System.out.println("resend fail "+i);
return -10;
}
i--;
@ -547,7 +510,6 @@ public class IspManager {
private int eraseFlash(Part parts,FlashListener listener) {
int ret = unlock();
if (ret != 0) {
System.out.println("unlock fail");
return -1;
}
for (int i = 0; i < parts.flash_nb_sectors; i++) {
@ -559,7 +521,6 @@ public class IspManager {
}
if (ret < 0) {
System.out.println("blank "+i+" fail");
return ret;
} else {
byte buf[] = new byte[REP_BUF];
@ -568,13 +529,11 @@ public class IspManager {
//prepare-for-write
ret = send_cmd_sectors('P', i, i);
if (ret != 0) {
System.out.println("prepare-for-write "+i+" fail");
return ret;
}
//erase
ret = send_cmd_sectors('E', i, i);
if (ret != 0) {
System.out.println("erase "+i+" fail");
return ret;
}
}

Näytä tiedosto

@ -126,7 +126,6 @@ public class NetworkManager {
InputStreamReader isr = new InputStreamReader(stream);
BufferedReader reader = new BufferedReader(isr);
String line = reader.readLine();
System.out.println("Browse binaries");
while(line != null){
if(!line.startsWith("#")) {
Binary b = parseLine(line);
@ -153,7 +152,6 @@ public class NetworkManager {
private Binary parseLine(String line){
if(!line.matches("(.*;){5}")){
System.out.println("Line not match regex");
return null;
}
Binary b = new Binary();
@ -240,7 +238,6 @@ public class NetworkManager {
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("Sha1 "+sha1);
return sha1.compareToIgnoreCase(binary.sha1) == 0;
}

Näytä tiedosto

@ -40,22 +40,17 @@ public class Binary {
Binary binary = (Binary) o;
if (version != binary.version) {
System.out.println("version");
return false;
}
if (!name.equals(binary.name)){
System.out.println("name");
return false;
}
if (!filename.equals(binary.filename)) {
System.out.println("filename");
return false;
}
if (!path.equals(binary.path)) {
System.out.println("path");
return false;
}
System.out.println("sha1 "+sha1.equals(binary.sha1));
return sha1.equals(binary.sha1);
}

Näytä tiedosto

@ -37,9 +37,6 @@ public class Server {
}
public boolean contains(Binary b) {
for(Binary binary : binaries){
System.out.println("Binary equals?"+b.name+" "+b.equals(binary));
}
return binaries.contains(b);
}
}