]> err.no Git - yubikey-personalization/commitdiff
more general way of setting mode bits for usb_mode
authorKlas Lindfors <klas@yubico.com>
Tue, 4 Dec 2012 13:47:18 +0000 (14:47 +0100)
committerKlas Lindfors <klas@yubico.com>
Tue, 4 Dec 2012 13:47:18 +0000 (14:47 +0100)
ykpers-args.c

index 1dfcdf9f01245fec42783ba0cd9163d8d7cc0969..852cf8de2ca599c33cc3e92f8dcb124ebaf8558c 100644 (file)
@@ -442,8 +442,8 @@ int args_to_config(int argc, char **argv, YKP_CONFIG *cfg, YK_KEY *yk,
                                *exit_code = 1;
                                return 0;
                        }
-                       if(optarg[0] == '8') {
-                               *usb_mode |= 0x80;
+                       if(optarg[1] != '\n') {
+                               *usb_mode = (optarg[0] - '0') << 4;
                                optarg++;
                        }
                        if(optarg[1] == '\0') {