aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NK_C_API.cc7
-rw-r--r--NK_C_API.h6
-rw-r--r--NitrokeyManager.cc3
-rw-r--r--command_id.cc4
-rw-r--r--libnitrokey/NitrokeyManager.h5
-rw-r--r--libnitrokey/command_id.h2
-rw-r--r--libnitrokey/stick20_commands.h6
7 files changed, 29 insertions, 4 deletions
diff --git a/NK_C_API.cc b/NK_C_API.cc
index 01963fc..103f34d 100644
--- a/NK_C_API.cc
+++ b/NK_C_API.cc
@@ -686,7 +686,12 @@ extern "C" {
});
}
-
+ NK_C_API int NK_wink() {
+ auto m = NitrokeyManager::instance();
+ return get_without_result([&]() {
+ return m->wink();
+ });
+ }
#ifdef __cplusplus
}
diff --git a/NK_C_API.h b/NK_C_API.h
index f23bb5d..c991d4c 100644
--- a/NK_C_API.h
+++ b/NK_C_API.h
@@ -745,7 +745,11 @@ extern "C" {
*/
NK_C_API int NK_connect_with_ID(const char* id);
-
+ /**
+ * Blink red and green LED alternatively and infinitely (until device is reconnected).
+ * @return command processing error code
+ */
+ NK_C_API int NK_wink();
#ifdef __cplusplus
}
diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc
index ab4cac5..600193d 100644
--- a/NitrokeyManager.cc
+++ b/NitrokeyManager.cc
@@ -1137,5 +1137,8 @@ using nitrokey::misc::strcpyT;
return current_device_id;
}
+ void NitrokeyManager::wink(){
+ stick20::Wink::CommandTransaction::run(device);
+ };
}
diff --git a/command_id.cc b/command_id.cc
index d81d487..a6c2a28 100644
--- a/command_id.cc
+++ b/command_id.cc
@@ -173,10 +173,10 @@ const char *commandid_to_string(CommandID id) {
return "NEW_AES_KEY";
case CommandID::WRITE_TO_SLOT_2:
return "WRITE_TO_SLOT_2";
- break;
case CommandID::SEND_OTP_DATA:
return "SEND_OTP_DATA";
- break;
+ case CommandID::WINK:
+ return "WINK";
}
return "UNKNOWN";
}
diff --git a/libnitrokey/NitrokeyManager.h b/libnitrokey/NitrokeyManager.h
index 0689c3f..b48afc5 100644
--- a/libnitrokey/NitrokeyManager.h
+++ b/libnitrokey/NitrokeyManager.h
@@ -288,6 +288,11 @@ char * strndup(const char* str, size_t maxlen);
* @return Returns true, if set unencrypted volume ro/rw pin type is User, false otherwise.
*/
bool set_unencrypted_volume_rorw_pin_type_user();
+
+ /**
+ * Blink red and green LED alternatively and infinitely (until device is reconnected).
+ */
+ void wink();
};
}
diff --git a/libnitrokey/command_id.h b/libnitrokey/command_id.h
index 1092ea9..eb0d450 100644
--- a/libnitrokey/command_id.h
+++ b/libnitrokey/command_id.h
@@ -130,6 +130,8 @@ enum class CommandID : uint8_t {
ENABLE_ADMIN_READONLY_ENCRYPTED_LUN = 0x20 + 30,
ENABLE_ADMIN_READWRITE_ENCRYPTED_LUN = 0x20 + 31,
CHECK_SMARTCARD_USAGE = 0x20 + 32,
+ //v0.52+
+ WINK = 0x20 + 33,
GET_PW_SAFE_SLOT_STATUS = 0x60,
GET_PW_SAFE_SLOT_NAME = 0x61,
diff --git a/libnitrokey/stick20_commands.h b/libnitrokey/stick20_commands.h
index 4b75e6a..7efa1b6 100644
--- a/libnitrokey/stick20_commands.h
+++ b/libnitrokey/stick20_commands.h
@@ -275,6 +275,12 @@ namespace nitrokey {
CommandTransaction;
};
+ class Wink : Command<CommandID::WINK> {
+ public:
+ typedef Transaction<command_id(), struct EmptyPayload, struct EmptyPayload>
+ CommandTransaction;
+ };
+
class CheckSmartcardUsage : Command<CommandID::CHECK_SMARTCARD_USAGE> {
public:
typedef Transaction<command_id(), struct EmptyPayload, EmptyPayload>