Changeset 0feaae4 in mainline for uspace/drv/bus/usb/usbmast/inquiry.c


Ignore:
Timestamp:
2011-07-02T17:21:50Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
239e7e10
Parents:
2429e4a
Message:

Factor out standard SCSI code from usbmast to a separate SCSI library.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbmast/inquiry.c

    r2429e4a r0feaae4  
    4242#include <str.h>
    4343#include <ctype.h>
     44#include <scsi/spc.h>
    4445#include "cmds.h"
    45 #include "scsi.h"
    4646#include "mast.h"
    4747
     
    5454#define INQUIRY_RESPONSE_LENGTH 36
    5555
    56 #define STR_UNKNOWN "<unknown>"
    57 
    58 /** String constants for SCSI peripheral device types. */
    59 static const char *str_peripheral_device_types[] = {
    60         "direct-access device",
    61         "sequential-access device",
    62         "printer device",
    63         "processor device",
    64         "write-once device",
    65         "CDROM device",
    66         "scanner device",
    67         "optical memory device",
    68         "medium changer",
    69         "communications device",
    70         "graphic arts pre-press device",
    71         "graphic arts pre-press device",
    72         "storage array controller device",
    73         "enclosure services device",
    74         "simplified direct-access device",
    75         "optical card reader/writer device",
    76         "bridging expander",
    77         "object-based storage device",
    78         "automation driver interface",
    79         STR_UNKNOWN, // 0x13
    80         STR_UNKNOWN, // 0x14
    81         STR_UNKNOWN, // 0x15
    82         STR_UNKNOWN, // 0x16
    83         STR_UNKNOWN, // 0x17
    84         STR_UNKNOWN, // 0x18
    85         STR_UNKNOWN, // 0x19
    86         STR_UNKNOWN, // 0x1A
    87         STR_UNKNOWN, // 0x1B
    88         STR_UNKNOWN, // 0x1C
    89         STR_UNKNOWN, // 0x1D
    90         "well-known logical unit",
    91         "uknown or no device state"
    92 };
    93 #define str_peripheral_device_types_count \
    94         (sizeof(str_peripheral_device_types)/sizeof(str_peripheral_device_types[0]))
    95 
    9656/** Get string representation for SCSI peripheral device type.
    97  *
    98  * See for example here for a list
    99  * http://en.wikipedia.org/wiki/SCSI_Peripheral_Device_Type.
    10057 *
    10158 * @param type SCSI peripheral device type code.
    10259 * @return String representation.
    10360 */
    104 const char *usb_str_masstor_scsi_peripheral_device_type(int type)
     61const char *usb_str_masstor_scsi_peripheral_device_type(unsigned type)
    10562{
    106         if ((type < 0)
    107             || ((size_t)type >= str_peripheral_device_types_count)) {
    108                 return STR_UNKNOWN;
    109         }
    110         return str_peripheral_device_types[type];
     63        return scsi_get_dev_type_str(type);
    11164}
    11265
     
    13689    usb_massstor_inquiry_result_t *inquiry_result)
    13790{
    138         scsi_cmd_inquiry_t inquiry = {
    139                 .op_code = 0x12,
    140                 .lun_evpd = 0,
     91        scsi_cdb_inquiry_t inquiry = {
     92                .op_code = SCSI_CMD_INQUIRY,
     93                .evpd = 0,
    14194                .page_code = 0,
    142                 .alloc_length = host2uint16_t_be(INQUIRY_RESPONSE_LENGTH),
    143                 .ctrl = 0
     95                .alloc_len = host2uint16_t_be(INQUIRY_RESPONSE_LENGTH),
     96                .control = 0
    14497        };
    14598        size_t response_len;
Note: See TracChangeset for help on using the changeset viewer.