PDA

View Full Version : Problem with firmware upgrade - SA3ARA04K/97



Nick75
12-15-2011, 10:56 AM
Hello,

I've bought Philips GoGear Ariaz MP3 player (SA3ARA04K/97) with firmware1.04.

Unfortunately, I couldn't update current firmware.

I'm trying to update my GoGear Ariaz firmware through Songbird v2.5.6 Build: 5.6.2119, with Philips Songbird version: 2.5.2 (Build: 5.2.1953; Revision: 625). I was trying to reset my player (by button 10 sec) and then to update.
OS of my PC is Windows 7 Ultimate x64

But I always have an error message as soon as it tries to begin the update process (after loading firmware from Internet).

Please see screen-shot of this error message.

696

Please assist if you have any ideas

Thank you

laserxp
12-16-2011, 02:55 PM
same thing here

Nick75
12-17-2011, 03:22 AM
Dear Moderators,

Please assist to resolve this issue.
This device has a very good design and loudspeaker. I bought this player for audio-books.

But, it will be sad if Philips support doesn’t provide clear answer about this issue.

Thank you

erick2005
12-24-2011, 07:20 PM
same issue here... ! :mad:

mallen100
12-26-2011, 07:09 PM
I am also having this problem...

Using
- Philips SA3VBE04RN Vibe 4GB
- Windows 7 Home premium x64
- Philips Songbird version: 2.5.4 (Build: 5.4.1980; Revision: 640)

kwinnie
01-04-2012, 10:20 AM
so all of you means you cannot upgrade your player with window 7 OS?

kwinnie
01-04-2012, 10:32 AM
so all of you means you cannot upgrade your player with window 7 OS?
maybe you can capture your error console here by Songbird>Tools>Error Console

Philips - Andrea
01-04-2012, 10:34 AM
Dear Nick75, Laserxp and Erick2005,

Thank you for the detailed information of the issue you have provided.

I would like to reassure you that we are looking into the issue regarding upgrading the firmware.

Thank you for your assistance and patience in advance.

Kindest regards,

Andrea

kwinnie
01-05-2012, 03:12 AM
wait :D
i seem to have misunderstand something.
so you mean it's not possible upgrading the songbird, not the firmware itself?

if that's the prob, the easiest mean to solve it is to uninstall the songbird, and then go to support website to download the latest songbird.
but if that's on the firmware itself, then it's diff story

Philips - Andrea
01-05-2012, 09:18 AM
Dear all,

After testing the issue that has been reported we have found that the latest version of Songbird should resolve the problem.

So, I would suggest updating your current Songbird version.

If you have an issue doing this, as Kwinnie has suggested please uninstall Songbird and re-install from our Philips site using this link: http://www.philips.co.uk/c/mp3-and-mp4-players/32317/cat/#/difference/philipssongbird

Please let me know if you have any further difficulties.

Kindest regards,

Andrea

mallen100
01-05-2012, 10:23 AM
I've updated to the latest Songbird (version: 2.5.6 Build: 5.6.2119) and still have the same error updating the firmware

This is the only error showing in the error console


Error: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [sbIDeviceProperties.hidden]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: file:///C:/Program%20Files%20(x86)/Philips/Philips%20Songbird/extensions/msc@songbirdnest.com/platform/WINNT_x86-msvc/components/sbMSCServicePaneService.js :: sbMSC_SPS__updateDevNode :: line 1151" data: no]
Source File: file:///C:/Program%20Files%20(x86)/Philips/Philips%20Songbird/extensions/msc@songbirdnest.com/platform/WINNT_x86-msvc/components/sbMSCServicePaneService.js
Line: 1151

kwinnie
01-05-2012, 10:31 AM
hi mallen100, :)

can you elaborate how you get this error?
you are performing upgrade or you are doing format or repair?

during upgrade/ format/ repair, have you stopped it from processing further?

mallen100
01-05-2012, 10:57 AM
Hi,

I am trying to update the firmware. This is the process I followed

Open Songbird
Connect MP3 player to pc
Select Device in songbird
On Tools tab click check for update
I get a message saying an upgrade from v1.00 to 2.21 is available
Click Install New Firmware button
After a few seconds I get a msg telling me to uplug device, turn it off and reconnect holding vol+ button.
I perform the above steps
After 5-10 seconds I get the message "There was an error installing firmware on your device"

kwinnie
01-06-2012, 02:47 AM
this is abnormal.
cuz if ask you to do this
uplug device, turn it off and reconnect holding vol+ button.
it s a repair. that means all your data in your mp3 will be lost. it's not usual firmware upgrade steps...

PLEASE stop doing anything if it asks you to repair if you do not want to lost all your media inside it.

seems there are something wrong in the firmware itself.

Nick75
01-06-2012, 08:43 AM
Dear All,

Thank you for your replies.

Philips – Andrea, Kwinnie

I’ve installed last version of SongBird - Philips Songbird version: 2.5.6 Build: 5.6.2119; Rev: 720; Firmware: UNIVER. I have absolutely the same result as Mallen100 (including message to unplug device, turn it off and reconnect holding vol+ button in firmware upgrade mode).

Finally, I have the same error window as before.

Information from error console is:

Error: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [sbIDeviceProperties.hidden]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: file:///C:/Program%20Files%20(x86)/Philips/Philips%20Songbird/extensions/msc@songbirdnest.com/platform/WINNT_x86-msvc/components/sbMSCServicePaneService.js :: sbMSC_SPS__updateDevNode :: line 1151" data: no]
Source: file:///C:/Program%20Files%20(x86)/Philips/Philips%20Songbird/extensions/msc@songbirdnest.com/platform/WINNT_x86-msvc/components/sbMSCServicePaneService.js
Line: 1151

Thank you for your help and will be waiting for new advices.

Philips - Andrea
01-06-2012, 01:35 PM
Dear Nick75 and Mallen100,

Thank you for letting us know how you got on. I will feed this error back to our development team and will update you accordingly.

Thanks for your patience in advance.

Kindest regards,

Andrea

Philips - QK
01-09-2012, 10:27 AM
Dear users,

We have tested the scenario you described and we can yet find any issues. To help us further testing, could you please let us know your full serial number (S/N) so that we can see if this is a patch-wise issue. This number can be found on the device.

Thanks a lot in advance.

Kind regards,
Philips Moderation Team

mallen100
01-09-2012, 06:09 PM
Hi,

Serial Number is MT1A1116001329

Nick75
01-10-2012, 08:55 AM
Hello,

My player info:

model: SA3ARA04K/97
s/n: MT1B1134023355

Philips - QK
01-11-2012, 02:02 AM
Hi mallen100 & Nick75,

Thanks a lot for giving us the S/N information.
I have sent you a private message to discuss with you the way to follow up this. Please check your inbox.

Kind regards,
Philips Moderation Team

Nacho
01-12-2012, 06:10 PM
Hi,

I'm having this same problem trying to update the firmware of my SA3ARA16K/02 ariaz player. Its serial number is MT1B1123004935.

I've already downloaded Philips Songbird from the link you've provided above, but the result is the same (either trying to update the firmware or trying to restore factory defaults).

Could you please provide some help? Thanks in advance,

Nacho.

erick2005
01-18-2012, 05:49 AM
I've updated to the latest Songbird version and still have the same issue updating the firmware.
Plz help me.

Model: SA2ARA16K/55
S/N: SF1A1015001068

RevanKnight
01-18-2012, 04:14 PM
Same problem here sa3vbe08k/97 S/N:MT1D1137019351 i update to last version of songbird same problem, error installing firmware to device, after i reconnect the device push vol + buttom.

Philips - QK
01-19-2012, 01:01 AM
Dear consumers,

We have done a very comprehensive testing on this firmware upgrade issue. Please find the results of FW upgrade for SA3ARA & SA3VBE from v1.00, v1.06 and v2.00 to v2.06 (P4C) via PSB 2.5.6 - 2119 below:

