Output usb data to debug log

This commit is contained in:
Vincent Breitmoser
2017-10-30 17:01:49 +01:00
parent 83b6c0e2f0
commit 5f622339b1

View File

@@ -30,6 +30,7 @@ import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.util.Pair; import android.util.Pair;
import org.bouncycastle.util.encoders.Hex;
import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.securitytoken.CommandApdu; import org.sufficientlysecure.keychain.securitytoken.CommandApdu;
import org.sufficientlysecure.keychain.securitytoken.ResponseApdu; import org.sufficientlysecure.keychain.securitytoken.ResponseApdu;
@@ -152,7 +153,17 @@ public class UsbTransport implements Transport {
*/ */
@Override @Override
public ResponseApdu transceive(CommandApdu data) throws UsbTransportException { public ResponseApdu transceive(CommandApdu data) throws UsbTransportException {
return ResponseApdu.fromBytes(ccidTransportProtocol.transceive(data.toBytes())); byte[] rawCommand = data.toBytes();
if (Constants.DEBUG) {
Log.d(Constants.TAG, "USB >> " + Hex.toHexString(rawCommand));
}
byte[] rawResponse = ccidTransportProtocol.transceive(rawCommand);
if (Constants.DEBUG) {
Log.d(Constants.TAG, "USB << " + Hex.toHexString(rawResponse));
}
return ResponseApdu.fromBytes(rawResponse);
} }
@Override @Override