Esempio n. 1
0
/*!
  Eject media in CD-ROM drive. Return DRIVER_OP_SUCCESS if successful, 
  DRIVER_OP_ERROR on error.
 */
driver_return_code_t
eject_media_freebsd_cam (_img_private_t *p_env) 
{
  int i_status;
  mmc_cdb_t cdb = {{0, }};
  uint8_t buf[1];
  
  CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_ALLOW_MEDIUM_REMOVAL);

  i_status = run_mmc_cmd_freebsd_cam (p_env, DEFAULT_TIMEOUT_MSECS,
				      mmc_get_cmd_len(cdb.field[0]), 
				      &cdb, SCSI_MMC_DATA_WRITE, 0, &buf);
  if (i_status) return i_status;
  
  CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_START_STOP);
  cdb.field[4] = 1;
  i_status = run_mmc_cmd_freebsd_cam (p_env, DEFAULT_TIMEOUT_MSECS,
				 mmc_get_cmd_len(cdb.field[0]), &cdb, 
				 SCSI_MMC_DATA_WRITE, 0, &buf);
  if (i_status) return i_status;
  
  CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_START_STOP);
  cdb.field[4] = 2; /* eject */

  return run_mmc_cmd_freebsd_cam (p_env, DEFAULT_TIMEOUT_MSECS,
				  mmc_get_cmd_len(cdb.field[0]), 
				  &cdb, 
				  SCSI_MMC_DATA_WRITE, 0, &buf);
}
Esempio n. 2
0
/**
   Issue a READ TOC/PMA/ATIP command to read the CD-TEXT from R-W sub-channel.

   @param p_cdio  the CD object to be acted upon.
   @param i_length pointer to number of bytes to request. 
                   Will be overwritten by the number of bytes available.
   @param p_buf  pointer to the location for the returned data

   @return DRIVER_OP_SUCCESS on success
 */
driver_return_code_t
mmc_read_toc_cdtext ( const CdIo_t *p_cdio, unsigned int *i_length,
                      unsigned char *p_buf, unsigned int i_timeout_ms )
{
  unsigned int i_size = *i_length;
  mmc_cdb_t  cdb = {{0, }};
  driver_return_code_t i_status;

  if (i_size < 4)
    return DRIVER_OP_BAD_PARAMETER;

  CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_READ_TOC);
  CDIO_MMC_SET_READ_LENGTH16(cdb.field, i_size);

  memset(p_buf, 0, i_size);

  if (0 == i_timeout_ms) i_timeout_ms = mmc_timeout_ms;

  cdb.field[1] = CDIO_CDROM_MSF;
  cdb.field[2] = CDIO_MMC_READTOC_FMT_CDTEXT;

  i_status = MMC_RUN_CMD(SCSI_MMC_DATA_READ, i_timeout_ms);

  if(i_status == DRIVER_OP_SUCCESS) {
    *i_length = CDIO_MMC_GET_LEN16(p_buf) + 4;
  }

  return i_status;
}
Esempio n. 3
0
/*!
   Reads nblocks of mode2 sectors from cd device into data starting
   from lsn.
   Returns 0 if no error. 
 */