SA3ARA & SA3VBE FW Upgrade to v2.06 via PSB 2.5.6 - 2119

From WinXP
v1.00 Passed
v1.06 Passed
v2.00 Passed

From Win7-32bit

v1.00 Passed
v1.06 Passed
v2.00 Passed

From Win7-64bit

v1.00 Passed
v1.06 Passed
v2.00 Passed

In short, we cannot reproduce the issue that you have. We suspect that it is a hardware issue instead of a software or Songbird issue. We are now in a process to track back devices for investigation. We will update you as soon as we have more information.

Thanks for your patience whilst we are looking into this.

Kind regards,
Philips Moderation Team

* Please check your inbox since we would like to obtain more information from some of you.

Philips - QK
01-20-2012, 02:10 AM
Hi mallen100,

Could you please check your inbox as we need some extra information from you?

Thanks & regards,
Philips Moderation Team

Hans37
01-29-2012, 03:39 PM
SA3RGA04RN/02 -> not responding after failed factory reset

pretty the same problem here
I use Philips Songbird version: 2.5.6 Build: 5.6.2119
firmware gogear was 1.07 (up to date)

During updating my gogear I got my list of genres mixed up in the gogear itself (not in songbird)
So deleted all songs from gogear and downloaded again. Same problem (some of the songs were put in a genre 28 f.i. instead of pop as is in the meta data)

so I decided to reformat the gogear. This didn't work: I got an error message
the gogear was still functional
then I tried a reset with the resetbutton on the device and tried another format, same result

back to the factorysettings via the gogear menu didn't work out either: error message after reconnecting with volume + key pressed

Via the manual I learned the option in the tools menu: now the device seamed to respond and get a new firmware, but somewhere after 3/4, songbird gave an errormessage and the instructions to try again. I waited a while and decided to follow this instruction

and now the gogear is dead, not responding, has a black screen and the toolmenu in songbird doesn't show the options anymore.
The gogear is part of reckognized in songbird as it is still in the lefthand menu but the information shows no firmware number neither memorysize

I agree with one of the former guys that the musicquality is very good, but I do have to much problems with the software to keep on liking this device.

Please, what can I do to get it operational again?

ps last time I had a question on this forum I had problems to reply

Philips - Remko
02-20-2012, 06:45 AM
Dear All,

Whenever you have issues upgrading your MP3 player using songbird this can related to various issues as for example Network issue, Windows issue and Profile issue.

These following steps may help to clean up the PSB:

1. Go to “All Programs” > “Philips”, click “Philips Songbird – Uninstall” to uninstall PSB
2. Reboot the PC
3. Unzip cleanPSB.zip as attached
4. Double click cleanPSB.bat
5. Install PSB again
6. Try to upgrade the device again

If you need this file please send me a PM.

Kind regards,

jpb67
03-05-2012, 10:37 PM
Hello, I seem to have similar problems:

I bought two SA3ARA04 for my sons. When connecting to Songbird, the first one indicated a new firmware was available and asked to install it. I confirmed and it did smoothly and the device works fine. So for the second one I used the "check firmware" command from SB and then I got these instructions with holding the Vol+ button etc. I proceeded and now the thing just has a white screen. You still can install mp3 files, it recognizes it but it can't be handled since the screen is just white. The firware installed is version 1.00, while the first one is 2.06?? Trying to reapir results in endless waiting (>35 minutes).
What to do??

Josin
04-29-2012, 05:07 PM
Hi, I just use the cleanPSB.bat and reinstall PSB but the issue is not solved.

My current firmware is v2.02 and I try to upgrade it to v2.06.

I try to update the firmware, but after a few seconds, the process is interrupted and displays an error message.

I tried to repair it, but when the PSB try to reload the firmware, it stops again and shows the error message.

Then I formatted the device and retried both procedures with the same results.

My computer runs Windows XP SP3.

The serial number of my SA3ARA16K/02 is MT1B1146012065

Can I do anything else?

Philips - QK
05-08-2012, 06:48 AM
Dear users,

If you are still experiencing a firmware upgrade issue, could you help provide us these info:


1. Philips Songbird (PSB) version number
a. Launch PSB
b. Click “Help”
c. Click “About Philips Songbird”
d. Copy the version number (e.g. Philips Songbird version: 2.6.1 Build: 6.1.2265; Rev: 720; Firmware: UNIVER)

2. OS information
a. Click “My computer”
b. Right click "Properties"
c. "System type". Check if you are using 64 bit or 32 bit system (e.g. Windows 7 - 32 bit, Windows 7 - 64 bit, WinXP)

3. Current and firmware version to be upgrade
a. Launch PSB
b. Plug in Philips GoGear device
c. Click on your device in device panel
d. Click “Tools”
e. Record “Current firmware version” from “Update Firmware” box
f. Click “Check for updated firmware” so as to see the latest version available.

4. Mode of the device (MTP or MSC mode)
a. Connect your Philips GoGear device to PC
b. Do not touch any buttons for 2 mins
b. After 2 mins, check which mode (MTP mode or MSC mode) is shown on the screen
NOTE: For some devices there is only MSC mode.

5. Capture the screen for the error message

Please be noted of the below:

Reinstall PSB Steps:
1. Uninstall PSB
2. Restart PC
3. Double click on cleanPSB.bat (this can be requested)
4. Install PSB from http://www.philips.com/songbird
5. Start PSB

Important note:

Prerequisite for PSB:
1. Make sure you have installed Windows Media Player 11 before installing Philips Songbird

Looking forward to your reply. Thanks.

Kind regards,
Philips Moderation Team

Josin
05-12-2012, 11:48 PM
Hi, this is my info:

Model: SA3ARA16K/02

Serial number: MT1B1146012065

Tested in PC 1:


Philips Songbird:

Philips Songbird version: 2.6.1 Build: 6.1.2265; Rev: 720; Firmware: UNIVER

OS Information:

Windows Vista Home Premium Service Pack 2 - 32 bit

Firmware:

Current: 2.02
Latest Available: 2.06

Mode of the device:

MTP mode.

Errors (from PSB Console):

Error: uncaught exception: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [sbIDeviceProperties.hidden]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: chrome://msc/content/xul/mscDeviceSummaryPage.xul?device-id={00000000-0000-0000-0000-000000000000} :: deviceSummary__update :: line 332" data: no]

Error: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [sbIDeviceProperties.hidden]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: file:///C:/Program%20Files/Philips/Philips%20Songbird/extensions/msc@songbirdnest.com/platform/WINNT_x86-msvc/components/sbMSCServicePaneService.js :: sbMSC_SPS__updateDevNode :: line 1183" data: no]
Archivo de origen: file:///C:/Program%20Files/Philips/Philips%20Songbird/extensions/msc@songbirdnest.com/platform/WINNT_x86-msvc/components/sbMSCServicePaneService.js
Línea: 1183

Other:

Uninstall and reinstall WMP11

THE ISSUE PERSIST


Tested in PC 2:

Philips Songbird:

Philips Songbird version: 2.6.1 Build: 6.1.2265; Rev: 720; Firmware: UNIVER

OS Information:

Windows XP Professional Version 2002 Service Pack 3 - 32 bit

Firmware:

Current: 2.02
Latest Available: 2.06

Mode of the device:

MTP mode.

Errors (from PSB Console):

Error: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [sbIDeviceProperties.hidden]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: file:///C:/Archivos%20de%20programa/Philips/Philips%20Songbird/extensions/msc@songbirdnest.com/platform/WINNT_x86-msvc/components/sbMSCServicePaneService.js :: sbMSC_SPS__updateDevNode :: line 1183" data: no]
Archivo de origen: file:///C:/Archivos%20de%20programa/Philips/Philips%20Songbird/extensions/msc@songbirdnest.com/platform/WINNT_x86-msvc/components/sbMSCServicePaneService.js
Línea: 1183

Other:

Uninstall and reinstall WMP11

