[Pkg-utopia-commits] r540 - in packages/unstable/hal/debian: .
patches
Sjoerd Simons
sjoerd at costa.debian.org
Wed Feb 1 22:53:23 UTC 2006
Author: sjoerd
Date: 2006-02-01 22:53:22 +0000 (Wed, 01 Feb 2006)
New Revision: 540
Added:
packages/unstable/hal/debian/patches/03_storage_sigio.patch
Modified:
packages/unstable/hal/debian/changelog
Log:
Use SG_IO interface to poll cdrom eject button
Modified: packages/unstable/hal/debian/changelog
===================================================================
--- packages/unstable/hal/debian/changelog 2006-02-01 22:48:06 UTC (rev 539)
+++ packages/unstable/hal/debian/changelog 2006-02-01 22:53:22 UTC (rev 540)
@@ -2,14 +2,17 @@
* debian/patches/01_hal_privsep.patch
+ Updated to current CVS version
- * udev communicated events to hal via a socket now, which as a side-effect
+ * udev communicated events to hal via a socket now, which as a side-effect
fixes incompatibility with udev 0.83 (Closes: #350639, #350762)
* Let hal look in the right location for the pci.ids and usb.ids files
(Closes: #341824)
* Because the addons run with root privs. now, harddisk properties are
available (Closes: #290653)
+ * debian/patches/03_storage_sigio.patch
+ + Added. Switch EjectButton detection to SG_IO interface. Solves some
+ problems with scsi cdrom drives (from hal CVS)
- -- Sjoerd Simons <sjoerd at debian.org> Wed, 1 Feb 2006 23:07:21 +0100
+ -- Sjoerd Simons <sjoerd at debian.org> Wed, 1 Feb 2006 23:52:18 +0100
hal (0.5.6-1) experimental; urgency=low
Added: packages/unstable/hal/debian/patches/03_storage_sigio.patch
===================================================================
--- packages/unstable/hal/debian/patches/03_storage_sigio.patch 2006-02-01 22:48:06 UTC (rev 539)
+++ packages/unstable/hal/debian/patches/03_storage_sigio.patch 2006-02-01 22:53:22 UTC (rev 540)
@@ -0,0 +1,67 @@
+diff -ruN hal-0.5.6-old/hald/linux2/addons/addon-storage.c hal-0.5.6/hald/linux2/addons/addon-storage.c
+--- hal-0.5.6-old/hald/linux2/addons/addon-storage.c 2005-11-02 16:38:14.000000000 +0100
++++ hal-0.5.6/hald/linux2/addons/addon-storage.c 2006-02-01 23:50:49.000000000 +0100
+@@ -1,5 +1,5 @@
+ /***************************************************************************
+- * CVSID: $Id: addon-storage.c,v 1.14 2005/11/02 15:38:14 david Exp $
++ * CVSID: $Id: addon-storage.c,v 1.15 2006/01/27 15:43:58 kay Exp $
+ *
+ * addon-storage.c : Poll storage devices for media changes
+ *
+@@ -42,6 +42,7 @@
+ #include <linux/cdrom.h>
+ #include <linux/fs.h>
+ #include <mntent.h>
++#include <scsi/sg.h>
+
+ #include "libhal/libhal.h"
+
+@@ -270,26 +271,22 @@
+
+ /* check if eject button was pressed */
+ if (got_media) {
+- struct cdrom_generic_command cgc;
+- struct request_sense sense;
++ unsigned char cdb[10] = { 0x4a, 1, 0, 0, 16, 0, 0, 0, 8, 0};
+ unsigned char buffer[8];
+- int ret;
++ struct sg_io_hdr sg_h;
++ int retval;
+
+- memset (&cgc, 0, sizeof (struct cdrom_generic_command));
+- memset (&sense, 0, sizeof (struct request_sense));
+- memset (buffer, 0, sizeof (buffer));
+- cgc.cmd[0] = GPCMD_GET_EVENT_STATUS_NOTIFICATION;
+- cgc.cmd[1] = 1;
+- cgc.cmd[4] = 16;
+- cgc.cmd[8] = sizeof (buffer);
+- cgc.timeout = 600;
+- cgc.buffer = buffer;
+- cgc.buflen = sizeof (buffer);
+- cgc.data_direction = CGC_DATA_READ;
+- cgc.sense = &sense;
+- cgc.quiet = 1;
+- ret = ioctl (fd, CDROM_SEND_PACKET, &cgc);
+- if (ret == 0 && (buffer[4] & 0x0f) == 0x01) {
++ memset(buffer, 0, sizeof(buffer));
++ memset(&sg_h, 0, sizeof(struct sg_io_hdr));
++ sg_h.interface_id = 'S';
++ sg_h.cmd_len = sizeof(cdb);
++ sg_h.dxfer_direction = SG_DXFER_FROM_DEV;
++ sg_h.dxfer_len = sizeof(buffer);
++ sg_h.dxferp = buffer;
++ sg_h.cmdp = cdb;
++ sg_h.timeout = 5000;
++ retval = ioctl(fd, SG_IO, &sg_h);
++ if (retval == 0 && sg_h.status == 0 && (buffer[4] & 0x0f) == 0x01) {
+ DBusError error;
+
+ /* emit signal from drive device object */
+@@ -297,7 +294,6 @@
+ libhal_device_emit_condition (ctx, udi, "EjectPressed", "", &error);
+ }
+ }
+-
+ close (fd);
+ } else {
+ fd = open (device_file, O_RDONLY);
More information about the Pkg-utopia-commits
mailing list