Logo Search packages:      
Sourcecode: u3-tool version File versions

int u3_unlock ( u3_handle_t device,
const char *  password,
int *  result 

Unlock data partition

This unlocks the data partition if the device is secured.

device U3 device handle
password The password for the private zone
result Return variable for result True if unlocking succeeded, else false
U3_SUCCESS if successful, else U3_FAILURE and an error string can be obtained using u3_error()

Definition at line 501 of file u3_commands.c.

References u3_send_cmd().

      uint8_t status;
      uint8_t cmd[U3_CMD_LEN] = {
            0xff, 0xA4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00
        uint8_t passhash_buf[U3_PASSWORD_HASH_LEN];

      *result = 0;
      u3_pass_to_hash(password, passhash_buf);
      if (u3_send_cmd(device, cmd, U3_DATA_TO_DEV, sizeof(passhash_buf),
            passhash_buf, &status) != U3_SUCCESS)
            return U3_FAILURE;

      if (status == 0) {
            *result = 1;

      return U3_SUCCESS;

Generated by  Doxygen 1.6.0   Back to index