THE ISSUE PERSIST

Philips - QK
05-14-2012, 04:31 AM
Dear Josin,

Could you follow the path below to see if the firmware package is in your Songbird or not?

Computer > Program files >Philips > Philips Songbird Resources> Firmware > See if there's a folder named "SA3ARA"

Meanwhile I will send your input to the software team to seek their advice. Will update you on this. Thanks.

Thanks,
Philips Moderation Team

Josin
05-14-2012, 07:48 PM
In folder "Computer > Program files >Philips > Philips Songbird Resources> Firmware >" there is a folder named SA3ARA. In it, there is a file named "GoGearFWLibSA3ARA.dll"

Many thanks for your time.

Philips - QK
05-15-2012, 07:14 AM
Hi Josin,

We have tried with your setting, firmware can be upgraded (from v2.02 to v2.06):

Setup:
1) two WinXP (32 bit) PC
2) PSB version: Philips Songbird version: 2.6.1 Build: 6.1.2265; Rev: 720; Firmware: UNIVER
3) MTP mode

If you can find the SA3ARA folder in the Philips Songbird Recources, then you are using the correct version of Songbird and you should be able to get the firmware.

Could you provide us more detailed error console by following these steps:

1. Launch PSB.
2. Press "new tab" button in the main frame.
3. Type “about:config” in the URL bar and press “Enter”
4. Click on the “I’ll be careful, I promise!” button
5. Right click in the new browsing tab. In the right click menu, select “New” >> “Boolean” >> type “extensions.firmware.philips.debug” as the preference name >> Select True >> Click OK.
6. Click “Tools” in the top menu and select “Error Console” to launch error capturing (you can delete the old error console before capturing error console for your issue)
7. Try to reproduce the issue: update / repair
8. More detailed log will capture by Error Console.
9. Copy and paste in the forum so that we can look into that further


Thanks a lot for your patience and time.

Kind regards,
Philips Moderation Team

Josin
05-17-2012, 12:12 AM
Error log

Error: DoRecoveryUpdate(C:\Documents and Settings\Josᅢᆵn\Configuraciᅢᄈn local\Datos de programa\Philips-Songbird\Profiles\z07ysl2v.default\firmware_cache\ v2\Philips SA3ARA\) in C:\Archivos de programa\Philips\Philips Songbird Resources\Firmware\SA3ARA\GoGearFWLibSA3ARA.dll FAILED [4]

Error: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [sbIDeviceProperties.hidden]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: file:///C:/Archivos%20de%20programa/Philips/Philips%20Songbird/extensions/msc@songbirdnest.com/platform/WINNT_x86-msvc/components/sbMSCServicePaneService.js :: sbMSC_SPS__updateDevNode :: line 1183" data: no]
Archivo de origen: file:///C:/Archivos%20de%20programa/Philips/Philips%20Songbird/extensions/msc@songbirdnest.com/platform/WINNT_x86-msvc/components/sbMSCServicePaneService.js
Línea: 1183

Error: uncaught exception: [Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [sbIDeviceFirmwareUpdater.finalizeUpdate]" nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)" location: "JS frame :: chrome://songbird/content/scripts/device/deviceFirmwareWizard.js :: deviceFirmwareWizard__finalize :: line 652" data: no]

Error: GetDeviceInfo(00000001000015420002DCDF7EC95542) in C:\Archivos de programa\Philips\Philips Songbird Resources\Firmware\SA3ARA\GoGearFWLibSA3ARA.dll FAILED [1]

Error: DoRecoveryUpdate(C:\Documents and Settings\Josᅢᆵn\Configuraciᅢᄈn local\Datos de programa\Philips-Songbird\Profiles\z07ysl2v.default\firmware_cache\ v2\Philips SA3ARA\) in C:\Archivos de programa\Philips\Philips Songbird Resources\Firmware\SA3ARA\GoGearFWLibSA3ARA.dll FAILED [4]

Error: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [sbIDeviceProperties.hidden]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: file:///C:/Archivos%20de%20programa/Philips/Philips%20Songbird/extensions/msc@songbirdnest.com/platform/WINNT_x86-msvc/components/sbMSCServicePaneService.js :: sbMSC_SPS__updateDevNode :: line 1183" data: no]
Archivo de origen: file:///C:/Archivos%20de%20programa/Philips/Philips%20Songbird/extensions/msc@songbirdnest.com/platform/WINNT_x86-msvc/components/sbMSCServicePaneService.js
Línea: 1183

DETAILS

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 :miv */
/*
*
*=BEGIN SONGBIRD LICENSE
*
* Copyright(c) 2005-2010 POTI, Inc.
* http://www.songbirdnest.com
*
* For information about the licensing and copyright of this Add-On please
* contact POTI, Inc. at customer@songbirdnest.com.
*
*=END SONGBIRD LICENSE
*
*/

/**
* \file sbMSCServicePaneService.js
* \brief Songbird MSC Device Service Pane Service Source.
*/

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//
// MSC device service pane service component.
//
// This component provides service pane support for MSC devices.
//
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
//
// MSC device service pane service imported services.
//
//------------------------------------------------------------------------------

// Component manager defs.
if (typeof(Cc) == "undefined")
var Cc = Components.classes;
if (typeof(Ci) == "undefined")
var Ci = Components.interfaces;
if (typeof(Cr) == "undefined")
var Cr = Components.results;
if (typeof(Cu) == "undefined")
var Cu = Components.utils;

// Songbird imports.
Cu.import("resource://app/jsmodules/ArrayConverter.jsm");
Cu.import("resource://app/jsmodules/sbProperties.jsm");
Cu.import("resource://app/jsmodules/kPlaylistCommands.jsm");
Cu.import("resource://app/jsmodules/StringUtils.jsm");
Cu.import("resource://app/jsmodules/SBTimer.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");


//------------------------------------------------------------------------------
//
// MSC device service pane service configuration.
//
//------------------------------------------------------------------------------

//
// classDescription Description of component class.
// classID Component class ID.
// contractID Component contract ID.
// ifList List of external component interfaces.
// _xpcom_categories List of component categories.
//
// mscSP_NS Device service pane namespace.
// itemURNPrefix Item URN prefix.
// devMgrURL URL of device manager window.
//

var sbMSC_SPSCfg = {
classDescription: "Songbird MSC Device Service Pane Service",
classID: Components.ID("{f8e494cc-560a-4e1c-81c8-4ea1a7709024}"),
contractID: "@songbirdnest.com/servicepane/MSCDevice;1",
ifList: [ Ci.sbIServicePaneModule,
Ci.sbIServicePaneMutationListener,
Ci.sbIDeviceEventListener ],
_xpcom_categories:
[
{
category: "service-pane",
entry: "msc-device"
}
],

itemURNPrefix: "urn:item:",
mscSP_NS: "http://songbirdnest.com/rdf/msc-servicepane#",
devMgrURL: "chrome://msc/content/xul/mscDeviceSummaryPage.xul"
};


//------------------------------------------------------------------------------
//
// MSC device service pane service object.
//
//------------------------------------------------------------------------------

/**
* Construct an MSC device service pane service object.
*/

function sbMSC_SPS() {
}

