2006-04-17 Aaron Bockover <aaron@abock.org>

* src/NjbTest.cs: Added --hal-fdi-dump to generate HAL FDI entries for
    all devices listed in DeviceId

    * src/DeviceId.cs: Added support for storing input/output formats


svn path=/trunk/njb-sharp/; revision=59542
This commit is contained in:
Aaron Bockover 2006-04-17 16:33:39 +00:00
Родитель 05fb2c379d
Коммит 45b24754e4
3 изменённых файлов: 82 добавлений и 35 удалений

Просмотреть файл

@ -1,3 +1,10 @@
2006-04-17 Aaron Bockover <aaron@abock.org>
* src/NjbTest.cs: Added --hal-fdi-dump to generate HAL FDI entries for
all devices listed in DeviceId
* src/DeviceId.cs: Added support for storing input/output formats
2006-04-13 Aaron Bockover <aaron@abock.org>
* configure.ac: Bump to 0.3.0

Просмотреть файл

@ -2,8 +2,8 @@
/***************************************************************************
* DeviceId.cs
*
* Copyright (C) 2005 Novell
* Written by Aaron Bockover (aaron@aaronbock.net)
* Copyright (C) 2005-2006 Novell, Inc.
* Written by Aaron Bockover <aaron@abock.org>
****************************************************************************/
/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW:
@ -32,27 +32,27 @@ namespace Njb
public class DeviceId
{
private static DeviceId [] device_id_list = {
// Full Device Name Display/Short Name Vendor ID Product ID
new DeviceId("Creative Nomad Jukebox", "Nomad Jukebox", 0x0471, 0x0222),
new DeviceId("Creative Nomad Jukebox 2", "Nomad Jukebox", 0x041e, 0x4100),
new DeviceId("Creative Nomad Jukebox 3", "Nomad Jukebox", 0x041e, 0x4101),
new DeviceId("Creative Nomad Jukebox Zen", "Zen Jukebox", 0x041e, 0x4108),
new DeviceId("Creative Nomad Jukebox Zen USB 2.0", "Zen Jukebox", 0x041e, 0x410b),
new DeviceId("Creative Nomad Jukebox Zen NX", "Zen NX Jukebox", 0x041e, 0x4109),
new DeviceId("Creative Nomad Jukebox Zen Xtra", "Zen Xtra Jukebox", 0x041e, 0x4110),
new DeviceId("Dell Digital Jukebox", "Dell Jukebox", 0x041e, 0x4111),
new DeviceId("Creative Nomad Jukebox Zen Touch", "Nomad Jukebox", 0x041e, 0x411b),
new DeviceId("Creative Zen (Zen Micro variant)", "Zen Micro", 0x041e, 0x411d),
new DeviceId("Creative Nomad Jukebox Zen Micro", "Zen Micro", 0x041e, 0x411e),
new DeviceId("Second Generation Dell Digital Jukebox", "Dell Jukebox", 0x041e, 0x4126),
new DeviceId("Dell Pocket DJ", "Dell Pocket DJ", 0x041e, 0x4127),
new DeviceId("Creative Zen Sleek", "Zen Sleek", 0x041e, 0x4136)
// Full Device Name Display/Short Name Vendor ID Product ID Output formats Input Formats
new DeviceId("Creative Nomad Jukebox", "Nomad Jukebox", 0x0471, 0x0222, new string [] { "audio/mpeg" }, null),
new DeviceId("Creative Nomad Jukebox 2", "Nomad Jukebox", 0x041e, 0x4100, new string [] { "audio/mpeg" }, null),
new DeviceId("Creative Nomad Jukebox 3", "Nomad Jukebox", 0x041e, 0x4101, new string [] { "audio/mpeg" }, null),
new DeviceId("Creative Nomad Jukebox Zen", "Zen Jukebox", 0x041e, 0x4108, new string [] { "audio/mpeg" }, null),
new DeviceId("Creative Nomad Jukebox Zen USB 2.0", "Zen Jukebox", 0x041e, 0x410b, new string [] { "audio/mpeg" }, null),
new DeviceId("Creative Nomad Jukebox Zen NX", "Zen NX Jukebox", 0x041e, 0x4109, new string [] { "audio/mpeg" }, null),
new DeviceId("Creative Nomad Jukebox Zen Xtra", "Zen Xtra Jukebox", 0x041e, 0x4110, new string [] { "audio/mpeg" }, null),
new DeviceId("Dell Digital Jukebox", "Dell Jukebox", 0x041e, 0x4111, new string [] { "audio/mpeg" }, null),
new DeviceId("Creative Nomad Jukebox Zen Touch", "Nomad Jukebox", 0x041e, 0x411b, new string [] { "audio/mpeg" }, null),
new DeviceId("Creative Zen (Zen Micro variant)", "Zen Micro", 0x041e, 0x411d, new string [] { "audio/mpeg" }, null),
new DeviceId("Creative Nomad Jukebox Zen Micro", "Zen Micro", 0x041e, 0x411e, new string [] { "audio/mpeg" }, null),
new DeviceId("Second Generation Dell Digital Jukebox", "Dell Jukebox", 0x041e, 0x4126, new string [] { "audio/mpeg" }, null),
new DeviceId("Dell Pocket DJ", "Dell Pocket DJ", 0x041e, 0x4127, new string [] { "audio/mpeg" }, null),
new DeviceId("Creative Zen Sleek", "Zen Sleek", 0x041e, 0x4136, new string [] { "audio/mpeg" }, null)
};
private static string [] EmptyArray = new string [] { };
public static DeviceId [] ListAll {
get {
return device_id_list;
}
get { return device_id_list; }
}
public static bool IsNjbDevice(short vendorId, short productId)
@ -75,37 +75,42 @@ namespace Njb
private string display_name;
private short vendor_id;
private short product_id;
private string [] output_formats;
private string [] input_formats;
private DeviceId(string name, string displayName, short vendorId, short productId)
private DeviceId(string name, string displayName, short vendorId, short productId,
string [] outputFormats, string [] inputFormats)
{
this.name = name;
this.display_name = displayName;
this.vendor_id = vendorId;
this.product_id = productId;
this.output_formats = outputFormats;
this.input_formats = inputFormats;
}
public string Name {
get {
return name;
}
get { return name; }
}
public string DisplayName {
get {
return display_name;
}
get { return display_name; }
}
public short VendorId {
get {
return vendor_id;
}
get { return vendor_id; }
}
public short ProductId {
get {
return product_id;
}
get { return product_id; }
}
public string [] OutputFormats {
get { return output_formats == null ? EmptyArray : output_formats; }
}
public string [] InputFormats {
get { return input_formats == null ? EmptyArray : input_formats; }
}
}
}

