usb: respect automatic PPS feature flag
If the feature flag is set, don't do PPS negotiation. Closes #2219
This commit is contained in:
@@ -36,6 +36,8 @@ abstract class CcidDescription {
|
||||
|
||||
// dwFeatures Masks
|
||||
private static final int FEATURE_AUTOMATIC_VOLTAGE = 0x00008;
|
||||
private static final int FEATURE_AUTOMATIC_PPS = 0x00080;
|
||||
|
||||
private static final int FEATURE_EXCHANGE_LEVEL_TPDU = 0x10000;
|
||||
private static final int FEATURE_EXCHAGE_LEVEL_SHORT_APDU = 0x20000;
|
||||
private static final int FEATURE_EXCHAGE_LEVEL_EXTENDED_APDU = 0x40000;
|
||||
@@ -130,6 +132,10 @@ abstract class CcidDescription {
|
||||
}
|
||||
}
|
||||
|
||||
boolean hasAutomaticPps() {
|
||||
return hasFeature(FEATURE_AUTOMATIC_PPS);
|
||||
}
|
||||
|
||||
private boolean hasFeature(int feature) {
|
||||
return (getFeatures() & feature) != 0;
|
||||
}
|
||||
|
||||
@@ -258,6 +258,10 @@ public class CcidTransceiver {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasAutomaticPps() {
|
||||
return usbCcidDescription.hasAutomaticPps();
|
||||
}
|
||||
|
||||
/** Corresponds to 6.2.1 RDR_to_PC_DataBlock. */
|
||||
@AutoValue
|
||||
public abstract static class CcidDataBlock {
|
||||
|
||||
@@ -54,7 +54,10 @@ public class T1TpduProtocol implements CcidTransportProtocol {
|
||||
// TODO: set checksum from atr
|
||||
blockFactory = new T1TpduBlockFactory(BlockChecksumAlgorithm.LRC);
|
||||
|
||||
performPpsExchange();
|
||||
boolean skipPpsExchange = ccidTransceiver.hasAutomaticPps();
|
||||
if (!skipPpsExchange) {
|
||||
performPpsExchange();
|
||||
}
|
||||
}
|
||||
|
||||
private void performPpsExchange() throws UsbTransportException {
|
||||
|
||||
Reference in New Issue
Block a user