// Define the object.
sbMSC_SPS.prototype = {
// Set the constructor.
constructor: sbMSC_SPS,

//
// MSC device service pane service fields.
//
// classDescription Description of component class.
// classID Component class ID.
// contractID Component contract ID.
// _xpcom_categories List of component categories.
//
// _cfg Configuration settings.
// _devMgr Device manager object.
// _servicePaneSvc Service pane service object.
// _devServicePaneSvc Device service pane service object.
// _libServicePaneSvc Library service pane service object.
// _libMgr Library manager object.
// _devInfoList List of device information. Each element
// contains the following properties: svcPaneNode,
// device, properties
// devLibTable, playlistTable
//

classDescription: sbMSC_SPSCfg.classDescription,
classID: sbMSC_SPSCfg.classID,
contractID: sbMSC_SPSCfg.contractID,
_xpcom_categories: sbMSC_SPSCfg._xpcom_categories,

_cfg: sbMSC_SPSCfg,
_devMgr: null,
_servicePaneSvc: null,
_devServicePaneSvc: null,
_libServicePaneSvc: null,
_libMgr: null,
_devInfoList: null,
_devStateRefreshTimer: null,

//----------------------------------------------------------------------------
//
// MSC device service pane sbIServicePaneModule services.
//
//----------------------------------------------------------------------------

/* \brief Initialize this service pane module
* This is where the module should set itself up in the tree if it hasn't
* before.
* \param aServicePaneService the service pane service instance
*/

servicePaneInit: function sbMSC_SPS_servicePaneInit(aServicePaneService) {
// Save the service pane service.
this._servicePaneSvc = aServicePaneService;

// Initialize the services.
this._initialize();
},


/* \brief Fill the context menu for the given node
* \param aNode the node that was context-clicked on
* \param aContextMenu the menu we're trying to fill
* \param aParentWindow the toplevel window we're displaying in
*/

fillContextMenu: function sbMSC_SPS_fillContextMenu(aNode,
aContextMenu,
aParentWindow) { },


/* \brief Fill a menu with menuitems to create new tree nodes
* \param aNode the node or null for the click and hold menu
* \param aContextMenu the menu we're trying to fill
* \param aParentWindow the toplevel window we're displaying in
*/

fillNewItemMenu: function sbMSC_SPS_fillNewItemMenu(aNode,
aContextMenu,
aParentWindow) { },


/* \brief Selection changes notification
* \param aNode the node that is now selected
* \param aParentWindow the toplevel window we're displaying in
*/

onSelectionChanged: function sbMSC_SPS_onSelectionChanged(aNode,
aContainer,
aParentWindow) { },


/* \brief Return whether the item can be dropped on the node
*/

canDrop: function sbMSC_SPS_canDrop(aNode,
aDragSession,
aOrientation,
aWindow) {
// only accept drops that are ON this node, not above or below
if (aOrientation != Ci.nsITreeView.DROP_ON)
return false;

// find the target library to which we need to forward the event
var libraryNode = this._getLibraryNodeForDeviceNode(aNode);
if (libraryNode) {
// forward the event
return this._servicePaneSvc.canDrop(libraryNode,
aDragSession,
Ci.nsITreeView.DROP_ON,
aWindow);
}
return false;
},


/* \brief Handle dropping of an item on node
*/

onDrop: function sbMSC_SPS_onDrop(aNode,
aDragSession,
aOrientation,
aWindow) {
// find the target library to which we need to forward the event
var libraryNode = this._getLibraryNodeForDeviceNode(aNode);
if (libraryNode) {
// forward the event
this._servicePaneSvc.onDrop(libraryNode,
aDragSession,
Ci.nsITreeView.DROP_ON,
aWindow);
}
},


/* \brief Handle drag gesture
*/

onDragGesture: function sbMSC_SPS_onDragGesture(aNode, aDataTransfer) { },


/* \brief Called before a user starts to rename a node.
* \param aNode the node that is about to be renamed
*/

onBeforeRename: function sbMSC_SPS_onBeforeRename(aNode) {
},


/* \brief Called when a node is renamed by the user, allows
* the module to accept the action by setting the
* node name to the given value.
* \param aNode the node that was renamed
* \param aNewName new name entered by the user or null if user canceled
* renaming
*/

onRename: function sbMSC_SPS_onRename(aNode, aNewName) {
// Get the device. Do nothing if not a device node.
var deviceID = aNode.getAttributeNS(this._cfg.mscSP_NS, "device-id");
if (!deviceID)
return;
var deviceInfo = this._devInfoList[deviceID];
if (!deviceInfo)
return;
var device = deviceInfo.device;
if (!device)
return;

// Set the new device name if there is one.
if (aNewName)
device.properties.friendlyName = aNewName;

// Update the device.
this._updateDevice(device);
},


/* \brief Called when the service pane service is shutting down
*/
shutdown: function sbMSC_SPS_shutdown() {
// Finalize the services.
this._finalize();
},


//----------------------------------------------------------------------------
//
// MSC device service pane sbIServicePaneMutationListener services.
//
//----------------------------------------------------------------------------

/**
* \brief Called after a node attribute changes
*
* \param aNode service pane node that was changed
* \param aAttrName name of the attribute modified
* \param aNamespace namespace of the attribute (can be null)
* \param aOldVal old attribute value (will be null for new attributes)
* \param aNewVal new attribute value (will ne null if attribute is removed)
*/

attrModified: function sbMSC__SPS_attrModified(aNode,
aAttrName,
aNamespace,
aOldVal,
aNewVal) {
},


/**
* \brief Called after a node is added to the service pane tree
*
* \param aNode service pane node that was added
* \param aParent new parent node
*/

nodeInserted: function sbMSC__SPS_nodeInserted(aNode,
aParent,
aInsertBefores) {
// Ignore all nodes except for media lists.
var resource = this._libServicePaneSvc.getLibraryResourceForNode( aNode);
if (!resource)
return;
if (!(resource instanceof Ci.sbIMediaList))
return;

// Get device for node. Just return if no associated device.
var device = this._devMgr.getDeviceForItem(resource);
if (!device)
return;

// Get the device info. Just return if no device info.
var devInfo = this._devInfoList[device.id];
if (!devInfo)
return;

// Update all libraries for device.
this._updateAllDevLibs(devInfo);
},


/**
* \brief Called after a node is removed from the service pane tree
*
* \param aNode service pane node that was removed
* \param aParent old parent node
*/

nodeRemoved: function sbMSC__SPS_nodeRemoved(aNode, aParent) {
},


//----------------------------------------------------------------------------
//
// MSC device service pane sbIDeviceEventListener services.
//
//----------------------------------------------------------------------------

/**
* aEvent - information about the event
*/

onDeviceEvent: function sbMSC_SPS_onDeviceEvent(aEvent) {
// Dispatch processing of the event.
switch(aEvent.type) {
case Ci.sbIDeviceEvent.EVENT_DEVICE_ADDED :
this._addDevice(aEvent.data.QueryInterface(Ci.sbID evice));
break;

case Ci.sbIDeviceEvent.EVENT_DEVICE_REMOVED :
this._removeDevice(aEvent.data.QueryInterface(Ci.s bIDevice));
break;

case Ci.sbIDeviceEvent.EVENT_DEVICE_STATE_CHANGED :
this._updateDevState(aEvent.origin.QueryInterface( Ci.sbIDevice));
break;

case Ci.sbIDeviceEvent.EVENT_DEVICE_INFO_CHANGED :
case Ci.sbIDeviceEvent.EVENT_DEVICE_DEFAULT_LIBRARY_CHA NGED :
this._updateDevice(aEvent.origin.QueryInterface(Ci .sbIDevice));
break;

case Ci.sbIDeviceEvent.EVENT_DEVICE_LIBRARY_ADDED :
this._onDeviceLibraryAdded
(aEvent.origin.QueryInterface(Ci.sbIDevice),
aEvent.data.QueryInterface(Ci.sbIDeviceLibrary));
break;

case Ci.sbIDeviceEvent.EVENT_DEVICE_LIBRARY_REMOVED :
this._onDeviceLibraryRemoved(aEvent.origin.QueryIn terface(Ci.sbIDevice),
aEvent.data);
break;

default :
break;
}
},


//----------------------------------------------------------------------------
//
// MSC device service pane sbIMediaListListener services.
//
//----------------------------------------------------------------------------

//
// _inBatchMap Map of media lists in a batch update.
// _rescanListMap Map of media lists to be rescanned.
//

_inBatchMap: null,
_rescanListMap: null,


/**
* \brief Initialize the sbIMediaListListener services.
*/

_sbIMLL_Initialize: function sbMSC_SPS__sbIMLL_Initialize() {
this._inBatchMap = { };
this._rescanListMap = { };
},


/**
* \brief Finalize the sbIMediaListListener services.
*/

_sbIMLL_Finalize: function sbMSC_SPS__sbIMLL_Finalize() {
this._inBatchMap = null;
this._rescanListMap = null;
},


/**
* \brief Called when a media item is added to the list.
* \param aMediaList The list that has changed.
* \param aMediaItem The new media item.
* \return True if you do not want any further onItemAdded notifications for
* the current batch. If there is no current batch, the return value
* is ignored.
*/

onItemAdded: function sbMSC_SPS_onItemAdded(aMediaList, aMediaItem, aIndex) {
var noFurtherNotifications = false;

// If in a batch, mark media list for rescanning. Otherwise, add any
// playlists to the device playlist maps.
if (this._inBatchMap[aMediaList.guid]) {
this._rescanListMap[aMediaList.guid] = true;
// No further onItemAdded notifications.
noFurtherNotifications = true;
} else {
if (aMediaItem instanceof Ci.sbIMediaList)
this._addDevPlaylist(aMediaItem);
}

return noFurtherNotifications;
},


/**
* \brief Called before a media item is removed from the list.
* \param aMediaList The list that has changed.
* \param aMediaItem The media item to be removed
* \return True if you do not want any further onBeforeItemRemoved
* notifications for the current batch. If there is no current batch,
* the return value is ignored.
*/

onBeforeItemRemoved: function sbMSC_SPS_onBeforeItemRemoved(aMediaList,
aMediaItem,
aIndex) {
var noFurtherNotifications = false;

// If in a batch, mark media list for rescanning. Otherwise, remove any
// playlists from the device playlist maps.
if (this._inBatchMap[aMediaList.guid]) {
this._rescanListMap[aMediaList.guid] = true;
noFurtherNotifications = true;
} else {
if (aMediaItem instanceof Ci.sbIMediaList)
this._removeDevPlaylist(aMediaItem);
}

return noFurtherNotifications;
},


/**
* \brief Called after a media item is removed from the list.
* \param aMediaList The list that has changed.
* \param aMediaItem The removed media item.
* \return True if you do not want any further onAfterItemRemoved for the
* current batch. If there is no current batch, the return value is
* ignored.
*/

onAfterItemRemoved: function sbMSC_SPS_onAfterItemRemoved(aMediaList,
aMediaItem,
aIndex) {
return true;
},


/**
* \brief Called when a media item is changed.
* \param aMediaList The list that has changed.
* \param aMediaItem The item that has changed.
* \param aProperties Array of properties that were updated. Each property's
* value is the previous value of the property
* \return True if you do not want any further onItemUpdated notifications
* for the current batch. If there is no current batch, the return
* value is ignored.
*/

onItemUpdated: function sbMSC_SPS_onItemUpdated(aMediaList,
aMediaItem,
aIndex,
aProperties) {
return true;
},

/**
* \Brief Called before a media list is cleared.
* \param sbIMediaList aMediaList The list that is about to be cleared.
* \param aExcludeLists If true, only media items, not media lists, are being
* cleared.
* \return True if you do not want any further onBeforeListCleared
* notifications for the current batch. If there is no current batch,
* the return value is ignored.
*/

onBeforeListCleared: function sbMSC_SPS_onBeforeListCleared(aMediaList,
aExcludeLists) {
return true;
},

/**
* \Brief Called when a media list is cleared.
* \param sbIMediaList aMediaList The list that was cleared.
* \param aExcludeLists If true, only media items, not media lists, were
* cleared.
* \return True if you do not want any further onListCleared notifications
* for the current batch. If there is no current batch, the return
* value is ignored.
*/

onListCleared: function sbMSC_SPS_onListCleared(aMediaList,
aExcludeLists) {
var noFurtherNotifications = false;

// If in a batch, mark media list for rescanning. Otherwise, update the
// device playlist maps.
if (this._inBatchMap[aMediaList.guid]) {
this._rescanListMap[aMediaList.guid] = true;
noFurtherNotifications = true;
} else {
this._updateDevPlaylists(aMediaList);
}

return noFurtherNotifications;
},


/**
* \brief Called when the library is about to perform multiple operations at
* once.
*
* This notification can be used to optimize behavior. The consumer may
* choose to ignore further onItemAdded or onItemRemoved notifications until
* the onBatchEnd notification is received.
*
* \param aMediaList The list that has changed.
*/

onBatchBegin: function sbMSC_SPS_onBatchBegin(aMediaList) {
// Add media list to the in batch map.
this._inBatchMap[aMediaList.guid] = true;
},


/**
* \brief Called when the library has finished performing multiple operations
* at once.
*
* This notification can be used to optimize behavior. The consumer may
* choose to stop ignoring onItemAdded or onItemRemoved notifications after
* receiving this notification.
*
* \param aMediaList The list that has changed.
*/

onBatchEnd: function sbMSC_SPS_onBatchEnd(aMediaList) {
// Remove media list from the in batch map.
delete this._inBatchMap[aMediaList.guid];

// Update device playlists if needed.
if (this._rescanListMap[aMediaList.guid]) {
this._updateDevPlaylists(aMediaList);
delete(this._rescanListMap[aMediaList.guid]);
}
},


//----------------------------------------------------------------------------
//
// MSC device service pane nsISupports services.
//
//----------------------------------------------------------------------------

QueryInterface: XPCOMUtils.generateQI(sbMSC_SPSCfg.ifList),


//----------------------------------------------------------------------------
//
// MSC device service pane event services.
//
//----------------------------------------------------------------------------

/**
* Handle the device library added event for the device specified by aDevice
* and library specified by aLibrary.
*
* \param aDevice Device to which library was added.
* \param aLibrary Library that was added.
*/

_onDeviceLibraryAdded: function sbMSC_SPS_onDeviceLibraryAdded(aDevice,
aLibrary) {
// Don't add libraries for devices that have not been added.
if (!(aDevice.id in this._devInfoList))
return;

// Add the device library.
this._addDevLib(aLibrary, aDevice);
},


/**
* Handle the device library removed event for the device specified by aDevice
* and library with the GUID specified by aLibraryGUID.
*
* \param aDevice Device from which library was removed.
* \param aLibraryGUID GUID of library that was removed.
*/

_onDeviceLibraryRemoved:
function sbMSC_SPS_onDeviceLibraryRemoved(aDevice,
aLibraryGUID) {
var devLibInfo = this._getDevLibInfo(aLibraryGUID);
if (devLibInfo) {
// Remove the device library.
this._removeDevLib(devLibInfo);
}
},


//----------------------------------------------------------------------------
//
// MSC device service pane services.
//
//----------------------------------------------------------------------------

/**
* \brief Initialize the MSC device service pane services.
*/

_initialize: function sbMSC_SPS__initialize() {
// Initialize the device lists and maps.
this._devInfoList = {};

// Get the library manager.
this._libMgr = Cc["@songbirdnest.com/Songbird/library/Manager;1"]
.getService(Ci.sbILibraryManager);

// Get the device manager and device and library service pane services.
this._devMgr = Cc["@songbirdnest.com/Songbird/DeviceManager;2"]
.getService(Ci.sbIDeviceManager2);
this._devServicePaneSvc = Cc["@songbirdnest.com/servicepane/device;1"]
.getService(Ci.sbIDeviceServicePaneService);
this._libServicePaneSvc = Cc["@songbirdnest.com/servicepane/library;1"]
.getService(Ci.sbILibraryServicePaneService);

// Add service pane mutation listener.
this._servicePaneSvc.root.addMutationListener(this );

// Initialize the sbIMediaListListener services.
this._sbIMLL_Initialize();

// Add device event listener.
this._devMgr.addEventListener(this);

// Add all connected devices.
this._addAllConnectedDevices();

// Start state polling timer
var self = this;
var func = function() { self._updateAllDevState(); }

// We use a timer on top of the events because there
// is no guarantee that our listener will be added
// at the correct time to catch all the events we are
// listening for to determine state
this._devStateRefreshTimer = new SBTimer(func,
1000,
Ci.nsITimer.TYPE_REPEATING_SLACK);
},


/**
* \brief Finalize the MSC device service pane services.
*/

_finalize: function sbMSC_SPS__finalize() {
// Clear timer
this._devStateRefreshTimer.cancel();
this._devStateRefreshTimer = null;

// Remove device event listener.
this._devMgr.removeEventListener(this);

// Finalize the sbIMediaListListener services.
this._sbIMLL_Finalize();

// Remove service pane mutation listener.
this._servicePaneSvc.root.removeMutationListener(t his);

// Remove all devices.
this._removeAllDevices();

// Clear the device lists and maps.
this._devInfoList = null;

// Clear object references.
this._devMgr = null;
this._servicePaneSvc = null;
this._libServicePaneSvc = null;
},


/**
* \brief Add the device specified by aDevice to the service pane.
*
* \param aDevice The device object.
*/

_addDevice: function sbMSC_SPS__addDevice(aDevice) {
// Do nothing if device has already been added.
var deviceID = aDevice.id;
if (this._devInfoList[deviceID])
return;

// Do nothing if device is not an MSC device.
//XXXeps would be nice to have a more generic DeviceClass = "MSC".
//XXXeps or perhaps, DeviceType = "MSC" and DeviceConnectionType = "USB".
if (aDevice.parameters.getProperty("DeviceType") != "MSCUSB")
return;

// Do nothing if device is not connected.
if (!aDevice.connected)
return;

// Create a device info list entry.
this._devInfoList[deviceID] = {
device: aDevice,
idleImageURL: null,
devLibTable: {},
playlistTable: {}
};

// Add a device node in the service pane.
var devNode = this._devServicePaneSvc.createNodeForDevice2(aDevi ce, true);
devNode.setAttributeNS(this._cfg.mscSP_NS, "device-id", deviceID);
devNode.contractid = this._cfg.contractID;
devNode.image = this._devInfoList[deviceID].idleImageURL;
devNode.hidden = false;
devNode.url = this._cfg.devMgrURL + "?device-id=" + deviceID;
devNode.editable = true;
this._devInfoList[deviceID].svcPaneNode = devNode;

// Fill device node context menu with default items.
this._devServicePaneSvc.setFillDefaultContextMenu( devNode, true);

// Add all device libraries.
for each (let library in ArrayConverter.JSEnum(aDevice.content.libraries)) {
this._addDevLib(library.QueryInterface(Ci.sbIDevic eLibrary), aDevice);
}

// Update the device.
this._updateDevice(aDevice);
},


/**
* \brief Remove the device specified by aDevice from the service pane.
*
* \param aDevice The device object.
*/

_removeDevice: function sbMSC_SPS__removeDevice(aDevice) {
// Get the device info. Do nothing if no device info available.
var device = aDevice.QueryInterface(Ci.sbIDevice);
var deviceID = device.id;
var devInfo = this._devInfoList[deviceID];
if (!devInfo)
return;

// Remove all device libraries.
this._removeAllDevLibs(devInfo);

// Remove the device node.
if (devInfo.svcPaneNode) {
devInfo.svcPaneNode.parentNode.removeChild(devInfo .svcPaneNode);
}

// Remove device info list entry.
delete this._devInfoList[deviceID];
devInfo.device = null;
},


/**
* \brief Add all connected devices to the service pane.
*/

_addAllConnectedDevices: function sbMSC_SPS__addAllConnectedDevices() {
var deviceList = ArrayConverter.JSArray(this._devMgr.devices);
for each (let device in deviceList) {
this._addDevice(device.QueryInterface(Ci.sbIDevice ));
}
},


/**
* \brief Remove all devices from the service pane.
*/

_removeAllDevices: function sbMSC_SPS__removeAllDevices() {
// Remove all devices.
for (var deviceID in this._devInfoList)
this._removeDevice(this._devInfoList[deviceID].device);
},


/**
* \brief Add the device library specified by aLibrary for the device
* specified by aDevice to the list of device libraries.
*
* \param aLibrary Device library to add.
* \param aDevice Device for which to add library.
*/

_addDevLib: function sbMSC_SPS__addDevLib(aLibrary, aDevice) {
// Get the device info. Just return if no info.
var deviceID = aDevice.id;
var devInfo = this._devInfoList[deviceID];
if (!devInfo)
return;

// Use the raw library instead of the sbIDeviceLibrary since the
// sbIDeviceLibrary is mostly useless in the device removal events.
let library = this._libMgr.getLibrary(aLibrary.guid);

// Do nothing if device library already added.
var devLibGUID = library.guid;
if (devLibGUID in devInfo.devLibTable)
return;

// Add library info to table.
var devLibInfo = {
devInfo: devInfo,
devLib: library,
devLibGUID: library.guid
};
devInfo.devLibTable[devLibGUID] = devLibInfo;

// Create the device library service pane node.
var devLibNode = this._devServicePaneSvc
.createLibraryNodeForDevice(aDevice, library);
if (!devLibNode)
return;

// Set the read-only property for the device library node.
this._setNodeReadOnly(aDevice, devLibNode);

// Add a listener for the device library.
library.addListener(this,
false,
Ci.sbIMediaList.LISTENER_FLAGS_ALL &
~Ci.sbIMediaList.LISTENER_FLAGS_ITEMUPDATED);

// register this device for the device-specific playlist commands
var mgr = Cc["@songbirdnest.com/Songbird/PlaylistCommandsManager;1"]
.getService(Ci.sbIPlaylistCommandsManager);

// Keep track of the commands registered to the servicepane menu
// so we can correctly unregister them later.
// XX jhawk currently there are none of these
devLibInfo.devLibServicePaneCmds = [];

var menuCmds = mgr.request(kPlaylistCommands.MEDIALIST_DEVICE_LIB RARY_CONTEXTMENU);
mgr.registerPlaylistCommandsForLibrary(false, library, menuCmds);

var toolbarCmds = mgr.request(kPlaylistCommands.MEDIALIST_DEVICE_LIB RARY_TOOLBAR);
mgr.registerPlaylistCommandsForLibrary(false, library, toolbarCmds);

// Keep track of the commands registered to the menu or toolbar
// so we can correctly unregister them later
devLibInfo.devLibMenuOrToolbarCmds = [menuCmds, toolbarCmds];

// Update device library playlists.
this._updateDevPlaylists(library);

// Update the device.
this._updateDevice(aDevice);
},


/**
* Remove all device libraries from the list of device libraries for the
* device specified by a aDevInfo.
*
* \param aDevInfo Device from which to remove libraries.
*/

_removeAllDevLibs: function sbMSC_SPS__removeAllDevLibs(aDevInfo) {
// Get the list of all device libraries.
var devLibInfoList = [];
for each (let devLibInfo in aDevInfo.devLibTable) {
devLibInfoList.push(devLibInfo);
}

// Remove all device libraries.
for each (let devLibInfo in devLibInfoList) {
this._removeDevLib(devLibInfo);
}
},


/**
* \brief Remove the device library specified by aDevLibInfo from the list of
* device libraries.
*
* \param aDevLibInfo Device library to remove.
*/

_removeDevLib: function sbMSC_SPS__removeDevLib(aDevLibInfo) {
// Get the library.
var devLib = aDevLibInfo.devLib;

// Remove library from the device library info table.
delete aDevLibInfo.devInfo.devLibTable[aDevLibInfo.devLibGUID];

// Remove listener from library.
try {
devLib.removeListener(this);
}
catch (e) {}

var cmdMgr = Cc["@songbirdnest.com/Songbird/PlaylistCommandsManager;1"]
.getService(Ci.sbIPlaylistCommandsManager);

// Remove library playlist commands. First handle servicepane commands.
if (aDevLibInfo.devLibServicePaneCmds) {

var len = aDevLibInfo.devLibServicePaneCmds.length;
for (var i = 0; i < len; i++) {
// Unregister each servicepane command
cmdMgr.unregisterPlaylistCommandsForLibrary
(true,
devLib,
aDevLibInfo.devLibServicePaneCmds[i]);
}
aDevLibInfo.devLibServicePaneCmds = null;
}

// Remove mediaitem context menu and toolbar commands
if (aDevLibInfo.devLibMenuOrToolbarCmds) {

var len = aDevLibInfo.devLibMenuOrToolbarCmds.length;
for (var i = 0; i < len; i++) {
// Unregister each mediaitem contextmenu or toolbar command
cmdMgr.unregisterPlaylistCommandsForLibrary
(false,
devLib,
aDevLibInfo.devLibMenuOrToolbarCmds[i]);
}
aDevLibInfo.devLibMenuOrToolbarCmds = null;
}

// Update the device.
this._updateDevice(aDevLibInfo.devInfo.device);
},


/**
* Return the device library info object for the device library with the GUID
* specified by aDevLibGUID.
*
* \param aDevLibGUID Device library GUID.
*
* \return Device library info object or null if none
* available.
*/

_getDevLibInfo: function sbMSC_SPS__getDevLibInfo(aDevLibGUID) {
// Search all device info objects for the device library info.
for each (let devInfo in this._devInfoList) {
if (aDevLibGUID in devInfo.devLibTable)
return devInfo.devLibTable[aDevLibGUID];
}

return null;
},


/**
* \brief Add the device playlist specified by aMediaList to the list of
* device playlists.
*
* \param aMediaList Device playlist to add.
*/

_addDevPlaylist: function sbMSC_SPS__addDevPlaylist(aMediaList) {
// Get the playlist device library info. Just return if no info.
var devLibInfo = this._getDevLibInfo(aMediaList.library.guid);
if (!devLibInfo)
return;

// Get the device info.
var devInfo = devLibInfo.devInfo;
var device = devInfo.device;

// Get the playlist info.
var playlistTable = devInfo.playlistTable;
var playlistURN = this._cfg.itemURNPrefix + aMediaList.guid;

// Do nothing if playlist already added.
if (aMediaList.guid in playlistTable)
return;

// Get the playlist service pane node, creating one if necessary.
var playlistNode = this._libServicePaneSvc
.getNodeForLibraryResource(aMediaList);
if (!playlistNode) {
playlistNode = this._servicePaneSvc.createNode();
playlistNode.id = playlistURN;
}

playlistNode.name = aMediaList.name;

// Set the read-only property for the playlist node.
this._setNodeReadOnly(device, playlistNode);

// Move the playlist service pane node underneath the device service pane
// node. Make sure the playlist nodes in alphabetical order.
this._devServicePaneSvc.insertChildByName(device,
playlistNode);

// Add the playlist to the device playlist table.
var playlistInfo = {
devInfo: devInfo,
mediaList: aMediaList,
node: playlistNode
};
devInfo.playlistTable[aMediaList.guid] = playlistInfo;
},


/**
* \brief Remove the device playlist specified by aMediaList from the list of
* device playlists.
*
* \param aMediaList Device playlist to remove.
*/

_removeDevPlaylist: function sbMSC_SPS__removeDevPlaylist(aMediaList) {
// Remove the playlist from the device playlist table.
var devLibInfo = this._getDevLibInfo(aMediaList.library.guid);
if (devLibInfo)
delete devLibInfo.devInfo.playlistTable[aMediaList.guid];
},


/**
* Update the service pane for the device specified by aDevice.
*
* \param aDevice Device for which to update service pane.
*/

_updateDevice: function sbMSC_SPS__updateDevice(aDevice) {
// Get the device info. Do nothing if no device info available.
var devInfo = this._devInfoList[aDevice.id];
if (!devInfo)
return;

// Update the device node.
this._updateDevNode(devInfo);

// Update all device libraries.
this._updateAllDevLibs(devInfo);
},


/**
* \brief Update the device state in the service pane for the device specified
* by aDevice.
*
* \param aDevice Device for which to update state.
*/

_updateDevState: function sbMSC_SPS__updateDevState(aDevice) {
// Get the device info.
if (!this._devInfoList[aDevice.id])
return;
var devInfo = this._devInfoList[aDevice.id];
var devNode = devInfo.svcPaneNode;

// Get the list of device node properties.
var devNodePropList = devNode.className.split(" ");

// Update the device node busy property.
devNodePropList = devNodePropList.filter
(function(aProperty) { return aProperty != "busy"; });
if (aDevice.state != Ci.sbIDevice.STATE_IDLE)
devNodePropList.push("busy");

// Determine whether or not the device is read-only
var deviceProperties = aDevice.properties.properties;
var accessCompatibility;
try {
accessCompatibility = deviceProperties.getPropertyAsAString
("http://songbirdnest.com/device/1.0#accessCompatibility");
} catch (ex) {}
if (accessCompatibility == "ro") {
devNodePropList = devNodePropList.filter
(function(aProperty) { return aProperty != "read-only"; });
devNodePropList.push("read-only");
}

// Update the device node image.
if (aDevice.state == Ci.sbIDevice.STATE_IDLE &&
devInfo.idleImageURL) {
devNode.image = devInfo.idleImageURL;
}
else {
devNode.image = null;
}
// Write the device node properties.
var newProps = devNodePropList.join(" ");
if(devNode.className != newProps)
devNode.className = newProps;
},

_updateAllDevState: function sbMSC_SPS__updateAllDevState() {
for each (let devInfo in this._devInfoList) {
this._updateDevState(devInfo.device);
}
},


/**
* Update the service pane node for the device specified by aDevInfo.
*
* \param aDevInfo Device for which to update service pane node.
*/

_updateDevNode: function sbMSC_SPS__updateDevNode(aDevInfo) {
// Get the device info.
var device = aDevInfo.device;

// If the device node is supposed to be hidden, hide the service pane node.
aDevInfo.svcPaneNode.hidden = device.properties.hidden;

// Set the device service pane node name.
aDevInfo.svcPaneNode.name = device.name;

// If we don't already have an image URL, then try and see if
// the spDeviceIcon property exists now and update the idleImageURL
// if we have a valid property value.
if (!aDevInfo.idleImageURL) {
try {
var devIconUri = device.properties.getProperty("spDeviceIcon")
.QueryInterface(Ci.nsIURI);
aDevInfo.idleImageURL = devIconUri.spec;
aDevInfo.svcPaneNode.image = devIconUri.spec;
} catch (e) {
}
}
},


/**
* Update the service pane for all device libraries belonging to the device
* specified by aDevInfo.
*
* \param aDevInfo Device for which to update service pane.
*/

_updateAllDevLibs: function sbMSC__SPS__updateAllDevLibs(aDevInfo) {
// Get the default device library.
var defaultDevLib = aDevInfo.device.defaultLibrary;

// Only show the default library nodes.
for each (let devLibInfo in aDevInfo.devLibTable) {
// Get the device library info.
var devLib = devLibInfo.devLib;

// If no default library is set, use first library as default.
if (!defaultDevLib)
defaultDevLib = devLib;

// Update the device library node table.
this._updateDevLibNodeTable(devLibInfo);

// Mark whether library nodes are for the default device library.
var isDefault = false;
try {
if (devLib.equals(defaultDevLib))
isDefault = true;
}
catch (ex) { }
for each (let node in devLibInfo.devLibNodeTable) {
if (isDefault) {
node.className = StringSet.remove(node.className,
"non-default-library-node");
}
else {
node.className = StringSet.add(node.className,
"non-default-library-node");
}
}
}
},


/**
* Update the device library node table for the library specified by
* aDevLibInfo.
*
* \param aDevLibInfo Device library for which to update node table.
*/

_updateDevLibNodeTable:
function sbMSC_SPS__updateDevLibNodeTable(aDevLibInfo) {
// Get the device library info.
var devLib = aDevLibInfo.devLib;
var devNode = aDevLibInfo.devInfo.svcPaneNode;

// Produce the new device library node table from all device node children
// that belong to the library.
var newDevLibNodeTable = {};
var childNode = devNode.firstChild;
for (var childNode = devNode.firstChild;
childNode;
childNode = childNode.nextSibling) {
// Get the child node library resource. Continue with next child if no
// library resource.
var libResource =
this._libServicePaneSvc.getLibraryResourceForNode( childNode);
if (!libResource)
continue;

// Get the library resource media item. Continue with next child if not
// a media item.
var mediaItem;
try {
mediaItem = libResource.QueryInterface(Ci.sbIMediaItem);
} catch(ex) { }
if (!mediaItem)
continue;

// If media item belongs to library, add the child to the node table.
if (mediaItem.library.equals(devLib))
newDevLibNodeTable[childNode.id] = childNode;
}

// Set the new device library node table.
aDevLibInfo.devLibNodeTable = newDevLibNodeTable;
},


/**
* \brief Update the list of device playlists with the playlists contained in
* the media list specified by aMediaList.
*
* \param aMediaList Media list from which to update.
*/

_updateDevPlaylists: function sbMSC_SPS__updateDevPlaylists(aMediaList) {
// Set up an enumeration listener to collect items into a simple array.
var enumListener = {
itemList: [],
onEnumerationBegin: function() { },
onEnumerationEnd: function() { },
onEnumeratedItem: function(aList, aItem) {
this.itemList.push(aItem);
}
};

// Create a list of media lists.
aMediaList.enumerateItemsByProperty(SBProperties.i sList, "1", enumListener);

// Add each media list as a device playlist.
var length = enumListener.itemList.length;
for (var i = 0; i < length; i++) {
this._addDevPlaylist(enumListener.itemList[i]);
}
},


/**
* \brief Set the read-only property for the node specified by aNode as
* appropriate for the current state of the device specified by
* aDevice.
*
* \param aDevice Device for which to set node read-only property.
* \param aNode Node for which to set read-only property.
*/

_setNodeReadOnly: function sbMSC_SPS__setNodeReadOnly(aDevice, aNode) {
//XXXeps implement
},


/**
* \brief Convert a deviceId into its corresponding sbIDevice
*
* \param aDeviceID The device ID of the device to retrieve
*/

_getDeviceForId: function sbMSC_SPS_getDeviceForId(aDeviceId) {
if (typeof(this._devInfoList[aDeviceId]) != 'undefined')
return this._devInfoList[aDeviceId].device;
return null;
},


/**
* \brief Retrieve the device given a service pane node
*
* \param aNode The service pane node to look up the device for.
*/

_getDeviceFromNode: function sbMSC_SPS_getDeviceFromNode(aNode) {
var deviceId = aNode.getAttributeNS(this._cfg.mscSP_NS, 'device-id');
if ( deviceId ) {
return this._getDeviceForId(deviceId);
}
return null;
},


/**
* \brief given a device node return the library node for that node
*
* \param aNode The device node to look up the library node
*/
_getLibraryNodeForDeviceNode: function
sbMSC_SPS_getLibraryNodeForDeviceNode(aNode)
{
var device = this._getDeviceFromNode(aNode);
if (device && device.defaultLibrary) {
let librarySPS = Cc["@songbirdnest.com/servicepane/library;1"]
.getService(Ci.sbILibraryServicePaneService);
return librarySPS.getNodeForLibraryResource(device.defaul tLibrary);
}
return null;
},
};


