aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2016-08-05 13:01:27 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2016-08-05 13:22:40 +0200
commit994eeab788b1de606f365fc42c523ac966b6555f (patch)
tree1388c9c9aede213ea1c8b513ce9c8af65f63fc47 /include
parent8f095c90866579b08a0b3a3e160f49b7e5d5220b (diff)
downloadlibnitrokey-994eeab788b1de606f365fc42c523ac966b6555f.tar.gz
libnitrokey-994eeab788b1de606f365fc42c523ac966b6555f.tar.bz2
Update general config commands - bool -> uint8_t
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'include')
-rw-r--r--include/NitrokeyManager.h2
-rw-r--r--include/stick10_commands.h26
2 files changed, 14 insertions, 14 deletions
diff --git a/include/NitrokeyManager.h b/include/NitrokeyManager.h
index 4dc6a81..7bc2673 100644
--- a/include/NitrokeyManager.h
+++ b/include/NitrokeyManager.h
@@ -72,7 +72,7 @@ namespace nitrokey {
void unlock_user_password(const char *admin_password, const char *new_user_password);
- void write_config(bool numlock, bool capslock, bool scrolllock, bool enable_user_password,
+ void write_config(uint8_t numlock, uint8_t capslock, uint8_t scrolllock, bool enable_user_password,
bool delete_user_password, const char *admin_temporary_password);
vector<uint8_t> read_config();
diff --git a/include/stick10_commands.h b/include/stick10_commands.h
index f7813c4..2d52352 100644
--- a/include/stick10_commands.h
+++ b/include/stick10_commands.h
@@ -299,14 +299,14 @@ class GetStatus : Command<CommandID::GET_STATUS> {
union {
uint8_t general_config[5];
struct{
- uint8_t numlock;
- uint8_t capslock;
- uint8_t scrolllock;
+ uint8_t numlock; /** 0-1: HOTP slot number from which the code will be get on double press, other value - function disabled */
+ uint8_t capslock; /** same as numlock */
+ uint8_t scrolllock; /** same as numlock */
uint8_t enable_user_password;
uint8_t delete_user_password;
};
};
- bool isValid() const { return true; }
+ bool isValid() const { return enable_user_password!=delete_user_password; }
std::string dissect() const {
std::stringstream ss;
@@ -317,9 +317,9 @@ class GetStatus : Command<CommandID::GET_STATUS> {
ss << "general_config:\t"
<< ::nitrokey::misc::hexdump((const char *)(general_config),
sizeof general_config);
- ss << "numlock:\t" << (bool)numlock << std::endl;
- ss << "capslock:\t" << (bool)capslock << std::endl;
- ss << "scrolllock:\t" << (bool)scrolllock << std::endl;
+ ss << "numlock:\t" << (uint8_t)numlock << std::endl;
+ ss << "capslock:\t" << (uint8_t)capslock << std::endl;
+ ss << "scrolllock:\t" << (uint8_t)scrolllock << std::endl;
ss << "enable_user_password:\t" << (bool) enable_user_password << std::endl;
ss << "delete_user_password:\t" << (bool) delete_user_password << std::endl;
@@ -587,18 +587,18 @@ class WriteGeneralConfig : Command<CommandID::WRITE_CONFIG> {
union{
uint8_t config[5];
struct{
- uint8_t numlock;
- uint8_t capslock;
- uint8_t scrolllock;
+ uint8_t numlock; /** 0-1: HOTP slot number from which the code will be get on double press, other value - function disabled */
+ uint8_t capslock; /** same as numlock */
+ uint8_t scrolllock; /** same as numlock */
uint8_t enable_user_password;
uint8_t delete_user_password;
};
};
std::string dissect() const {
std::stringstream ss;
- ss << "numlock:\t" << (bool)numlock << std::endl;
- ss << "capslock:\t" << (bool)capslock << std::endl;
- ss << "scrolllock:\t" << (bool)scrolllock << std::endl;
+ ss << "numlock:\t" << (uint8_t)numlock << std::endl;
+ ss << "capslock:\t" << (uint8_t)capslock << std::endl;
+ ss << "scrolllock:\t" << (uint8_t)scrolllock << std::endl;
ss << "enable_user_password:\t" << (bool) enable_user_password << std::endl;
ss << "delete_user_password:\t" << (bool) delete_user_password << std::endl;
return ss.str();