Patch for libcdio-0.81 FreeBSD drive lock

View: New views
2 Messages — Rating Filter:   Alert me  

Patch for libcdio-0.81 FreeBSD drive lock

by John Wehle :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

A side effect of opening the cdrom device on FreeBSD is it
locks the drive.  This makes cdio_get_media_changed less
useful and prevents you from being able to switch disks
when using things such as the audacious media player.

This patch simply unlocks the drive right after it's opened
prior to opening the cam passthrough device.

-- John Wehle
------------------8<------------------------8<------------------------
--- lib/driver/FreeBSD/freebsd_cam.c.ORIGINAL 2008-04-24 02:59:26.000000000 -0400
+++ lib/driver/FreeBSD/freebsd_cam.c 2009-04-21 02:46:02.000000000 -0400
@@ -122,6 +122,8 @@ init_freebsd_cam (_img_private_t *p_env)
       return false;
     }
 
+  (void)ioctl(p_env->gen.fd, CDIOCALLOW);
+
   if (ioctl (p_env->gen.fd, CAMGETPASSTHRU, &p_env->ccb) < 0)
     {
       cdio_warn ("open: %s", strerror (errno));
-------------------------------------------------------------------------
|   Feith Systems  |   Voice: 1-215-646-8000  |  Email: john@...  |
|    John Wehle    |     Fax: 1-215-540-5495  |                         |
-------------------------------------------------------------------------




Re: Patch for libcdio-0.81 FreeBSD drive lock

by r- :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Patch applied. Please double check I did this correctly.

Thanks

On Thu, Apr 23, 2009 at 12:39 AM, John Wehle <john@...> wrote:

> A side effect of opening the cdrom device on FreeBSD is it
> locks the drive.  This makes cdio_get_media_changed less
> useful and prevents you from being able to switch disks
> when using things such as the audacious media player.
>
> This patch simply unlocks the drive right after it's opened
> prior to opening the cam passthrough device.
>
> -- John Wehle
> ------------------8<------------------------8<------------------------
> --- lib/driver/FreeBSD/freebsd_cam.c.ORIGINAL   2008-04-24
> 02:59:26.000000000 -0400
> +++ lib/driver/FreeBSD/freebsd_cam.c    2009-04-21 02:46:02.000000000 -0400
> @@ -122,6 +122,8 @@ init_freebsd_cam (_img_private_t *p_env)
>       return false;
>     }
>
> +  (void)ioctl(p_env->gen.fd, CDIOCALLOW);
> +
>   if (ioctl (p_env->gen.fd, CAMGETPASSTHRU, &p_env->ccb) < 0)
>     {
>       cdio_warn ("open: %s", strerror (errno));
> -------------------------------------------------------------------------
> |   Feith Systems  |   Voice: 1-215-646-8000  |  Email: john@...  |
> |    John Wehle    |     Fax: 1-215-540-5495  |                         |
> -------------------------------------------------------------------------
>
>
>
>