//------------------------------------------------------------------------------
//
// MSC device service pane service component services.
//
//------------------------------------------------------------------------------

function NSGetModule(compMgr, fileSpec) {
return XPCOMUtils.generateModule([sbMSC_SPS]);
}

---

If that was not what you need, let me know.

Many thanks.

Philips - QK
05-17-2012, 04:05 AM
Dear Josin,

We have looked into your log. Below is the investigation results:

1. PSB can download the firmware from the server and save it in the cache. Therefore, there is no issue in the server.

Error: DoRecoveryUpdate(C:\Documents and Settings\Josᅢᆵn\Configuraciᅢᄈn local\Datos de programa\Philips-Songbird\Profiles\z07ysl2v.default\firmware_cache\ v2\Philips SA3ARA\) in C:\Archivos de programa\Philips\Philips Songbird Resources\Firmware\SA3ARA\GoGearFWLibSA3ARA.dll FAILED [4]

2. PSB however cannot get device info via DLL file and DLL failed when system try to do "DoRecoveryUpdate". (Background: when press the update/repair button, PSB will just trigger the DLL file and then all the command come from DLL.)


Error: GetDeviceInfo(00000001000015420002DCDF7EC95542) in C:\Archivos de programa\Philips\Philips Songbird Resources\Firmware\SA3ARA\GoGearFWLibSA3ARA.dll FAILED [1]

