Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Oct 2002 22:37:09 -0700 (PDT)
From:      Jim Pirzyk <jim@pirzyk.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   kern/43885: USB CDROM does not work with vmware 2.x
Message-ID:  <200210100537.g9A5b94U000475@zephyr.pirzyk.org>

next in thread | raw e-mail | index | archive | help

>Number:         43885
>Category:       kern
>Synopsis:       USB CDROM does not work with vmware 2.x
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 09 22:40:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Jim Pirzyk
>Release:        FreeBSD 4.6.2-RELEASE i386
>Organization:
>Environment:
System: FreeBSD zephyr.pirzyk.org 4.6.2-RELEASE FreeBSD 4.6.2-RELEASE #0: Fri Aug 16 09:46:23 PDT 2002 root@zephyr.pirzyk.org:/usr/src/sys/compile/ZEPHYR_KERNEL i386


>Description:
	when using a USB CDROM drive, vmware cannot query the drive for sense mode
	information.  The scsi_cd.c call uses 10 byte read/write commands but
	uses a 6 byte mode sense command.  This confuses the IDE CDROM drive
	that is behind a USB interface.  
>How-To-Repeat:
	install vmware, try to use it with the USB CDROM drive.
>Fix:

	Convert the cdgetmode to use the 10 byte mode_sense command 
	instead. 

*** sys/cam/scsi/scsi_cd.c.orig	Wed Oct  2 23:14:41 2002
--- sys/cam/scsi/scsi_cd.c	Thu Oct  3 21:47:41 2002
***************
*** 2768,2774 ****
  static int
  cdgetmode(struct cam_periph *periph, struct cd_mode_data *data, u_int32_t page)
  {
! 	struct scsi_mode_sense_6 *scsi_cmd;
          struct ccb_scsiio *csio;
  	union ccb *ccb;
  	int error;
--- 2768,2774 ----
  static int
  cdgetmode(struct cam_periph *periph, struct cd_mode_data *data, u_int32_t page)
  {
! 	struct scsi_mode_sense_10 *scsi_cmd;
          struct ccb_scsiio *csio;
  	union ccb *ccb;
  	int error;
***************
*** 2786,2800 ****
  		      /* data_ptr */ (u_int8_t *)data,
  		      /* dxfer_len */ sizeof(*data),
  		      /* sense_len */ SSD_FULL_SIZE,
! 		      sizeof(struct scsi_mode_sense_6),
   		      /* timeout */ 50000);
  
! 	scsi_cmd = (struct scsi_mode_sense_6 *)&csio->cdb_io.cdb_bytes;
  	bzero (scsi_cmd, sizeof(*scsi_cmd));
  
  	scsi_cmd->page = page;
! 	scsi_cmd->length = sizeof(*data) & 0xff;
! 	scsi_cmd->opcode = MODE_SENSE;
  
  	error = cdrunccb(ccb, cderror, /*cam_flags*/0,
  			 /*sense_flags*/SF_RETRY_UA|SF_RETRY_SELTO);
--- 2786,2801 ----
  		      /* data_ptr */ (u_int8_t *)data,
  		      /* dxfer_len */ sizeof(*data),
  		      /* sense_len */ SSD_FULL_SIZE,
! 		      sizeof(struct scsi_mode_sense_10),
   		      /* timeout */ 50000);
  
! 	scsi_cmd = (struct scsi_mode_sense_10 *)&csio->cdb_io.cdb_bytes;
  	bzero (scsi_cmd, sizeof(*scsi_cmd));
  
  	scsi_cmd->page = page;
! 	scsi_cmd->length[0] = (sizeof(*data)) >> 8;
! 	scsi_cmd->length[1] = (sizeof(*data)) & 0xff;
! 	scsi_cmd->opcode = MODE_SENSE_10;
  
  	error = cdrunccb(ccb, cderror, /*cam_flags*/0,
  			 /*sense_flags*/SF_RETRY_UA|SF_RETRY_SELTO);
***************
*** 2807,2813 ****
  static int
  cdsetmode(struct cam_periph *periph, struct cd_mode_data *data)
  {
! 	struct scsi_mode_select_6 *scsi_cmd;
          struct ccb_scsiio *csio;
  	union ccb *ccb;
  	int error;
--- 2808,2814 ----
  static int
  cdsetmode(struct cam_periph *periph, struct cd_mode_data *data)
  {
! 	struct scsi_mode_select_10 *scsi_cmd;
          struct ccb_scsiio *csio;
  	union ccb *ccb;
  	int error;
***************
*** 2826,2840 ****
  		      /* data_ptr */ (u_int8_t *)data,
  		      /* dxfer_len */ sizeof(*data),
  		      /* sense_len */ SSD_FULL_SIZE,
! 		      sizeof(struct scsi_mode_select_6),
   		      /* timeout */ 50000);
  
! 	scsi_cmd = (struct scsi_mode_select_6 *)&csio->cdb_io.cdb_bytes;
  
  	bzero(scsi_cmd, sizeof(*scsi_cmd));
  	scsi_cmd->opcode = MODE_SELECT;
  	scsi_cmd->byte2 |= SMS_PF;
! 	scsi_cmd->length = sizeof(*data) & 0xff;
  	data->header.data_length = 0;
  	/*
  	 * SONY drives do not allow a mode select with a medium_type
--- 2827,2842 ----
  		      /* data_ptr */ (u_int8_t *)data,
  		      /* dxfer_len */ sizeof(*data),
  		      /* sense_len */ SSD_FULL_SIZE,
! 		      sizeof(struct scsi_mode_select_10),
   		      /* timeout */ 50000);
  
! 	scsi_cmd = (struct scsi_mode_select_10 *)&csio->cdb_io.cdb_bytes;
  
  	bzero(scsi_cmd, sizeof(*scsi_cmd));
  	scsi_cmd->opcode = MODE_SELECT;
  	scsi_cmd->byte2 |= SMS_PF;
! 	scsi_cmd->length[0] = (sizeof(*data)) >> 8;
! 	scsi_cmd->length[1] = (sizeof(*data)) & 0xff;
  	data->header.data_length = 0;
  	/*
  	 * SONY drives do not allow a mode select with a medium_type
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210100537.g9A5b94U000475>