Skip to content

Commit 9fce85f

Browse files
Remove clone method not used by nitrokey-app2 in the end
1 parent 763f7ea commit 9fce85f

File tree

1 file changed

+0
-27
lines changed

1 file changed

+0
-27
lines changed

src/nitrokey/trussed/_device.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -219,33 +219,6 @@ def from_device(
219219
device: CtapHidDevice | ExclusiveTransmitCardConnection | ExclusiveConnectCardConnection,
220220
) -> T: ...
221221

222-
@classmethod
223-
def clone(cls: type[T], device: T, exclusive: bool = True) -> Optional[T]:
224-
"""Clone the device, closing the previous connection first
225-
226-
The exclusive argument defines whether in the case of CCID communication, the connection should be exclusively connected, which is required for some multi-command operations"""
227-
228-
device.close()
229-
if isinstance(device.device, CtapHidDevice):
230-
new_device = cls.open(_device_path_to_str(device.device.descriptor.path))
231-
return new_device
232-
else:
233-
reader = device.device.getReader()
234-
for r in readers():
235-
if r.name == reader:
236-
raw_connection = r.createConnection()
237-
connection: Union[
238-
ExclusiveConnectCardConnection, ExclusiveTransmitCardConnection
239-
]
240-
if exclusive:
241-
connection = ExclusiveConnectCardConnection(raw_connection)
242-
else:
243-
connection = ExclusiveTransmitCardConnection(raw_connection)
244-
245-
connection.connect()
246-
return cls.from_device(connection)
247-
return None
248-
249222
@classmethod
250223
def open(cls: type[T], path: str) -> Optional[T]:
251224
try:

0 commit comments

Comments
 (0)