0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 #include <linux/errno.h>
0024
0025 #include "usb.h"
0026 #include "initializers.h"
0027 #include "debug.h"
0028 #include "transport.h"
0029
0030
0031
0032
0033
0034 int usb_stor_euscsi_init(struct us_data *us)
0035 {
0036 int result;
0037
0038 usb_stor_dbg(us, "Attempting to init eUSCSI bridge...\n");
0039 result = usb_stor_control_msg(us, us->send_ctrl_pipe,
0040 0x0C, USB_RECIP_INTERFACE | USB_TYPE_VENDOR,
0041 0x01, 0x0, NULL, 0x0, 5 * HZ);
0042 usb_stor_dbg(us, "-- result is %d\n", result);
0043
0044 return 0;
0045 }
0046
0047
0048
0049
0050
0051 int usb_stor_ucr61s2b_init(struct us_data *us)
0052 {
0053 struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap*) us->iobuf;
0054 struct bulk_cs_wrap *bcs = (struct bulk_cs_wrap*) us->iobuf;
0055 int res;
0056 unsigned int partial;
0057 static char init_string[] = "\xec\x0a\x06\x00$PCCHIPS";
0058
0059 usb_stor_dbg(us, "Sending UCR-61S2B initialization packet...\n");
0060
0061 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
0062 bcb->Tag = 0;
0063 bcb->DataTransferLength = cpu_to_le32(0);
0064 bcb->Flags = bcb->Lun = 0;
0065 bcb->Length = sizeof(init_string) - 1;
0066 memset(bcb->CDB, 0, sizeof(bcb->CDB));
0067 memcpy(bcb->CDB, init_string, sizeof(init_string) - 1);
0068
0069 res = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, bcb,
0070 US_BULK_CB_WRAP_LEN, &partial);
0071 if (res)
0072 return -EIO;
0073
0074 usb_stor_dbg(us, "Getting status packet...\n");
0075 res = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, bcs,
0076 US_BULK_CS_WRAP_LEN, &partial);
0077 if (res)
0078 return -EIO;
0079
0080 return 0;
0081 }
0082
0083
0084 int usb_stor_huawei_e220_init(struct us_data *us)
0085 {
0086 int result;
0087
0088 result = usb_stor_control_msg(us, us->send_ctrl_pipe,
0089 USB_REQ_SET_FEATURE,
0090 USB_TYPE_STANDARD | USB_RECIP_DEVICE,
0091 0x01, 0x0, NULL, 0x0, 1 * HZ);
0092 usb_stor_dbg(us, "Huawei mode set result is %d\n", result);
0093 return 0;
0094 }