Просмотреть файл

@ -32,6 +32,36 @@ using Njb;
public class Test
{
public static void HalFdiDump()
{
Console.WriteLine(" <match key=\"info.bus\" string=\"usb\">\n\n");
Console.WriteLine(" <!-- Begin NJB devices (generated by njb-sharp for libnjb compatible devices) -->\n");
foreach(DeviceId device in DeviceId.ListAll) {
Console.WriteLine(" <!-- {0} -->", device.Name);
Console.WriteLine(" <match key=\"usb.vendor_id\" int=\"0x{0:x4}\">", device.VendorId);
Console.WriteLine(" <match key=\"usb.product_id\" int=\"0x{0:x4}\">", device.ProductId);
Console.WriteLine(" <append key=\"info.capabilities\" type=\"strlist\">portable_audio_player</append>");
Console.WriteLine(" <merge key=\"info.category\" type=\"string\">portable_audio_player</merge>");
Console.WriteLine(" <merge key=\"portable_audio_player.type\" type=\"string\">njb</merge>");
Console.WriteLine(" <merge key=\"portable_audio_player.access_method\" type=\"string\">user</merge>");
foreach(string output_format in device.OutputFormats) {
Console.WriteLine(" <append key=\"portable_audio_player.output_formats\" type=\"strlist\">{0}</append>", output_format);
}
foreach(string input_format in device.InputFormats) {
Console.WriteLine(" <append key=\"portable_audio_player.input_formats\" type=\"strlist\">{0}</append>", input_format);
}
Console.WriteLine(" </match>");
Console.WriteLine(" </match>\n");
}
Console.WriteLine(" <!-- End NJB devices -->");
Console.WriteLine("\n\n </match>");
}
public static void Assert(bool assert, string msg)
{
if(!assert) {
@ -41,6 +71,11 @@ public class Test
public static void Main(string [] args)
{
if(args[0] == "--hal-fdi-dump") {
HalFdiDump();
return;
}
Discoverer discoverer = new Discoverer();
//Global.Debug = Global.DebugFlags.ALL;
@ -85,9 +120,9 @@ public class Test
string filename = song.TrackNumber.ToString("00") + ". " + song.Artist
+ " - " + song.Title + "." + song.Codec.ToLower();
device.ReadProgressChanged += OnProgress;
device.ProgressChanged += OnProgress;
device.ReadSong(song, filename);
device.ReadProgressChanged -= OnProgress;
device.ProgressChanged -= OnProgress;
Console.WriteLine("");
}