diff --git a/NEWS b/NEWS index cd97288e..7fa7ac2b 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,16 @@ $Id: NEWS,v 1.124 2008/10/20 01:10:19 rocky Exp $ +version 0.82 +2009-10-27 + +- Remove all uses of CDIO_MIN_DRIVER, + CDIO_MAX_DRIVER, CDIO_MIN_DEVICE_DRIVER or CDIO_MAX_DEVICE_DRIVER. +- FreeBSD get_media_changed fixes +- MingGW/Msys compilation issues +- Add OS/2 driver +- Cross compilations fixes and uclinix is like GNU/Linux +- Numerous other bug fixes + version 0.81 2008-10-27 diff --git a/lib/driver/FreeBSD/freebsd.c b/lib/driver/FreeBSD/freebsd.c index 9395e053..81f4f09d 100644 --- a/lib/driver/FreeBSD/freebsd.c +++ b/lib/driver/FreeBSD/freebsd.c @@ -21,7 +21,7 @@ control of the CD drive. Culled initially I think from xine's or mplayer's FreeBSD code with lots of modifications. */ - + #ifdef HAVE_CONFIG_H # include "config.h" #endif @@ -651,6 +651,8 @@ cdio_get_devices_freebsd (void) } /* Scan are ATAPI devices */ + exists = true; + for ( c='0'; exists && c <='9'; c++ ) { sprintf(drive, "/dev/acd%c%s", c, DEVICE_POSTFIX); exists = cdio_is_cdrom(drive, NULL); @@ -707,6 +709,8 @@ cdio_get_default_device_freebsd() } /* Scan are ATAPI devices */ + exists = true; + for ( c='0'; exists && c <='9'; c++ ) { sprintf(drive, "/dev/acd%c%s", c, DEVICE_POSTFIX); exists = cdio_is_cdrom(drive, NULL); @@ -760,6 +764,57 @@ get_media_changed_freebsd (const void *p_user_data) } #endif /*HAVE_FREEBSD_CDROM*/ +/*! Find out if media has changed since the last call. @param + p_user_data the environment of the CD object to be acted upon. + @return 1 if media has changed since last call, 0 if not. Error + return codes are the same as driver_return_code_t + */ + +int +get_media_changed_freebsd (const void *p_user_data) +{ +#ifdef HAVE_FREEBSD_CDROM + const _img_private_t *p_env = p_user_data; + int changed = 0 ; + + if ( p_env->access_mode == _AM_CAM ) { + changed = mmc_get_media_changed( p_env->gen.cdio ); + } + else if ( p_env->access_mode == _AM_IOCTL ) { + changed = mmc_get_media_changed( p_env->gen.cdio ); + } + else + return DRIVER_OP_UNSUPPORTED; + + return ((changed > 0) ? changed : 0); + +#else + return DRIVER_OP_NO_DRIVER; + +#endif /*HAVE_FREEBSD_CDROM*/ +} + +static const char* +get_access_mode(const char *source) +{ + if(source) { + if (!(strncmp(source, "/dev/acd", 8))) + return "ioctl"; + else { + char devname[256]; + int bytes = readlink(source, devname, 255); + + if(bytes >0) { + devname[bytes]=0; + if (!(strncmp(devname, "acd", 3))) + return "ioctl"; + } + } + } + + return "CAM"; +} + /*! Initialization routine. This is the only thing that doesn't get called via a function pointer. In fact *we* are the @@ -786,6 +841,9 @@ cdio_open_am_freebsd (const char *psz_orig_source_name, CdIo *ret; _img_private_t *_data; char *psz_source_name; + + if(!psz_access_mode) + psz_access_mode = get_access_mode(psz_orig_source_name); cdio_funcs_t _funcs = { .audio_get_volume = audio_get_volume_freebsd, diff --git a/lib/driver/FreeBSD/freebsd.h b/lib/driver/FreeBSD/freebsd.h index 2bf51662..29f92cb3 100644 --- a/lib/driver/FreeBSD/freebsd.h +++ b/lib/driver/FreeBSD/freebsd.h @@ -159,6 +159,8 @@ void get_drive_cap_freebsd_cam (const _img_private_t *p_env, static int get_media_changed_freebsd (const void *p_user_data); +int get_media_changed_freebsd (const void *p_user_data); + char *get_mcn_freebsd_ioctl (const _img_private_t *p_env); void free_freebsd_cam (void *obj); diff --git a/lib/driver/FreeBSD/freebsd_ioctl.c b/lib/driver/FreeBSD/freebsd_ioctl.c index 0f227a08..ffa7cfbf 100644 --- a/lib/driver/FreeBSD/freebsd_ioctl.c +++ b/lib/driver/FreeBSD/freebsd_ioctl.c @@ -76,21 +76,17 @@ int read_audio_sectors_freebsd_ioctl (_img_private_t *_obj, void *data, lsn_t lsn, unsigned int nblocks) { - unsigned char buf[CDIO_CD_FRAMESIZE_RAW] = { 0, }; - struct ioc_read_audio cdda; - - cdda.address.lba = lsn; - cdda.buffer = buf; - cdda.nframes = nblocks; - cdda.address_format = CDIO_CDROM_LBA; - + int bsize = CDIO_CD_FRAMESIZE_RAW; + + /* set block size */ + if (ioctl(_obj->gen.fd, CDRIOCSETBLOCKSIZE, &bsize) == -1) return 1; + /* read a frame */ - if(ioctl(_obj->gen.fd, CDIOCREADAUDIO, &cdda) < 0) { - perror("CDIOCREADAUDIO"); + if (pread(_obj->gen.fd, data, nblocks*bsize, lsn*bsize) != nblocks*bsize) { + perror("read_audio_sectors_freebsd_ioctl"); return 1; } - memcpy (data, buf, CDIO_CD_FRAMESIZE_RAW); - + return 0; } diff --git a/lib/driver/Makefile.am b/lib/driver/Makefile.am index 4eb777a3..1be1ad9c 100644 --- a/lib/driver/Makefile.am +++ b/lib/driver/Makefile.am @@ -42,7 +42,7 @@ # public release, then set AGE to 0. A changed interface means an # incompatibility with previous versions. -libcdio_la_CURRENT = 11 +libcdio_la_CURRENT = 12 libcdio_la_REVISION = 0 libcdio_la_AGE = 0