hal: Branch 'master'

Danny Kukawka dkukawka at kemper.freedesktop.org
Wed Aug 16 09:49:39 PDT 2006


 doc/spec/hal-spec-properties.xml |   68 +++++++++++++++++++++++++++++++++++++++
 hald/linux2/physdev.c            |   41 ++++++++++++++++-------
 2 files changed, 96 insertions(+), 13 deletions(-)

New commits:
diff-tree 189b452798f9441dd59d90d806b417f1a7725006 (from fc2d5aa046af0d4de600d48c92dce9017969057a)
Author: Danny Kukawka <danny.kukawka at web.de>
Date:   Wed Aug 16 18:48:30 2006 +0200

    add more scsi.type mapping and add property info to spec
    
    Added missing scsi.type mappings which are e.g. needed to identify
    scsi printer/scanner or media changer/raid devices. Added also the
    property information about scsi.type to the spec.
    
    Mapping of kernel types is:
     TYPE_DISK, TYPE_MOD, TYPE_RBC --> disk
     TYPE_TAPE                     --> tape
     TYPE_PROCESSOR                --> processor
     TYPE_WORM, TYPE_ROM           --> cdrom
     TYPE_SCANNER                  --> scanner
     TYPE_MEDIUM_CHANGER           --> medium_changer
     TYPE_COMM                     --> comm
     TYPE_RAID                     --> raid

diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml
index 264d736..4cb5ead 100644
--- a/doc/spec/hal-spec-properties.xml
+++ b/doc/spec/hal-spec-properties.xml
@@ -962,6 +962,74 @@
               <entry>Yes</entry>
               <entry>SCSI Logical Unit Number</entry>
             </row>
+            <row>
+              <entry>
+                <literal>scsi.type</literal> (string)
+              </entry>
+              <entry>Example: disk</entry>
+              <entry>Yes</entry>
+              <entry>SCSI device type</entry>
+            </row>
+            <row>
+              <entry></entry>
+              <entry>cdrom</entry>
+              <entry></entry>
+              <entry>This is a SCSI cdrom device.</entry>
+            </row>
+            <row>
+              <entry></entry>
+              <entry>comm</entry>
+              <entry></entry>
+              <entry>This is a SCSI communication device.</entry>
+            </row>
+            <row>
+              <entry></entry>
+              <entry>disk</entry>
+              <entry></entry>
+              <entry>This is a SCSI disk device.</entry>
+            </row>
+            <row>
+              <entry></entry>
+              <entry>medium_changer</entry>
+              <entry></entry>
+              <entry>This is a SCSI media changer (e.g. for CD/Tape).</entry>
+            </row>
+            <row>
+              <entry></entry>
+              <entry>printer</entry>
+              <entry></entry>
+              <entry>This is a SCSI printer.</entry>
+            </row>
+            <row>
+              <entry></entry>
+              <entry>processor</entry>
+              <entry></entry>
+              <entry>This is a SCSI processor device.</entry>
+            </row>
+            <row>
+              <entry></entry>
+              <entry>raid</entry>
+              <entry></entry>
+              <entry>This is a SCSI raid device.</entry>
+            </row>
+            <row>
+              <entry></entry>
+              <entry>scanner</entry>
+              <entry></entry>
+              <entry>This is a SCSI scanner.</entry>
+            </row>
+            <row>
+              <entry></entry>
+              <entry>tape</entry>
+              <entry></entry>
+              <entry>This is a SCSI tape device.</entry>
+            </row>
+            <row>
+              <entry></entry>
+              <entry>unknown</entry>
+              <entry></entry>
+              <entry>The type of this SCSI device is unknwon.</entry>
+            </row>
           </tbody>
         </tgroup>
       </informaltable>
diff --git a/hald/linux2/physdev.c b/hald/linux2/physdev.c
index 9d5b366..c2ae795 100644
--- a/hald/linux2/physdev.c
+++ b/hald/linux2/physdev.c
@@ -674,25 +674,40 @@ scsi_add (const gchar *sysfs_path, HalDe
 	hal_util_get_int_from_file (sysfs_path, "type", &type, 0);
 	HAL_INFO (("%s/type -> %d (-> scsi.type)", sysfs_path, type));
 	switch (type) {
-	case 0:
-		/* Disk */
-	case 14:
-		/* TYPE_RBC (Reduced Block Commands)
-		 * Simple Direct Access Device, set it to disk
-		 * (some Firewire Disks use it)
-		 */
+	case 0:  /* TYPE_DISK (disk) */
+	case 7:  /* TYPE_MOD (Magneto-optical disk) */
+	case 14: /* TYPE_RBC (Reduced Block Commands)
+		  * Simple Direct Access Device, set it to disk
+		  * (some Firewire Disks use it)
+		  */
 		hal_device_property_set_string (d, "scsi.type", "disk");
 		break;
-	case 1:
-		/* Tape */
+	case 1: /* TYPE_TAPE (Tape) */
 		hal_device_property_set_string (d, "scsi.type", "tape");
 		break;
-	case 4:
-		/* WORM */
-	case 5:
-		/* CD-ROM */
+	case 2:
+		/* TYPE_PRINTER (Tape) */
+		hal_device_property_set_string (d, "scsi.type", "printer");
+		break;
+	case 3:  /* TYPE_PROCESSOR */
+		hal_device_property_set_string (d, "scsi.type", "processor");
+		break;
+	case 4: /* TYPE_WORM */
+	case 5: /* TYPE_ROM (CD-ROM) */
 		hal_device_property_set_string (d, "scsi.type", "cdrom");
 		break;
+	case 6: /* TYPE_SCANNER */
+		hal_device_property_set_string (d, "scsi.type", "scanner");
+		break;
+	case 8: /* TYPE_MEDIUM_CHANGER */
+		hal_device_property_set_string (d, "scsi.type", "medium_changer");
+		break;
+	case 9: /* TYPE_COMM */
+		hal_device_property_set_string (d, "scsi.type", "comm");
+		break;
+	case 12: /* TYPE_RAID */
+		hal_device_property_set_string (d, "scsi.type", "raid");
+		break;
 	default:
 		hal_device_property_set_string (d, "scsi.type", "unknown");
 	}



More information about the hal-commit mailing list