Skip to content

Instantly share code, notes, and snippets.

@cail
Created May 6, 2018 07:50
Show Gist options
  • Save cail/a370e8920097e394d666875270b4a674 to your computer and use it in GitHub Desktop.
Save cail/a370e8920097e394d666875270b4a674 to your computer and use it in GitHub Desktop.
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
// Source File Name: SourceFile
package tw.com.prolific.driver.pl2303;
import android.app.PendingIntent;
import android.content.*;
import android.content.pm.PackageManager;
import android.hardware.usb.*;
import android.os.Build;
import java.io.*;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.*;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.atomic.AtomicInteger;
public class PL2303Driver
{
public static final class BaudRate extends Enum
{
public static BaudRate[] values()
{
BaudRate abaudrate[];
int i1;
BaudRate abaudrate1[];
System.arraycopy(abaudrate = a, 0, abaudrate1 = new BaudRate[i1 = abaudrate.length], 0, i1);
return abaudrate1;
}
public static BaudRate valueOf(String s1)
{
return (BaudRate)Enum.valueOf(tw/com/prolific/driver/pl2303/PL2303Driver$BaudRate, s1);
}
public static final BaudRate B0;
public static final BaudRate B75;
public static final BaudRate B150;
public static final BaudRate B300;
public static final BaudRate B600;
public static final BaudRate B1200;
public static final BaudRate B1800;
public static final BaudRate B2400;
public static final BaudRate B4800;
public static final BaudRate B9600;
public static final BaudRate B14400;
public static final BaudRate B19200;
public static final BaudRate B38400;
public static final BaudRate B57600;
public static final BaudRate B115200;
public static final BaudRate B230400;
public static final BaudRate B460800;
public static final BaudRate B614400;
public static final BaudRate B921600;
public static final BaudRate B1228800;
public static final BaudRate B2457600;
public static final BaudRate B3000000;
public static final BaudRate B6000000;
public static final BaudRate B12000000;
private static final BaudRate a[];
static
{
B0 = new BaudRate("B0", 0);
B75 = new BaudRate("B75", 1);
B150 = new BaudRate("B150", 2);
B300 = new BaudRate("B300", 3);
B600 = new BaudRate("B600", 4);
B1200 = new BaudRate("B1200", 5);
B1800 = new BaudRate("B1800", 6);
B2400 = new BaudRate("B2400", 7);
B4800 = new BaudRate("B4800", 8);
B9600 = new BaudRate("B9600", 9);
B14400 = new BaudRate("B14400", 10);
B19200 = new BaudRate("B19200", 11);
B38400 = new BaudRate("B38400", 12);
B57600 = new BaudRate("B57600", 13);
B115200 = new BaudRate("B115200", 14);
B230400 = new BaudRate("B230400", 15);
B460800 = new BaudRate("B460800", 16);
B614400 = new BaudRate("B614400", 17);
B921600 = new BaudRate("B921600", 18);
B1228800 = new BaudRate("B1228800", 19);
B2457600 = new BaudRate("B2457600", 20);
B3000000 = new BaudRate("B3000000", 21);
B6000000 = new BaudRate("B6000000", 22);
B12000000 = new BaudRate("B12000000", 23);
a = (new BaudRate[] {
B0, B75, B150, B300, B600, B1200, B1800, B2400, B4800, B9600,
B14400, B19200, B38400, B57600, B115200, B230400, B460800, B614400, B921600, B1228800,
B2457600, B3000000, B6000000, B12000000
});
}
private BaudRate(String s1, int i1)
{
super(s1, i1);
}
}
public static final class DataBits extends Enum
{
public static DataBits[] values()
{
DataBits adatabits[];
int i1;
DataBits adatabits1[];
System.arraycopy(adatabits = a, 0, adatabits1 = new DataBits[i1 = adatabits.length], 0, i1);
return adatabits1;
}
public static DataBits valueOf(String s1)
{
return (DataBits)Enum.valueOf(tw/com/prolific/driver/pl2303/PL2303Driver$DataBits, s1);
}
public static final DataBits D5;
public static final DataBits D6;
public static final DataBits D7;
public static final DataBits D8;
private static final DataBits a[];
static
{
D5 = new DataBits("D5", 0);
D6 = new DataBits("D6", 1);
D7 = new DataBits("D7", 2);
D8 = new DataBits("D8", 3);
a = (new DataBits[] {
D5, D6, D7, D8
});
}
private DataBits(String s1, int i1)
{
super(s1, i1);
}
}
public static final class FlowControl extends Enum
{
public static FlowControl[] values()
{
FlowControl aflowcontrol[];
int i1;
FlowControl aflowcontrol1[];
System.arraycopy(aflowcontrol = a, 0, aflowcontrol1 = new FlowControl[i1 = aflowcontrol.length], 0, i1);
return aflowcontrol1;
}
public static FlowControl valueOf(String s1)
{
return (FlowControl)Enum.valueOf(tw/com/prolific/driver/pl2303/PL2303Driver$FlowControl, s1);
}
public static final FlowControl OFF;
public static final FlowControl RTSCTS;
public static final FlowControl RFRCTS;
public static final FlowControl DTRDSR;
public static final FlowControl RTSCTSDTRDSR;
public static final FlowControl XONXOFF;
private static final FlowControl a[];
static
{
OFF = new FlowControl("OFF", 0);
RTSCTS = new FlowControl("RTSCTS", 1);
RFRCTS = new FlowControl("RFRCTS", 2);
DTRDSR = new FlowControl("DTRDSR", 3);
RTSCTSDTRDSR = new FlowControl("RTSCTSDTRDSR", 4);
XONXOFF = new FlowControl("XONXOFF", 5);
a = (new FlowControl[] {
OFF, RTSCTS, RFRCTS, DTRDSR, RTSCTSDTRDSR, XONXOFF
});
}
private FlowControl(String s1, int i1)
{
super(s1, i1);
}
}
public static final class Parity extends Enum
{
public static Parity[] values()
{
Parity aparity[];
int i1;
Parity aparity1[];
System.arraycopy(aparity = a, 0, aparity1 = new Parity[i1 = aparity.length], 0, i1);
return aparity1;
}
public static Parity valueOf(String s1)
{
return (Parity)Enum.valueOf(tw/com/prolific/driver/pl2303/PL2303Driver$Parity, s1);
}
public static final Parity NONE;
public static final Parity ODD;
public static final Parity EVEN;
private static final Parity a[];
static
{
NONE = new Parity("NONE", 0);
ODD = new Parity("ODD", 1);
EVEN = new Parity("EVEN", 2);
a = (new Parity[] {
NONE, ODD, EVEN
});
}
private Parity(String s1, int i1)
{
super(s1, i1);
}
}
class a extends Thread
{
public void a()
{
c = 0;
b = 0;
PL2303Driver.e(a).clear();
}
public void a(int i1)
{
a();
b(i1);
}
public void b(int i1)
{
f.set(i1);
}
public void b()
{
e = true;
while(isAlive()) ;
PL2303Driver.e(a).clear();
}
private void c(int i1)
{
if(i1 == 0)
return;
long l1 = System.currentTimeMillis();
long l2;
do
{
l2 = System.currentTimeMillis();
Thread.yield();
} while(l2 - l1 <= (long)i1);
}
public void run()
{
try
{
byte abyte0[] = new byte[4096];
while(!e)
{
b = PL2303Driver.a(a, abyte0, abyte0.length);
if(b > 0)
synchronized(PL2303Driver.ReadQueueLock)
{
c = PL2303Driver.e(a).size();
if(4096 != c)
{
for(int k1 = 0; k1 < b && c < 4096; k1++)
{
int i1 = Integer.valueOf(abyte0[k1]).intValue();
if(FlowControl.XONXOFF == PL2303Driver.f(a))
{
if(19 == i1)
{
PL2303Driver.b(a, false);
continue;
}
if(17 == i1)
{
PL2303Driver.b(a, true);
continue;
}
}
d = PL2303Driver.e(a).offer(Integer.valueOf(i1));
if(!d)
break;
c = PL2303Driver.e(a).size();
}
}
}
int j1 = f.get();
c(j1);
}
}
catch(Exception exception) { }
}
private int b;
private int c;
private boolean d;
private boolean e;
private AtomicInteger f;
final PL2303Driver a;
a()
{
a = PL2303Driver.this;
super();
d = true;
e = false;
f = new AtomicInteger(500);
}
}
public static final class StopBits extends Enum
{
public static StopBits[] values()
{
StopBits astopbits[];
int i1;
StopBits astopbits1[];
System.arraycopy(astopbits = a, 0, astopbits1 = new StopBits[i1 = astopbits.length], 0, i1);
return astopbits1;
}
public static StopBits valueOf(String s1)
{
return (StopBits)Enum.valueOf(tw/com/prolific/driver/pl2303/PL2303Driver$StopBits, s1);
}
public static final StopBits S1;
public static final StopBits S2;
private static final StopBits a[];
static
{
S1 = new StopBits("S1", 0);
S2 = new StopBits("S2", 1);
a = (new StopBits[] {
S1, S2
});
}
private StopBits(String s1, int i1)
{
super(s1, i1);
}
}
private void a(UsbManager usbmanager, Context context, String s1, boolean flag)
{
I = usbmanager;
J = null;
M = null;
N = null;
O = null;
R = 0;
S = 0;
ap = false;
Y = false;
aq = false;
d = context;
ar = flag;
ad = s1;
at = true;
as = FlowControl.OFF;
b("067B:2303");
b("067B:2304");
b("067B:2551");
b("067B:2503");
b("067B:A100");
b("067B:AAA5");
b("05AD:0FBA");
af = ae.size();
ay = 0;
az = 15;
aA = 3;
aB = 0;
aC = 0;
aD = 0;
aE = 0;
aF = 0;
T = 100;
U = 100;
V = 100;
}
public PL2303Driver(UsbManager manager, Context mContext, String sAppName)
{
e = false;
j = new byte[7];
C = 0;
D = 0;
c = new byte[4096];
W = new ArrayBlockingQueue(4096, true);
Z = 0;
aa = 0;
ab = false;
ac = false;
ae = new ArrayList();
ag = 0;
aG = false;
aH = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent)
{
String s1;
UsbDevice usbdevice;
s1 = intent.getAction();
usbdevice = (UsbDevice)intent.getParcelableExtra("device");
if(!"android.hardware.usb.action.USB_DEVICE_ATTACHED".equals(s1)) goto _L2; else goto _L1
_L2:
if(!"android.hardware.usb.action.USB_DEVICE_DETACHED".equals(s1)) goto _L4; else goto _L3
_L3:
String s2 = usbdevice.getDeviceName();
if(PL2303Driver.a(a) != null && PL2303Driver.a(a).equals(s2))
{
Intent intent1 = new Intent("tw.PL2303USBMessage");
intent1.putExtra("USB.Detached", String.valueOf(255));
a.d.sendBroadcast(intent1);
a.end();
}
goto _L1
_L4:
if(!s1.equals(PL2303Driver.b(a))) goto _L1; else goto _L5
_L5:
_cls1 _lcls1 = this;
JVM INSTR monitorenter ;
if(!intent.getBooleanExtra("permission", false) || usbdevice == null) goto _L1; else goto _L6
_L6:
int i1 = 0;
goto _L7
_L8:
if(!String.format("%04X:%04X", new Object[] {
Integer.valueOf(usbdevice.getVendorId()), Integer.valueOf(usbdevice.getProductId())
}).equals(PL2303Driver.d(a).get(i1)))
continue; /* Loop/switch isn't completed */
PL2303Driver.a(a, usbdevice);
return;
i1++;
_L7:
if(i1 < PL2303Driver.c(a)) goto _L8; else goto _L1
_lcls1;
JVM INSTR monitorexit ;
throw ;
_L1:
}
final PL2303Driver a;
{
a = PL2303Driver.this;
super();
}
}
;
a(manager, mContext, sAppName, true);
}
public PL2303Driver(UsbManager manager, Context mContext, String sAppName, boolean bWithQueue)
{
e = false;
j = new byte[7];
C = 0;
D = 0;
c = new byte[4096];
W = new ArrayBlockingQueue(4096, true);
Z = 0;
aa = 0;
ab = false;
ac = false;
ae = new ArrayList();
ag = 0;
aG = false;
aH = new _cls1();
a(manager, mContext, sAppName, bWithQueue);
}
private void a(UsbDevice usbdevice)
{
int i1 = 0;
boolean flag = false;
if(K != null)
{
if(L != null)
{
K.releaseInterface(L);
L = null;
}
K.close();
J = null;
K = null;
}
if(usbdevice == null)
return;
int k1 = usbdevice.getInterfaceCount();
for(int j1 = 0; j1 < k1; j1++)
{
UsbInterface usbinterface = usbdevice.getInterface(j1);
if(255 != usbinterface.getInterfaceClass() || usbinterface.getInterfaceProtocol() != 0 || usbinterface.getInterfaceSubclass() != 0 || 3 != usbinterface.getEndpointCount())
continue;
flag = true;
i1 = j1;
break;
}
if(!flag)
{
Intent intent = new Intent("tw.PL2303USBMessage");
intent.putExtra("USB.Detached", String.valueOf(255));
d.sendBroadcast(intent);
end();
return;
}
UsbInterface usbinterface1 = usbdevice.getInterface(i1);
if(usbdevice != null && usbinterface1 != null)
{
UsbDeviceConnection usbdeviceconnection = I.openDevice(usbdevice);
if(usbdeviceconnection != null)
if(usbdeviceconnection.claimInterface(usbinterface1, true))
{
J = usbdevice;
K = usbdeviceconnection;
L = usbinterface1;
if(a(L))
return;
} else
{
usbdeviceconnection.close();
}
}
}
boolean a(String s1)
{
String s2 = "";
boolean flag = true;
if(android.os.Build.VERSION.SDK_INT >= 21)
return true;
try
{
String s3 = (new StringBuilder("toolbox ls ")).append(s1).toString();
Process process = Runtime.getRuntime().exec(s3);
BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(process.getInputStream()));
for(String s4 = null; (s4 = bufferedreader.readLine()) != null;)
s2 = (new StringBuilder(String.valueOf(s2))).append(s4).toString();
if(s1.compareTo(s2) != 0)
flag = false;
}
catch(IOException ioexception)
{
ioexception.printStackTrace();
flag = false;
}
return flag;
}
private boolean b(String s1)
{
ae.add(s1);
af = ae.size();
return true;
}
public boolean enumerate()
{
I = (UsbManager)d.getSystemService("usb");
HashMap hashmap = I.getDeviceList();
Iterator iterator = hashmap.values().iterator();
PendingIntent pendingintent = PendingIntent.getBroadcast(d, 0, new Intent(ad), 0);
while(iterator.hasNext())
{
UsbDevice usbdevice = (UsbDevice)iterator.next();
for(int i1 = 0; i1 < af; i1++)
if(String.format("%04X:%04X", new Object[] {
Integer.valueOf(usbdevice.getVendorId()), Integer.valueOf(usbdevice.getProductId())
}).equals(ae.get(i1)) && a(usbdevice.getDeviceName()))
{
IntentFilter intentfilter = new IntentFilter(ad);
intentfilter.addAction("android.hardware.usb.action.USB_DEVICE_DETACHED");
d.registerReceiver(aH, intentfilter);
if(!I.hasPermission(usbdevice))
{
I.requestPermission(usbdevice, pendingintent);
} else
{
b(usbdevice);
if(String.format("%04X:%04X", new Object[] {
Integer.valueOf(usbdevice.getVendorId()), Integer.valueOf(usbdevice.getProductId())
}).equals("067B:2551") || String.format("%04X:%04X", new Object[] {
Integer.valueOf(usbdevice.getVendorId()), Integer.valueOf(usbdevice.getProductId())
}).equals("067B:2503") || String.format("%04X:%04X", new Object[] {
Integer.valueOf(usbdevice.getVendorId()), Integer.valueOf(usbdevice.getProductId())
}).equals("067B:A100"))
aq = true;
return true;
}
}
}
return false;
}
private void b(UsbDevice usbdevice)
{
sDevice = usbdevice;
(new Thread(aI)).start();
}
private boolean f()
{
if(!ap)
return false;
if(J == null)
return false;
int i1 = a(K);
if(i1 < 0)
return false;
if(ag != 4 && ag != 6)
return false;
if(ar)
X = new a();
else
X = null;
return true;
}
public boolean InitByDefualtValue()
{
if(!f())
return false;
if(ar)
g();
return true;
}
public boolean InitByBaudRate(BaudRate R)
{
if(!f())
return false;
int i1 = 0;
try
{
i1 = setup(R, DataBits.D8, StopBits.S1, Parity.NONE, FlowControl.OFF);
}
catch(IOException ioexception)
{
ioexception.printStackTrace();
}
if(i1 < 0)
return false;
if(ar)
g();
return true;
}
public boolean InitByBaudRate(BaudRate R, int TimeoutConstant)
{
if(!f())
return false;
int i1 = 0;
try
{
i1 = setup(R, DataBits.D8, StopBits.S1, Parity.NONE, FlowControl.OFF);
}
catch(IOException ioexception)
{
ioexception.printStackTrace();
}
if(i1 < 0)
return false;
if(!PL2303Device_SetCommTimeouts(TimeoutConstant))
return false;
if(ar)
g();
return true;
}
public boolean InitByPortSetting(BaudRate R, DataBits D, StopBits S, Parity P, FlowControl F)
{
if(!f())
return false;
int i1 = 0;
try
{
i1 = setup(R, D, S, P, F);
}
catch(IOException ioexception)
{
ioexception.printStackTrace();
}
if(i1 < 0)
return false;
if(ar)
g();
return true;
}
public void end()
{
if(J != null)
{
if(ar)
h();
aq = false;
d.unregisterReceiver(aH);
a(((UsbDevice) (null)));
}
}
public boolean isConnected()
{
return J != null && M != null && N != null;
}
private boolean a(UsbInterface usbinterface)
{
if(usbinterface == null)
return false;
for(int i1 = 0; i1 < usbinterface.getEndpointCount(); i1++)
if(usbinterface.getEndpoint(i1).getType() == 2)
{
if(usbinterface.getEndpoint(i1).getDirection() == 128)
M = usbinterface.getEndpoint(i1);
else
N = usbinterface.getEndpoint(i1);
} else
if(usbinterface.getEndpoint(i1).getType() == 3 && usbinterface.getEndpoint(i1).getDirection() == 128)
O = usbinterface.getEndpoint(i1);
return true;
}
private void g()
{
if(!Y)
{
X.start();
X.setPriority(10);
Y = X.isAlive();
}
}
private void h()
{
if(Y && X != null)
{
X.b();
Y = X.isAlive();
X = null;
}
}
private void a(BaudRate baudrate)
{
int ai1[] = {
3, 5, 10, 25, 100, 200
};
int i1 = ai1[3];
switch(a()[baudrate.ordinal()])
{
case 20: // '\024'
case 21: // '\025'
case 22: // '\026'
case 23: // '\027'
i1 = ai1[0];
break;
case 15: // '\017'
case 16: // '\020'
case 17: // '\021'
case 18: // '\022'
case 19: // '\023'
i1 = ai1[1];
break;
case 11: // '\013'
case 12: // '\f'
case 13: // '\r'
case 14: // '\016'
i1 = ai1[2];
break;
case 6: // '\006'
case 7: // '\007'
case 8: // '\b'
case 9: // '\t'
case 10: // '\n'
i1 = ai1[3];
break;
case 4: // '\004'
case 5: // '\005'
i1 = ai1[4];
break;
case 2: // '\002'
case 3: // '\003'
i1 = ai1[5];
break;
case 1: // '\001'
i1 = 10000;
break;
default:
return;
}
if(X != null)
X.b(i1);
}
public int read(byte buf[])
{
int i1 = 0;
int k1 = buf.length;
if(k1 == 0)
return 0;
if(k1 > 4096)
buf = new byte[4096];
if(ar)
{
synchronized(ReadQueueLock)
{
int l1 = W.size();
if(l1 > 0)
{
if(k1 >= l1)
i1 = l1;
else
i1 = k1;
for(int j1 = 0; j1 < i1; j1++)
{
Integer integer = (Integer)W.poll();
if(integer == null)
break;
buf[j1] = (byte)(integer.intValue() & 0xff);
}
} else
{
i1 = 0;
}
}
} else
{
int i2 = a(buf, k1);
if(i2 > 0)
if(k1 >= i2)
i1 = i2;
else
i1 = k1;
}
return i1;
}
private int a(byte abyte0[], int i1)
{
if(abyte0.length == 0 || i1 == 0)
return 0;
if(K == null)
{
X.b();
return -1;
}
if(S > 0 && i1 <= S)
{
if(!e)
{
System.arraycopy(c, R, abyte0, 0, i1);
} else
{
for(int j1 = 0; j1 < i1; j1++)
{
abyte0[j1] = c[R++];
for(Z++; (Z - 1) % 10 != Byte.valueOf(abyte0[j1]).byteValue() - 48; Z++);
}
aa += i1;
ab = true;
}
S -= i1;
return i1;
}
int k1 = 0;
int l1 = i1;
if(S > 0)
{
l1 -= S;
System.arraycopy(c, R, abyte0, k1, S);
}
int i2 = K.bulkTransfer(M, c, c.length, T);
if(i2 < 0)
return i2;
if(i2 == 0)
return 0;
int j2 = i2 / 64;
int k2 = i2 % 64;
if(k2 > 0)
j2++;
S = i2;
int l2 = 0;
for(int i3 = 0; i3 < j2; i3++)
{
int j3 = i3 * 64;
for(int k3 = 0; k3 < 64; k3++)
c[l2++] = c[j3 + k3];
}
R = 0;
for(; S > 0 && l1 > 0; l1--)
{
abyte0[k1++] = c[R++];
if(e)
for(Z++; (Z - 1) % 10 != Byte.valueOf(abyte0[k1 - 1]).byteValue() - 48; Z++);
S--;
}
if(e)
{
if(k1 > 0)
{
aa += k1;
ab = true;
}
if(ab)
ab = false;
}
return k1;
}
public int write(byte buf[])
{
return write(buf, buf.length);
}
public int write(byte buf[], int wlength)
{
int i1 = 0;
byte abyte0[] = new byte[4096];
if(K == null)
{
abyte0 = null;
return -1;
}
if(FlowControl.XONXOFF == as && !at)
return 0;
int j1;
for(; i1 < wlength; i1 += j1)
{
int k1 = 4096;
if(i1 + k1 > wlength)
k1 = wlength - i1;
System.arraycopy(buf, i1, abyte0, 0, k1);
j1 = K.bulkTransfer(N, abyte0, k1, U);
if(j1 < 0)
return -1;
}
return i1;
}
public int setup(BaudRate R, DataBits D, StopBits S, Parity P, FlowControl F)
throws IOException
{
int i1 = 0;
if(K == null)
return -1;
if(FlowControl.XONXOFF == as && !at)
return 0;
i1 = K.controlTransfer(161, 33, 0, 0, j, 7, V);
if(i1 < 0)
return i1;
int l2 = 0;
switch(a()[R.ordinal()])
{
case 1: // '\001'
l2 = 0;
break;
case 2: // '\002'
l2 = 75;
break;
case 3: // '\003'
l2 = 150;
break;
case 4: // '\004'
l2 = 300;
break;
case 5: // '\005'
l2 = 600;
break;
case 6: // '\006'
l2 = 1200;
break;
case 7: // '\007'
l2 = 1800;
break;
case 8: // '\b'
l2 = 2400;
break;
case 9: // '\t'
l2 = 4800;
break;
case 10: // '\n'
l2 = 9600;
break;
case 11: // '\013'
l2 = 14400;
break;
case 12: // '\f'
l2 = 19200;
break;
case 13: // '\r'
l2 = 38400;
break;
case 14: // '\016'
l2 = 57600;
break;
case 15: // '\017'
l2 = 0x1c200;
break;
case 16: // '\020'
l2 = 0x38400;
break;
case 17: // '\021'
l2 = 0x70800;
break;
case 18: // '\022'
l2 = 0x96000;
break;
case 19: // '\023'
l2 = 0xe1000;
break;
case 20: // '\024'
l2 = 0x12c000;
break;
case 21: // '\025'
l2 = 0x258000;
break;
case 22: // '\026'
l2 = 0x2dc6c0;
break;
case 23: // '\027'
l2 = 0x5b8d80;
break;
case 24: // '\030'
l2 = 0xb71b00;
break;
default:
return -2;
}
if(l2 > 0x12c000 && ag == 0)
return -2;
if(X != null)
a(R);
j[0] = (byte)(l2 & 0xff);
j[1] = (byte)(l2 >> 8 & 0xff);
j[2] = (byte)(l2 >> 16 & 0xff);
j[3] = (byte)(l2 >> 24 & 0xff);
switch(b()[S.ordinal()])
{
case 1: // '\001'
j[4] = 0;
break;
case 2: // '\002'
j[4] = 2;
break;
default:
return -3;
}
switch(c()[P.ordinal()])
{
case 1: // '\001'
j[5] = 0;
break;
case 2: // '\002'
j[5] = 1;
break;
case 3: // '\003'
j[5] = 2;
break;
default:
return -4;
}
switch(d()[D.ordinal()])
{
case 1: // '\001'
j[6] = 5;
break;
case 2: // '\002'
j[6] = 6;
break;
case 3: // '\003'
j[6] = 7;
break;
case 4: // '\004'
j[6] = 8;
break;
default:
return -5;
}
i1 = K.controlTransfer(33, 32, 0, 0, j, 7, V);
if(i1 < 0)
return i1;
i1 = K.controlTransfer(33, 35, 0, 0, null, 0, V);
if(i1 < 0)
return i1;
switch(e()[F.ordinal()])
{
case 1: // '\001'
int j1 = K.controlTransfer(64, 1, 0, 0, null, 0, V);
if(j1 < 0)
return j1;
j1 = K.controlTransfer(64, 1, 1, 0, null, 0, V);
if(j1 < 0)
return j1;
j1 = K.controlTransfer(64, 1, 2, 68, null, 0, V);
if(j1 < 0)
return j1;
break;
case 3: // '\003'
break;
case 2: // '\002'
int k1 = K.controlTransfer(64, 1, 0, 97, null, 0, V);
if(k1 < 0)
return k1;
k1 = K.controlTransfer(64, 1, 1, 0, null, 0, V);
if(k1 < 0)
return k1;
k1 = K.controlTransfer(64, 1, 2, 68, null, 0, V);
if(k1 < 0)
return k1;
break;
case 4: // '\004'
if(ag != 4)
break;
int l1 = K.controlTransfer(64, 1, 0, 73, null, 0, V);
if(l1 < 0)
return l1;
l1 = K.controlTransfer(64, 1, 1, 5, null, 0, V);
if(l1 < 0)
return l1;
l1 = K.controlTransfer(64, 1, 2, 68, null, 0, V);
if(l1 < 0)
return l1;
break;
case 5: // '\005'
if(ag != 4)
break;
int i2 = K.controlTransfer(64, 1, 0, 105, null, 0, V);
if(i2 < 0)
return i2;
i2 = K.controlTransfer(64, 1, 1, 7, null, 0, V);
if(i2 < 0)
return i2;
i2 = K.controlTransfer(64, 1, 2, 68, null, 0, V);
if(i2 < 0)
return i2;
break;
case 6: // '\006'
int j2 = K.controlTransfer(64, 1, 0, 193, null, 0, V);
if(j2 < 0)
return j2;
j2 = K.controlTransfer(64, 1, 1, 0, null, 0, V);
if(j2 < 0)
return j2;
j2 = K.controlTransfer(64, 1, 2, 68, null, 0, V);
if(j2 < 0)
return j2;
break;
default:
return -6;
}
as = F;
if(ac)
{
int k2 = a(0, 49);
if(k2 < 0)
return k2;
k2 = a(1, 8);
if(k2 < 0)
return k2;
}
return 0;
}
public int setDTR(boolean state)
{
if(state && (C & 1) != 1)
C++;
if(!state && (C & 1) == 1)
C--;
int i1 = K.controlTransfer(33, 34, C, 0, null, 0, V);
if(i1 < 0)
return i1;
else
return 0;
}
public int setRTS(boolean state)
{
if(state && (C & 2) != 2)
C += 2;
if(!state && (C & 2) == 2)
C -= 2;
int i1 = K.controlTransfer(33, 34, C, 0, null, 0, V);
if(i1 < 0)
return i1;
else
return 0;
}
private int a(UsbDeviceConnection usbdeviceconnection)
{
int j1 = 0;
int ai1[] = new int[2];
ai1[0] = 0;
if(aq)
{
ag = 4;
} else
{
if(!l() && (j1 = m()) < 0)
return j1;
if(usbdeviceconnection.getRawDescriptors()[13] == 4)
ag = 4;
if((j1 = j()) < 0)
return j1;
if(aG && (j1 = k()) < 0)
return j1;
if(usbdeviceconnection.getRawDescriptors()[13] == 5 && (j1 = i()) < 0)
return j1;
}
if(ag != 4 && ag != 6)
return -1;
for(int i1 = 128; i1 <= 130; i1++)
{
ai1 = b(i1);
if(ai1[0] < 0)
return ai1[0];
}
try
{
j1 = setup(BaudRate.B9600, DataBits.D8, StopBits.S1, Parity.NONE, FlowControl.OFF);
}
catch(IOException ioexception)
{
ioexception.printStackTrace();
}
if(ai1[0] < 0)
return j1;
else
return 0;
}
private int i()
{
int ai1[] = new int[2];
char c1 = '\224';
ai1 = b(148);
if(ai1[0] < 0)
return ai1[0];
if((ai1[1] & c1) == c1)
ag = 6;
else
ag = 2;
return 0;
}
private int j()
{
int ai1[] = new int[2];
char c1 = '\377';
int ai2[] = new int[2];
ai1 = b(129);
if(ai1[0] < 0)
return ai1[0];
int i1 = ai1[1];
ai1[0] = a(1, c1);
if(ai1[0] < 0)
return ai1[0];
ai1 = b(129);
if(ai1[0] < 0)
return ai1[0];
if((ai1[1] & 0xf) == 15)
{
ag = 4;
ai1 = c(250);
if(ai1[0] < 0)
return ai1[0];
ai2[0] = ai1[1];
ai1 = c(251);
if(ai1[0] < 0)
return ai1[0];
ai2[1] = ai1[1];
if((ai2[0] != 1 || ai2[1] != 4) && (ai2[0] != 2 || ai2[1] != 4) && (ai2[0] != 3 || ai2[1] != 4) && ai2[0] == 1 && ai2[1] == 3)
ag = 2;
} else
{
ag = 2;
}
ai1[0] = a(1, i1);
if(ai1[0] < 0)
return ai1[0];
else
return 0;
}
private String a(int i1)
{
char ac1[] = {
Character.forDigit(i1 >> 4 & 0xf, 16), Character.forDigit(i1 & 0xf, 16)
};
String s1 = new String(ac1);
return s1;
}
private static String b(byte abyte0[], int i1)
{
StringBuffer stringbuffer = null;
try
{
MessageDigest messagedigest = MessageDigest.getInstance("SHA-512");
messagedigest.reset();
byte abyte1[] = messagedigest.digest(abyte0);
stringbuffer = new StringBuffer();
byte abyte2[];
int k1 = (abyte2 = abyte1).length;
for(int j1 = 0; j1 < k1; j1++)
{
byte byte0 = abyte2[j1];
stringbuffer.append(String.format("%02X", new Object[] {
Byte.valueOf(byte0)
}));
}
}
catch(NoSuchAlgorithmException nosuchalgorithmexception)
{
nosuchalgorithmexception.printStackTrace();
}
return stringbuffer.toString();
}
private int k()
{
byte byte0 = 9;
int ai1[] = new int[2];
ai1 = c(byte0);
if(ai1[0] < 0)
return ai1[0];
if((ai1[1] & 8) == 8)
{
ai1[0] = a(0, 49);
if(ai1[0] < 0)
return ai1[0];
ai1[0] = a(1, 8);
if(ai1[0] < 0)
return ai1[0];
ac = true;
}
return ai1[0];
}
public int PL2303TB_Set_PWM(int PWM_IO_Num, byte Frequency_value, byte Duty_value)
{
int ai1[] = new int[2];
int i1 = 0;
if(K == null)
return -1;
i1 = Duty_value & 0xff;
i1 <<= 8;
i1 += Frequency_value;
byte byte0;
switch(PWM_IO_Num)
{
case 0: // '\0'
ai1[0] = a(2, 0);
if(ai1[0] < 0)
return ai1[0];
byte0 = 16;
break;
case 1: // '\001'
byte0 = 17;
break;
case 2: // '\002'
byte0 = 18;
break;
case 3: // '\003'
byte0 = 19;
break;
default:
return -1;
}
ai1[0] = a(byte0, i1);
if(ai1[0] < 0)
return ai1[0];
else
return 0;
}
public int PL2303TB_Enable_GPIO(int GPIO_Num, boolean Enable)
{
int ai1[] = new int[2];
if(K == null)
return -1;
if(GPIO_Num == 6 || GPIO_Num == 7 || GPIO_Num == 9)
{
ai1[0] = a(2, 0);
if(ai1[0] < 0)
return ai1[0];
}
switch(GPIO_Num)
{
case 0: // '\0'
if(Enable)
aE |= 1;
else
aE &= -2;
break;
case 1: // '\001'
if(Enable)
aE |= 2;
else
aE &= -3;
break;
case 2: // '\002'
if(Enable)
aE |= 4;
else
aE &= -5;
break;
case 3: // '\003'
if(Enable)
aE |= 8;
else
aE &= -9;
break;
case 4: // '\004'
if(Enable)
aE |= 0x10;
else
aE &= 0xffffffef;
break;
case 5: // '\005'
if(Enable)
aE |= 0x20;
else
aE &= 0xffffffdf;
break;
case 6: // '\006'
if(Enable)
aE |= 0x40;
else
aE &= 0xffffffbf;
break;
case 7: // '\007'
if(Enable)
aE |= 0x80;
else
aE &= 0xffffff7f;
break;
case 8: // '\b'
if(Enable)
aE |= 0x100;
else
aE &= 0xfffffeff;
break;
case 9: // '\t'
if(Enable)
aE |= 0x200;
else
aE &= 0xfffffdff;
break;
case 10: // '\n'
if(Enable)
aE |= 0x400;
else
aE &= 0xfffffbff;
break;
case 11: // '\013'
if(Enable)
aE |= 0x800;
else
aE &= 0xfffff7ff;
break;
default:
return -1;
}
ai1[0] = a(14, aE);
if(ai1[0] < 0)
return ai1[0];
else
return 0;
}
public int PL2303HXD_Enable_GPIO(int GPIO_Num, boolean Enable)
{
int ai1[] = new int[2];
boolean flag = false;
if(K == null)
return -1;
switch(GPIO_Num)
{
case 0: // '\0'
ai1 = b(129);
if(ai1[0] < 0)
return ai1[0];
int i1;
if(Enable)
i1 = ai1[1] |= 0x10;
else
i1 = ai1[1] &= 0xffffffef;
ai1[0] = a(1, i1);
if(ai1[0] < 0)
return ai1[0];
break;
case 1: // '\001'
ai1 = b(129);
if(ai1[0] < 0)
return ai1[0];
int j1;
if(Enable)
j1 = ai1[1] |= 0x20;
else
j1 = ai1[1] &= 0xffffffdf;
ai1[0] = a(1, j1);
if(ai1[0] < 0)
return ai1[0];
break;
case 2: // '\002'
if(Enable)
az |= 3;
else
az &= -4;
ai1[0] = a(12, az);
if(ai1[0] < 0)
return ai1[0];
break;
case 3: // '\003'
if(Enable)
az |= 0xc;
else
az &= 0xfffffff3;
ai1[0] = a(12, az);
if(ai1[0] < 0)
return ai1[0];
break;
case 4: // '\004'
if(Enable)
aB |= 3;
else
aB &= -4;
ai1[0] = a(6, aB);
break;
case 5: // '\005'
if(Enable)
aB |= 0xc;
else
aB &= 0xfffffff3;
ai1[0] = a(6, aB);
break;
case 6: // '\006'
if(Enable)
aB |= 0x30;
else
aB &= 0xffffffcf;
ai1[0] = a(6, aB);
break;
case 7: // '\007'
if(Enable)
aB |= 0xc0;
else
aB &= 0xffffff3f;
ai1[0] = a(6, aB);
break;
default:
return -1;
}
return 0;
}
public int PL2303TB_Set_GPIO_Value(int GPIO_Num, int val)
{
int ai1[] = new int[2];
int i1 = 0;
if(K == null)
return -1;
ai1 = b(143);
if(ai1[0] < 0)
return ai1[0];
switch(GPIO_Num)
{
case 0: // '\0'
if(val == 1)
i1 |= 1;
else
i1 &= -2;
break;
case 1: // '\001'
if(val == 1)
i1 |= 2;
else
i1 &= -3;
break;
case 2: // '\002'
if(val == 1)
i1 |= 4;
else
i1 &= -5;
break;
case 3: // '\003'
if(val == 1)
i1 |= 4;
else
i1 &= -5;
break;
case 4: // '\004'
if(val == 1)
i1 |= 0x10;
else
i1 &= 0xffffffef;
break;
case 5: // '\005'
if(val == 1)
i1 |= 0x20;
else
i1 &= 0xffffffdf;
break;
case 6: // '\006'
if(val == 1)
i1 |= 0x40;
else
i1 &= 0xffffffbf;
break;
case 7: // '\007'
if(val == 1)
i1 |= 0x80;
else
i1 &= 0xffffff7f;
break;
case 8: // '\b'
if(val == 1)
i1 |= 0x100;
else
i1 &= 0xfffffeff;
break;
case 9: // '\t'
if(val == 1)
i1 |= 0x200;
else
i1 &= 0xfffffdff;
break;
case 10: // '\n'
if(val == 1)
i1 |= 0x400;
else
i1 &= 0xfffffbff;
break;
case 11: // '\013'
if(val == 1)
i1 |= 0x800;
else
i1 &= 0xfffff7ff;
break;
default:
return -1;
}
ai1[0] = a(15, i1);
if(ai1[0] < 0)
return ai1[0];
else
return 0;
}
public int PL2303HXD_Set_GPIO_Value(int GPIO_Num, int val)
{
int ai1[] = new int[2];
boolean flag = false;
if(K == null)
return -1;
switch(GPIO_Num)
{
case 0: // '\0'
ai1 = b(129);
if(ai1[0] < 0)
return ai1[0];
int i1;
if(val == 1)
i1 = ai1[1] |= 0x40;
else
i1 = ai1[1] &= 0xffffffbf;
ai1[0] = a(1, i1);
if(ai1[0] < 0)
return ai1[0];
break;
case 1: // '\001'
ai1 = b(129);
if(ai1[0] < 0)
return ai1[0];
int j1;
if(val == 1)
j1 = ai1[1] |= 0x80;
else
j1 = ai1[1] &= 0xffffff7f;
ai1[0] = a(1, j1);
if(ai1[0] < 0)
return ai1[0];
break;
case 2: // '\002'
ai1 = b(141);
if(ai1[0] < 0)
return ai1[0];
int k1;
if(val == 1)
k1 = ai1[1] |= 1;
else
k1 = ai1[1] &= -2;
ai1[0] = a(13, k1);
if(ai1[0] < 0)
return ai1[0];
break;
case 3: // '\003'
ai1 = b(141);
if(ai1[0] < 0)
return ai1[0];
int l1;
if(val == 1)
l1 = ai1[1] |= 2;
else
l1 = ai1[1] &= -3;
ai1[0] = a(13, l1);
if(ai1[0] < 0)
return ai1[0];
break;
case 4: // '\004'
if(aD == 0)
aC = 0;
else
aC = aD;
if(val == 1)
aC |= 1;
else
aC &= -2;
aD = aC;
ai1[0] = a(7, aC);
if(ai1[0] < 0)
return ai1[0];
break;
case 5: // '\005'
if(aD == 0)
aC = 0;
else
aC = aD;
if(val == 1)
aC |= 2;
else
aC &= -3;
aD = aC;
ai1[0] = a(7, aC);
if(ai1[0] < 0)
return ai1[0];
break;
case 6: // '\006'
if(aD == 0)
aC = 0;
else
aC = aD;
if(val == 1)
aC |= 4;
else
aC &= -5;
aD = aC;
ai1[0] = a(7, aC);
if(ai1[0] < 0)
return ai1[0];
break;
case 7: // '\007'
if(aD == 0)
aC = 0;
else
aC = aD;
if(val == 1)
aC |= 8;
else
aC &= -9;
aD = aC;
ai1[0] = a(7, aC);
if(ai1[0] < 0)
return ai1[0];
break;
default:
return -1;
}
return 0;
}
public int[] PL2303TB_Get_GPIO_Value(int GPIO_Num)
{
int ai1[] = new int[2];
if(K == null)
{
ai1[0] = -1;
return ai1;
}
ai1 = b(143);
if(ai1[0] < 0)
return ai1;
switch(GPIO_Num)
{
case 0: // '\0'
if((ai1[1] & 1) == 1)
ai1[1] = 1;
else
ai1[1] = 0;
break;
case 1: // '\001'
if((ai1[1] & 2) == 2)
ai1[1] = 1;
else
ai1[1] = 0;
break;
case 2: // '\002'
if((ai1[1] & 4) == 4)
ai1[1] = 1;
else
ai1[1] = 0;
break;
case 3: // '\003'
if((ai1[1] & 8) == 8)
ai1[1] = 1;
else
ai1[1] = 0;
break;
case 4: // '\004'
if((ai1[1] & 0x10) == 16)
ai1[1] = 1;
else
ai1[1] = 0;
break;
case 5: // '\005'
if((ai1[1] & 0x20) == 32)
ai1[1] = 1;
else
ai1[1] = 0;
break;
case 6: // '\006'
if((ai1[1] & 0x40) == 64)
ai1[1] = 1;
else
ai1[1] = 0;
break;
case 7: // '\007'
if((ai1[1] & 0x80) == 128)
ai1[1] = 1;
else
ai1[1] = 0;
break;
case 8: // '\b'
if((ai1[1] & 0x100) == 256)
ai1[1] = 1;
else
ai1[1] = 0;
break;
case 9: // '\t'
if((ai1[1] & 0x200) == 512)
ai1[1] = 1;
else
ai1[1] = 0;
break;
case 10: // '\n'
if((ai1[1] & 0x400) == 1024)
ai1[1] = 1;
else
ai1[1] = 0;
break;
case 11: // '\013'
if((ai1[1] & 0x800) == 2048)
ai1[1] = 1;
else
ai1[1] = 0;
break;
default:
ai1[0] = -1;
return ai1;
}
return ai1;
}
public int[] PL2303HXD_Get_GPIO_Value(int GPIO_Num)
{
int ai1[] = new int[2];
if(K == null)
{
ai1[0] = -1;
return ai1;
}
switch(GPIO_Num)
{
case 0: // '\0'
ai1 = b(129);
if(ai1[0] < 0)
return ai1;
if((ai1[1] & 0x40) == 64)
ai1[1] = 1;
else
ai1[1] = 0;
break;
case 1: // '\001'
ai1 = b(129);
if(ai1[0] < 0)
return ai1;
if((ai1[1] & 0x80) == 128)
ai1[1] = 1;
else
ai1[1] = 0;
break;
case 2: // '\002'
ai1 = b(141);
if(ai1[0] < 0)
return ai1;
if((ai1[1] & 1) == 1)
ai1[1] = 1;
else
ai1[1] = 0;
break;
case 3: // '\003'
ai1 = b(141);
if(ai1[0] < 0)
return ai1;
if((ai1[1] & 2) == 2)
ai1[1] = 1;
else
ai1[1] = 0;
break;
case 4: // '\004'
ai1 = b(135);
if(ai1[0] < 0)
return ai1;
if((ai1[1] & 1) == 1)
ai1[1] = 1;
else
ai1[1] = 0;
break;
case 5: // '\005'
ai1 = b(135);
if(ai1[0] < 0)
return ai1;
if((ai1[1] & 2) == 2)
ai1[1] = 1;
else
ai1[1] = 0;
break;
case 6: // '\006'
ai1 = b(135);
if(ai1[0] < 0)
return ai1;
if((ai1[1] & 4) == 4)
ai1[1] = 1;
else
ai1[1] = 0;
break;
case 7: // '\007'
ai1 = b(135);
if(ai1[0] < 0)
return ai1;
if((ai1[1] & 8) == 8)
ai1[1] = 1;
else
ai1[1] = 0;
break;
default:
ai1[0] = -1;
return ai1;
}
return ai1;
}
private int a(int i1, int j1)
{
int k1 = 0;
if(K == null)
return -1;
k1 = K.controlTransfer(64, 1, i1, j1, null, 0, V);
if(k1 < 0)
return k1;
else
return k1;
}
private int[] b(int i1)
{
int ai1[] = new int[2];
byte abyte0[] = new byte[1];
ai1[0] = 0;
if(K == null)
{
ai1[0] = -1;
return ai1;
}
ai1[0] = K.controlTransfer(192, 1, i1, 0, abyte0, 1, V);
if(ai1[0] < 0)
{
return ai1;
} else
{
ai1[1] = abyte0[0];
return ai1;
}
}
private int[] c(int i1)
{
int ai1[] = new int[2];
ai1[0] = 0;
ai1 = b(132);
if(ai1[0] < 0)
return ai1;
ai1[0] = a(4, i1);
if(ai1[0] < 0)
return ai1;
ai1 = b(132);
if(ai1[0] < 0)
return ai1;
ai1 = b(131);
if(ai1[0] < 0)
return ai1;
else
return ai1;
}
private boolean l()
{
int ai1[] = new int[2];
int ai3[] = new int[2];
for(int i1 = 0; i1 < 2; i1++)
{
int ai2[] = c(i1);
if(ai2[0] < 0)
return aG;
ai3[i1] = ai2[1];
}
if(ai3[0] == 123 && ai3[1] == 6)
aG = true;
return aG;
}
private int m()
{
int ai1[] = {
1, 0, 68
};
int ai2[] = new int[2];
ai2[0] = a(2056, 0);
if(ai2[0] < 0)
return ai2[0];
ai2[0] = a(2313, 0);
if(ai2[0] < 0)
return ai2[0];
for(int i1 = 0; i1 <= 2; i1++)
{
ai2[0] = a(i1, ai1[i1]);
if(ai2[0] < 0)
return ai2[0];
}
for(int j1 = 128; j1 <= 130; j1++)
{
ai2 = b(j1);
if(ai2[0] < 0)
return ai2[0];
}
return ai2[0];
}
private int d(int i1)
{
byte abyte0[] = new byte[2];
byte abyte1[] = new byte[2];
int j1 = 0;
boolean flag = false;
if(K == null)
return -1;
abyte1[0] = (byte)(i1 & 0xff);
abyte1[1] = (byte)(i1 >> 8 & 0xff);
j1 = K.controlTransfer(161, 32, 0, 0, abyte1, 2, U);
if(j1 < 0)
return j1;
try
{
Thread.sleep(100L);
}
catch(InterruptedException interruptedexception)
{
interruptedexception.printStackTrace();
}
j1 = K.bulkTransfer(O, abyte0, abyte0.length, T);
if(j1 < 0)
{
return 0;
} else
{
int k1 = abyte0[1] << 8 | abyte0[0];
return k1;
}
}
private int[] n()
{
int ai1[] = new int[2];
char c1 = '\207';
ai1[0] = 0;
ai1 = b(c1);
if(ai1[0] < 0)
return ai1;
else
return ai1;
}
public int[] PL2303HXD_GetCommModemStatus()
{
int ai1[] = new int[2];
int i1 = 0;
ai1 = n();
if(ai1[0] < 0)
return ai1;
if((ai1[1] & 1) == 1)
i1 &= -9;
else
i1 |= 8;
if((ai1[1] & 2) == 2)
i1 &= -2;
else
i1 |= 1;
if((ai1[1] & 4) == 4)
i1 &= -3;
else
i1 |= 2;
if((ai1[1] & 8) == 8)
i1 &= 0xffffff7f;
else
i1 |= 0x80;
ai1[1] = i1;
return ai1;
}
public void PL2303LibGetVersion(byte byVersion[])
{
int i1 = 0;
if(byVersion.length < i.length())
i1 = byVersion.length;
else
i1 = i.length();
char ac1[] = i.toCharArray();
for(int j1 = 0; j1 < i1; j1++)
byVersion[j1] = (byte)ac1[j1];
}
public boolean PL2303USBFeatureSupported()
{
boolean flag = d.getPackageManager().hasSystemFeature("android.hardware.usb.host");
return flag;
}
public String PL2303Device_GetSerialNumber()
{
if(isConnected())
return K.getSerial();
else
return null;
}
public boolean PL2303Device_IsHasPermission()
{
return ap;
}
public boolean PL2303Device_IsSupportChip()
{
boolean flag = false;
if(ag == 4)
flag = true;
return flag;
}
public boolean PL2303Device_SetCommTimeouts(int TimeoutConstant)
{
if(TimeoutConstant < 0)
{
return false;
} else
{
T = TimeoutConstant;
U = TimeoutConstant;
return true;
}
}
public boolean PL2303Device_GetCommTimeouts(int TimeoutConstant)
{
TimeoutConstant = U;
return true;
}
private static void a(Object obj)
{
}
static UsbDevice a(PL2303Driver pl2303driver)
{
return pl2303driver.J;
}
static String b(PL2303Driver pl2303driver)
{
return pl2303driver.ad;
}
static int c(PL2303Driver pl2303driver)
{
return pl2303driver.af;
}
static ArrayList d(PL2303Driver pl2303driver)
{
return pl2303driver.ae;
}
static void a(PL2303Driver pl2303driver, UsbDevice usbdevice)
{
pl2303driver.b(usbdevice);
}
static void b(PL2303Driver pl2303driver, UsbDevice usbdevice)
{
pl2303driver.a(usbdevice);
}
static void a(PL2303Driver pl2303driver, boolean flag)
{
pl2303driver.ap = flag;
}
static ArrayBlockingQueue e(PL2303Driver pl2303driver)
{
return pl2303driver.W;
}
static int a(PL2303Driver pl2303driver, byte abyte0[], int i1)
{
return pl2303driver.a(abyte0, i1);
}
static FlowControl f(PL2303Driver pl2303driver)
{
return pl2303driver.as;
}
static void b(PL2303Driver pl2303driver, boolean flag)
{
pl2303driver.at = flag;
}
static int[] a()
{
aJ;
if(aJ == null) goto _L2; else goto _L1
_L1:
return;
_L2:
JVM INSTR pop ;
int ai1[] = new int[BaudRate.values().length];
try
{
ai1[BaudRate.B0.ordinal()] = 1;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[BaudRate.B115200.ordinal()] = 15;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[BaudRate.B1200.ordinal()] = 6;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[BaudRate.B12000000.ordinal()] = 24;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[BaudRate.B1228800.ordinal()] = 20;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[BaudRate.B14400.ordinal()] = 11;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[BaudRate.B150.ordinal()] = 3;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[BaudRate.B1800.ordinal()] = 7;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[BaudRate.B19200.ordinal()] = 12;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[BaudRate.B230400.ordinal()] = 16;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[BaudRate.B2400.ordinal()] = 8;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[BaudRate.B2457600.ordinal()] = 21;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[BaudRate.B300.ordinal()] = 4;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[BaudRate.B3000000.ordinal()] = 22;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[BaudRate.B38400.ordinal()] = 13;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[BaudRate.B460800.ordinal()] = 17;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[BaudRate.B4800.ordinal()] = 9;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[BaudRate.B57600.ordinal()] = 14;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[BaudRate.B600.ordinal()] = 5;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[BaudRate.B6000000.ordinal()] = 23;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[BaudRate.B614400.ordinal()] = 18;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[BaudRate.B75.ordinal()] = 2;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[BaudRate.B921600.ordinal()] = 19;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[BaudRate.B9600.ordinal()] = 10;
}
catch(NoSuchFieldError _ex) { }
return aJ = ai1;
}
static int[] b()
{
aK;
if(aK == null) goto _L2; else goto _L1
_L1:
return;
_L2:
JVM INSTR pop ;
int ai1[] = new int[StopBits.values().length];
try
{
ai1[StopBits.S1.ordinal()] = 1;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[StopBits.S2.ordinal()] = 2;
}
catch(NoSuchFieldError _ex) { }
return aK = ai1;
}
static int[] c()
{
aL;
if(aL == null) goto _L2; else goto _L1
_L1:
return;
_L2:
JVM INSTR pop ;
int ai1[] = new int[Parity.values().length];
try
{
ai1[Parity.EVEN.ordinal()] = 3;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[Parity.NONE.ordinal()] = 1;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[Parity.ODD.ordinal()] = 2;
}
catch(NoSuchFieldError _ex) { }
return aL = ai1;
}
static int[] d()
{
aM;
if(aM == null) goto _L2; else goto _L1
_L1:
return;
_L2:
JVM INSTR pop ;
int ai1[] = new int[DataBits.values().length];
try
{
ai1[DataBits.D5.ordinal()] = 1;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[DataBits.D6.ordinal()] = 2;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[DataBits.D7.ordinal()] = 3;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[DataBits.D8.ordinal()] = 4;
}
catch(NoSuchFieldError _ex) { }
return aM = ai1;
}
static int[] e()
{
aN;
if(aN == null) goto _L2; else goto _L1
_L1:
return;
_L2:
JVM INSTR pop ;
int ai1[] = new int[FlowControl.values().length];
try
{
ai1[FlowControl.DTRDSR.ordinal()] = 4;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[FlowControl.OFF.ordinal()] = 1;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[FlowControl.RFRCTS.ordinal()] = 3;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[FlowControl.RTSCTS.ordinal()] = 2;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[FlowControl.RTSCTSDTRDSR.ordinal()] = 5;
}
catch(NoSuchFieldError _ex) { }
try
{
ai1[FlowControl.XONXOFF.ordinal()] = 6;
}
catch(NoSuchFieldError _ex) { }
return aN = ai1;
}
private boolean e;
private static final boolean f = false;
private static final boolean g = false;
private static final boolean h = false;
private static String i = "2.0.13.35";
public static final int BAUD0 = 0;
public static final int BAUD75 = 75;
public static final int BAUD150 = 150;
public static final int BAUD300 = 300;
public static final int BAUD600 = 600;
public static final int BAUD1200 = 1200;
public static final int BAUD1800 = 1800;
public static final int BAUD2400 = 2400;
public static final int BAUD4800 = 4800;
public static final int BAUD9600 = 9600;
public static final int BAUD14400 = 14400;
public static final int BAUD19200 = 19200;
public static final int BAUD38400 = 38400;
public static final int BAUD57600 = 57600;
public static final int BAUD115200 = 0x1c200;
public static final int BAUD230400 = 0x38400;
public static final int BAUD460800 = 0x70800;
public static final int BAUD614400 = 0x96000;
public static final int BAUD921600 = 0xe1000;
public static final int BAUD1228800 = 0x12c000;
public static final int BAUD2457600 = 0x258000;
public static final int BAUD3000000 = 0x2dc6c0;
public static final int BAUD6000000 = 0x5b8d80;
public static final int BAUD12000000 = 0xb71b00;
public static final int PL2303HXD_DCD_ON = 1;
public static final int PL2303HXD_DSR_ON = 2;
public static final int PL2303HXD_RI_ON = 8;
public static final int PL2303HXD_CTS_ON = 128;
private byte j[];
static final int a = 11;
static final int b = 12;
private static final int k = 33;
private static final int l = 32;
private static final int m = 33;
private static final int n = 35;
private static final int o = 0;
private static final int p = 161;
private static final int q = 33;
private static final int r = 64;
private static final int s = 1;
private static final int t = 192;
private static final int u = 1;
private static final int v = 33;
private static final int w = 34;
private static final int x = 0;
private static final int y = 1;
private static final int z = 2;
private static final int A = 2056;
private static final int B = 2313;
private int C;
private byte D;
private static final int E = 1;
private static final int F = 2;
private static final int G = 32;
public static final int PL_MAX_INTERFACE_NUM = 4;
private final int H = 64;
private UsbManager I;
private UsbDevice J;
private UsbDeviceConnection K;
private UsbInterface L;
private UsbEndpoint M;
private UsbEndpoint N;
private UsbEndpoint O;
public static final int READBUF_SIZE = 4096;
public static final int WRITEBUF_SIZE = 4096;
private static final boolean P = false;
private static final boolean Q = false;
private int R;
private int S;
byte c[];
private int T;
private int U;
private int V;
private ArrayBlockingQueue W;
public static Object ReadQueueLock = new Object();
private a X;
private boolean Y;
private int Z;
private int aa;
private boolean ab;
private boolean ac;
private String ad;
private ArrayList ae;
private int af;
Context d;
private int ag;
private final int ah = 2;
private final int ai = 3;
private final int aj = 4;
private final int ak = 5;
private final int al = 6;
private final int am = 7;
private final int an = 8;
private final int ao = 9;
private boolean ap;
private boolean aq;
private boolean ar;
private FlowControl as;
private boolean at;
private final boolean au = true;
private final boolean av = false;
private final int aw = 17;
private final int ax = 19;
public final String PLUART_MESSAGE = "tw.PL2303USBMessage";
public final String PLUART_DETACHED = "USB.Detached";
public final int PLDETACHED_VALUE = 255;
private int ay;
private int az;
private int aA;
private int aB;
private int aC;
private int aD;
private int aE;
private int aF;
private boolean aG;
private final BroadcastReceiver aH;
public static UsbDevice sDevice = null;
private Runnable aI = new Runnable() {
public void run()
{
UsbDevice usbdevice = PL2303Driver.sDevice;
if(!a.isConnected())
{
PL2303Driver.b(a, usbdevice);
PL2303Driver.a(a, true);
}
}
final PL2303Driver a;
{
a = PL2303Driver.this;
super();
}
}
;
private static int aJ[];
private static int aK[];
private static int aL[];
private static int aM[];
private static int aN[];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment