hal/hald/linux block_class_device.c, 1.86.2.7, 1.86.2.8 osspec.c,
1.52.2.4, 1.52.2.5 pcmcia_bus_device.c, NONE, 1.1.2.1
David Zeuthen
david at freedesktop.org
Fri Jan 21 07:46:57 PST 2005
- Previous message: hal/hald/linux/libsysfs dlist.c, 1.2, 1.2.2.1 dlist.h, 1.2,
1.2.2.1 sysfs.h, 1.2, 1.2.2.1 sysfs_dir.c, 1.3, 1.3.2.1
- Next message: hal/hald/linux/libsysfs sysfs.h,1.2.2.1,1.2.2.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvs/hal/hal/hald/linux
In directory gabe:/tmp/cvs-serv9479/hald/linux
Modified Files:
Tag: hal-0_4-stable-branch
block_class_device.c osspec.c
Added Files:
Tag: hal-0_4-stable-branch
pcmcia_bus_device.c
Log Message:
2005-01-21 David Zeuthen <davidz at redhat.com>
* tools/fstab-sync.c (remove_udi): Check for return value to
avoid dereferencing a NULL pointer
* hald/linux/block_class_device.c (block_class_pre_process): Only
do drive_id real SCSI since doing an INQUIRY on USB devices may
crash the device if the transfer length is not exactly 36 bytes.
* hald/linux/libsysfs/sysfs.h: Remove the #define DEBUG symbol
again
* hald/Makefile.am (hald_SOURCES): Add linux/pcmcia_bus_device.c
* hald/linux/pcmcia_bus_device.c: New file
* hald/linux/osspec.c: Add support for 16-bit PCMCIA in sysfs;
without this hald won't work for 16-bit PCMCIA cards and a
kernel with sysfs support for those.
Index: block_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/Attic/block_class_device.c,v
retrieving revision 1.86.2.7
retrieving revision 1.86.2.8
diff -u -d -r1.86.2.7 -r1.86.2.8
--- block_class_device.c 7 Jan 2005 03:07:45 -0000 1.86.2.7
+++ block_class_device.c 21 Jan 2005 15:46:55 -0000 1.86.2.8
@@ -1462,6 +1462,7 @@
device_file = hal_device_property_get_string (d, "block.device");
did = drive_id_open_node(device_file);
+
if (drive_id_probe(did, DRIVE_ID_ATA) == 0) {
if (did->serial[0] != '\0')
hal_device_property_set_string (stordev, "storage.serial", did->serial);
@@ -1511,18 +1512,28 @@
}
device_file = hal_device_property_get_string (d, "block.device");
- did = drive_id_open_node(device_file);
- if (drive_id_probe(did, DRIVE_ID_SCSI) == 0) {
- if (did->serial[0] != '\0')
- hal_device_property_set_string (stordev,
- "storage.serial",
- did->serial);
- if (did->revision[0] != '\0')
- hal_device_property_set_string (stordev,
- "storage.revision",
- did->revision);
- }
- drive_id_close(did);
+
+ /* Only do drive_id on real SCSI devices - not on USB which uses emulated SCSI
+ * since an INQUIRY on most USB devices may crash the storage device if the
+ * transfer length isn't exactly 36 bytes.
+ *
+ * (See also Red Hat bug #145256)
+ */
+ if (strcmp (hal_device_property_get_string (stordev, "storage.bus"), "scsi") == 0) {
+
+ did = drive_id_open_node(device_file);
+ if (drive_id_probe(did, DRIVE_ID_SCSI) == 0) {
+ if (did->serial[0] != '\0')
+ hal_device_property_set_string (stordev,
+ "storage.serial",
+ did->serial);
+ if (did->revision[0] != '\0')
+ hal_device_property_set_string (stordev,
+ "storage.revision",
+ did->revision);
+ }
+ drive_id_close(did);
+ }
/* see if this is really a SATA disk */
#if 0
Index: osspec.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/Attic/osspec.c,v
retrieving revision 1.52.2.4
retrieving revision 1.52.2.5
diff -u -d -r1.52.2.4 -r1.52.2.5
--- osspec.c 12 Jan 2005 17:38:44 -0000 1.52.2.4
+++ osspec.c 21 Jan 2005 15:46:55 -0000 1.52.2.5
@@ -90,6 +90,7 @@
extern BusDeviceHandler ide_bus_handler;
extern BusDeviceHandler scsi_bus_handler;
extern BusDeviceHandler macio_bus_handler;
+extern BusDeviceHandler pcmcia_bus_handler;
extern BusDeviceHandler platform_bus_handler;
extern BusDeviceHandler usb_serial_bus_handler;
@@ -123,6 +124,7 @@
&ide_host_bus_handler,
&ide_bus_handler,
&macio_bus_handler,
+ &pcmcia_bus_handler,
&platform_bus_handler,
&scsi_bus_handler,
&usb_serial_bus_handler,
--- NEW FILE: pcmcia_bus_device.c ---
/***************************************************************************
* CVSID: $Id: pcmcia_bus_device.c,v 1.1.2.1 2005/01/21 15:46:55 david Exp $
*
* PCMCIA bus device
*
* Copyright (C) 2004 David Zeuthen, <david at fubar.dk>
*
* Licensed under the Academic Free License version 2.0
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
#include <assert.h>
#include <unistd.h>
#include <stdarg.h>
#include "../logger.h"
#include "../device_store.h"
#include "bus_device.h"
#include "common.h"
/**
* @defgroup HalDaemonLinuxIde IDE
* @ingroup HalDaemonLinux
* @brief IDE
* @{
*/
static char *
pcmcia_device_compute_udi (HalDevice *d, int append_num)
{
static char buf[256];
if (append_num == -1)
sprintf (buf, "/org/freedesktop/Hal/devices/pcmcia_%s",
hal_device_property_get_string (d, "pcmcia.bus_id"));
else
sprintf (buf, "/org/freedesktop/Hal/devices/pcmcia_%s/%d",
hal_device_property_get_string (d, "pcmcia.bus_id"),
append_num);
return buf;
}
static void
pcmcia_device_pre_process (BusDeviceHandler *self,
HalDevice *d,
const char *sysfs_path,
struct sysfs_device *device)
{
hal_device_property_set_string (d, "pcmcia.bus_id", device->bus_id);
}
BusDeviceHandler pcmcia_bus_handler = {
bus_device_init, /**< init function */
bus_device_shutdown, /**< shutdown function */
bus_device_tick, /**< timer function */
bus_device_accept, /**< accept function */
bus_device_visit, /**< visitor function */
bus_device_removed, /**< device is removed */
pcmcia_device_compute_udi, /**< UDI computing function */
pcmcia_device_pre_process, /**< add more properties */
bus_device_got_udi, /**< got UDI */
bus_device_in_gdl, /**< in GDL */
"pcmcia", /**< sysfs bus name */
"pcmcia" /**< namespace */
};
/** @} */
- Previous message: hal/hald/linux/libsysfs dlist.c, 1.2, 1.2.2.1 dlist.h, 1.2,
1.2.2.1 sysfs.h, 1.2, 1.2.2.1 sysfs_dir.c, 1.3, 1.3.2.1
- Next message: hal/hald/linux/libsysfs sysfs.h,1.2.2.1,1.2.2.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the hal-commit
mailing list