int
read_mode2_sectors_freebsd_cam (_img_private_t *p_env, void *p_buf, 
				lsn_t lsn, unsigned int nblocks)
{
  mmc_cdb_t cdb = {{0, }};

  bool b_read_10 = false;

  CDIO_MMC_SET_READ_LBA(cdb.field, lsn);
  
  if (b_read_10) {
    int retval;
    
    CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_READ_10);
    CDIO_MMC_SET_READ_LENGTH16(cdb.field, nblocks);
    if ((retval = mmc_set_blocksize (p_env->gen.cdio, M2RAW_SECTOR_SIZE)))
      return retval;
    
    if ((retval = run_mmc_cmd_freebsd_cam (p_env, 0, 
					   mmc_get_cmd_len(cdb.field[0]),
					   &cdb, 
					   SCSI_MMC_DATA_READ,
					   M2RAW_SECTOR_SIZE * nblocks, 
					   p_buf)))
      {
	mmc_set_blocksize (p_env->gen.cdio, CDIO_CD_FRAMESIZE);
	return retval;
      }
    
    return mmc_set_blocksize (p_env->gen.cdio, CDIO_CD_FRAMESIZE);
  } else {
    CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_READ_CD);
    CDIO_MMC_SET_READ_LENGTH24(cdb.field, nblocks);
    cdb.field[1] = 0; /* sector size mode2 */
    cdb.field[9] = 0x58; /* 2336 mode2 */
    return run_mmc_cmd_freebsd_cam (p_env, 0, 
				    mmc_get_cmd_len(cdb.field[0]), 
				    &cdb, 
				    SCSI_MMC_DATA_READ,
				    M2RAW_SECTOR_SIZE * nblocks, p_buf);
    
  }
}
Esempio n. 4
0
int
main(int argc, const char *argv[])
{
  CdIo_t *p_cdio;
  const char *psz_drive = NULL;

  if (argc > 1) psz_drive = argv[1];

  p_cdio = cdio_open (psz_drive, DRIVER_UNKNOWN);

  if (NULL == p_cdio) {
    printf("Couldn't find CD\n");
    return 1;
  } else {
    int i_status;             /* Result of MMC command */
    char buf[36] = { 0, };    /* Place to hold returned data */
    mmc_cdb_t cdb = {{0, }};  /* Command Descriptor Buffer */

    CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_INQUIRY);
    cdb.field[4] = sizeof(buf);

    i_status = mmc_run_cmd(p_cdio, DEFAULT_TIMEOUT_MS, &cdb, 
			   SCSI_MMC_DATA_READ, sizeof(buf), &buf);
    if (i_status == 0) {
      char psz_vendor[CDIO_MMC_HW_VENDOR_LEN+1];
      char psz_model[CDIO_MMC_HW_MODEL_LEN+1];
      char psz_rev[CDIO_MMC_HW_REVISION_LEN+1];
      
      memcpy(psz_vendor, buf + 8, sizeof(psz_vendor)-1);
      psz_vendor[sizeof(psz_vendor)-1] = '\0';
      memcpy(psz_model,
	     buf + 8 + CDIO_MMC_HW_VENDOR_LEN, 
	     sizeof(psz_model)-1);
      psz_model[sizeof(psz_model)-1] = '\0';
      memcpy(psz_rev,
	     buf + 8 + CDIO_MMC_HW_VENDOR_LEN +CDIO_MMC_HW_MODEL_LEN,
	     sizeof(psz_rev)-1);
      psz_rev[sizeof(psz_rev)-1] = '\0';

      printf("Vendor: %s\nModel: %s\nRevision: %s\n",
	     psz_vendor, psz_model, psz_rev);
    } else {
      printf("Couldn't get INQUIRY data (vendor, model, and revision).\n");
    }
  }
  
  cdio_destroy(p_cdio);
  
  return 0;
}
Esempio n. 5
0
/*!
   Reads a single raw sector using the DeviceIoControl method into
   data starting from lsn. Returns 0 if no error.
 */
static int
read_raw_sector (_img_private_t *p_env, void *p_buf, lsn_t lsn) 
{
  mmc_cdb_t cdb = {{0, }};

  /* ReadCD CDB12 command.  The values were taken from MMC1 draft paper. */
  CDIO_MMC_SET_COMMAND      (cdb.field, CDIO_MMC_GPCMD_READ_CD);
  CDIO_MMC_SET_READ_LBA     (cdb.field, lsn);
  CDIO_MMC_SET_READ_LENGTH24(cdb.field, 1);

  cdb.field[9]=0xF8;  /* Raw read, 2352 bytes per sector */
  
  return run_mmc_cmd_win32ioctl(p_env, OP_TIMEOUT_MS,
				mmc_get_cmd_len(cdb.field[0]), 
				&cdb, SCSI_MMC_DATA_READ, 
				CDIO_CD_FRAMESIZE_RAW, p_buf);
}
Esempio n. 6
0
/**
   Issue a READ SUB-CHANNEL command to read current position, ISRC or
   MCN from subchannel Q.
   Note: READ SUB-CHANNEL is deprecated as of MMC-5
         but the alternative requires manual parsing of the subchannel.

   @param p_cdio  the CD object to be acted upon.
   @param i_track track number (only for ISRC)
   @param sub_chan_param 2 for MCN, 3 for ISRC
   @param i_length pointer to number of bytes to request. 
                   Will be overwritten by the number of bytes available.
   @param p_buf  pointer to the location for the returned data

   @return DRIVER_OP_SUCCESS on success
 */
