diff options
Diffstat (limited to 'rbutil/rbutilqt')
-rw-r--r-- | rbutil/rbutilqt/icons/talkfile_btn.png | bin | 2796 -> 3776 bytes | |||
-rw-r--r-- | rbutil/rbutilqt/installbootloader.cpp | 190 | ||||
-rw-r--r-- | rbutil/rbutilqt/installbootloader.h | 6 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbutilqt.pro | 12 |
4 files changed, 203 insertions, 5 deletions
diff --git a/rbutil/rbutilqt/icons/talkfile_btn.png b/rbutil/rbutilqt/icons/talkfile_btn.png index ba168676e1..64e2763c94 100644 --- a/rbutil/rbutilqt/icons/talkfile_btn.png +++ b/rbutil/rbutilqt/icons/talkfile_btn.png | |||
Binary files differ | |||
diff --git a/rbutil/rbutilqt/installbootloader.cpp b/rbutil/rbutilqt/installbootloader.cpp index 5c278ee5a7..85dd369693 100644 --- a/rbutil/rbutilqt/installbootloader.cpp +++ b/rbutil/rbutilqt/installbootloader.cpp | |||
@@ -54,6 +54,12 @@ void BootloaderInstaller::install(Ui::InstallProgressFrm* dp) | |||
54 | connect(this,SIGNAL(prepare()),this,SLOT(ipodPrepare())); | 54 | connect(this,SIGNAL(prepare()),this,SLOT(ipodPrepare())); |
55 | connect(this,SIGNAL(finish()),this,SLOT(ipodFinish())); | 55 | connect(this,SIGNAL(finish()),this,SLOT(ipodFinish())); |
56 | } | 56 | } |
57 | else if(m_bootloadermethod == "sansapatcher") | ||
58 | { | ||
59 | // connect internal signal | ||
60 | connect(this,SIGNAL(prepare()),this,SLOT(sansaPrepare())); | ||
61 | connect(this,SIGNAL(finish()),this,SLOT(sansaFinish())); | ||
62 | } | ||
57 | else | 63 | else |
58 | { | 64 | { |
59 | m_dp->listProgress->addItem(tr("unsupported install Method")); | 65 | m_dp->listProgress->addItem(tr("unsupported install Method")); |
@@ -91,6 +97,11 @@ void BootloaderInstaller::uninstall(Ui::InstallProgressFrm* dp) | |||
91 | // connect internal signal | 97 | // connect internal signal |
92 | connect(this,SIGNAL(prepare()),this,SLOT(ipodPrepare())); | 98 | connect(this,SIGNAL(prepare()),this,SLOT(ipodPrepare())); |
93 | } | 99 | } |
100 | else if(m_bootloadermethod == "sansapatcher") | ||
101 | { | ||
102 | // connect internal signal | ||
103 | connect(this,SIGNAL(prepare()),this,SLOT(sansaPrepare())); | ||
104 | } | ||
94 | else | 105 | else |
95 | { | 106 | { |
96 | m_dp->listProgress->addItem(tr("unsupported install Method")); | 107 | m_dp->listProgress->addItem(tr("unsupported install Method")); |
@@ -596,7 +607,7 @@ void BootloaderInstaller::ipodPrepare() | |||
596 | if (delete_bootloader(&ipod)==0) | 607 | if (delete_bootloader(&ipod)==0) |
597 | { | 608 | { |
598 | m_dp->listProgress->addItem(tr("Successfully removed Bootloader")); | 609 | m_dp->listProgress->addItem(tr("Successfully removed Bootloader")); |
599 | emit done(true); | 610 | emit done(false); |
600 | ipod_close(&ipod); | 611 | ipod_close(&ipod); |
601 | return; | 612 | return; |
602 | } | 613 | } |
@@ -604,6 +615,7 @@ void BootloaderInstaller::ipodPrepare() | |||
604 | { | 615 | { |
605 | m_dp->listProgress->addItem(tr("--delete-bootloader failed.")); | 616 | m_dp->listProgress->addItem(tr("--delete-bootloader failed.")); |
606 | emit done(true); | 617 | emit done(true); |
618 | ipod_close(&ipod); | ||
607 | return; | 619 | return; |
608 | } | 620 | } |
609 | } | 621 | } |
@@ -685,7 +697,7 @@ void BootloaderInstaller::ipodFinish() | |||
685 | if (add_bootloader(&ipod, m_tempfilename.toLatin1().data(), FILETYPE_DOT_IPOD)==0) | 697 | if (add_bootloader(&ipod, m_tempfilename.toLatin1().data(), FILETYPE_DOT_IPOD)==0) |
686 | { | 698 | { |
687 | m_dp->listProgress->addItem(tr("Successfully added Bootloader")); | 699 | m_dp->listProgress->addItem(tr("Successfully added Bootloader")); |
688 | emit done(true); | 700 | emit done(false); |
689 | ipod_close(&ipod); | 701 | ipod_close(&ipod); |
690 | return; | 702 | return; |
691 | } | 703 | } |
@@ -695,8 +707,182 @@ void BootloaderInstaller::ipodFinish() | |||
695 | ipod_close(&ipod); | 707 | ipod_close(&ipod); |
696 | emit done(true); | 708 | emit done(true); |
697 | return; | 709 | return; |
710 | } | ||
711 | } | ||
712 | |||
713 | /************************************************** | ||
714 | *** sansa secific code | ||
715 | ***************************************************/ | ||
716 | // reserves memory for sansapatcher | ||
717 | bool initSansaPatcher() | ||
718 | { | ||
719 | if (sansa_alloc_buffer(§orbuf,BUFFER_SIZE) < 0) return true; | ||
720 | else return false; | ||
721 | } | ||
722 | |||
723 | |||
724 | void BootloaderInstaller::sansaPrepare() | ||
725 | { | ||
726 | m_dp->listProgress->addItem(tr("Searching for sansas")); | ||
727 | struct sansa_t sansa; | ||
728 | |||
729 | int n = sansa_scan(&sansa); | ||
730 | if (n == 0) | ||
731 | { | ||
732 | m_dp->listProgress->addItem(tr("No Sansa found")); | ||
733 | emit done(true); | ||
734 | return; | ||
698 | } | 735 | } |
736 | if (n > 1) | ||
737 | { | ||
738 | m_dp->listProgress->addItem(tr("Too many Sansas found")); | ||
739 | emit done(true); | ||
740 | } | ||
741 | |||
742 | if(m_install) // Installation | ||
743 | { | ||
744 | QString url = m_bootloaderUrlBase + "/sandisk-sansa/e200/" + m_bootloadername; | ||
745 | |||
746 | m_dp->listProgress->addItem(tr("Downloading file %1.%2") | ||
747 | .arg(QFileInfo(url).baseName(), QFileInfo(url).completeSuffix())); | ||
748 | |||
749 | // temporary file needs to be opened to get the filename | ||
750 | downloadFile.open(); | ||
751 | m_tempfilename = downloadFile.fileName(); | ||
752 | downloadFile.close(); | ||
753 | // get the real file. | ||
754 | getter = new HttpGet(this); | ||
755 | getter->setProxy(m_proxy); | ||
756 | getter->setFile(&downloadFile); | ||
757 | getter->getFile(QUrl(url)); | ||
758 | // connect signals from HttpGet | ||
759 | connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); | ||
760 | //connect(getter, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadRequestFinished(int, bool))); | ||
761 | connect(getter, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int))); | ||
762 | } | ||
763 | else // Uninstallation | ||
764 | { | ||
765 | |||
766 | if (sansa_open(&sansa, 0) < 0) | ||
767 | { | ||
768 | m_dp->listProgress->addItem(tr("could not open Sansa")); | ||
769 | emit done(true); | ||
770 | return; | ||
771 | } | ||
772 | |||
773 | if (sansa_read_partinfo(&sansa,0) < 0) | ||
774 | { | ||
775 | m_dp->listProgress->addItem(tr("could not read partitiontable")); | ||
776 | emit done(true); | ||
777 | return; | ||
778 | } | ||
779 | |||
780 | int i = is_e200(&sansa); | ||
781 | if (i < 0) { | ||
782 | m_dp->listProgress->addItem(tr("Disk is not an E200 (%1), aborting.").arg(i)); | ||
783 | emit done(true); | ||
784 | return; | ||
785 | } | ||
786 | |||
787 | if (sansa.hasoldbootloader) | ||
788 | { | ||
789 | m_dp->listProgress->addItem(tr("********************************************\n" | ||
790 | "OLD ROCKBOX INSTALLATION DETECTED, ABORTING.\n" | ||
791 | "You must reinstall the original Sansa firmware before running\n" | ||
792 | "sansapatcher for the first time.\n" | ||
793 | "See http://www.rockbox.org/twiki/bin/view/Main/SansaE200Install\n" | ||
794 | "*********************************************\n")); | ||
795 | emit done(true); | ||
796 | return; | ||
797 | } | ||
798 | |||
799 | |||
800 | if (sansa_reopen_rw(&sansa) < 0) | ||
801 | { | ||
802 | m_dp->listProgress->addItem(tr("Could not open Sansa in RW mode")); | ||
803 | emit done(true); | ||
804 | return; | ||
805 | } | ||
699 | 806 | ||
807 | if (sansa_delete_bootloader(&sansa)==0) | ||
808 | { | ||
809 | m_dp->listProgress->addItem(tr("Successfully removed Bootloader")); | ||
810 | emit done(false); | ||
811 | sansa_close(&sansa); | ||
812 | return; | ||
813 | } | ||
814 | else | ||
815 | { | ||
816 | m_dp->listProgress->addItem(tr("--delete-bootloader failed.")); | ||
817 | emit done(true); | ||
818 | sansa_close(&sansa); | ||
819 | return; | ||
820 | } | ||
821 | } | ||
822 | } | ||
823 | |||
824 | void BootloaderInstaller::sansaFinish() | ||
825 | { | ||
826 | struct sansa_t sansa; | ||
827 | sansa_scan(&sansa); | ||
828 | |||
829 | if (sansa_open(&sansa, 0) < 0) | ||
830 | { | ||
831 | m_dp->listProgress->addItem(tr("could not open Sansa")); | ||
832 | emit done(true); | ||
833 | return; | ||
834 | } | ||
835 | |||
836 | if (sansa_read_partinfo(&sansa,0) < 0) | ||
837 | { | ||
838 | m_dp->listProgress->addItem(tr("could not read partitiontable")); | ||
839 | emit done(true); | ||
840 | return; | ||
841 | } | ||
842 | |||
843 | |||
844 | int i = is_e200(&sansa); | ||
845 | if (i < 0) { | ||
846 | |||
847 | m_dp->listProgress->addItem(tr("Disk is not an E200 (%1), aborting.").arg(i)); | ||
848 | emit done(true); | ||
849 | return; | ||
850 | } | ||
851 | |||
852 | if (sansa.hasoldbootloader) | ||
853 | { | ||
854 | m_dp->listProgress->addItem(tr("********************************************\n" | ||
855 | "OLD ROCKBOX INSTALLATION DETECTED, ABORTING.\n" | ||
856 | "You must reinstall the original Sansa firmware before running\n" | ||
857 | "sansapatcher for the first time.\n" | ||
858 | "See http://www.rockbox.org/twiki/bin/view/Main/SansaE200Install\n" | ||
859 | "*********************************************\n")); | ||
860 | emit done(true); | ||
861 | return; | ||
862 | } | ||
863 | |||
864 | if (sansa_reopen_rw(&sansa) < 0) | ||
865 | { | ||
866 | m_dp->listProgress->addItem(tr("Could not open Sansa in RW mode")); | ||
867 | emit done(true); | ||
868 | return; | ||
869 | } | ||
870 | |||
871 | if (sansa_add_bootloader(&sansa, m_tempfilename.toLatin1().data(), FILETYPE_MI4)==0) | ||
872 | { | ||
873 | m_dp->listProgress->addItem(tr("Successfully added Bootloader")); | ||
874 | emit done(false); | ||
875 | sansa_close(&sansa); | ||
876 | return; | ||
877 | } | ||
878 | else | ||
879 | { | ||
880 | m_dp->listProgress->addItem(tr("failed to add Bootloader")); | ||
881 | sansa_close(&sansa); | ||
882 | emit done(true); | ||
883 | return; | ||
884 | } | ||
885 | |||
700 | } | 886 | } |
701 | 887 | ||
702 | 888 | ||
diff --git a/rbutil/rbutilqt/installbootloader.h b/rbutil/rbutilqt/installbootloader.h index 24d1fe33e4..8f3b6d4b64 100644 --- a/rbutil/rbutilqt/installbootloader.h +++ b/rbutil/rbutilqt/installbootloader.h | |||
@@ -28,9 +28,11 @@ | |||
28 | extern "C" { | 28 | extern "C" { |
29 | // Ipodpatcher | 29 | // Ipodpatcher |
30 | #include "../ipodpatcher/ipodpatcher.h" | 30 | #include "../ipodpatcher/ipodpatcher.h" |
31 | #include "../sansapatcher/sansapatcher.h" | ||
31 | }; | 32 | }; |
32 | 33 | ||
33 | bool initIpodpatcher(); | 34 | bool initIpodpatcher(); |
35 | bool initSansapatcher(); | ||
34 | 36 | ||
35 | class BootloaderInstaller : public QObject | 37 | class BootloaderInstaller : public QObject |
36 | { | 38 | { |
@@ -78,6 +80,10 @@ private slots: | |||
78 | void ipodPrepare(); | 80 | void ipodPrepare(); |
79 | void ipodFinish(); | 81 | void ipodFinish(); |
80 | 82 | ||
83 | //sansa specific routines | ||
84 | void sansaPrepare(); | ||
85 | void sansaFinish(); | ||
86 | |||
81 | private: | 87 | private: |
82 | QString m_mountpoint, m_device,m_bootloadermethod,m_bootloadername; | 88 | QString m_mountpoint, m_device,m_bootloadermethod,m_bootloadername; |
83 | QString m_bootloaderUrlBase,m_tempfilename; | 89 | QString m_bootloaderUrlBase,m_tempfilename; |
diff --git a/rbutil/rbutilqt/rbutilqt.pro b/rbutil/rbutilqt/rbutilqt.pro index ef558de6a8..dd8e1bca2c 100644 --- a/rbutil/rbutilqt/rbutilqt.pro +++ b/rbutil/rbutilqt/rbutilqt.pro | |||
@@ -8,7 +8,8 @@ SOURCES += rbutilqt.cpp \ | |||
8 | installzip.cpp \ | 8 | installzip.cpp \ |
9 | installbootloader.cpp \ | 9 | installbootloader.cpp \ |
10 | installbl.cpp \ | 10 | installbl.cpp \ |
11 | ../ipodpatcher/ipodpatcher.c | 11 | ../ipodpatcher/ipodpatcher.c \ |
12 | ../sansapatcher/sansapatcher.c | ||
12 | 13 | ||
13 | 14 | ||
14 | HEADERS += rbutilqt.h \ | 15 | HEADERS += rbutilqt.h \ |
@@ -27,7 +28,9 @@ HEADERS += rbutilqt.h \ | |||
27 | installbl.h \ | 28 | installbl.h \ |
28 | ../ipodpatcher/ipodpatcher.h \ | 29 | ../ipodpatcher/ipodpatcher.h \ |
29 | ../ipodpatcher/ipodio.h \ | 30 | ../ipodpatcher/ipodio.h \ |
30 | ../ipodpatcher/parttypes.h | 31 | ../ipodpatcher/parttypes.h \ |
32 | ../sansapatcher/sansapatcher.h \ | ||
33 | ../sansapatcher/sansaio.h | ||
31 | 34 | ||
32 | 35 | ||
33 | TEMPLATE = app | 36 | TEMPLATE = app |
@@ -46,11 +49,14 @@ RESOURCES += rbutilqt.qrc | |||
46 | 49 | ||
47 | TRANSLATIONS += rbutil_de.ts | 50 | TRANSLATIONS += rbutil_de.ts |
48 | QT += network | 51 | QT += network |
52 | DEFINES += RBUTIL | ||
49 | 53 | ||
50 | win32{ | 54 | win32{ |
51 | SOURCES += ../ipodpatcher/ipodio-win32.c | 55 | SOURCES += ../ipodpatcher/ipodio-win32.c |
56 | SOURCES += ../sansapatcher/sansaio-win32.c | ||
52 | } | 57 | } |
53 | 58 | ||
54 | !win32{ | 59 | unix{ |
55 | SOURCES += ../ipodpatcher/ipodio-posix.c | 60 | SOURCES += ../ipodpatcher/ipodio-posix.c |
61 | SOURCES += ../sansapatcher/sansaio-posix.c | ||
56 | } | 62 | } |