aboutsummaryrefslogtreecommitdiff
path: root/NK_C_API.cc
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2016-08-05 19:50:46 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2016-08-05 20:32:45 +0200
commite9c165399bc87e9d283845efdd2d667061b1e323 (patch)
tree8ce834d70805fad5bde2ed8a2aec3b9beba3b37d /NK_C_API.cc
parent2675570622b808aec77be240b4663e29598049ef (diff)
downloadlibnitrokey-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.cc8
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();
+ });
+}
}