Lines Matching refs: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()
313 static int datafab_determine_lun(struct us_data *us, in datafab_determine_lun() argument
323 unsigned char *command = us->iobuf; in datafab_determine_lun()
335 usb_stor_dbg(us, "locating...\n"); in datafab_determine_lun()
342 rc = datafab_bulk_write(us, command, 8); in datafab_determine_lun()
348 rc = datafab_bulk_read(us, buf, 512); in datafab_determine_lun()
357 rc = datafab_bulk_write(us, command, 8); in datafab_determine_lun()
363 rc = datafab_bulk_read(us, buf, 512); in datafab_determine_lun()
380 static int datafab_id_device(struct us_data *us, in datafab_id_device() argument
388 unsigned char *command = us->iobuf; in datafab_id_device()
396 rc = datafab_determine_lun(us, info); in datafab_id_device()
408 rc = datafab_bulk_write(us, command, 8); in datafab_id_device()
416 rc = datafab_bulk_read(us, reply, 512); in datafab_id_device()
436 static int datafab_handle_mode_sense(struct us_data *us, in datafab_handle_mode_sense() argument
454 struct datafab_info *info = (struct datafab_info *) (us->extra); in datafab_handle_mode_sense()
455 unsigned char *ptr = us->iobuf; in datafab_handle_mode_sense()
467 usb_stor_dbg(us, "Current values\n"); in datafab_handle_mode_sense()
470 usb_stor_dbg(us, "Changeable values\n"); in datafab_handle_mode_sense()
473 usb_stor_dbg(us, "Default values\n"); in datafab_handle_mode_sense()
476 usb_stor_dbg(us, "Saves values\n"); in datafab_handle_mode_sense()
547 static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us) in datafab_transport() argument
552 unsigned char *ptr = us->iobuf; in datafab_transport()
557 if (!us->extra) { in datafab_transport()
558 us->extra = kzalloc(sizeof(struct datafab_info), GFP_NOIO); in datafab_transport()
559 if (!us->extra) in datafab_transport()
562 us->extra_destructor = datafab_info_destructor; in datafab_transport()
563 ((struct datafab_info *)us->extra)->lun = -1; in datafab_transport()
566 info = (struct datafab_info *) (us->extra); in datafab_transport()
569 usb_stor_dbg(us, "INQUIRY - Returning bogus response\n"); in datafab_transport()
571 fill_inquiry_response(us, ptr, 36); in datafab_transport()
577 rc = datafab_id_device(us, info); in datafab_transport()
581 usb_stor_dbg(us, "READ_CAPACITY: %ld sectors, %ld bytes per sector\n", in datafab_transport()
594 usb_stor_dbg(us, "Gah! MODE_SELECT_10\n"); in datafab_transport()
606 usb_stor_dbg(us, "READ_10: read block 0x%04lx count %ld\n", in datafab_transport()
608 return datafab_read_data(us, info, block, blocks); in datafab_transport()
620 usb_stor_dbg(us, "READ_12: read block 0x%04lx count %ld\n", in datafab_transport()
622 return datafab_read_data(us, info, block, blocks); in datafab_transport()
631 usb_stor_dbg(us, "WRITE_10: write block 0x%04lx count %ld\n", in datafab_transport()
633 return datafab_write_data(us, info, block, blocks); in datafab_transport()
645 usb_stor_dbg(us, "WRITE_12: write block 0x%04lx count %ld\n", in datafab_transport()
647 return datafab_write_data(us, info, block, blocks); in datafab_transport()
651 usb_stor_dbg(us, "TEST_UNIT_READY\n"); in datafab_transport()
652 return datafab_id_device(us, info); in datafab_transport()
656 usb_stor_dbg(us, "REQUEST_SENSE - Returning faked response\n"); in datafab_transport()
674 usb_stor_dbg(us, "MODE_SENSE_6 detected\n"); in datafab_transport()
675 return datafab_handle_mode_sense(us, srb, 1); in datafab_transport()
679 usb_stor_dbg(us, "MODE_SENSE_10 detected\n"); in datafab_transport()
680 return datafab_handle_mode_sense(us, srb, 0); in datafab_transport()
696 usb_stor_dbg(us, "START_STOP\n"); in datafab_transport()
701 rc = datafab_id_device(us, info); in datafab_transport()
712 usb_stor_dbg(us, "Gah! Unknown command: %d (0x%x)\n", in datafab_transport()
725 struct us_data *us; in datafab_probe() local
728 result = usb_stor_probe1(&us, intf, id, in datafab_probe()
734 us->transport_name = "Datafab Bulk-Only"; in datafab_probe()
735 us->transport = datafab_transport; in datafab_probe()
736 us->transport_reset = usb_stor_Bulk_reset; in datafab_probe()
737 us->max_lun = 1; in datafab_probe()
739 result = usb_stor_probe2(us); in datafab_probe()