We have a try on the same environment, it works for us. So, it is not likely an issue related to Philips Songbird. We are sorry to tell you that it appears to be a hardware issue to us. We suggest you can contact your local support (call centre/ service centre) to continue with this as arrangement will be differ from country to country.

With thanks & regards,
Philips Moderation Team

maxdos
11-02-2013, 09:06 PM
Repair your philips
Gogear Ariaz SA3ARA

I have found the solution for this issue.Follow these steps to repair your philips
Gogear Ariaz SA3ARA...(4Gb, 8Gb, or 16Gb).

The problem is the file GoGearFWLibSA3ARA.dll .I think this library
can't download properly the latest firmware of the philips gogear ariaz
when the player is in the repair mode, or something like that.

Then you have to repair it manually by using the 'AriaG3 Device Firmware Downloader'(StUpdaterApp_v103_20110126.exe).
To find this files and the Ariaz firmware update file you have to:

First download Philips songbird for the Gogear SA3ARA04K/02 from here (http://www.nodevice.com.pt/driver/SA3ARA04K_02/get86102.html)
(from nodevice.com not from philips support).

After then unzip to a folder. You will get 2 files :
sa3ara04k_02_psb_eng.exe and
DriverUpdaterSetup-2.0.0.6004.exe

Now install the Philips songbird file (sa3ara04k_02_psb_eng.exe).

When finished in the folder C:\Program Files (x86)\Philips\Philips
Songbird Resources\Firmware\SA3ARA you should have 3 files :
GoGearFWLibSA3ARA.dll ,
SA3ARA.rar and
SA3ARA_release_notes.html .

Then unzip SA3ARA.rar and you will get 3 files:
firmware.sb,
StUpdaterApp_v103_20110126.exe and
updater.sb

Lanch StUpdaterApp_v103_20110126.exe and connect gogear Ariaz in repair
mode holding vol+ button.
the file named firmware.sb is the firmware file for the Gogear ariaz SA3ARA v1.00

What you are doing is to downgrade the philips ariaz to v1.00, You will have a white screen after this.
Don't worry. Your gogear work properly with just a blank screen. After that just power on your gogear normally and connect it to the computer. Open philips songbird, Click on the philips device and at left click on support tab. Now check for update to download the latest firmware file. after download Songbird will tell you to reconnect the gogear holding the Vol+ button. then follow instruction to finsh the update. all should be ok now!

If the update fail again after the download just go to this folder
C:\Users\*******\AppData\Local\Philips-Songbird\Profiles\*******.default\firmware_cache\v 2
(search on google how to show the appdata folder)

And copy the 2 files downloded by your songbird firmware.sb and updater.sb and add them to the AriaG3 Device Firmware Downloader file (downloaded above) in another folder, run again AriaG3 Device Firmware Downloader(StUpdaterApp_v103_20110126.exe) and follow the instructions shown above to flash the gogear to the latest version of the fimware.

Done!!!

Hope this long tuto is useful for you!!!