-
Bump the minimum supported Rust version (MSRV) to 1.56.0 from 1.38.0.
-
Update
bitflagsfrom version 1 to 2. This is a breaking change to theState,StatusandProtocolstypes, but I tried to keep them compatible followingbitflags's instructions so hopefully it doesn't break any usage in practice. -
Make
ctl_codea const fn.Contributed by Sola.
-
Add
Transaction::reconnect()to allow reconnecting to a card from withing a transaction.Contributed by Konrad Vité.
-
Bump the minimum supported Rust version (MSRV) to 1.56.0 from 1.38.0.
-
Add nicer error message when pcsclite is not found on Linux.
-
Make
SCARD_CTL_CODEa const fn.Contributed by Sola.
-
Fix
SCardControlon mac OS (use the newerSCardControl132symbol).Contributed by Tang Cheng.
-
Make
pcsc::ffipublic again; accidentally regressed in 2.8.1.Contributed by Ignacio Casal Quinteiro.
-
Fix possible panics in
list_readers_ownedandget_attribute_ownedfunctions, and handling of null buffers inlist_readersandget_attribute.Reported by @ n-eq in issue #9.
-
The
pcsc-syscrate is now reexported from thepcsccrate aspcsc::ffi.Contributed by Basix.
-
Added
Card::transmit2(), which is likeCard::transmit(), but also returns the required receive buffer size onError::InsufficientBuffererrors.Make sure to heed the note on the function's documentation if you intend to use it!
Contributed by Nicolas Dusart.
-
Added
ReaderState::current_state() -> Stategetter. This returns the last current state that was set usingsync_current_state().Note that for observing the current state as reported by
get_status_change(), you wantevent_state(), notcurrent_state().Contributed by Ilya Averyanov.
-
ReaderStateis nowSendandSync. -
Bumped the minimum supported rust version (MSRV) 1.20 -> 1.38.
-
Added
Card::transaction2(), which is likeCard::transaction(), but also returns the&mut selfon error. Without it is is difficult (impossible) to encapsulate a retry-loop of trying to acquire a transaction in a function, at least until some borrow-checker improvements end our woes.Contributed by Neal H. Walfield.
- Un-deprecated the
pcsc::Statustype. It was previously disabled due to a portability hazard; now Windows is made to behave like other platforms, although only one bit is ever set.
- Added
status.status()accessor toCardStatus(return value ofCard::status2()) andCardStatusOwned(return value ofCard::status2_owned()).
-
Added owned versions of several functions:
Context::list_readers->Context::list_readers_ownedCard::get_attribute->Card::get_attribute_ownedCard::status2->Card::status2_ownedYou can use them if you don't want to deal with lengths and buffers and just allocate.
Contributed by Robin Krahl.
-
Added support for direct connections to a reader (without a card attached).
This enables setting control parameters on readers which support it, for example. Transmitting with custom protocols on such connections is not supported however.
Such connections use
ShareMode::DirectandProtocols::UNDEFINED.For this purpose the following changes were made:
-
Added a
CardStatus::protocol2()which returnsOption<Protocol>, as opposed toCardStatus::protocol()which now panics when missing protocol. -
Made
Card::status()panic when missing protocol. This function is deprecated (useCard::status2()instead). -
Made
Card::transmit()panic when missing protocol.
-
-
Fixed wrong result from
Error::into_raw()on 64-bit Linux/BSD.An incorrect cast caused a bit extension to be made when
LONGis 64 bit. This means 64-bit platforms other than Windows and macOS (whereLONGis always 32 bit).Internally,
Error::into_raw()is used inContext::list_readers()andContext::list_readers_len(), which had a bug as a result: instead of returning empty iterator/Ok(0)when no readers are available,Err(Error::NoReadersAvailable)was returned.
-
Deprecated the
Card::status()function and theStatustype. Turns outStatusis not a bitmask on Windows, so the interface was not portable and unfixable.These were replaced with
Card::status2(), which returns a newCardStatustype. This interface is portable, and also exposes the ATR and reader names. However, it doesn't yet expose the actual status -- if you need it, please open an issue. -
Implemented
Debugfor theReaderNamesiterator struct.
-
Added
SCARD_ATR_LENGTHconstant. -
Fixed values of card state constants (
SCARD_PRESENTand friends) on Windows. They were entirely wrong there. -
Fixed value of
SCARD_PROTOCOL_RAWon Windows.
- Added a
ctl_function(), a wrapper for theSCARD_CTL_CODEPCSC API.
-
Added bindings for the
SCARD_CTL_CODEPCSC API. -
Added a way to specify which PCSC library to use directly instead of using pkg-config, if needed. The build script now checks for two environment variables,
PCSC_LIB_DIRandPCSC_LIB_NAME. So the crate documentation for details.
- Fixed bug where card.disconnect() would keep the associated Context alive (leaked a strong reference).
- Added support for getting the ATR (Answer To Reset) from a
ReaderState.
-
BREAKING CHANGE (
pcsc) Remove the lifetime from theCardtype.This lifetime made the common case of bundling a
Contextand aCardin the same struct very difficult, due to Rust's current inability to express "self-referential structs".Instead of the lifetime, a
Cardnow holds anArcreference to itsContext. The consequences of this are:-
Contextnow implementsClone. The implementation is anArc::clone. -
The PCSC context is only released once the last clone is dropped.
-
The function
Context::release()fails with anError::CantDisposeif called while there are other clones alive. -
The "transitive"
'cardlifetime ofTransactionis removed.
The migrate your code, replace all instances of
Card<'lifetime>withCard, if you had to explicitly specify the lifetime.Note that the
'txlifetime ofTransactionremains. Transactions are normally short-lived and well-scoped, so using a static lifetime makes better sense in this case.Reported by @a-dma in issue #9.
-
-
BREAKING CHANGE (
pcsc-sys) Fix the types ofSCARDCONTEXTandSCARDHANDLEon Windows.Previously they were (effectively) defined as
i32, but the correct definition isusize. Hence on all Windows platforms, the sign is different (not really a problem); and on 64 bits, the width is different (wouldn't work).While this is technically a breaking change, this should be transparent and binaries for Windows 64 bits wouldn't have worked anyway, so we avoid a major version bump which is a headache for FFI crates.
Reported and debugged by @ndusart in issue #6.
-
(
pcsc) Depend onpcsc-sys >= 1.0.1to discourage using the broken1.0.0.
-
BREAKING CHANGE Update bitflags to version 1. This makes the flag types easier to use, and improves the documentation.
Since bitflags now uses associated constants, Rust >= 1.20 is required.
Example for updating:
STATE_UNAWARE->State::UNAWARE. -
The
pcsc-syscrate is also promoted to 1.0.0, without changes.
-
pcsc-sys: AddedSCardControl()bindings. -
Added
Card::control(), a wrapper overSCardControl(). -
pcsc-sys: Improved build target detection in the build script.
-
Fixed errors in the macOS bindings. In particular, wrong integer types were used, and some structs had incorrect padding.
All discovered problems were fixed; the library now works correctly on macOS.
Reported and debugged by @RokLenarcic in issue #4.
-
The function
ReaderState::new()now takesInto<CString>instead of&CStr. Previously the&CStrwas turned into aCStringinternally; the new form is more explicit and can avoid an allocation if aCStringis passed directly.
Initial stable release.