118c2aff7Sartem /*************************************************************************** 218c2aff7Sartem * 318c2aff7Sartem * devinfo_ieee1394.c : IEEE 1394/FireWire devices 418c2aff7Sartem * 5*112cd14aSqz150045 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 618c2aff7Sartem * Use is subject to license terms. 718c2aff7Sartem * 818c2aff7Sartem * Licensed under the Academic Free License version 2.1 918c2aff7Sartem * 1018c2aff7Sartem **************************************************************************/ 1118c2aff7Sartem 1292f38132Sartem #pragma ident "%Z%%M% %I% %E% SMI" 1392f38132Sartem 1400687e57Sartem #ifdef HAVE_CONFIG_H 1500687e57Sartem # include <config.h> 1600687e57Sartem #endif 1700687e57Sartem 1818c2aff7Sartem #include <stdio.h> 1918c2aff7Sartem #include <string.h> 2018c2aff7Sartem #include <libdevinfo.h> 2118c2aff7Sartem #include <sys/types.h> 2218c2aff7Sartem #include <sys/mkdev.h> 2318c2aff7Sartem #include <sys/stat.h> 2418c2aff7Sartem 2518c2aff7Sartem #include "../osspec.h" 2618c2aff7Sartem #include "../logger.h" 2718c2aff7Sartem #include "../hald.h" 2818c2aff7Sartem #include "../hald_dbus.h" 2918c2aff7Sartem #include "../device_info.h" 3018c2aff7Sartem #include "../util.h" 3118c2aff7Sartem #include "../ids.h" 3218c2aff7Sartem #include "hotplug.h" 3318c2aff7Sartem #include "devinfo.h" 3418c2aff7Sartem #include "devinfo_ieee1394.h" 3518c2aff7Sartem 3618c2aff7Sartem HalDevice *devinfo_ieee1394_add(HalDevice *parent, di_node_t node, char *devfs_path, char *device_type); 3718c2aff7Sartem static HalDevice *devinfo_scsa1394_add(HalDevice *d, di_node_t node, gchar *devfs_path); 3818c2aff7Sartem 3918c2aff7Sartem DevinfoDevHandler devinfo_ieee1394_handler = { 4018c2aff7Sartem devinfo_ieee1394_add, 4118c2aff7Sartem NULL, 4218c2aff7Sartem NULL, 4318c2aff7Sartem NULL, 4418c2aff7Sartem NULL, 4518c2aff7Sartem NULL 4618c2aff7Sartem }; 4718c2aff7Sartem 4818c2aff7Sartem HalDevice * 4918c2aff7Sartem devinfo_ieee1394_add(HalDevice *parent, di_node_t node, char *devfs_path, char *device_type) 5018c2aff7Sartem { 5118c2aff7Sartem HalDevice *d = NULL; 5218c2aff7Sartem char *compat; 5318c2aff7Sartem char *driver_name; 5418c2aff7Sartem 5518c2aff7Sartem /* 5618c2aff7Sartem * we distinguish 1394 devices by compatible name 5718c2aff7Sartem * starting with 'firewire' 5818c2aff7Sartem */ 5918c2aff7Sartem if ((di_compatible_names (node, &compat) < 1) || 6018c2aff7Sartem (strncmp (compat, "firewire", sizeof ("firewire") - 1) != 0)) { 6118c2aff7Sartem return (NULL); 6218c2aff7Sartem } 6318c2aff7Sartem 6418c2aff7Sartem if ((driver_name = di_driver_name (node)) == NULL) { 6518c2aff7Sartem return (NULL); 6618c2aff7Sartem } 6718c2aff7Sartem 6818c2aff7Sartem if (strcmp (driver_name, "scsa1394") == 0) { 6918c2aff7Sartem d = devinfo_scsa1394_add (parent, node, devfs_path); 7018c2aff7Sartem } 7118c2aff7Sartem 7218c2aff7Sartem return (d); 7318c2aff7Sartem } 7418c2aff7Sartem 7518c2aff7Sartem static HalDevice * 7618c2aff7Sartem devinfo_scsa1394_add(HalDevice *parent, di_node_t node, gchar *devfs_path) 7718c2aff7Sartem { 7818c2aff7Sartem HalDevice *d = NULL; 7918c2aff7Sartem 8018c2aff7Sartem d = hal_device_new (); 8118c2aff7Sartem 8218c2aff7Sartem devinfo_set_default_properties (d, parent, node, devfs_path); 83*112cd14aSqz150045 hal_device_property_set_string (d, "info.subsystem", "ieee1394"); 8418c2aff7Sartem hal_device_property_set_string (d, "info.product", "FireWire SBP-2 device"); 8518c2aff7Sartem 8618c2aff7Sartem devinfo_add_enqueue (d, devfs_path, &devinfo_ieee1394_handler); 8718c2aff7Sartem 8818c2aff7Sartem return (d); 8918c2aff7Sartem } 9018c2aff7Sartem 91