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

int u3_reset ( u3_handle_t device  ) 

Reset device

This function tell's the device to reconnect. When the function returns the device should have been reset and reconnected. The exact working of this action is still vague

device U3 device handle
U3_SUCCESS if successful, else U3_FAILURE and an error string can be obtained using u3_error()

Definition at line 395 of file u3_commands.c.

References u3_send_cmd().

      uint8_t status;
      uint8_t cmd[U3_CMD_LEN] = {
            0xff, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00
      uint8_t data[12] = { // the magic numbers
            0x50, 0x00, 0x00, 0x00, 0x40, 0x9c, 0x00, 0x00,
            0x01, 0x00, 0x00, 0x00
      if (u3_send_cmd(device, cmd, U3_DATA_TO_DEV, sizeof(data),
            data, &status) != U3_SUCCESS)
            return U3_FAILURE;

      if (status != 0) {
            u3_set_error(device, "Device reported command failed: status %d", status);
            return U3_FAILURE;

      sleep(2); // wait for device to reset

//    u3_reopen(device);

      return U3_SUCCESS;

Generated by  Doxygen 1.6.0   Back to index