FreeBSD audio control patches from Heiner.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: freebsd.c,v 1.27 2005/03/29 12:00:23 rocky Exp $
|
||||
$Id: freebsd.c,v 1.28 2005/04/05 02:13:58 rocky Exp $
|
||||
|
||||
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
static const char _rcsid[] = "$Id: freebsd.c,v 1.27 2005/03/29 12:00:23 rocky Exp $";
|
||||
static const char _rcsid[] = "$Id: freebsd.c,v 1.28 2005/04/05 02:13:58 rocky Exp $";
|
||||
|
||||
#include "freebsd.h"
|
||||
|
||||
@@ -359,8 +359,14 @@ audio_read_subchannel_freebsd (void *p_user_data,
|
||||
const _img_private_t *p_env = p_user_data;
|
||||
int i_rc;
|
||||
struct cd_sub_channel_info bsdinfo;
|
||||
bsdinfo.what.position.data_format = CD_CURRENT_POSITION;
|
||||
i_rc = ioctl(p_env->gen.fd, CDIOCREADSUBCHANNEL, &bsdinfo);
|
||||
memset(& bsdinfo, 0, sizeof(struct cd_sub_channel_info));
|
||||
struct ioc_read_subchannel read_subchannel;
|
||||
read_subchannel.address_format = CD_MSF_FORMAT;
|
||||
read_subchannel.data_format = CD_CURRENT_POSITION;
|
||||
read_subchannel.track = 0;
|
||||
read_subchannel.data_len = sizeof(struct cd_sub_channel_info);
|
||||
read_subchannel.data = & bsdinfo;
|
||||
i_rc = ioctl(p_env->gen.fd, CDIOCREADSUBCHANNEL, &read_subchannel);
|
||||
if (0 == i_rc) {
|
||||
msf_t msf;
|
||||
p_subchannel->audio_status = bsdinfo.header.audio_status;
|
||||
@@ -370,15 +376,12 @@ audio_read_subchannel_freebsd (void *p_user_data,
|
||||
p_subchannel->track = bsdinfo.what.position.track_number;
|
||||
p_subchannel->index = bsdinfo.what.position.index_number;
|
||||
|
||||
cdio_lba_to_msf(bsdinfo.what.position.absaddr.lba, &msf);
|
||||
p_subchannel->abs_addr.m = cdio_from_bcd8 (msf.m);
|
||||
p_subchannel->abs_addr.s = cdio_from_bcd8 (msf.s);
|
||||
p_subchannel->abs_addr.f = cdio_from_bcd8 (msf.f);
|
||||
|
||||
cdio_lsn_to_msf(bsdinfo.what.position.reladdr.lba, &msf);
|
||||
p_subchannel->rel_addr.m = cdio_from_bcd8 (msf.m);
|
||||
p_subchannel->rel_addr.s = cdio_from_bcd8 (msf.s);
|
||||
p_subchannel->rel_addr.f = cdio_from_bcd8 (msf.f);
|
||||
p_subchannel->abs_addr.m = cdio_from_bcd8 (bsdinfo.what.position.absaddr.msf.minute);
|
||||
p_subchannel->abs_addr.s = cdio_from_bcd8 (bsdinfo.what.position.absaddr.msf.second);
|
||||
p_subchannel->abs_addr.f = cdio_from_bcd8 (bsdinfo.what.position.absaddr.msf.frame);
|
||||
p_subchannel->rel_addr.m = cdio_from_bcd8 (bsdinfo.what.position.reladdr.msf.minute);
|
||||
p_subchannel->rel_addr.s = cdio_from_bcd8 (bsdinfo.what.position.reladdr.msf.second);
|
||||
p_subchannel->rel_addr.f = cdio_from_bcd8 (bsdinfo.what.position.reladdr.msf.frame);
|
||||
}
|
||||
return i_rc;
|
||||
}
|
||||
@@ -728,8 +731,8 @@ close_tray_freebsd (const char *psz_device)
|
||||
int fd = open (psz_device, O_RDONLY|O_NONBLOCK, 0);
|
||||
int i_rc;
|
||||
|
||||
if((i_rc = ioctl(fd, CDIOCSTART)) != 0) {
|
||||
cdio_warn ("ioctl CDROMCLOSETRAY failed: %s\n", strerror(errno));
|
||||
if((i_rc = ioctl(fd, CDIOCCLOSE)) != 0) {
|
||||
cdio_warn ("ioctl CDIOCCLOSE failed: %s\n", strerror(errno));
|
||||
return DRIVER_OP_ERROR;
|
||||
}
|
||||
close(fd);
|
||||
@@ -798,6 +801,7 @@ cdio_open_am_freebsd (const char *psz_orig_source_name,
|
||||
.lseek = cdio_generic_lseek,
|
||||
.read = cdio_generic_read,
|
||||
.read_audio_sectors = read_audio_sectors_freebsd,
|
||||
.read_data_sectors = read_data_sectors_mmc,
|
||||
.read_mode2_sector = read_mode2_sector_freebsd,
|
||||
.read_mode2_sectors = read_mode2_sectors_freebsd,
|
||||
.read_toc = read_toc_freebsd,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: freebsd_cam.c,v 1.7 2005/02/07 03:36:02 rocky Exp $
|
||||
$Id: freebsd_cam.c,v 1.8 2005/04/05 02:13:58 rocky Exp $
|
||||
|
||||
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
static const char _rcsid[] = "$Id: freebsd_cam.c,v 1.7 2005/02/07 03:36:02 rocky Exp $";
|
||||
static const char _rcsid[] = "$Id: freebsd_cam.c,v 1.8 2005/04/05 02:13:58 rocky Exp $";
|
||||
|
||||
#ifdef HAVE_FREEBSD_CDROM
|
||||
|
||||
@@ -72,19 +72,20 @@ run_mmc_cmd_freebsd_cam( const void *p_user_data, unsigned int i_timeout_ms,
|
||||
ccb.ccb_h.target_lun = p_env->cam->target_lun;
|
||||
ccb.ccb_h.timeout = i_timeout_ms;
|
||||
|
||||
if (!i_cdb)
|
||||
if (!i_buf)
|
||||
direction |= CAM_DIR_NONE;
|
||||
else
|
||||
direction |= (e_direction == SCSI_MMC_DATA_READ)?CAM_DIR_IN : CAM_DIR_OUT;
|
||||
cam_fill_csio (&(ccb.csio), 1, NULL,
|
||||
direction | CAM_DEV_QFRZDIS, MSG_SIMPLE_Q_TAG, p_buf, i_buf,
|
||||
sizeof(ccb.csio.sense_data), 0, 30*1000);
|
||||
|
||||
memcpy(ccb.csio.cdb_io.cdb_bytes, p_cdb, i_cdb);
|
||||
|
||||
memcpy(ccb.csio.cdb_io.cdb_bytes, p_cdb->field, i_cdb);
|
||||
ccb.csio.cdb_len =
|
||||
mmc_get_cmd_len(ccb.csio.cdb_io.cdb_bytes[0]);
|
||||
|
||||
cam_fill_csio (&(ccb.csio), 1, NULL,
|
||||
direction | CAM_DEV_QFRZDIS, MSG_SIMPLE_Q_TAG, p_buf, i_buf,
|
||||
sizeof(ccb.csio.sense_data), ccb.csio.cdb_len, 30*1000);
|
||||
|
||||
if ((i_status = cam_send_ccb(p_env->cam, &ccb)) < 0)
|
||||
{
|
||||
cdio_warn ("transport failed: %d", i_status);
|
||||
@@ -237,6 +238,7 @@ eject_media_freebsd_cam (_img_private_t *p_env)
|
||||
&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,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: device.c,v 1.22 2005/03/22 08:59:54 rocky Exp $
|
||||
$Id: device.c,v 1.23 2005/04/05 02:13:58 rocky Exp $
|
||||
|
||||
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
|
||||
|
||||
@@ -134,7 +134,7 @@ CdIo_driver_t CdIo_all_drivers[CDIO_MAX_DRIVER+1] = {
|
||||
&cdio_open_am_freebsd,
|
||||
&cdio_get_default_device_freebsd,
|
||||
&cdio_is_device_generic,
|
||||
NULL,
|
||||
&close_tray_freebsd
|
||||
},
|
||||
|
||||
{DRIVER_LINUX,
|
||||
|
||||
Reference in New Issue
Block a user