diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2016-08-05 19:50:46 +0200 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2016-08-05 20:32:45 +0200 |
commit | e9c165399bc87e9d283845efdd2d667061b1e323 (patch) | |
tree | 8ce834d70805fad5bde2ed8a2aec3b9beba3b37d /NK_C_API.cc | |
parent | 2675570622b808aec77be240b4663e29598049ef (diff) | |
download | libnitrokey-e9c165399bc87e9d283845efdd2d667061b1e323.tar.gz libnitrokey-e9c165399bc87e9d283845efdd2d667061b1e323.tar.bz2 |
Autodetect inserted stick and connect to it
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'NK_C_API.cc')
-rw-r--r-- | NK_C_API.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/NK_C_API.cc b/NK_C_API.cc index d93283d..4773036 100644 --- a/NK_C_API.cc +++ b/NK_C_API.cc @@ -73,7 +73,7 @@ extern int NK_login(const char *device_model) { auto m = NitrokeyManager::instance(); try { NK_last_command_status = 0; - m->connect(device_model); + return m->connect(device_model); } catch (CommandFailedException & commandFailedException){ NK_last_command_status = commandFailedException.last_command_status; @@ -432,6 +432,12 @@ extern int NK_is_AES_supported(const char *user_password) { }); } +extern int NK_login_auto() { + auto m = NitrokeyManager::instance(); + return get_with_result([&](){ + return (uint8_t) m->connect(); + }); +} } |