diff options
author | Gabriel Burt <gabriel.burt@gmail.com> | 2011-04-26 20:50:29 -0500 |
---|---|---|
committer | Gabriel Burt <gabriel.burt@gmail.com> | 2011-04-26 22:03:54 -0500 |
commit | 15feb870a6f275e1c48123b3d69ce9d6d7200b65 (patch) | |
tree | fc475d86987bd416658991bd5ad9a5493fa03f61 | |
parent | 7fd93615f18ed9c1a3ef697673ede2afbada018a (diff) |
cleanup: Remove HAL backend
The GIO-based backend is the future, HAL has been obsolete for some time
now.
21 files changed, 0 insertions, 2204 deletions
diff --git a/Banshee.sln b/Banshee.sln index 553b51343..528040e67 100644 --- a/Banshee.sln +++ b/Banshee.sln @@ -54,8 +54,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Banshee.Gnome", "src\Backen EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Banshee.Unix", "src\Backends\Banshee.Unix\Banshee.Unix.csproj", "{C1065582-4F64-4810-8C35-E7EB2D2A432C}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Banshee.Hal", "src\Backends\Banshee.Hal\Banshee.Hal.csproj", "{3B7DD288-5546-4907-B302-0CD0271D9713}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Banshee.NowPlaying.X11", "src\Backends\Banshee.NowPlaying.X11\Banshee.NowPlaying.X11.csproj", "{46C02D13-5ED4-4A14-9ACF-125B1E4B6EB5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Banshee.Osx", "src\Backends\Banshee.Osx\Banshee.Osx.csproj", "{379034DF-F34D-409B-8DE9-097BE78E37C8}"
@@ -249,9 +247,6 @@ Global {3935AE8A-E283-4C0D-9094-7435A937DC90}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{3935AE8A-E283-4C0D-9094-7435A937DC90}.Release|Any CPU.Build.0 = Debug|Any CPU
{3935AE8A-E283-4C0D-9094-7435A937DC90}.Windows|Any CPU.ActiveCfg = Windows|Any CPU
- {3B7DD288-5546-4907-B302-0CD0271D9713}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {3B7DD288-5546-4907-B302-0CD0271D9713}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {3B7DD288-5546-4907-B302-0CD0271D9713}.Windows|Any CPU.ActiveCfg = Windows|Any CPU
{3B855EBC-8E55-48DF-816B-B241BE45EBD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3B855EBC-8E55-48DF-816B-B241BE45EBD8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3B855EBC-8E55-48DF-816B-B241BE45EBD8}.Debug|x86.ActiveCfg = Debug|Any CPU
@@ -504,7 +499,6 @@ Global {5F696A8F-B216-4ECE-9E35-907DDFC760BD} = {A03B194F-F644-4E95-A602-87200029240D}
{CA8BAD3C-1545-4B04-AF6B-4105DFD3A9A1} = {A03B194F-F644-4E95-A602-87200029240D}
{C1065582-4F64-4810-8C35-E7EB2D2A432C} = {A03B194F-F644-4E95-A602-87200029240D}
- {3B7DD288-5546-4907-B302-0CD0271D9713} = {A03B194F-F644-4E95-A602-87200029240D}
{46C02D13-5ED4-4A14-9ACF-125B1E4B6EB5} = {A03B194F-F644-4E95-A602-87200029240D}
{379034DF-F34D-409B-8DE9-097BE78E37C8} = {A03B194F-F644-4E95-A602-87200029240D}
{BA67DA42-F0DA-4D64-BD8B-22F30C727BAB} = {A03B194F-F644-4E95-A602-87200029240D}
diff --git a/build/build.environment.mk b/build/build.environment.mk index 177764bcd..f8a1d4edb 100644 --- a/build/build.environment.mk +++ b/build/build.environment.mk @@ -172,7 +172,6 @@ REF_BACKEND_GIO = $(LINK_BANSHEE_SERVICES_DEPS) $(LINK_GIO) $(LINK_GUDEV) $(LINK REF_BACKEND_GNOME = $(LINK_BANSHEE_SERVICES_DEPS) $(LINK_BANSHEE_THICKCLIENT_DEPS) $(LINK_GCONF) REF_BACKEND_GSTREAMER = $(LINK_BANSHEE_SERVICES_DEPS) $(LINK_GLIB) REF_BACKEND_UNIX = $(LINK_BANSHEE_CORE_DEPS) $(LINK_MONO_POSIX) -REF_BACKEND_HAL = $(LINK_BANSHEE_SERVICES_DEPS) $(LINK_DBUS) REF_BACKEND_OSX = $(LINK_BANSHEE_SERVICES_DEPS) $(LINK_BANSHEE_THICKCLIENT_DEPS) $(MONOMAC_LIBS) REF_BACKEND_BNPX11 = $(LINK_EXTENSION_NOWPLAYING_DEPS) diff --git a/build/m4/banshee/hal.m4 b/build/m4/banshee/hal.m4 deleted file mode 100644 index a9c475378..000000000 --- a/build/m4/banshee/hal.m4 +++ /dev/null @@ -1,6 +0,0 @@ -AC_DEFUN([BANSHEE_CHECK_HAL], -[ - AC_ARG_ENABLE(hal, AC_HELP_STRING([--disable-hal], [Disable Hal hardware backend]), ,enable_hal="yes") - - AM_CONDITIONAL(ENABLE_HAL, test "x$enable_hal" = "xyes") -])
\ No newline at end of file diff --git a/configure.ac b/configure.ac index 92dc9c0f7..7335fd408 100644 --- a/configure.ac +++ b/configure.ac @@ -131,9 +131,6 @@ BANSHEE_CHECK_LIBWEBKIT dnl gdata (optional through --disable-youtube) BANSHEE_CHECK_YOUTUBE -dnl Check for disabled hal -BANSHEE_CHECK_HAL - dnl gtk#-beans and gio# BANSHEE_CHECK_GIO_SHARP @@ -325,7 +322,6 @@ src/Backends/Banshee.Gio/Makefile src/Backends/Banshee.Gnome/Makefile src/Backends/Banshee.GStreamer/Makefile src/Backends/Banshee.GStreamerSharp/Makefile -src/Backends/Banshee.Hal/Makefile src/Backends/Banshee.Unix/Makefile src/Backends/Banshee.Osx/Makefile src/Backends/Banshee.NowPlaying.X11/Makefile @@ -430,7 +426,6 @@ ${PACKAGE}-${VERSION} DAAP: ${enable_daap} GIO Backend: ${enable_gio} (glib >= 2.22, gtk-sharp-beans, and gio-sharp) GIO Hardware: ${enable_gio_hardware} (gudev-sharp, gkeyfile-sharp) - HAL Hardware (legacy): ${enable_hal} Library Watcher: ${HAVE_MONO_2_4_3} (Mono >= 2.4.3) Podcasts: ${enable_podcast} Gapless playback: ${ENABLE_GAPLESS} (gstreamer-plugins-base > 0.10.25.2) diff --git a/src/Backends/Banshee.Hal/Banshee.Hal.addin.xml b/src/Backends/Banshee.Hal/Banshee.Hal.addin.xml deleted file mode 100644 index 6c1cd2c86..000000000 --- a/src/Backends/Banshee.Hal/Banshee.Hal.addin.xml +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Addin - id="Banshee.Hal" - version="1.0" - compatVersion="1.0" - copyright="© 2008 Novell Inc. Licensed under the MIT X11 license." - category="required:Backends" - description="Provides hardware support through HAL." - defaultEnabled="true"> - - <Dependencies> - <Addin id="Banshee.Services" version="1.0"/> - </Dependencies> - - <Extension path="/Banshee/Platform/HardwareManager"> - <HardwareManager class="Banshee.HalBackend.HardwareManager" id="Banshee.HalBackend.HardwareManager" /> - </Extension> - -</Addin> diff --git a/src/Backends/Banshee.Hal/Banshee.Hal.csproj b/src/Backends/Banshee.Hal/Banshee.Hal.csproj deleted file mode 100644 index da0e3144a..000000000 --- a/src/Backends/Banshee.Hal/Banshee.Hal.csproj +++ /dev/null @@ -1,101 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>8.0.50727</ProductVersion> - <ProjectGuid>{3B7DD288-5546-4907-B302-0CD0271D9713}</ProjectGuid> - <OutputType>Library</OutputType> - <UseParentDirectoryAsNamespace>true</UseParentDirectoryAsNamespace> - <AssemblyName>Banshee.Hal</AssemblyName> - <SchemaVersion>2.0</SchemaVersion> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> - <Optimize>true</Optimize> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <ReleaseVersion>1.3</ReleaseVersion> - <RootNamespace>Banshee.Hal</RootNamespace> - <AssemblyOriginatorKeyFile>.</AssemblyOriginatorKeyFile> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <OutputPath>..\..\..\bin</OutputPath> - <WarningLevel>4</WarningLevel> - <Optimize>false</Optimize> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Windows|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <PlatformTarget>x86</PlatformTarget> - <OutputPath>..\..\..\bin\bin</OutputPath> - <WarningLevel>4</WarningLevel> - <Optimize>false</Optimize> - </PropertyGroup> - <ItemGroup> - <ProjectReference Include="..\..\Core\Banshee.Core\Banshee.Core.csproj"> - <Project>{2ADB831A-A050-47D0-B6B9-9C19D60233BB}</Project> - <Name>Banshee.Core</Name> - </ProjectReference> - <ProjectReference Include="..\..\Core\Banshee.Services\Banshee.Services.csproj"> - <Project>{B28354F0-BA87-44E8-989F-B864A3C7C09F}</Project> - <Name>Banshee.Services</Name> - </ProjectReference> - <ProjectReference Include="..\..\Hyena\Hyena.Data.Sqlite\Hyena.Data.Sqlite.csproj"> - <Project>{95374549-9553-4C1E-9D89-667755F90E13}</Project> - <Name>Hyena.Data.Sqlite</Name> - <Private>False</Private> - </ProjectReference> - <ProjectReference Include="..\..\Hyena\Hyena\Hyena.csproj"> - <Project>{95374549-9553-4C1E-9D89-667755F90E12}</Project> - <Name>Hyena</Name> - </ProjectReference> - </ItemGroup> - <ItemGroup> - <Reference Include="System" /> - <Reference Include="NDesk.DBus"> - <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\..\bin\bin\NDesk.DBus.dll</HintPath> - </Reference> - <Reference Include="NDesk.DBus.GLib"> - <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\..\bin\bin\NDesk.DBus.GLib.dll</HintPath> - </Reference> - </ItemGroup> - <ItemGroup> - <Compile Include="Banshee.HalBackend\DkDisk.cs" /> - <Compile Include="Banshee.HalBackend\HardwareManager.cs" /> - <Compile Include="Hal\Device.cs" /> - <Compile Include="Hal\Manager.cs" /> - <Compile Include="Hal\Volume.cs" /> - <Compile Include="Banshee.HalBackend\Device.cs" /> - <Compile Include="Banshee.HalBackend\BlockDevice.cs" /> - <Compile Include="Banshee.HalBackend\CdromDevice.cs" /> - <Compile Include="Banshee.HalBackend\DiskDevice.cs" /> - <Compile Include="Banshee.HalBackend\Volume.cs" /> - <Compile Include="Banshee.HalBackend\DiscVolume.cs" /> - <Compile Include="Banshee.HalBackend\DeviceMediaCapabilities.cs" /> - <Compile Include="Banshee.HalBackend\UsbDevice.cs" /> - </ItemGroup> - <ItemGroup> - <EmbeddedResource Include="Banshee.Hal.addin.xml"> - <LogicalName>Banshee.Hal.addin.xml</LogicalName> - </EmbeddedResource> - </ItemGroup> - <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> - <ProjectExtensions> - <MonoDevelop> - <Properties> - <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="true" RelativeMakefileName="./Makefile.am"> - <BuildFilesVar Sync="true" Name="SOURCES" /> - <DeployFilesVar /> - <ResourcesVar Sync="true" Name="RESOURCES" /> - <OthersVar /> - <GacRefVar /> - <AsmRefVar /> - <ProjectRefVar /> - </MonoDevelop.Autotools.MakefileInfo> - </Properties> - </MonoDevelop> - </ProjectExtensions> -</Project> diff --git a/src/Backends/Banshee.Hal/Banshee.HalBackend/BlockDevice.cs b/src/Backends/Banshee.Hal/Banshee.HalBackend/BlockDevice.cs deleted file mode 100644 index a953b97f7..000000000 --- a/src/Backends/Banshee.Hal/Banshee.HalBackend/BlockDevice.cs +++ /dev/null @@ -1,91 +0,0 @@ -// -// BlockDevice.cs -// -// Author: -// Aaron Bockover <abockover@novell.com> -// -// Copyright (C) 2008 Novell, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using System.Collections.Generic; - -using Banshee.Hardware; - -namespace Banshee.HalBackend -{ - public abstract class BlockDevice : Device, IBlockDevice - { - public static BlockDevice Resolve<T> (Hal.Manager manager, Hal.Device device) where T : IBlockDevice - { - if (device.QueryCapability ("block") && device.PropertyExists ("block.device")) { - if (typeof (T) == typeof (ICdromDevice)) { - return CdromDevice.Resolve (manager, device); - } else if (typeof (T) == typeof (IDiskDevice)) { - return DiskDevice.Resolve (manager, device); - } - - return (BlockDevice)CdromDevice.Resolve (manager, device) - ?? (BlockDevice)DiskDevice.Resolve (manager, device); - } - - return null; - } - - protected BlockDevice (Hal.Manager manager, Hal.Device device) : base (manager, device) - { - } - - public string DeviceNode { - get { return HalDevice["block.device"]; } - } - - public bool IsRemovable { - get { return HalDevice.GetPropertyBoolean ("storage.removable"); } - } - - public IEnumerable<IVolume> Volumes { - get { return this; } - } - - public IEnumerator<IVolume> GetEnumerator () - { - foreach (Hal.Device hal_device in HalDevice.GetChildrenAsDevice (HalManager)) { - Volume volume = Volume.Resolve (this, HalManager, hal_device); - if (volume != null) { - yield return volume; - } - } - } - - IEnumerator IEnumerable.GetEnumerator () - { - return GetEnumerator (); - } - - public override string ToString () - { - return DeviceNode; - } - } -} diff --git a/src/Backends/Banshee.Hal/Banshee.HalBackend/CdromDevice.cs b/src/Backends/Banshee.Hal/Banshee.HalBackend/CdromDevice.cs deleted file mode 100644 index 8191ebfce..000000000 --- a/src/Backends/Banshee.Hal/Banshee.HalBackend/CdromDevice.cs +++ /dev/null @@ -1,96 +0,0 @@ -// -// CdromDevice.cs -// -// Author: -// Aaron Bockover <abockover@novell.com> -// -// Copyright (C) 2008 Novell, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Runtime.InteropServices; -using Mono.Unix; - -using Banshee.Hardware; - -namespace Banshee.HalBackend -{ - public class CdromDevice : BlockDevice, ICdromDevice - { - public static CdromDevice Resolve (Hal.Manager manager, Hal.Device device) - { - if (device["storage.drive_type"] == "cdrom") { - return new CdromDevice (manager, device); - } - - return null; - } - - private CdromDevice (Hal.Manager manager, Hal.Device device) : base (manager, device) - { - } - - [DllImport ("libc")] - private static extern int ioctl (int device, IoctlOperation request, bool lockdoor); - - private enum IoctlOperation { - LockDoor = 0x5329 - } - - private bool is_door_locked = false; - - private bool LockDeviceNode (string device, bool lockdoor) - { - try { - using (UnixStream stream = (new UnixFileInfo (device)).Open ( - Mono.Unix.Native.OpenFlags.O_RDONLY | - Mono.Unix.Native.OpenFlags.O_NONBLOCK)) { - bool success = ioctl (stream.Handle, IoctlOperation.LockDoor, lockdoor) == 0; - is_door_locked = success && lockdoor; - return success; - } - } catch { - return false; - } - } - - public bool LockDoor () - { - lock (this) { - return LockDeviceNode (DeviceNode, true); - } - } - - public bool UnlockDoor () - { - lock (this) { - return LockDeviceNode (DeviceNode, false); - } - } - - // FIXME: This is incredibly lame, there must be a way to query the - // device itself rather than hackisly attempting to keep track of it - public bool IsDoorLocked { - get { return is_door_locked; } - } - } -} diff --git a/src/Backends/Banshee.Hal/Banshee.HalBackend/Device.cs b/src/Backends/Banshee.Hal/Banshee.HalBackend/Device.cs deleted file mode 100644 index 88bbe5625..000000000 --- a/src/Backends/Banshee.Hal/Banshee.HalBackend/Device.cs +++ /dev/null @@ -1,205 +0,0 @@ -// -// Device.cs -// -// Author: -// Aaron Bockover <abockover@novell.com> -// -// Copyright (C) 2008 Novell, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections.Generic; - -using Banshee.Hardware; - -namespace Banshee.HalBackend -{ - public class Device : IDevice - { - private Hal.Device device; - internal Hal.Device HalDevice { - get { return device; } - } - - private Hal.Manager manager; - protected Hal.Manager HalManager { - get { return manager; } - } - - public Device (Hal.Manager manager, Hal.Device device) - { - this.manager = manager; - this.device = device; - } - - private string uuid; - public string Uuid { - get { return uuid ?? (uuid = device.Udi); /*String.IsNullOrEmpty (HalDevice["usb.serial"]) ? device.Udi : HalDevice["usb.serial"];*/ } - } - - private string serial; - public virtual string Serial { - get { return serial ?? (serial = HalDevice["usb.serial"]); } - } - - private string name; - public virtual string Name { - get { - if (name == null) { - Stack<Hal.Device> usb_devices = CollectUsbDeviceStack (device); - while (usb_devices.Count > 0 && name == null) { - name = usb_devices.Pop() ["info.product"]; - } - name = name ?? device["volume.label"]; - } - - return name; - } - } - - public virtual string Product { - get { return device["info.product"]; } - } - - public virtual string Vendor { - get { return device["info.vendor"]; } - } - - protected IDeviceMediaCapabilities media_capabilities; - public IDeviceMediaCapabilities MediaCapabilities { - get { - if (media_capabilities == null && device.PropertyExists ("portable_audio_player.output_formats")) { - media_capabilities = new DeviceMediaCapabilities (device); - } - return media_capabilities; - } - } - - public bool PropertyExists (string key) - { - return device.PropertyExists (key); - } - - public string GetPropertyString (string key) - { - return device.GetPropertyString (key); - } - - public double GetPropertyDouble (string key) - { - return device.GetPropertyDouble (key); - } - - public bool GetPropertyBoolean (string key) - { - return device.GetPropertyBoolean (key); - } - - public int GetPropertyInteger (string key) - { - return device.GetPropertyInteger (key); - } - - public ulong GetPropertyUInt64 (string key) - { - return device.GetPropertyUInt64 (key); - } - - public string [] GetPropertyStringList (string key) - { - return device.GetPropertyStringList (key); - } - - public IUsbDevice ResolveRootUsbDevice () - { - return UsbDevice.Resolve (HalManager, CollectUsbDeviceStack (device).Peek ()); - } - - public IUsbPortInfo ResolveUsbPortInfo () - { - var device = this.device; - while (device != null) { - if (device.PropertyExists ("usb.bus_number") && device.PropertyExists ("usb.linux.device_number")) { - return new UsbPortInfo (device.GetPropertyInteger ("usb.bus_number"), - device.GetPropertyInteger ("usb.linux.device_number")); - } - device = device.Parent; - } - return null; - } - - private static Stack<Hal.Device> CollectUsbDeviceStack (Hal.Device device) - { - Stack<Hal.Device> device_stack = new Stack<Hal.Device> (); - int usb_vendor_id = -1; - int usb_product_id = -1; - - Hal.Device tmp_device = device; - - while (tmp_device != null) { - // Skip the SCSI parents of the volume if they are in the tree - if ((tmp_device.PropertyExists("info.bus") && tmp_device["info.bus"] == "scsi") || - (tmp_device.PropertyExists("info.category") && tmp_device["info.category"] == "scsi_host")) { - device_stack.Push (tmp_device); - tmp_device = tmp_device.Parent; - continue; - } - - bool have_usb_ids = false; - int _usb_vendor_id = -1; - int _usb_product_id = -1; - - // Figure out the IDs if they exist - if (tmp_device.PropertyExists ("usb.vendor_id") && - tmp_device.PropertyExists ("usb.product_id")) { - _usb_vendor_id = tmp_device.GetPropertyInteger ("usb.vendor_id"); - _usb_product_id = tmp_device.GetPropertyInteger ("usb.product_id"); - have_usb_ids = true; - } else if (tmp_device.PropertyExists("usb_device.vendor_id") && - tmp_device.PropertyExists("usb_device.product_id")) { - _usb_vendor_id = tmp_device.GetPropertyInteger("usb_device.vendor_id"); - _usb_product_id = tmp_device.GetPropertyInteger("usb_device.product_id"); - have_usb_ids = true; - } - - if (have_usb_ids) { - if (usb_vendor_id == -1 && usb_product_id == -1) { - // We found the first raw USB device, remember it - usb_vendor_id = _usb_vendor_id; - usb_product_id = _usb_product_id; - } else if (usb_vendor_id != _usb_vendor_id || usb_product_id != _usb_product_id) { - // We are no longer looking at the device we care about (could now be at a hub or something) - break; - } - } else if (usb_vendor_id != -1 || usb_product_id != -1) { - // We are no longer even looking at USB devices - break; - } - - device_stack.Push (tmp_device); - tmp_device = tmp_device.Parent; - } - - return device_stack; - } - } -} diff --git a/src/Backends/Banshee.Hal/Banshee.HalBackend/DeviceMediaCapabilities.cs b/src/Backends/Banshee.Hal/Banshee.HalBackend/DeviceMediaCapabilities.cs deleted file mode 100644 index ec0575d99..000000000 --- a/src/Backends/Banshee.Hal/Banshee.HalBackend/DeviceMediaCapabilities.cs +++ /dev/null @@ -1,182 +0,0 @@ -// -// DeviceMediaCapabilities.cs -// -// Author: -// Gabriel Burt <gburt@novell.com> -// -// Copyright (C) 2008 Novell, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections.Generic; - -using Banshee.Hardware; - -namespace Banshee.HalBackend -{ - public class DeviceMediaCapabilities : IDeviceMediaCapabilities - { - private Hal.Device device; - - public DeviceMediaCapabilities (Hal.Device device) - { - this.device = device; - } - - private int? cover_art_size; - public int CoverArtSize { - get { - if (cover_art_size == null) { - cover_art_size = SafelyGetInt ("portable_audio_player.cover_art_size", -1); - } - return cover_art_size.Value; - } - } - - private int? folder_depth; - public int FolderDepth { - get { - if (folder_depth == null) { - folder_depth = SafelyGetInt ("portable_audio_player.folder_depth", -1); - } - return folder_depth.Value; - } - } - - private string [] audio_folders; - public string [] AudioFolders { - get { - if (audio_folders == null) { - audio_folders = SafelyGetStringList ("portable_audio_player.audio_folders"); - } - return audio_folders; - } - } - - private string [] video_folders; - public string [] VideoFolders { - get { - if (video_folders == null) { - video_folders = SafelyGetStringList ("portable_audio_player.video_folders"); - } - return video_folders; - } - } - - private string cover_art_file_name; - public string CoverArtFileName { - get { - if (cover_art_file_name == null) { - cover_art_file_name = SafelyGetString ("portable_audio_player.cover_art_file_name"); - } - return cover_art_file_name; - } - } - - private string cover_art_file_type; - public string CoverArtFileType { - get { - if (cover_art_file_type == null) { - cover_art_file_type = SafelyGetString ("portable_audio_player.cover_art_file_type"); - } - return cover_art_file_type; - } - } - - private string [] playlist_formats; - public string [] PlaylistFormats { - get { - if (playlist_formats == null) { - playlist_formats = SafelyGetStringList ("portable_audio_player.playlist_format"); - } - return playlist_formats; - } - } - - private string playlist_path; - public string PlaylistPath { - get { - if (playlist_path == null) { - playlist_path = SafelyGetString ("portable_audio_player.playlist_path"); - } - return playlist_path; - } - } - - private string [] playback_formats; - public string [] PlaybackMimeTypes { - get { - if (playback_formats == null) { - playback_formats = SafelyGetStringList ("portable_audio_player.output_formats"); - } - return playback_formats; - } - } - - private string SafelyGetString (string name) - { - try { - if (device.PropertyExists (name)) { - return device[name]; - } - } catch {} - return null; - } - - private string[] SafelyGetStringList (string name) - { - try { - if (device.PropertyExists (name)) { - return device.GetPropertyStringList (name); - } - } catch {} - return new string [0]; - } - - private int SafelyGetInt (string name, int def) - { - try { - if (device.PropertyExists (name)) { - return device.GetPropertyInteger (name); - } - } catch {} - return def; - } - - public bool IsType (string type) - { - if (device.PropertyExists ("portable_audio_player.type")) { - if (device ["portable_audio_player.type"] == type) { - return true; - } - } - - if (device.PropertyExists ("portable_audio_player.access_method.protocols")) { - if (Array.IndexOf (device.GetPropertyStringList ("portable_audio_player.access_method.protocols"), type) != -1) { - return true; - } - } - - return false; - } - } -} diff --git a/src/Backends/Banshee.Hal/Banshee.HalBackend/DiscVolume.cs b/src/Backends/Banshee.Hal/Banshee.HalBackend/DiscVolume.cs deleted file mode 100644 index 1798984b1..000000000 --- a/src/Backends/Banshee.Hal/Banshee.HalBackend/DiscVolume.cs +++ /dev/null @@ -1,72 +0,0 @@ -// -// DiscVolume.cs -// -// Author: -// Aaron Bockover <abockover@novell.com> -// -// Copyright (C) 2008 Novell, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -using Banshee.Hardware; - -namespace Banshee.HalBackend -{ - public class DiscVolume : Volume, IDiscVolume - { - public new static DiscVolume Resolve (BlockDevice parent, Hal.Manager manager, Hal.Device device) - { - return device.QueryCapability ("volume.disc") ? new DiscVolume (parent, manager, device) : null; - } - - private DiscVolume (BlockDevice parent, Hal.Manager manager, Hal.Device device) : base (parent, manager, device) - { - } - - public bool HasAudio { - get { return HalDevice.GetPropertyBoolean ("volume.disc.has_audio"); } - } - - public bool HasData { - get { return HalDevice.GetPropertyBoolean ("volume.disc.has_data"); } - } - - public bool IsBlank { - get { return HalDevice.GetPropertyBoolean ("volume.disc.is_blank"); } - } - - public bool IsRewritable { - get { return HalDevice.GetPropertyBoolean ("volume.disc.is_rewritable"); } - } - - public ulong MediaCapacity { - get { return HalDevice.GetPropertyUInt64 ("volume.disc.capacity"); } - } - - public override string ToString () - { - return String.Format ("Optical Disc, Audio = {0}, Data = {1}, Blank = {2}, Rewritable = {3}, Media Capacity = {4}", - HasAudio, HasData, IsBlank, IsRewritable, MediaCapacity); - } - } -} diff --git a/src/Backends/Banshee.Hal/Banshee.HalBackend/DiskDevice.cs b/src/Backends/Banshee.Hal/Banshee.HalBackend/DiskDevice.cs deleted file mode 100644 index 0b5f913c1..000000000 --- a/src/Backends/Banshee.Hal/Banshee.HalBackend/DiskDevice.cs +++ /dev/null @@ -1,52 +0,0 @@ -// -// DiskDevice.cs -// -// Author: -// Aaron Bockover <abockover@novell.com> -// -// Copyright (C) 2008 Novell, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using System.Collections.Generic; - -using Banshee.Hardware; - -namespace Banshee.HalBackend -{ - public class DiskDevice : BlockDevice, IDiskDevice - { - public static DiskDevice Resolve (Hal.Manager manager, Hal.Device device) - { - if (device["storage.drive_type"] == "disk") { - return new DiskDevice (manager, device); - } - - return null; - } - - private DiskDevice (Hal.Manager manager, Hal.Device device) : base (manager, device) - { - } - } -} diff --git a/src/Backends/Banshee.Hal/Banshee.HalBackend/DkDisk.cs b/src/Backends/Banshee.Hal/Banshee.HalBackend/DkDisk.cs deleted file mode 100644 index 0843377ad..000000000 --- a/src/Backends/Banshee.Hal/Banshee.HalBackend/DkDisk.cs +++ /dev/null @@ -1,178 +0,0 @@ -// -// DkDisk.cs -// -// Author: -// Gabriel Burt <gburt@novell.com> -// -// Copyright (C) 2009 Novell, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -using NDesk.DBus; - -namespace Banshee.HalBackend -{ - public class DkDisk - { - public static DkDisk FindByDevice (string device_path) - { - if (device_path == null) - return null; - - if (udisks_finder == null && dk_finder == null) - return null; - - - string disk_path = null; - try { - if (udisks_finder != null) { - disk_path = udisks_finder.FindDeviceByDeviceFile (device_path); - } else { - disk_path = dk_finder.FindDeviceByDeviceFile (device_path); - } - } catch {} - - if (disk_path == null) - return null; - - try { - return new DkDisk (disk_path); - } catch {} - - return null; - } - - private UDisksDisk udisks_disk; - private IDkDisk dk_disk; - private org.freedesktop.DBus.Properties props; - - const string dk_bus_name = "org.freedesktop.DeviceKit.Disks"; - const string udisks_bus_name = "org.freedesktop.UDisks"; - - private DkDisk (string obj_path) - { - if (udisks_finder != null) { - udisks_disk = Bus.System.GetObject<UDisksDisk> (udisks_bus_name, new ObjectPath (obj_path)); - props = Bus.System.GetObject<org.freedesktop.DBus.Properties> (udisks_bus_name, new ObjectPath (obj_path)); - } else { - dk_disk = Bus.System.GetObject<IDkDisk> (dk_bus_name, new ObjectPath(obj_path)); - props = Bus.System.GetObject<org.freedesktop.DBus.Properties> (dk_bus_name, new ObjectPath(obj_path)); - } - } - - public bool IsMounted { - get { - return (bool) props.Get (props_iface, "DeviceIsMounted"); - } - } - - public bool IsReadOnly { - get { - return (bool) props.Get (props_iface, "DeviceIsReadOnly"); - } - } - - public string MountPoint { - get { - var ary = (string[])props.Get (props_iface, "DeviceMountPaths"); - return ary != null && ary.Length > 0 ? ary[0] : null; - } - } - - public void Eject () - { - if (udisks_disk != null) { - udisks_disk.DriveEject (new string [0]); - } else { - dk_disk.DriveEject (new string [0]); - } - } - - public void Unmount () - { - if (udisks_disk != null) { - udisks_disk.FilesystemUnmount (new string [0]); - } else { - dk_disk.FilesystemUnmount (new string [0]); - } - } - - private static UDisksFinder udisks_finder; - private static DkFinder dk_finder; - private static string props_iface; - - static DkDisk () - { - try { - if (Bus.System.NameHasOwner (udisks_bus_name)) { - udisks_finder = Bus.System.GetObject<UDisksFinder>(udisks_bus_name, new ObjectPath("/org/freedesktop/UDisks")); - props_iface = "org.freedesktop.UDisks.Device"; - } - } catch { - udisks_finder = null; - } - - if (udisks_finder == null) { - try { - if (Bus.System.NameHasOwner (dk_bus_name)) { - dk_finder = Bus.System.GetObject<DkFinder>(dk_bus_name, - new ObjectPath("/org/freedesktop/DeviceKit/Disks")); - props_iface = "org.freedesktop.DeviceKit.Disks.Device"; - } - } catch { - dk_finder = null; - } - } - } - - [Interface("org.freedesktop.UDisks")] - internal interface UDisksFinder - { - string FindDeviceByDeviceFile (string deviceFile); - } - - [Interface("org.freedesktop.DeviceKit.Disks")] - internal interface DkFinder - { - string FindDeviceByDeviceFile (string deviceFile); - } - - [Interface("org.freedesktop.UDisks.Device")] - internal interface UDisksDisk - { - bool DeviceIsMounted { get; } - string [] DeviceMountPaths { get; } - void DriveEject (string [] options); - void FilesystemUnmount (string [] options); - } - - [Interface("org.freedesktop.DeviceKit.Disks.Device")] - internal interface IDkDisk - { - bool DeviceIsMounted { get; } - string [] DeviceMountPaths { get; } - void DriveEject (string [] options); - void FilesystemUnmount (string [] options); - } - } -} diff --git a/src/Backends/Banshee.Hal/Banshee.HalBackend/HardwareManager.cs b/src/Backends/Banshee.Hal/Banshee.HalBackend/HardwareManager.cs deleted file mode 100644 index 83c9f684b..000000000 --- a/src/Backends/Banshee.Hal/Banshee.HalBackend/HardwareManager.cs +++ /dev/null @@ -1,147 +0,0 @@ -// -// HardwareManager.cs -// -// Author: -// Aaron Bockover <abockover@novell.com> -// -// Copyright (C) 2008 Novell, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections.Generic; - -using Hyena; -using Banshee.Hardware; - -namespace Banshee.HalBackend -{ - public sealed class HardwareManager : IHardwareManager - { - private Hal.Manager manager; - - public event DeviceAddedHandler DeviceAdded; - public event DeviceRemovedHandler DeviceRemoved; - - public HardwareManager () - { - manager = new Hal.Manager (); - manager.DeviceAdded += OnHalDeviceAdded; - manager.DeviceRemoved += OnHalDeviceRemoved; - - Volume.HardwareManager = this; - } - - public void Dispose () - { - } - - public IEnumerable<IDevice> GetAllDevices () - { - IDevice device; - foreach (string udi in manager.GetAllDevices ()) { - device = Resolve (new Hal.Device (udi)); - if (device != null) { - yield return device; - } - } - } - - private IEnumerable<T> GetAllBlockDevices<T> () where T : IBlockDevice - { - foreach (Hal.Device hal_device in manager.FindDeviceByCapabilityAsDevice ("block")) { - IBlockDevice device = BlockDevice.Resolve<T> (manager, hal_device); - if (device != null) { - yield return (T)device; - } - } - } - - public IEnumerable<IBlockDevice> GetAllBlockDevices () - { - return GetAllBlockDevices<IBlockDevice> (); - } - - public IEnumerable<ICdromDevice> GetAllCdromDevices () - { - return GetAllBlockDevices<ICdromDevice> (); - } - - public IEnumerable<IDiskDevice> GetAllDiskDevices () - { - return GetAllBlockDevices<IDiskDevice> (); - } - - private void OnHalDeviceAdded (object o, Hal.DeviceAddedArgs args) - { - try { - OnHalDeviceAdded (Resolve (args.Device)); - } catch (Exception e) { - Log.Exception (e); - } - } - - private IDevice Resolve (Hal.Device hal_device) - { - if (!hal_device.QueryCapability ("block") && !hal_device.QueryCapability ("portable_audio_player")) { - return null; - } - - IDevice device = BlockDevice.Resolve<IBlockDevice> (manager, hal_device); - if (device == null) { - device = Volume.Resolve (null, manager, hal_device); - if (device == null) { - device = new Device (manager, hal_device); - } - } - - return device; - } - - internal void OnHalDeviceAdded (IDevice device) - { - if (device != null) { - OnDeviceAdded (device); - } - } - - private void OnHalDeviceRemoved (object o, Hal.DeviceRemovedArgs args) - { - OnDeviceRemoved (args.Udi); - } - - private void OnDeviceAdded (IDevice device) - { - DeviceAddedHandler handler = DeviceAdded; - if (handler != null) { - handler (this, new DeviceAddedArgs (device)); - } - } - - internal void OnDeviceRemoved (string uuid) - { - DeviceRemovedHandler handler = DeviceRemoved; - if (handler != null) { - handler (this, new DeviceRemovedArgs (uuid)); - } - } - } -} diff --git a/src/Backends/Banshee.Hal/Banshee.HalBackend/UsbDevice.cs b/src/Backends/Banshee.Hal/Banshee.HalBackend/UsbDevice.cs deleted file mode 100644 index 206c7d51a..000000000 --- a/src/Backends/Banshee.Hal/Banshee.HalBackend/UsbDevice.cs +++ /dev/null @@ -1,75 +0,0 @@ -// -// UsbDevice.cs -// -// Author: -// Aaron Bockover <abockover@novell.com> -// -// Copyright (C) 2008 Novell, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -using Banshee.Hardware; - -namespace Banshee.HalBackend -{ - public class UsbDevice : Device, IUsbDevice - { - public static UsbDevice Resolve (Hal.Manager manager, Hal.Device device) - { - if (device["info.subsystem"] == "usb_device" && - device.PropertyExists ("usb_device.product_id") && - device.PropertyExists ("usb_device.vendor_id")) { - return new UsbDevice (manager, device); - } - - return null; - } - - private UsbDevice (Hal.Manager manager, Hal.Device device) : base (manager, device) - { - } - - public int VendorId { - get { return HalDevice.GetPropertyInteger ("usb_device.vendor_id"); } - } - - public int ProductId { - get { return HalDevice.GetPropertyInteger ("usb_device.product_id"); } - } - - public override string Serial { - get { return HalDevice.PropertyExists ("usb_device.serial") - ? HalDevice["usb_device.serial"] : null; } - } - - public double Speed { - get { return HalDevice.PropertyExists ("usb_device.speed") - ? HalDevice.GetPropertyDouble ("usb_device.speed") : 0.0; } - } - - public double Version { - get { return HalDevice.PropertyExists ("usb_device.version") - ? HalDevice.GetPropertyDouble ("usb_device.version") : 0.0; } - } - } -} diff --git a/src/Backends/Banshee.Hal/Banshee.HalBackend/Volume.cs b/src/Backends/Banshee.Hal/Banshee.HalBackend/Volume.cs deleted file mode 100644 index c69150a40..000000000 --- a/src/Backends/Banshee.Hal/Banshee.HalBackend/Volume.cs +++ /dev/null @@ -1,249 +0,0 @@ -// -// Volume.cs -// -// Author: -// Aaron Bockover <abockover@novell.com> -// -// Copyright (C) 2008 Novell, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections.Generic; - -using Banshee.Hardware; - -namespace Banshee.HalBackend -{ - public class Volume : Device, IVolume - { - private static Dictionary<Hal.Device, Volume> mounted_volumes = new Dictionary<Hal.Device, Volume> (); - private static Dictionary<Hal.Device, Volume> unmounted_volumes = new Dictionary<Hal.Device, Volume> (); - - internal static HardwareManager HardwareManager; - - private const string method_names_property = "org.freedesktop.Hal.Device.Volume.method_names"; - - public static Volume Resolve (BlockDevice parent, Hal.Manager manager, Hal.Device device) - { - if (!device.IsVolume) { - return null; - } - - try { - Volume volume = (parent is ICdromDevice || (parent == null && device.QueryCapability ("volume.disc"))) - ? DiscVolume.Resolve (parent, manager, device) - : new Volume (parent, manager, device); - - return CheckVolumeMounted (volume) ? volume : null; - } catch (Exception e) { - Hyena.Log.Exception (e); - } - - return null; - } - - private DkDisk dk_disk; - private BlockDevice parent; - private string [] method_names; - - protected Volume (BlockDevice parent, Hal.Manager manager, Hal.Device device) : base (manager, device) - { - this.parent = parent ?? BlockDevice.Resolve<IBlockDevice> (manager, device.Parent); - dk_disk = DkDisk.FindByDevice (DeviceNode); - - method_names = HalDevice.PropertyExists (method_names_property) - ? device.GetPropertyStringList (method_names_property) - : new string[0]; - } - - public string DeviceNode { - get { return HalDevice["block.device"]; } - } - - public string MountPoint { - get { - if (dk_disk != null && dk_disk.MountPoint != null) { - return dk_disk.MountPoint; - } else { - return HalDevice["volume.mount_point"]; - } - } - } - - public string FileSystem { - get { return HalDevice["volume.fstype"]; } - } - - /*private string serial; - public override string Serial { - get { - if (serial == null) { - serial = String.IsNullOrEmpty (HalDevice["volume.uuid"]) - ? base.Serial - : HalDevice["volume.uuid"]; - } - - return serial; - } - }*/ - - public bool IsMounted { - get { return (dk_disk != null && dk_disk.IsMounted) || HalDevice.GetPropertyBoolean ("volume.is_mounted"); } - } - - public bool ShouldIgnore { - get { return HalDevice.GetPropertyBoolean ("volume.ignore"); } - } - - public bool IsReadOnly { - get { return (dk_disk != null && dk_disk.IsReadOnly) || HalDevice.GetPropertyBoolean ("volume.is_mounted_read_only"); } - } - - public ulong Capacity { - get { return HalDevice.GetPropertyUInt64 ("volume.size"); } - } - - public long Available { - get { - if (!IsMounted) { - return -1; - } - - // FIXME: maybe we should use UnixDriveInfo? Advantages? - - try { - Mono.Unix.Native.Statvfs statvfs_info; - if (Mono.Unix.Native.Syscall.statvfs (MountPoint, out statvfs_info) != -1) { - return ((long)statvfs_info.f_bavail) * ((long)statvfs_info.f_bsize); - } - } catch { - } - - return -1; - } - } - - public IBlockDevice Parent { - get { return parent; } - } - - public bool CanEject { - get { return Array.IndexOf<string> (method_names, "Eject") >= 0; } - } - - public void Eject () - { - if (CanEject && HalDevice.IsVolume) { - HalDevice.Volume.Eject (); - } - } - - public bool CanMount { - get { return Array.IndexOf <string>(method_names, "Mount") >= 0; } - } - - public bool CanUnmount { - get { return Array.IndexOf<string> (method_names, "Unmount") >= 0; } - } - - public void Mount () - { - if (CanMount && HalDevice.IsVolume) - HalDevice.Volume.Mount (); - } - - public void Unmount () - { - if (CanUnmount && HalDevice.IsVolume) { - if (dk_disk != null) { - dk_disk.Unmount (); - } else { - HalDevice.Volume.Unmount (); - } - } - } - - public override string ToString () - { - if (IsMounted) { - return String.Format ("`{0}': mounted {1} volume at {2} with {3} bytes free (of {4})", - Name, IsReadOnly ? "read only" : "read/write", MountPoint, Available, Capacity); - } - - return String.Format ("`{0}': not mounted (capacity: {1} bytes)", Name, Capacity); - } - - private static bool CheckVolumeMounted (Volume volume) - { - if (volume != null && !(volume is IDiscVolume)) { - lock (mounted_volumes) { - if (mounted_volumes.ContainsKey (volume.HalDevice)) { - return true; - } else if (unmounted_volumes.ContainsKey (volume.HalDevice)) { - return false; - } - - volume.HalDevice.PropertyModified += HandleVolumeChanged; - - if (!volume.IsMounted) { - unmounted_volumes[volume.HalDevice] = volume; - return false; - } else { - mounted_volumes[volume.HalDevice] = volume; - } - } - } - return true; - } - - private static void HandleVolumeChanged (object o, Hal.PropertyModifiedArgs args) - { - Hal.Device device = o as Hal.Device; - if (device == null) { - return; - } - - lock (mounted_volumes) { - if (mounted_volumes.ContainsKey (device)) { - Volume volume = mounted_volumes[device]; - bool mounted = false; - try { - mounted = volume.IsMounted; - } catch (Exception) {} - - if (!mounted) { - mounted_volumes.Remove (device); - unmounted_volumes[device] = volume; - HardwareManager.OnDeviceRemoved (volume.Uuid); - } - } else if (unmounted_volumes.ContainsKey (device)) { - Volume volume = unmounted_volumes[device]; - if (volume.IsMounted) { - unmounted_volumes.Remove (device); - mounted_volumes[device] = volume; - HardwareManager.OnHalDeviceAdded (volume); - } - } - } - } - } -} diff --git a/src/Backends/Banshee.Hal/Hal/Device.cs b/src/Backends/Banshee.Hal/Hal/Device.cs deleted file mode 100644 index e284481f8..000000000 --- a/src/Backends/Banshee.Hal/Hal/Device.cs +++ /dev/null @@ -1,398 +0,0 @@ -// -// Device.cs -// -// Author: -// Aaron Bockover <abockover@novell.com> -// -// Copyright (C) 2006-2008 Novell, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using System.Collections.Generic; - -using NDesk.DBus; - -namespace Hal -{ - public struct PropertyModification - { - public string Key; - public bool Added; - public bool Removed; - } - - internal delegate void DBusPropertyModifiedHandler(int modificationsLength, - PropertyModification [] modifications); - - [Interface("org.freedesktop.Hal.Device")] - internal interface IDevice - { - // TODO: - // Need to support the Condition event, but it has a - // variable number of arguments, not currently supported - - event DBusPropertyModifiedHandler PropertyModified; - - void SetPropertyString(string key, string value); - void SetPropertyInteger(string key, int value); - void SetPropertyBoolean(string key, bool value); - void SetPropertyDouble(string key, double value); - void SetPropertyStringList(string key, string [] value); - - void SetProperty(string key, ulong value); - ulong GetProperty(string key); // nasty hack to get around the fact - // that HAL doesn't actually send this - // in a variant, nor does it have a - // GetPropertyUInt64 - // should be object GetProperty(string key) - - void StringListPrepend(string key, string value); - void StringListAppend(string key, string value); - void StringListRemove(string key, string value); - - string GetPropertyString(string key); - int GetPropertyInteger(string key); - bool GetPropertyBoolean(string key); - double GetPropertyDouble(string key); - string [] GetPropertyStringList(string key); - - IDictionary<string, object> GetAllProperties(); - void RemoveProperty(string key); - PropertyType GetPropertyType(string key); - bool PropertyExists(string key); - - void AddCapability(string capability); - bool QueryCapability(string capability); - void Lock(string reason); - void Unlock(); - } - - internal enum DType : byte - { - Invalid = (byte)'\0', - Byte = (byte)'y', - Boolean = (byte)'b', - Int16 = (byte)'n', - UInt16 = (byte)'q', - Int32 = (byte)'i', - UInt32 = (byte)'u', - Int64 = (byte)'x', - UInt64 = (byte)'t', - Single = (byte)'f', - Double = (byte)'d', - String = (byte)'s', - ObjectPath = (byte)'o', - Signature = (byte)'g', - Array = (byte)'a', - Struct = (byte)'r', - DictEntry = (byte)'e', - Variant = (byte)'v', - StructBegin = (byte)'(', - StructEnd = (byte)')', - DictEntryBegin = (byte)'{', - DictEntryEnd = (byte)'}', - } - - public enum PropertyType - { - Invalid = DType.Invalid, - Int32 = DType.Int32, - UInt64 = DType.UInt64, - Double = DType.Double, - Boolean = DType.Boolean, - String = DType.String, - StrList = ((int)(DType.String << 8) + ('l')) - } - - public class PropertyModifiedArgs : EventArgs - { - private PropertyModification [] modifications; - - public PropertyModifiedArgs(PropertyModification [] modifications) - { - this.modifications = modifications; - } - - public PropertyModification [] Modifications { - get { return modifications; } - } - } - - public delegate void PropertyModifiedHandler(object o, PropertyModifiedArgs args); - - public class Device : IEnumerable<KeyValuePair<string, object>>, IEqualityComparer<Device>, - IEquatable<Device>, IComparer<Device>, IComparable<Device> - { - private string udi; - private IDevice device; - - public event PropertyModifiedHandler PropertyModified; - - public Device(string udi) - { - this.udi = udi; - - device = CastDevice<IDevice>(); - device.PropertyModified += OnPropertyModified; - } - - public static Device [] UdisToDevices(string [] udis) - { - if(udis == null || udis.Length == 0) { - return new Device[0]; - } - - Device [] devices = new Device[udis.Length]; - for(int i = 0; i < udis.Length; i++) { - devices[i] = new Device(udis[i]); - } - - return devices; - } - - protected virtual void OnPropertyModified(int modificationsLength, PropertyModification [] modifications) - { - if(modifications.Length != modificationsLength) { - throw new ApplicationException("Number of modified properties does not match"); - } - - PropertyModifiedHandler handler = PropertyModified; - if(handler != null) { - handler(this, new PropertyModifiedArgs(modifications)); - } - } - - public string [] GetChildren(Manager manager) - { - return manager.FindDeviceByStringMatch("info.parent", Udi); - } - - public Device [] GetChildrenAsDevice(Manager manager) - { - return manager.FindDeviceByStringMatchAsDevice("info.parent", Udi); - } - - public void Lock(string reason) - { - device.Lock(reason); - } - - public void Unlock() - { - device.Unlock(); - } - - public string GetPropertyString(string key) - { - return device.GetPropertyString(key); - } - - public int GetPropertyInteger(string key) - { - return device.GetPropertyInteger(key); - } - - public ulong GetPropertyUInt64(string key) - { - return device.GetProperty(key); - } - - public double GetPropertyDouble(string key) - { - return device.GetPropertyDouble(key); - } - - public bool GetPropertyBoolean(string key) - { - return device.GetPropertyBoolean(key); - } - - public string [] GetPropertyStringList(string key) - { - return device.GetPropertyStringList(key); - } - - public PropertyType GetPropertyType(string key) - { - return PropertyExists(key) ? device.GetPropertyType(key) : PropertyType.Invalid; - } - - public void StringListPrepend(string key, string value) - { - device.SetPropertyString(key, value); - } - - public void StringListAppend(string key, string value) - { - device.StringListAppend(key, value); - } - - public void StringListRemove(string key, string value) - { - device.StringListRemove(key, value); - } - - public void SetPropertyString(string key, string value) - { - device.SetPropertyString(key, value); - } - - public void SetPropertyUInt64(string key, ulong value) - { - device.SetProperty(key, value); - } - - public void SetPropertyInteger(string key, int value) - { - device.SetPropertyInteger(key, value); - } - - public void SetPropertyDouble(string key, double value) - { - device.SetPropertyDouble(key, value); - } - - public void SetPropertyBoolean(string key, bool value) - { - device.SetPropertyBoolean(key, value); - } - - public void SetPropertyStringList(string key, string [] value) - { - device.SetPropertyStringList(key, value); - } - - public void RemoveProperty(string key) - { - device.RemoveProperty(key); - } - - public bool PropertyExists(string key) - { - return device.PropertyExists(key); - } - - public void AddCapability(string capability) - { - device.AddCapability(capability); - } - - public bool QueryCapability(string capability) - { - return device.QueryCapability(capability); - } - - public T CastDevice<T>() - { - if(!Bus.System.NameHasOwner("org.freedesktop.Hal")) { - throw new ApplicationException("Could not find org.freedesktop.Hal"); - } - - return Bus.System.GetObject<T>("org.freedesktop.Hal", new ObjectPath(Udi)); - } - - public IEnumerator<KeyValuePair<string, object>> GetEnumerator() - { - return device.GetAllProperties().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return device.GetAllProperties().GetEnumerator(); - } - - public bool Equals(Device other) - { - return Udi.Equals(other.Udi); - } - - public bool Equals(Device a, Device b) - { - return a.Udi.Equals(b.Udi); - } - - public int CompareTo(Device other) - { - return Udi.CompareTo(other.Udi); - } - - public int Compare(Device a, Device b) - { - return a.Udi.CompareTo(b.Udi); - } - - public int GetHashCode(Device a) - { - return a.Udi.GetHashCode(); - } - - public override int GetHashCode() - { - return Udi.GetHashCode(); - } - - public override string ToString() - { - return udi; - } - - public string this[string property] { - get { return PropertyExists(property) ? GetPropertyString(property) : null; } - set { SetPropertyString(property, value); } - } - - public string Udi { - get { return udi; } - } - - public bool IsVolume { - get { - if(!PropertyExists("info.interfaces")) { - return false; - } - - foreach(string @interface in GetPropertyStringList("info.interfaces")) { - if(@interface == "org.freedesktop.Hal.Device.Volume") { - return true; - } - } - - return false; - } - } - - public Volume Volume { - get { return new Volume(Udi); } - } - - public Device Parent { - get { - if(PropertyExists("info.parent")) { - return new Device(this["info.parent"]); - } - - return null; - } - } - } -} diff --git a/src/Backends/Banshee.Hal/Hal/Manager.cs b/src/Backends/Banshee.Hal/Hal/Manager.cs deleted file mode 100644 index 218a96565..000000000 --- a/src/Backends/Banshee.Hal/Hal/Manager.cs +++ /dev/null @@ -1,210 +0,0 @@ -// -// Manager.cs -// -// Author: -// Aaron Bockover <abockover@novell.com> -// -// Copyright (C) 2006-2008 Novell, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using System.Collections.Generic; - -using NDesk.DBus; -using org.freedesktop.DBus; - -namespace Hal -{ - internal delegate void DBusDeviceAddedHandler(string udi); - internal delegate void DBusDeviceRemovedHandler(string udi); - internal delegate void DBusNewCapabilityHandler(string udi, string capability); - - [Interface("org.freedesktop.Hal.Manager")] - internal interface IManager - { - event DBusDeviceAddedHandler DeviceAdded; - event DBusDeviceRemovedHandler DeviceRemoved; - event DBusNewCapabilityHandler NewCapability; - - string [] GetAllDevices(); - bool DeviceExists(string udi); - string [] FindDeviceStringMatch(string key, string value); - string [] FindDeviceByCapability(string capability); - } - - public class DeviceArgs : EventArgs - { - private string udi; - - public DeviceArgs(string udi) - { - this.udi = udi; - } - - public string Udi { - get { return udi; } - } - } - - public class DeviceAddedArgs : DeviceArgs - { - private Device device; - - public DeviceAddedArgs(string udi) : base(udi) - { - } - - public Device Device { - get { - if(device == null) { - device = new Device(Udi); - } - - return device; - } - } - } - - public class DeviceRemovedArgs : DeviceArgs - { - public DeviceRemovedArgs(string udi) : base(udi) - { - } - } - - public class NewCapabilityArgs : DeviceArgs - { - private string capability; - - public NewCapabilityArgs(string udi, string capability) : base(udi) - { - this.capability = capability; - } - - public string Capability { - get { return capability; } - } - } - - public delegate void DeviceAddedHandler(object o, DeviceAddedArgs args); - public delegate void DeviceRemovedHandler(object o, DeviceRemovedArgs args); - public delegate void NewCapabilityHandler(object o, NewCapabilityArgs args); - - public class Manager : IEnumerable<string> - { - private IManager manager; - - public event DeviceAddedHandler DeviceAdded; - public event DeviceRemovedHandler DeviceRemoved; - public event NewCapabilityHandler NewCapability; - - public Manager() - { - if(!Bus.System.NameHasOwner("org.freedesktop.Hal")) { - // try to start it - var reply = Bus.System.StartServiceByName ("org.freedesktop.Hal"); - if (reply != StartReply.Success && reply != StartReply.AlreadyRunning) { - throw new ApplicationException("Could not start org.freedesktop.Hal"); - } - - // If still not started, we're done - if(!Bus.System.NameHasOwner("org.freedesktop.Hal")) { - throw new ApplicationException("Could not find org.freedesktop.Hal"); - } - } - - manager = Bus.System.GetObject<IManager>("org.freedesktop.Hal", - new ObjectPath("/org/freedesktop/Hal/Manager")); - - if(manager == null) { - throw new ApplicationException("The /org/freedesktop/Hal/Manager object could not be located on the DBUs interface org.freedesktop.Hal"); - } - - manager.DeviceAdded += OnDeviceAdded; - manager.DeviceRemoved += OnDeviceRemoved; - manager.NewCapability += OnNewCapability; - } - - protected virtual void OnDeviceAdded(string udi) - { - if(DeviceAdded != null) { - DeviceAdded(this, new DeviceAddedArgs(udi)); - } - } - - protected virtual void OnDeviceRemoved(string udi) - { - if(DeviceRemoved != null) { - DeviceRemoved(this, new DeviceRemovedArgs(udi)); - } - } - - protected virtual void OnNewCapability(string udi, string capability) - { - if(NewCapability != null) - NewCapability(this, new NewCapabilityArgs(udi, capability)); - } - - public bool DeviceExists(string udi) - { - return manager.DeviceExists(udi); - } - - public string [] FindDeviceByStringMatch(string key, string value) - { - return manager.FindDeviceStringMatch(key, value); - } - - public string [] FindDeviceByCapability(string capability) - { - return manager.FindDeviceByCapability(capability); - } - - public Device [] FindDeviceByCapabilityAsDevice(string capability) - { - return Device.UdisToDevices(FindDeviceByCapability(capability)); - } - - public Device [] FindDeviceByStringMatchAsDevice(string key, string value) - { - return Device.UdisToDevices(FindDeviceByStringMatch(key, value)); - } - - public string [] GetAllDevices() - { - return manager.GetAllDevices(); - } - - public IEnumerator<string> GetEnumerator() - { - foreach(string device in GetAllDevices()) { - yield return device; - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - } -} diff --git a/src/Backends/Banshee.Hal/Hal/Volume.cs b/src/Backends/Banshee.Hal/Hal/Volume.cs deleted file mode 100644 index fb0e2937a..000000000 --- a/src/Backends/Banshee.Hal/Hal/Volume.cs +++ /dev/null @@ -1,81 +0,0 @@ -// -// Volume.cs -// -// Author: -// Aaron Bockover <abockover@novell.com> -// -// Copyright (C) 2006-2008 Novell, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using System.Collections.Generic; - -using NDesk.DBus; - -namespace Hal -{ - [Interface("org.freedesktop.Hal.Device.Volume")] - internal interface IVolume - { - void Mount(string [] args); - void Unmount(string [] args); - void Eject(string [] args); - } - - public class Volume : Device - { - public Volume(string udi) : base(udi) - { - } - - public void Mount() - { - Mount(new string [] { String.Empty }); - } - - public void Mount(params string [] args) - { - CastDevice<IVolume>().Mount(args); - } - - public void Unmount() - { - Unmount(new string [] { String.Empty }); - } - - public void Unmount(params string [] args) - { - CastDevice<IVolume>().Unmount(args); - } - - public void Eject() - { - Eject(new string [] { String.Empty }); - } - - public void Eject(params string [] args) - { - CastDevice<IVolume>().Eject(args); - } - } -} diff --git a/src/Backends/Banshee.Hal/Makefile.am b/src/Backends/Banshee.Hal/Makefile.am deleted file mode 100644 index 454ba290f..000000000 --- a/src/Backends/Banshee.Hal/Makefile.am +++ /dev/null @@ -1,29 +0,0 @@ -ASSEMBLY = Banshee.Hal -TARGET = library -LINK = $(REF_BACKEND_HAL) -INSTALL_DIR = $(BACKENDS_INSTALL_DIR) - -SOURCES = \ - Banshee.HalBackend/BlockDevice.cs \ - Banshee.HalBackend/CdromDevice.cs \ - Banshee.HalBackend/Device.cs \ - Banshee.HalBackend/DeviceMediaCapabilities.cs \ - Banshee.HalBackend/DiscVolume.cs \ - Banshee.HalBackend/DiskDevice.cs \ - Banshee.HalBackend/DkDisk.cs \ - Banshee.HalBackend/HardwareManager.cs \ - Banshee.HalBackend/UsbDevice.cs \ - Banshee.HalBackend/Volume.cs \ - Hal/Device.cs \ - Hal/Manager.cs \ - Hal/Volume.cs - -RESOURCES = Banshee.Hal.addin.xml - -if ENABLE_HAL -include $(top_srcdir)/build/build.mk -else -EXTRA_DIST = $(SOURCES) $(RESOURCES) -endif - - diff --git a/src/Backends/Makefile.am b/src/Backends/Makefile.am index c0d5c4148..65d979945 100644 --- a/src/Backends/Makefile.am +++ b/src/Backends/Makefile.am @@ -3,7 +3,6 @@ SUBDIRS = \ Banshee.Gnome \ Banshee.GStreamer \ Banshee.GStreamerSharp \ - Banshee.Hal \ Banshee.Unix \ Banshee.NowPlaying.X11 \ Banshee.Osx |