Lines Matching full:us
70 static int datafab_determine_lun(struct us_data *us,
114 datafab_bulk_read(struct us_data *us, unsigned char *data, unsigned int len) { in datafab_bulk_read() argument
118 usb_stor_dbg(us, "len = %d\n", len); in datafab_bulk_read()
119 return usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, in datafab_bulk_read()
125 datafab_bulk_write(struct us_data *us, unsigned char *data, unsigned int len) { in datafab_bulk_write() argument
129 usb_stor_dbg(us, "len = %d\n", len); in datafab_bulk_write()
130 return usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, in datafab_bulk_write()
135 static int datafab_read_data(struct us_data *us, in datafab_read_data() argument
140 unsigned char *command = us->iobuf; in datafab_read_data()
157 result = datafab_determine_lun(us, info); in datafab_read_data()
192 result = datafab_bulk_write(us, command, 8); in datafab_read_data()
197 result = datafab_bulk_read(us, buffer, len); in datafab_read_data()
202 usb_stor_access_xfer_buf(buffer, len, us->srb, in datafab_read_data()
218 static int datafab_write_data(struct us_data *us, in datafab_write_data() argument
223 unsigned char *command = us->iobuf; in datafab_write_data()
224 unsigned char *reply = us->iobuf; in datafab_write_data()
241 result = datafab_determine_lun(us, info); in datafab_write_data()
265 usb_stor_access_xfer_buf(buffer, len, us->srb, in datafab_write_data()
280 result = datafab_bulk_write(us, command, 8); in datafab_write_data()
285 result = datafab_bulk_write(us, buffer, len); in datafab_write_data()
290 result = datafab_bulk_read(us, reply, 2); in datafab_write_data()
295 usb_stor_dbg(us, "Gah! write return code: %02x %02x\n", in datafab_write_data()
314 static int datafab_determine_lun(struct us_data *us, in datafab_determine_lun() argument
324 unsigned char *command = us->iobuf; in datafab_determine_lun()
336 usb_stor_dbg(us, "locating...\n"); in datafab_determine_lun()
343 rc = datafab_bulk_write(us, command, 8); in datafab_determine_lun()
349 rc = datafab_bulk_read(us, buf, 512); in datafab_determine_lun()
358 rc = datafab_bulk_write(us, command, 8); in datafab_determine_lun()
364 rc = datafab_bulk_read(us, buf, 512); in datafab_determine_lun()
381 static int datafab_id_device(struct us_data *us, in datafab_id_device() argument
389 unsigned char *command = us->iobuf; in datafab_id_device()
397 rc = datafab_determine_lun(us, info); in datafab_id_device()
409 rc = datafab_bulk_write(us, command, 8); in datafab_id_device()
417 rc = datafab_bulk_read(us, reply, 512); in datafab_id_device()
437 static int datafab_handle_mode_sense(struct us_data *us, in datafab_handle_mode_sense() argument
455 struct datafab_info *info = (struct datafab_info *) (us->extra); in datafab_handle_mode_sense()
456 unsigned char *ptr = us->iobuf; in datafab_handle_mode_sense()
468 usb_stor_dbg(us, "Current values\n"); in datafab_handle_mode_sense()
471 usb_stor_dbg(us, "Changeable values\n"); in datafab_handle_mode_sense()
474 usb_stor_dbg(us, "Default values\n"); in datafab_handle_mode_sense()
477 usb_stor_dbg(us, "Saves values\n"); in datafab_handle_mode_sense()
548 static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us) in datafab_transport() argument
553 unsigned char *ptr = us->iobuf; in datafab_transport()
558 if (!us->extra) { in datafab_transport()
559 us->extra = kzalloc(sizeof(struct datafab_info), GFP_NOIO); in datafab_transport()
560 if (!us->extra) in datafab_transport()
563 us->extra_destructor = datafab_info_destructor; in datafab_transport()
564 ((struct datafab_info *)us->extra)->lun = -1; in datafab_transport()
567 info = (struct datafab_info *) (us->extra); in datafab_transport()
570 usb_stor_dbg(us, "INQUIRY - Returning bogus response\n"); in datafab_transport()
572 fill_inquiry_response(us, ptr, 36); in datafab_transport()
578 rc = datafab_id_device(us, info); in datafab_transport()
582 usb_stor_dbg(us, "READ_CAPACITY: %ld sectors, %ld bytes per sector\n", in datafab_transport()
595 usb_stor_dbg(us, "Gah! MODE_SELECT_10\n"); in datafab_transport()
607 usb_stor_dbg(us, "READ_10: read block 0x%04lx count %ld\n", in datafab_transport()
609 return datafab_read_data(us, info, block, blocks); in datafab_transport()
621 usb_stor_dbg(us, "READ_12: read block 0x%04lx count %ld\n", in datafab_transport()
623 return datafab_read_data(us, info, block, blocks); in datafab_transport()
632 usb_stor_dbg(us, "WRITE_10: write block 0x%04lx count %ld\n", in datafab_transport()
634 return datafab_write_data(us, info, block, blocks); in datafab_transport()
646 usb_stor_dbg(us, "WRITE_12: write block 0x%04lx count %ld\n", in datafab_transport()
648 return datafab_write_data(us, info, block, blocks); in datafab_transport()
652 usb_stor_dbg(us, "TEST_UNIT_READY\n"); in datafab_transport()
653 return datafab_id_device(us, info); in datafab_transport()
657 usb_stor_dbg(us, "REQUEST_SENSE - Returning faked response\n"); in datafab_transport()
675 usb_stor_dbg(us, "MODE_SENSE_6 detected\n"); in datafab_transport()
676 return datafab_handle_mode_sense(us, srb, 1); in datafab_transport()
680 usb_stor_dbg(us, "MODE_SENSE_10 detected\n"); in datafab_transport()
681 return datafab_handle_mode_sense(us, srb, 0); in datafab_transport()
697 usb_stor_dbg(us, "START_STOP\n"); in datafab_transport()
702 rc = datafab_id_device(us, info); in datafab_transport()
713 usb_stor_dbg(us, "Gah! Unknown command: %d (0x%x)\n", in datafab_transport()
726 struct us_data *us; in datafab_probe() local
729 result = usb_stor_probe1(&us, intf, id, in datafab_probe()
735 us->transport_name = "Datafab Bulk-Only"; in datafab_probe()
736 us->transport = datafab_transport; in datafab_probe()
737 us->transport_reset = usb_stor_Bulk_reset; in datafab_probe()
738 us->max_lun = 1; in datafab_probe()
740 result = usb_stor_probe2(us); in datafab_probe()