forked from len0rd/rockbox
Support for Sansa E200 in rbutil
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13315 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
39939bb137
commit
dde262b58a
15 changed files with 232 additions and 53 deletions
|
@ -11,8 +11,8 @@
|
|||
|
||||
CXX=$(shell $(PREFIX)wx-config --cxx)
|
||||
INC =
|
||||
CFLAGS = -Wall -Wundef
|
||||
OBJS=rbutil.o rbutilApp.o rbutilFrm.o rbutilCtrls.o install_dialogs.o bootloaders.o installlog.o ipodpatcher/ipodpatcher.o ipodpatcher/ipodio-posix.o irivertools.o md5sum.o
|
||||
CFLAGS = -Wall -Wundef -DRBUTIL
|
||||
OBJS=rbutil.o rbutilApp.o rbutilFrm.o rbutilCtrls.o install_dialogs.o bootloaders.o installlog.o ipodpatcher/ipodpatcher.o ipodpatcher/ipodio-posix.o sansapatcher/sansapatcher.o sansapatcher/sansaio-posix.o irivertools.o md5sum.o
|
||||
|
||||
# Install into /usr/local by default
|
||||
ifndef DESTDIR
|
||||
|
|
|
@ -25,7 +25,7 @@ LDFLAGS_GUI =
|
|||
CXX = g++
|
||||
CXXFLAGS = -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386 -Wall -Wundef -Wno-ctor-dtor-privacy -O2 -fno-strict-aliasing -fno-common
|
||||
CPPFLAGS = -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -I${wx_top_builddir}/lib/wx/include/mac-ansi-release-static-2.8 -I${top_srcdir}/include -fpascal-strings -I${top_srcdir}/src/mac/carbon/morefilex -I/Developer/Headers/FlatCarbon
|
||||
RBUTIL_CFLAGS = $(CXXFLAGS) -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -I${wx_top_builddir}/lib/wx/include/mac-ansi-release-static-2.8 -I${top_srcdir}/include -fpascal-strings -I${top_srcdir}/src/mac/carbon/morefilex -I/Developer/Headers/FlatCarbon
|
||||
RBUTIL_CFLAGS = $(CXXFLAGS) -DRBUTIL -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -I${wx_top_builddir}/lib/wx/include/mac-ansi-release-static-2.8 -I${top_srcdir}/include -fpascal-strings -I${top_srcdir}/src/mac/carbon/morefilex -I/Developer/Headers/FlatCarbon
|
||||
LDFLAGS = -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386 -framework QuickTime -framework IOKit -framework Carbon -framework Cocoa -framework System
|
||||
WX_LIB_FLAVOUR =
|
||||
TOOLKIT = MAC
|
||||
|
@ -51,6 +51,7 @@ RBUTIL_OBJECTS = \
|
|||
$(__rbutil_os2_lib_res) \
|
||||
rbutil.o rbutilApp.o rbutilFrm.o install_dialogs.o bootloaders.o installlog.o \
|
||||
rbutilCtrls.o ipodpatcher/ipodpatcher.o ipodpatcher/ipodio-posix.o \
|
||||
sansapatcher/sansapatcher.o sansapatcher/sansaio-posix.o \
|
||||
md5sum.o irivertools.o \
|
||||
$(__rbutil___win32rc)
|
||||
|
||||
|
|
|
@ -26,8 +26,7 @@
|
|||
#include "installlog.h"
|
||||
|
||||
|
||||
// for ipodpatcher
|
||||
int verbose = 0;
|
||||
int verbose =0;
|
||||
// reserves memory for ipodpatcher
|
||||
bool initIpodpatcher()
|
||||
{
|
||||
|
@ -162,6 +161,108 @@ bool ipodpatcher(int mode,wxString bootloadername)
|
|||
return true;
|
||||
}
|
||||
|
||||
// reserves memory for sansapatcher
|
||||
bool initSansaPatcher()
|
||||
{
|
||||
if (sansa_alloc_buffer(§orbuf,BUFFER_SIZE) < 0) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
|
||||
// sansainstallation
|
||||
bool sansapatcher(int mode,wxString bootloadername)
|
||||
{
|
||||
wxString src,dest,buf;
|
||||
|
||||
struct sansa_t sansa;
|
||||
|
||||
int n = sansa_scan(&sansa);
|
||||
if (n == 0)
|
||||
{
|
||||
ERR_DIALOG(wxT("[ERR] No Sansa found."), wxT("Scanning for Sansa"));
|
||||
return false;
|
||||
}
|
||||
if (n > 1)
|
||||
{
|
||||
ERR_DIALOG(wxT("[ERR] to many Sansa found."), wxT("Scanning for Sansa"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// downloading files
|
||||
if(mode == BOOTLOADER_ADD)
|
||||
{
|
||||
src.Printf(wxT("%s/sandisk-sansa/e200/%s"),gv->bootloader_url.c_str(),bootloadername.c_str());
|
||||
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"),
|
||||
gv->stdpaths->GetUserDataDir().c_str(),bootloadername.c_str());
|
||||
if ( DownloadURL(src, dest) )
|
||||
{
|
||||
wxRemoveFile(dest);
|
||||
buf.Printf(wxT("Unable to download %s"), src.c_str() );
|
||||
ERR_DIALOG(buf, wxT("Download"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (sansa_open(&sansa, 0) < 0)
|
||||
{
|
||||
ERR_DIALOG(wxT("[ERR] could not open sansa"), wxT("open Sansa"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sansa_read_partinfo(&sansa,0) < 0)
|
||||
{
|
||||
ERR_DIALOG(wxT("[ERR] could not read partitiontable"), wxT("reading partitiontable"));
|
||||
return false;
|
||||
}
|
||||
|
||||
int i = is_e200(&sansa);
|
||||
if (i < 0) {
|
||||
ERR_DIALOG(wxT("[ERR] Disk is not an E200 (%d), aborting.\n"), wxT("Checking Disk"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sansa.hasoldbootloader)
|
||||
{
|
||||
ERR_DIALOG(wxT("[ERR] ************************************************************************\n"
|
||||
"[ERR] *** OLD ROCKBOX INSTALLATION DETECTED, ABORTING.\n"
|
||||
"[ERR] *** You must reinstall the original Sansa firmware before running\n"
|
||||
"[ERR] *** sansapatcher for the first time.\n"
|
||||
"[ERR] *** See http://www.rockbox.org/twiki/bin/view/Main/SansaE200Install\n"
|
||||
"[ERR] ************************************************************************\n"),wxT("Checking Disk"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(mode == BOOTLOADER_ADD)
|
||||
{
|
||||
if (sansa_reopen_rw(&sansa) < 0) {
|
||||
ERR_DIALOG(wxT("[ERR] Could not open Sansa in RW mode"), wxT("Bootloader add"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sansa_add_bootloader(&sansa, (char*)dest.c_str(), FILETYPE_MI4)==0) {
|
||||
|
||||
} else {
|
||||
ERR_DIALOG(wxT("[ERR] failed to add Bootloader"), wxT("Bootloader add"));
|
||||
}
|
||||
|
||||
}
|
||||
else if(mode == BOOTLOADER_REM)
|
||||
{
|
||||
if (sansa_reopen_rw(&sansa) < 0) {
|
||||
ERR_DIALOG(wxT("[ERR] Could not open Sansa in RW mode"), wxT("Bootloader Remove"));
|
||||
}
|
||||
|
||||
if (sansa_delete_bootloader(&sansa)==0) {
|
||||
|
||||
} else {
|
||||
ERR_DIALOG(wxT("[ERR] failed to remove Bootloader"), wxT("Bootloader remove"));
|
||||
}
|
||||
}
|
||||
|
||||
sansa_close(&sansa);
|
||||
return true;
|
||||
}
|
||||
|
||||
// gigabeatinstallation
|
||||
bool gigabeatf(int mode,wxString bootloadername,wxString deviceDir)
|
||||
{
|
||||
|
|
|
@ -28,11 +28,15 @@
|
|||
extern "C" {
|
||||
// Ipodpatcher
|
||||
#include "ipodpatcher/ipodpatcher.h"
|
||||
// Sansapatcher
|
||||
#include "sansapatcher/sansapatcher.h"
|
||||
};
|
||||
|
||||
|
||||
bool initIpodpatcher();
|
||||
bool initSansaPatcher();
|
||||
bool ipodpatcher(int mode,wxString bootloadername);
|
||||
bool sansapatcher(int mode,wxString bootloadername);
|
||||
bool gigabeatf(int mode,wxString bootloadername,wxString deviceDir);
|
||||
bool iaudiox5(int mode,wxString bootloadername,wxString deviceDir);
|
||||
bool fwpatcher(int mode,wxString bootloadername,wxString deviceDir,wxString firmware);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#define CREDITS_H_INCLUDED
|
||||
|
||||
#define RBUTIL_FULLNAME "The Rockbox Utility"
|
||||
#define RBUTIL_VERSION "Version 0.3.1.0"
|
||||
#define RBUTIL_VERSION "Version 0.3.2.0"
|
||||
|
||||
static const wxString rbutil_developers[] = {
|
||||
wxT("Christi Alice Scarborough"),
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#define RBUTIL 1
|
||||
#include <wx/msw/wx.rc>
|
||||
RBUTIL VERSIONINFO
|
||||
FILEVERSION 0,3,1,0
|
||||
PRODUCTVERSION 0,3,1,0
|
||||
FILEVERSION 0,3,2,0
|
||||
PRODUCTVERSION 0,3,2,0
|
||||
FILEOS 0x00000004
|
||||
FILETYPE 0x00000001
|
||||
BEGIN
|
||||
|
@ -10,8 +10,8 @@ BEGIN
|
|||
BEGIN
|
||||
BLOCK "FFFF0000"
|
||||
BEGIN
|
||||
VALUE "FileVersion", "0.3.1.0\0"
|
||||
VALUE "ProductVersion", "0.3.1.0\0"
|
||||
VALUE "FileVersion", "0.3.2.0\0"
|
||||
VALUE "ProductVersion", "0.3.2.0\0"
|
||||
VALUE "CompanyName", "Rockbox Team\0"
|
||||
VALUE "FileDescription", "Rockbox Utility\0"
|
||||
VALUE "InternalName", "rbutil\0"
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
<Add option="-D__GNUWIN32__" />
|
||||
<Add option="-D__WXMSW__" />
|
||||
<Add option="-DUSE_PCH" />
|
||||
<Add option="-DRBUTIL" />
|
||||
<Add directory="$(#WX.include)" />
|
||||
<Add directory="$(#WX.lib)\gcc_lib$(WX_CFG)\msw" />
|
||||
<Add directory="$(#WX)\contrib\include" />
|
||||
|
@ -130,9 +131,22 @@
|
|||
<Unit filename="rbutil.iss" />
|
||||
<Unit filename="rbutilApp.cpp" />
|
||||
<Unit filename="rbutilApp.h" />
|
||||
<Unit filename="rbutilCtrls.cpp" />
|
||||
<Unit filename="rbutilCtrls.h" />
|
||||
<Unit filename="rbutilFrm.cpp" />
|
||||
<Unit filename="rbutilFrm.h" />
|
||||
<Unit filename="rbutilFrm_XPM.xpm" />
|
||||
<Unit filename="sansapatcher\parttypes.h" />
|
||||
<Unit filename="sansapatcher\sansaio-win32.c">
|
||||
<Option compilerVar="CC" />
|
||||
<Option compiler="gcc" use="1" buildCommand="mingw32-gcc.exe -W -g -pipe -mthreads -Winvalid-pch -D__GNUWIN32__ -D__WXMSW__ -DUSE_PCH -g -I.\ -IC:\Dev-Cpp\include -c $file -o .objs\sansapatcher\sansaio-win32.o" />
|
||||
</Unit>
|
||||
<Unit filename="sansapatcher\sansaio.h" />
|
||||
<Unit filename="sansapatcher\sansapatcher.c">
|
||||
<Option compilerVar="CC" />
|
||||
<Option compiler="gcc" use="1" buildCommand="mingw32-gcc.exe -W -g -pipe -mthreads -Winvalid-pch -D__GNUWIN32__ -D__WXMSW__ -DUSE_PCH -g -I.\ -IC:\Dev-Cpp\include -c $file -o .objs\sansapatcher\sansapatcher.o" />
|
||||
</Unit>
|
||||
<Unit filename="sansapatcher\sansapatcher.h" />
|
||||
<Unit filename="themes_3d.xpm" />
|
||||
<Unit filename="tools2_3d.xpm" />
|
||||
<Unit filename="uninstall_3d.xpm" />
|
||||
|
|
|
@ -35,6 +35,7 @@ platform22=iaudiox5
|
|||
platform23=iaudiom5
|
||||
platform24=iaudiox5v
|
||||
platform25=gigabeatf
|
||||
platform26=sansae200
|
||||
|
||||
[player]
|
||||
name=Archos Jukebox Player 6000, Jukebox Studio 5/10/20
|
||||
|
@ -259,3 +260,12 @@ needsbootloader=yes
|
|||
bootloadermethod=gigabeatf
|
||||
bootloadername=FWIMG01.DAT
|
||||
resolution=240x320x16
|
||||
|
||||
[sansae200]
|
||||
name=Sandisk Sansa E200
|
||||
platform=sansae200
|
||||
released=no
|
||||
needsbootloader=yes
|
||||
bootloadermethod=sansapatcher
|
||||
bootloadername=PP5022.mi4
|
||||
resolution=176x220x16
|
||||
|
|
|
@ -84,6 +84,8 @@ bool rbutilFrmApp::OnInit()
|
|||
myFrame->Show(TRUE);
|
||||
|
||||
initIpodpatcher(); // reserve mem for ipodpatcher
|
||||
initSansaPatcher(); // reserve mem for sansapatcher
|
||||
|
||||
wxInitAllImageHandlers(); //init Image handlers
|
||||
|
||||
wxLogVerbose(wxT("=== end rbUtilFrmApp::OnInit()"));
|
||||
|
|
|
@ -414,23 +414,38 @@ void DeviceSelectorCtrl::OnAutoDetect(wxCommandEvent& event)
|
|||
if(n == 1)
|
||||
{
|
||||
wxString temp(ipod.targetname,wxConvUTF8);
|
||||
int index = gv->plat_bootloadername.Index(temp);
|
||||
int index = gv->plat_bootloadername.Index(temp); // use the bootloader names..
|
||||
m_deviceCbx->SetValue(gv->plat_name[index]);
|
||||
gv->curplat=gv->plat_id[index];
|
||||
return;
|
||||
}
|
||||
else if (n > 1)
|
||||
{
|
||||
WARN_DIALOG(wxT("More then one device Ipod detected, please connect only One"),
|
||||
WARN_DIALOG(wxT("More then one Ipod device detected, please connect only One"),
|
||||
wxT("Detecting a Device"));
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
struct sansa_t sansa;
|
||||
int n2 = sansa_scan(&sansa);
|
||||
if(n2==1)
|
||||
{
|
||||
WARN_DIALOG(wxT("No Device detected. (This function currently only works for Ipods)."),
|
||||
int index = gv->plat_id.Index(wxT("sansae200"));
|
||||
m_deviceCbx->SetValue(gv->plat_name[index]);
|
||||
gv->curplat=gv->plat_id[index];
|
||||
return;
|
||||
}
|
||||
else if (n2 > 1)
|
||||
{
|
||||
WARN_DIALOG(wxT("More then one Sansa device detected, please connect only One"),
|
||||
wxT("Detecting a Device"));
|
||||
return;
|
||||
}
|
||||
|
||||
WARN_DIALOG(wxT("No Device detected. (This function currently only works for Ipods and Sansas)."),
|
||||
wxT("Detecting a Device"));
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////
|
||||
|
|
|
@ -374,6 +374,17 @@ void rbutilFrm::OnBootloaderRemoveBtn(wxCommandEvent& event)
|
|||
MESG_DIALOG(wxT("The Uninstallation failed.") );
|
||||
}
|
||||
}
|
||||
if(bootloadermethod == wxT("sansapatcher"))
|
||||
{
|
||||
if(sansapatcher(BOOTLOADER_REM,gv->plat_bootloadername[index]))
|
||||
{
|
||||
MESG_DIALOG(wxT("The Bootloader has been uninstalled.") );
|
||||
}
|
||||
else
|
||||
{
|
||||
MESG_DIALOG(wxT("The Uninstallation failed.") );
|
||||
}
|
||||
}
|
||||
else if(bootloadermethod== wxT("gigabeatf"))
|
||||
{
|
||||
|
||||
|
@ -439,6 +450,18 @@ void rbutilFrm::OnBootloaderBtn(wxCommandEvent& event)
|
|||
MESG_DIALOG(wxT("The installation has failed.") );
|
||||
}
|
||||
}
|
||||
if(bootloadermethod == wxT("sansapatcher"))
|
||||
{
|
||||
if(sansapatcher(BOOTLOADER_ADD,gv->plat_bootloadername[index]))
|
||||
{
|
||||
MESG_DIALOG(wxT("The Bootloader has been installed on your device.") );
|
||||
}
|
||||
else
|
||||
{
|
||||
MESG_DIALOG(wxT("The installation has failed.") );
|
||||
}
|
||||
|
||||
}
|
||||
else if(bootloadermethod== wxT("gigabeatf"))
|
||||
{
|
||||
|
||||
|
|
|
@ -42,10 +42,12 @@
|
|||
|
||||
#include "sansaio.h"
|
||||
|
||||
#ifndef RBUTIL
|
||||
void print_error(char* msg)
|
||||
{
|
||||
perror(msg);
|
||||
}
|
||||
#endif
|
||||
|
||||
int sansa_open(struct sansa_t* sansa, int silent)
|
||||
{
|
||||
|
|
|
@ -53,6 +53,7 @@ static int unlock_volume(HANDLE hDisk)
|
|||
&dummy, NULL);
|
||||
}
|
||||
|
||||
#ifndef RBUTIL
|
||||
void print_error(char* msg)
|
||||
{
|
||||
char* pMsgBuf;
|
||||
|
@ -65,7 +66,7 @@ void print_error(char* msg)
|
|||
printf(pMsgBuf);
|
||||
LocalFree(pMsgBuf);
|
||||
}
|
||||
|
||||
#endif
|
||||
int sansa_open(struct sansa_t* sansa, int silent)
|
||||
{
|
||||
DISK_GEOMETRY_EX diskgeometry_ex;
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
#endif
|
||||
|
||||
struct partinfo_t {
|
||||
struct sansa_partinfo_t {
|
||||
unsigned long start; /* first sector (LBA) */
|
||||
unsigned long size; /* number of sectors */
|
||||
int type;
|
||||
|
@ -57,7 +57,7 @@ struct sansa_t {
|
|||
HANDLE dh;
|
||||
char diskname[4096];
|
||||
int sector_size;
|
||||
struct partinfo_t pinfo[4];
|
||||
struct sansa_partinfo_t pinfo[4];
|
||||
int hasoldbootloader;
|
||||
loff_t start; /* Offset in bytes of firmware partition from start of disk */
|
||||
};
|
||||
|
|
|
@ -28,8 +28,10 @@
|
|||
|
||||
#include "sansaio.h"
|
||||
#include "sansapatcher.h"
|
||||
#include "bootimg.h"
|
||||
|
||||
#ifndef RBUTIL
|
||||
#include "bootimg.h"
|
||||
#endif
|
||||
/* The offset of the MI4 image header in the firmware partition */
|
||||
#define PPMI_OFFSET 0x80000
|
||||
|
||||
|
@ -571,7 +573,9 @@ int sansa_add_bootloader(struct sansa_t* sansa, char* filename, int type)
|
|||
|
||||
bl_length = filesize(infile);
|
||||
} else {
|
||||
#ifndef RBUTIL
|
||||
bl_length = LEN_bootimg;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Create PPMI header */
|
||||
|
@ -595,7 +599,9 @@ int sansa_add_bootloader(struct sansa_t* sansa, char* filename, int type)
|
|||
return -1;
|
||||
}
|
||||
} else {
|
||||
#ifndef RBUTIL
|
||||
memcpy(sectorbuf+0x200,bootimg,LEN_bootimg);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Load original firmware from Sansa to the space after the bootloader */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue