Index: serialinterface.h
===================================================================
--- serialinterface.h	(revision 0)
+++ serialinterface.h	(revision 0)
@@ -0,0 +1,98 @@
+/*  This file is part of the KDE project
+    Copyright (C) 2009 Harald Fernengel <harry@kdevelop.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License version 2 as published by the Free Software Foundation.
+
+    This library 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
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+
+*/
+
+#ifndef SOLID_SERIALINTERFACE_H
+#define SOLID_SERIALINTERFACE_H
+
+#include <solid/solid_export.h>
+
+#include <solid/deviceinterface.h>
+
+namespace Solid
+{
+    class SerialInterfacePrivate;
+    class Device;
+
+    /**
+     * This device interface is available on network interfaces.
+     */
+    class SOLID_EXPORT SerialInterface : public DeviceInterface
+    {
+        Q_OBJECT
+        Q_PROPERTY(QString ifaceName READ ifaceName)
+        Q_PROPERTY(QString serialType READ serialType)
+        Q_PROPERTY(int port READ port)
+        Q_DECLARE_PRIVATE(SerialInterface)
+        friend class Device;
+
+    private:
+        /**
+         * Creates a new SerialInterface object.
+         * You generally won't need this. It's created when necessary using
+         * Device::as().
+         *
+         * @param backendObject the device interface object provided by the backend
+         * @see Solid::Device::as()
+         */
+        explicit SerialInterface(QObject *backendObject);
+
+    public:
+        /**
+         * Destroys a SerialInterface object.
+         */
+        virtual ~SerialInterface();
+
+
+        /**
+         * Get the Solid::DeviceInterface::Type of the SerialInterface device interface.
+         *
+         * @return the SerialInterface device interface type
+         * @see Solid::Ifaces::Enums::DeviceInterface::Type
+         */
+        static Type deviceInterfaceType() { return DeviceInterface::SerialInterface; }
+
+
+        /**
+         * Retrieves the name of the interface in the system.
+         * This name is system dependent, it allows to identify the interface
+         * in the system. For example it can be of the form "/dev/ttyS0" under Linux.
+         *
+         * @return the interface name
+         */
+        virtual QString ifaceName() const;
+
+        /**
+         * Retrieves the type of the serial device.
+         * Examples for Linux are "usb" for USB based serial devices,
+         * or "platform" for built-in serial ports.
+         *
+         * @return the type of the serial device
+         */
+        virtual QString serialType() const;
+
+        /**
+         * Retrieves the port number, e.g. 0 for the first COM port.
+         *
+         * @return The port number of the serial device.
+         */
+        virtual int port() const;
+    };
+}
+
+#endif // SOLID_SERIALINTERFACE_H
Index: serialinterface_p.h
===================================================================
--- serialinterface_p.h	(revision 0)
+++ serialinterface_p.h	(revision 0)
@@ -0,0 +1,70 @@
+/*  This file is part of the KDE project
+    Copyright (C) 2009 Harald Fernengel <harry@kdevelop.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License version 2 as published by the Free Software Foundation.
+
+    This library 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
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+
+*/
+
+#ifndef SOLID_SERIALINTERFACE_P_H
+#define SOLID_SERIALINTERFACE_P_H
+
+#include "deviceinterface_p.h"
+
+namespace Solid
+{
+    class SerialInterfacePrivate : public DeviceInterfacePrivate
+    {
+    public:
+        SerialInterfacePrivate()
+            : DeviceInterfacePrivate() { }
+    };
+}
+
+#endif // SOLID_SERIALINTERFACE_P_H
+/*  This file is part of the KDE project
+    Copyright (C) 2009 Harald Fernengel <harry@kdevelop.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License version 2 as published by the Free Software Foundation.
+
+    This library 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
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+
+*/
+
+#ifndef SOLID_SERIALINTERFACE_P_H
+#define SOLID_SERIALINTERFACE_P_H
+
+#include "deviceinterface_p.h"
+
+namespace Solid
+{
+    class SerialInterfacePrivate : public DeviceInterfacePrivate
+    {
+    public:
+        SerialInterfacePrivate()
+            : DeviceInterfacePrivate() { }
+    };
+}
+
+#endif // SOLID_SERIALINTERFACE_P_H
Index: device.cpp
===================================================================
--- device.cpp	(revision 913689)
+++ device.cpp	(working copy)
@@ -61,6 +61,8 @@
 #include <solid/ifaces/dvbinterface.h>
 #include <solid/video.h>
 #include <solid/ifaces/video.h>
+#include <solid/serialinterface.h>
+#include <solid/ifaces/serialinterface.h>
 
 
 Solid::Device::Device(const QString &udi)
@@ -212,6 +214,9 @@
             case DeviceInterface::Video:
                 iface = deviceinterface_cast(Ifaces::Video, Video, dev_iface);
                 break;
+            case DeviceInterface::SerialInterface:
+                iface = deviceinterface_cast(Ifaces::SerialInterface, SerialInterface, dev_iface);
+                break;
             case DeviceInterface::Unknown:
             case DeviceInterface::Last:
                 break;
Index: ifaces/serialinterface.h
===================================================================
--- ifaces/serialinterface.h	(revision 0)
+++ ifaces/serialinterface.h	(revision 0)
@@ -0,0 +1,72 @@
+/*  This file is part of the KDE project
+    Copyright (C) 2009 Harald Fernengel <harry@kdevelop.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License version 2 as published by the Free Software Foundation.
+
+    This library 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
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+
+*/
+
+#ifndef SOLID_IFACE_SERIALINTERFACE_H
+#define SOLID_IFACE_SERIALINTERFACE_H
+
+#include <solid/ifaces/deviceinterface.h>
+
+namespace Solid
+{
+namespace Ifaces
+{
+    /**
+     * This device interface is available on serial interfaces,
+     * like modems.
+     */
+    class SerialInterface : virtual public DeviceInterface
+    {
+    public:
+        /**
+         * Destroys a SerialInterface object.
+         */
+        virtual ~SerialInterface();
+
+
+        /**
+         * Retrieves the name of the interface in the system.
+         * This name is system dependent, it allows to identify the interface
+         * in the system. For example it can be of the form "/dev/ttyS0" under Linux.
+         *
+         * @return the interface name
+         */
+        virtual QString ifaceName() const = 0;
+
+        /**
+         * Retrieves the type of the serial device.
+         * Examples for Linux are "usb" for USB based serial devices,
+         * or "platform" for built-in serial ports.
+         *
+         * @return the type of the serial device
+         */
+        virtual QString serialType() const = 0;
+
+        /**
+         * Retrieves the port number, e.g. 0 for the first COM port.
+         *
+         * @return The port number of the serial device.
+         */
+        virtual int port() const = 0;
+    };
+}
+}
+
+Q_DECLARE_INTERFACE(Solid::Ifaces::SerialInterface, "org.kde.Solid.Ifaces.SerialInterface/0.1")
+
+#endif // SOLID_IFACE_SERIALINTERFACE_H
Index: ifaces/serialinterface.cpp
===================================================================
--- ifaces/serialinterface.cpp	(revision 0)
+++ ifaces/serialinterface.cpp	(revision 0)
@@ -0,0 +1,25 @@
+/*  This file is part of the KDE project
+    Copyright (C) 2009 Harald Fernengel <harry@kdevelop.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License version 2 as published by the Free Software Foundation.
+
+    This library 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
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+
+*/
+
+#include "serialinterface.h"
+
+Solid::Ifaces::SerialInterface::~SerialInterface()
+{
+}
+
Index: deviceinterface.h
===================================================================
--- deviceinterface.h	(revision 913689)
+++ deviceinterface.h	(working copy)
@@ -58,6 +58,7 @@
          * - Camera : A digital camera
          * - PortableMediaPlayer: A portable media player
          * - NetworkInterface: A network interface
+         * - SerialInterface: A serial interface
          */
         enum Type { Unknown = 0, GenericInterface = 1, Processor = 2,
                     Block = 3, StorageAccess = 4, StorageDrive = 5,
@@ -65,6 +66,7 @@
                     Camera = 9, PortableMediaPlayer = 10,
                     NetworkInterface = 11, AcAdapter = 12, Battery = 13,
                     Button = 14, AudioInterface = 15, DvbInterface = 16, Video = 17,
+                    SerialInterface = 18,
                     Last = 0xffff  };
 
         /**
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(revision 913689)
+++ CMakeLists.txt	(working copy)
@@ -46,6 +46,7 @@
    camera.cpp 
    portablemediaplayer.cpp 
    networkinterface.cpp 
+   serialinterface.cpp
    acadapter.cpp 
    battery.cpp 
    button.cpp
@@ -72,6 +73,7 @@
    ifaces/dvbinterface.cpp
    ifaces/genericinterface.cpp
    ifaces/networkinterface.cpp
+   ifaces/serialinterface.cpp
    ifaces/opticaldisc.cpp
    ifaces/portablemediaplayer.cpp
    ifaces/processor.cpp
@@ -120,6 +122,7 @@
    backends/hal/haldevice.cpp
    backends/hal/halmanager.cpp
    backends/hal/halnetworkinterface.cpp
+   backends/hal/halserialinterface.cpp
    backends/hal/halopticaldisc.cpp
    backends/hal/halportablemediaplayer.cpp
    backends/hal/halprocessor.cpp
@@ -209,7 +212,7 @@
                storageaccess.h storagedrive.h opticaldrive.h storagevolume.h opticaldisc.h 
                camera.h portablemediaplayer.h networkinterface.h acadapter.h battery.h 
                button.h audiointerface.h dvbinterface.h predicate.h powermanagement.h 
-               networking.h video.h 
+               networking.h video.h serialinterface.h
                DESTINATION ${INCLUDE_INSTALL_DIR}/solid COMPONENT Devel)
 
 ########### parser build ###############
Index: serialinterface.cpp
===================================================================
--- serialinterface.cpp	(revision 0)
+++ serialinterface.cpp	(revision 0)
@@ -0,0 +1,54 @@
+/*  This file is part of the KDE project
+    Copyright (C) 2009 Harald Fernengel <harry@kdevelop.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License version 2 as published by the Free Software Foundation.
+
+    This library 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
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+
+*/
+
+#include "serialinterface.h"
+#include "serialinterface_p.h"
+
+#include "soliddefs_p.h"
+#include <solid/ifaces/serialinterface.h>
+
+Solid::SerialInterface::SerialInterface(QObject *backendObject)
+    : DeviceInterface(*new SerialInterfacePrivate(), backendObject)
+{
+}
+
+Solid::SerialInterface::~SerialInterface()
+{
+
+}
+
+QString Solid::SerialInterface::ifaceName() const
+{
+    Q_D(const SerialInterface);
+    return_SOLID_CALL(Ifaces::SerialInterface *, d->backendObject(), QString(), ifaceName());
+}
+
+QString Solid::SerialInterface::serialType() const
+{
+    Q_D(const SerialInterface);
+    return_SOLID_CALL(Ifaces::SerialInterface *, d->backendObject(), QString(), serialType());
+}
+
+int Solid::SerialInterface::port() const
+{
+    Q_D(const SerialInterface);
+    return_SOLID_CALL(Ifaces::SerialInterface *, d->backendObject(), 0, port());
+}
+
+#include "serialinterface.moc"
Index: backends/hal/haldeviceinterface.h
===================================================================
--- backends/hal/haldeviceinterface.h	(revision 913689)
+++ backends/hal/haldeviceinterface.h	(working copy)
@@ -102,6 +102,9 @@
         case Solid::DeviceInterface::Video:
             list << "video4linux";
             break;
+        case Solid::DeviceInterface::SerialInterface:
+            list << "serial";
+            break;
         case Solid::DeviceInterface::Unknown:
             break;
         case Solid::DeviceInterface::Last:
@@ -143,6 +146,8 @@
             return Solid::DeviceInterface::DvbInterface;
         else if (capability == "video4linux")
             return Solid::DeviceInterface::Video;
+        else if (capability == "serial")
+            return Solid::DeviceInterface::SerialInterface;
         else
             return Solid::DeviceInterface::Unknown;
     }
Index: backends/hal/haldevice.cpp
===================================================================
--- backends/hal/haldevice.cpp	(revision 913689)
+++ backends/hal/haldevice.cpp	(working copy)
@@ -45,6 +45,7 @@
 #include "halaudiointerface.h"
 #include "haldvbinterface.h"
 #include "halvideo.h"
+#include "halserialinterface.h"
 
 using namespace Solid::Backends::Hal;
 
@@ -246,6 +247,10 @@
         case Solid::AudioInterface::Modem:
             return QLatin1String("modem");
         }
+    } else if (category == "serial") {
+        // TODO - a serial device can be a modem, or just
+        // a COM port - need a new icon?
+        return QLatin1String("modem");
     }
 
     return QString();
@@ -343,7 +348,6 @@
     }
 
     QStringList cap_list = DeviceInterface::toStringList(type);
-    QStringList result;
 
     foreach (const QString &cap, cap_list)
     {
@@ -422,6 +426,9 @@
     case Solid::DeviceInterface::Video:
         iface = new Video(this);
         break;
+    case Solid::DeviceInterface::SerialInterface:
+        iface = new SerialInterface(this);
+        break;
     case Solid::DeviceInterface::Unknown:
     case Solid::DeviceInterface::Last:
         break;
Index: backends/hal/halserialinterface.cpp
===================================================================
--- backends/hal/halserialinterface.cpp	(revision 0)
+++ backends/hal/halserialinterface.cpp	(revision 0)
@@ -0,0 +1,54 @@
+/*  This file is part of the KDE project
+    Copyright (C) 2009 Harald Fernengel <harry@kdevelop.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License version 2 as published by the Free Software Foundation.
+
+    This library 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
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+
+*/
+
+#include "halserialinterface.h"
+
+#include "haldevice.h"
+
+#include <QtCore/QStringList>
+
+using namespace Solid::Backends::Hal;
+
+SerialInterface::SerialInterface(HalDevice *device)
+    : DeviceInterface(device)
+{
+
+}
+
+SerialInterface::~SerialInterface()
+{
+
+}
+
+QString SerialInterface::ifaceName() const
+{
+    return m_device->property("serial.device").toString();
+}
+
+QString SerialInterface::serialType() const
+{
+    return m_device->property("serial.type").toString();
+}
+
+int SerialInterface::port() const
+{
+    return m_device->property("serial.port").toInt();
+}
+
+#include "backends/hal/halserialinterface.moc"
Index: backends/hal/halserialinterface.h
===================================================================
--- backends/hal/halserialinterface.h	(revision 0)
+++ backends/hal/halserialinterface.h	(revision 0)
@@ -0,0 +1,51 @@
+/*  This file is part of the KDE project
+    Copyright (C) 2009 Harald Fernengel <harry@kdevelop.org>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License version 2 as published by the Free Software Foundation.
+
+    This library 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
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+
+*/
+
+#ifndef SOLID_BACKENDS_HAL_HALSERIALINTERFACE_H
+#define SOLID_BACKENDS_HAL_HALSERIALINTERFACE_H
+
+#include <solid/ifaces/serialinterface.h>
+#include "haldeviceinterface.h"
+
+namespace Solid
+{
+namespace Backends
+{
+namespace Hal
+{
+class HalDevice;
+
+class SerialInterface : public DeviceInterface, virtual public Solid::Ifaces::SerialInterface
+{
+    Q_OBJECT
+    Q_INTERFACES(Solid::Ifaces::SerialInterface)
+
+public:
+    SerialInterface(HalDevice *device);
+    virtual ~SerialInterface();
+
+    virtual QString ifaceName() const;
+    virtual QString serialType() const;
+    virtual int port() const;
+};
+}
+}
+}
+
+#endif // SOLID_BACKENDS_HAL_HALSERIALINTERFACE_H