driver_return_code_t
mmc_read_subchannel ( const CdIo_t *p_cdio,
                             track_t i_track,
                             unsigned char sub_chan_param,
                             unsigned int *i_length,
                             char *p_buf,
                             unsigned int i_timeout_ms
                            )
{
  unsigned int i_size = *i_length;
  mmc_cdb_t cdb = {{0, }};
  driver_return_code_t i_status;

  if (i_size < 4)
    return DRIVER_OP_BAD_PARAMETER;

  CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_READ_SUBCHANNEL);
  CDIO_MMC_SET_READ_LENGTH8(cdb.field, i_size);

  if(CDIO_SUBCHANNEL_CURRENT_POSITION == sub_chan_param)
    cdb.field[1] = CDIO_CDROM_MSF;
  else
    cdb.field[1] = 0x0;
  cdb.field[2] = 0x40;
  cdb.field[3] = sub_chan_param;
  if(CDIO_SUBCHANNEL_TRACK_ISRC == sub_chan_param)
   cdb.field[6] = i_track;
  else
   cdb.field[6] = 0;

  memset(p_buf, 0, i_size);

  if (0 == i_timeout_ms) i_timeout_ms = mmc_timeout_ms;

  i_status = MMC_RUN_CMD(SCSI_MMC_DATA_READ, i_timeout_ms);

  if(i_status == DRIVER_OP_SUCCESS) {
    *i_length = CDIO_MMC_GET_LEN16((p_buf+2)) + 4;
  }
  return i_status;
}
Esempio n. 7
0
int
main(int argc, const char *argv[])
{
  CdIo_t *p_cdio;
  const char *psz_drive = NULL;

  if (argc > 1) psz_drive = argv[1];
  p_cdio = cdio_open (psz_drive, DRIVER_UNKNOWN);

  if (!p_cdio) {
    printf("-- Couldn't find CD\n");
    return 77;
  } else {
    int i_status;             /* Result of MMC command */
    mmc_cdb_t cdb = {{0, }};  /* Command Descriptor Buffer */
    char buf[36] = { 0, };    /* Place to hold returned data */

    CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_INQUIRY);
    cdb.field[4] = sizeof(buf);

    i_status = mmc_run_cmd(p_cdio, DEFAULT_TIMEOUT_MS, &cdb, 
			   SCSI_MMC_DATA_READ, sizeof(buf), &buf);
    if (i_status == 0) {
	char psz_vendor[CDIO_MMC_HW_VENDOR_LEN+1];
	char psz_model[CDIO_MMC_HW_MODEL_LEN+1];
	char psz_rev[CDIO_MMC_HW_REVISION_LEN+1];
	
	memcpy(psz_vendor, buf + 8, sizeof(psz_vendor)-1);
	psz_vendor[sizeof(psz_vendor)-1] = '\0';
	memcpy(psz_model,
	       buf + 8 + CDIO_MMC_HW_VENDOR_LEN, 
	       sizeof(psz_model)-1);
	psz_model[sizeof(psz_model)-1] = '\0';
	memcpy(psz_rev,
	       buf + 8 + CDIO_MMC_HW_VENDOR_LEN +CDIO_MMC_HW_MODEL_LEN,
	       sizeof(psz_rev)-1);
	psz_rev[sizeof(psz_rev)-1] = '\0';
	
	printf("-- Vendor: %s\n-- Model: %s\n-- Revision: %s\n",
	       psz_vendor, psz_model, psz_rev);
    } else {
      printf("-- Couldn't get INQUIRY data (vendor, model, and revision).\n");
    }

    {
	driver_return_code_t i_status;
	bool b_erasable;

	i_status = mmc_get_disc_erasable(p_cdio, &b_erasable);
	cdio_mmc_feature_profile_t disctype;
	if (DRIVER_OP_SUCCESS == i_status)
	    printf("-- Disc is %serasable.\n", b_erasable ? "" : "not ");
	else
	    printf("-- Can't determine if disc is erasable.\n");

	i_status = mmc_get_disctype(p_cdio, 0, &disctype);
	if (DRIVER_OP_SUCCESS == i_status) {
	    printf("-- disc type: profile is %s (0x%X)\n", 
		   mmc_feature_profile2str(disctype), 
		   disctype);
	}
    }

  }
  
  cdio_destroy(p_cdio);
  
  return 0;
}
Esempio n. 8
0
int
main(int argc, const char *argv[])
{
  CdIo_t *p_cdio;

  p_cdio = cdio_open (NULL, DRIVER_UNKNOWN);

  if (NULL == p_cdio) {
    printf("Couldn't find CD\n");
    return 1;
  } else {
    int i_status;              /* Result of MMC command */
    uint8_t buf[500] = { 0, }; /* Place to hold returned data */
    mmc_cdb_t cdb = {{0, }};   /* Command Descriptor Buffer */

    CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_GET_CONFIGURATION);
    CDIO_MMC_SET_READ_LENGTH8(cdb.field, sizeof(buf));
    cdb.field[1] = CDIO_MMC_GET_CONF_ALL_FEATURES;
    cdb.field[3] = 0x0;

    i_status = mmc_run_cmd(p_cdio, 0, &cdb, SCSI_MMC_DATA_READ, sizeof(buf), 
			   &buf);
    if (i_status == 0) {
      uint8_t *p;
      uint32_t i_data;
      uint8_t *p_max = buf + 65530;

      i_data = (unsigned int) CDIO_MMC_GET_LEN32(buf);
      /* set to first sense feature code, and then walk through the masks */
      p = buf + 8;
      while( (p < &(buf[i_data])) && (p < p_max) ) {
	uint16_t i_feature;
	uint8_t i_feature_additional = p[3];
	
	i_feature = CDIO_MMC_GET_LEN16(p);
	{
	  uint8_t *q;
	  const char *feature_str = mmc_feature2str(i_feature);
	  printf("%s Feature\n", feature_str);
	  switch( i_feature )
	    {
	    case CDIO_MMC_FEATURE_PROFILE_LIST:
	      for ( q = p+4 ; q < p + i_feature_additional ; q += 4 ) {
		int i_profile=CDIO_MMC_GET_LEN16(q);
		const char *feature_profile_str = 
		  mmc_feature_profile2str(i_profile);
		printf( "\t%s", feature_profile_str );
		if (q[2] & 1) {
		  printf(" - on");
		}
		printf("\n");
	      }
	      printf("\n");
	    
	      break;
	    case CDIO_MMC_FEATURE_CORE: 
	      {
		uint8_t *q = p+4;
		uint32_t 	i_interface_standard = CDIO_MMC_GET_LEN32(q);
		switch(i_interface_standard) {
		case 0: 
		  printf("\tunspecified interface\n");
		  break;
		case 1: 
		  printf("\tSCSI interface\n");
		  break;
		case 2: 
		  printf("\tATAPI interface\n");
		  break;
		case 3: 
		  printf("\tIEEE 1394 interface\n");
		  break;
		case 4:
		  printf("\tIEEE 1394A interface\n");
		  break;
		case 5:
		  printf("\tFibre Channel interface\n");
		}
		printf("\n");
		break;
	      }
	    case CDIO_MMC_FEATURE_REMOVABLE_MEDIUM:
	      switch(p[4] >> 5) {
	      case 0:
		printf("\tCaddy/Slot type loading mechanism\n");
		break;
	      case 1:
		printf("\tTray type loading mechanism\n");
		break;
	      case 2:
		printf("\tPop-up type loading mechanism\n");
		break;
	      case 4:
		printf("\tEmbedded changer with individually changeable discs\n");
		break;
	      case 5:
		printf("\tEmbedded changer using a magazine mechanism\n");
		break;
	      default:
		printf("\tUnknown changer mechanism\n");
	      }
	      
	      printf("\tcan%s eject the medium or magazine via the normal "
		     "START/STOP command\n", 
		     (p[4] & 8) ? "": "not");
	      printf("\tcan%s be locked into the Logical Unit\n", 
		     (p[4] & 1) ? "": "not");
	      printf("\n");
	      break;
	    case CDIO_MMC_FEATURE_CD_READ:
	      printf("CD Read Feature\n");
	      printf("\tC2 Error pointers are %ssupported\n", 
		     (p[4] & 2) ? "": "not ");
	      printf("\tCD-Text is %ssupported\n", 
		     (p[4] & 1) ? "": "not ");
	      printf("\n");
	      break;
	    case CDIO_MMC_FEATURE_CDDA_EXT_PLAY:
	      printf("\tSCAN command is %ssupported\n", 
		     (p[4] & 4) ? "": "not ");
	      printf("\taudio channels can %sbe muted separately\n", 
		     (p[4] & 2) ? "": "not ");
	      printf("\taudio channels can %shave separate volume levels\n", 
		     (p[4] & 1) ? "": "not ");
	      {
		uint8_t *q = p+6;
		uint16_t i_vol_levels = CDIO_MMC_GET_LEN16(q);
		printf("\t%d volume levels can be set\n", i_vol_levels);
	      }
	      printf("\n");
	      break;
	    case CDIO_MMC_FEATURE_LU_SN: {
	      uint8_t i_serial = *(p+3);
	      char serial[257] = { '\0', };
	      memcpy(serial, p+4, i_serial);
	      printf("\t%s\n\n", serial);
	      break;
	    }
	    default: 
	      printf("\n");
	      break;
	    }
	  p += i_feature_additional + 4;
	}
      }
    } else {
Esempio n. 9
0
int libunieject_togglelock(struct unieject_opts *opts, int lock)
{
	if ( opts->caps )
	{
		// TODO: tell libcdio author about this
		cdio_drive_misc_cap_t unused, misc_cap;
		cdio_get_drive_cap((CdIo_t*)opts->cdio, &unused, &unused, &misc_cap);

#ifdef __FreeBSD__
		if ( strncmp("/dev/cd", opts->device, 7) != 0 )
			misc_cap = 0xFFFFFFFF;
#endif

		if ( ! (misc_cap & CDIO_DRIVE_CAP_MISC_LOCK) )
		{
			unieject_error(*opts, _("the selected device doesn't have locking capabilities.\n"));
			return -2;
		}
	}
	
	if ( opts->fake )
		return 0;

/*
 * On Linux the allow medium removal command is a priviledged command that
 * cannot be instanced by userspace.
 * Until this changes, use a workaround with syscalls instead.
 */
#if defined(__linux__) && defined(USE_LOCK_WORKAROUND)
	cdio_destroy(opts->cdio);
	opts->cdio = NULL;
	
	int devfd = open(opts->device, O_RDONLY|O_NONBLOCK);
	if ( UNLIKELY(devfd == -1) )
	{
		unieject_error(*opts, _("unable to open device descriptor [%s].\n"), strerror(errno));
		return -4;
	}
	
	if ( UNLIKELY(ioctl(devfd, CDROM_LOCKDOOR, lock ? 1 : 0) == -1) )
	{
		unieject_error(*opts, _("error in ioctl [%s].\n"), strerror(errno));
		return -5;
	}
	
	close(devfd);
	
	return 0;
#else
	mmc_cdb_t lockcmd = { {0, } }; /* Command description buffer */
	uint8_t buf[1]; /* Fake buffer */
	
	CDIO_MMC_SET_COMMAND(lockcmd.field, CDIO_MMC_GPCMD_ALLOW_MEDIUM_REMOVAL);
	
	lockcmd.field[4] = lock ? 1 : 0;
	
	driver_return_code_t sts = mmc_run_cmd(
		(CdIo_t*)opts->cdio,
		DEFAULT_TIMEOUT_MS, /* Should this be configurable? */
		&lockcmd,
		SCSI_MMC_DATA_READ,
		0,
		buf
		);
	
	return unieject_status(*opts, sts);
#endif
}
Esempio n. 10
0
/*!  
  Read and cache the CD's Track Table of Contents and track info.
  via a SCSI MMC READ_TOC (FULTOC).  Return true if successful or
  false if an error.
*/
static bool
read_fulltoc_win32mmc (_img_private_t *p_env) 
{
  mmc_cdb_t  cdb = {{0, }};
  CDROM_TOC_FULL  cdrom_toc_full;
  int             i_status, i, j;
  int             i_track_format = 0;
  int             i_seen_flag;

  /* Operation code */
  CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_READ_TOC);

  cdb.field[1] = 0x00;

  /* Format */
  cdb.field[2] = CDIO_MMC_READTOC_FMT_FULTOC;

  memset(&cdrom_toc_full, 0, sizeof(cdrom_toc_full));

  /* Setup to read header, to get length of data */
  CDIO_MMC_SET_READ_LENGTH16(cdb.field, sizeof(cdrom_toc_full));

  i_status = run_mmc_cmd_win32ioctl (p_env, 1000*60*3,
				     mmc_get_cmd_len(cdb.field[0]), 
				     &cdb, SCSI_MMC_DATA_READ, 
				     sizeof(cdrom_toc_full), &cdrom_toc_full);

  if ( 0 != i_status ) {
    cdio_debug ("SCSI MMC READ_TOC failed\n");  
    return false;
  } 
    
  i_seen_flag=0;
  for( i = 0 ; i <= CDIO_CD_MAX_TRACKS+3; i++ ) {
    
    if ( 0xA0 == cdrom_toc_full.TrackData[i].POINT ) { 
      /* First track number */
      p_env->gen.i_first_track = cdrom_toc_full.TrackData[i].PMIN;
      i_track_format = cdrom_toc_full.TrackData[i].PSEC;
      i_seen_flag|=0x01;
    }
    
    if ( 0xA1 == cdrom_toc_full.TrackData[i].POINT ) { 
      /* Last track number */
      p_env->gen.i_tracks = 
	cdrom_toc_full.TrackData[i].PMIN - p_env->gen.i_first_track + 1;
      i_seen_flag|=0x02;
    }

    j = cdrom_toc_full.TrackData[i].POINT;
    if ( 0xA2 ==  j ) { 
      /* Start position of the lead out */
      p_env->tocent[ p_env->gen.i_tracks ].start_lsn = 
	cdio_lba_to_lsn(
			cdio_msf3_to_lba(
					 cdrom_toc_full.TrackData[i].PMIN,
					 cdrom_toc_full.TrackData[i].PSEC,
					 cdrom_toc_full.TrackData[i].PFRAME 
					 )
			);
      p_env->tocent[ p_env->gen.i_tracks ].Control 
	= cdrom_toc_full.TrackData[i].Control;
      p_env->tocent[ p_env->gen.i_tracks ].Format  = i_track_format;
      i_seen_flag|=0x04;
    }
    
    if (cdrom_toc_full.TrackData[i].POINT > 0 
	&& cdrom_toc_full.TrackData[i].POINT <= p_env->gen.i_tracks) {
      p_env->tocent[j-1].start_lsn = 
	cdio_lba_to_lsn(
			cdio_msf3_to_lba(
					 cdrom_toc_full.TrackData[i].PMIN,
					 cdrom_toc_full.TrackData[i].PSEC,
					 cdrom_toc_full.TrackData[i].PFRAME 
					 )
			);
      p_env->tocent[j-1].Control = 
	cdrom_toc_full.TrackData[i].Control;
      p_env->tocent[j-1].Format  = i_track_format;
      
      set_track_flags(&(p_env->gen.track_flags[j]), 
		      p_env->tocent[j-1].Control);
    
      cdio_debug("p_sectors: %i, %lu", i, 
		 (unsigned long int) (p_env->tocent[i].start_lsn));
      
      if (cdrom_toc_full.TrackData[i].POINT == p_env->gen.i_tracks)
	i_seen_flag|=0x08;
    }
    
    if ( 0x0F == i_seen_flag ) break;
  }
  if ( 0x0F == i_seen_flag ) {
    p_env->gen.toc_init = true; 
    return true;
  }
  return false;
}