From 83da928701b52005b1e29234164b2d21bfdeff39 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Tue, 10 Apr 2018 07:40:29 +0200 Subject: Precise value for p.enable_user_password field to 1 on true, as in firmware Signed-off-by: Szczepan Zalega --- NitrokeyManager.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc index db0c0a9..4008bd0 100644 --- a/NitrokeyManager.cc +++ b/NitrokeyManager.cc @@ -840,11 +840,11 @@ using nitrokey::misc::strcpyT; void NitrokeyManager::write_config(uint8_t numlock, uint8_t capslock, uint8_t scrolllock, bool enable_user_password, bool delete_user_password, const char *admin_temporary_password) { auto p = get_payload(); - p.numlock = (uint8_t) numlock; - p.capslock = (uint8_t) capslock; - p.scrolllock = (uint8_t) scrolllock; - p.enable_user_password = (uint8_t) enable_user_password; - p.delete_user_password = (uint8_t) delete_user_password; + p.numlock = numlock; + p.capslock = capslock; + p.scrolllock = scrolllock; + p.enable_user_password = static_cast(enable_user_password ? 1 : 0); + p.delete_user_password = static_cast(delete_user_password ? 1 : 0); if (is_authorization_command_supported()){ authorize_packet(p, admin_temporary_password, device); } else { -- cgit v1.2.3