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

int u3_send_cmd ( u3_handle_t device,
uint8_t  cmd[U3_CMD_LEN],
int  dxfer_direction,
int  dxfer_length,
uint8_t *  dxfer_data,
uint8_t *  status 

Execute a scsi command at device

This send the given SCSI CDB in 'cmd' to the device given by 'device'. Optional data is transfered from or to the device. The SCSI status as returned by the device is placed in 'status'.

device U3 handle
dxfer_direction Direction of extra data, given by on of the U3_DATA_* enum values
dxfer_len Length of extra data
dxfer_data Buffer with extra data
status Pointer to variable to return SCSI status in
U3_SUCCESS if successful, else U3_FAILURE and an error string can be obtained using u3_error()

Definition at line 66 of file u3_scsi_debug.c.

References u3_handle::dev, and u3_send_cmd().

Referenced by u3_cd_write(), u3_change_password(), u3_chip_info(), u3_data_partition_info(), u3_disable_security(), u3_enable_security(), u3_partition(), u3_partition_info(), u3_partition_sector_round(), u3_read_device_property(), u3_reset(), u3_security_sector_round(), u3_send_cmd(), and u3_unlock().

      FILE *fp = (FILE *)device->dev;
      int i;

      fprintf(fp, "---------------------------------------------------------"

      fprintf(fp, "Command block:\n");
      for (i=0; i < U3_CMD_LEN; i++) {
            fprintf(fp, "%.2X ", cmd[i]);
      fprintf(fp, "\n");

      fprintf(fp, "\n");
      switch (dxfer_direction) {
            case U3_DATA_NONE:
                  fprintf(fp, "No data\n");
            case U3_DATA_TO_DEV:
                  fprintf(fp, "Sending %d bytes of data to device\n", dxfer_length);
                  fprintf(fp, "Data:");
                  for (i=0; i < dxfer_length; i++) {
                        if (i % 8 == 0) fprintf(fp, "\n%.4x\t", i);
                        fprintf(fp, "%.2x ", dxfer_data[i]);
                  fprintf(fp, "\n");
            case U3_DATA_FROM_DEV:
                  fprintf(fp, "Reading %d bytes of data from device\n", dxfer_length);
                  memset(dxfer_data, 0, dxfer_length);

      fprintf(fp, "---------------------------------------------------------"

      *status = 0;

      return U3_SUCCESS;

Generated by  Doxygen 1.6.0   Back to index