1 /*************************************************************************** 2 * 3 * devinfo_ieee1394.c : IEEE 1394/FireWire devices 4 * 5 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 6 * Use is subject to license terms. 7 * 8 * Licensed under the Academic Free License version 2.1 9 * 10 **************************************************************************/ 11 12 #pragma ident "%Z%%M% %I% %E% SMI" 13 14 #include <stdio.h> 15 #include <string.h> 16 #include <libdevinfo.h> 17 #include <sys/types.h> 18 #include <sys/mkdev.h> 19 #include <sys/stat.h> 20 21 #include "../osspec.h" 22 #include "../logger.h" 23 #include "../hald.h" 24 #include "../hald_dbus.h" 25 #include "../device_info.h" 26 #include "../util.h" 27 #include "../ids.h" 28 #include "hotplug.h" 29 #include "devinfo.h" 30 #include "devinfo_ieee1394.h" 31 32 HalDevice *devinfo_ieee1394_add(HalDevice *parent, di_node_t node, char *devfs_path, char *device_type); 33 static HalDevice *devinfo_scsa1394_add(HalDevice *d, di_node_t node, gchar *devfs_path); 34 35 DevinfoDevHandler devinfo_ieee1394_handler = { 36 devinfo_ieee1394_add, 37 NULL, 38 NULL, 39 NULL, 40 NULL, 41 NULL 42 }; 43 44 HalDevice * 45 devinfo_ieee1394_add(HalDevice *parent, di_node_t node, char *devfs_path, char *device_type) 46 { 47 HalDevice *d = NULL; 48 char *compat; 49 char *driver_name; 50 51 /* 52 * we distinguish 1394 devices by compatible name 53 * starting with 'firewire' 54 */ 55 if ((di_compatible_names (node, &compat) < 1) || 56 (strncmp (compat, "firewire", sizeof ("firewire") - 1) != 0)) { 57 return (NULL); 58 } 59 60 if ((driver_name = di_driver_name (node)) == NULL) { 61 return (NULL); 62 } 63 64 if (strcmp (driver_name, "scsa1394") == 0) { 65 d = devinfo_scsa1394_add (parent, node, devfs_path); 66 } 67 68 return (d); 69 } 70 71 static HalDevice * 72 devinfo_scsa1394_add(HalDevice *parent, di_node_t node, gchar *devfs_path) 73 { 74 HalDevice *d = NULL; 75 76 d = hal_device_new (); 77 78 devinfo_set_default_properties (d, parent, node, devfs_path); 79 hal_device_property_set_string (d, "info.bus", "ieee1394"); 80 hal_device_property_set_string (d, "info.product", "FireWire SBP-2 device"); 81 82 devinfo_add_enqueue (d, devfs_path, &devinfo_ieee1394_handler); 83 84 return (d); 85 } 86 87