summaryrefslogtreecommitdiffstats
path: root/utils/MTP
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2009-06-12 17:12:41 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2009-06-12 17:12:41 +0000
commit94823c65ac7555a7ed19521184064255902ff615 (patch)
treecf37d35ccfb2357c09b59393ab11178e33ac2e09 /utils/MTP
parent11fa12c366a0d33b198fea657dca18bc9d658b61 (diff)
downloadrockbox-94823c65ac7555a7ed19521184064255902ff615.tar.gz
rockbox-94823c65ac7555a7ed19521184064255902ff615.tar.bz2
rockbox-94823c65ac7555a7ed19521184064255902ff615.zip
Fix beastpatcher on linux and code police.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21263 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/MTP')
-rw-r--r--utils/MTP/beastpatcher/beastpatcher.c6
-rw-r--r--utils/MTP/beastpatcher/main.c38
-rw-r--r--utils/MTP/beastpatcher/mtp_libmtp.c1
3 files changed, 25 insertions, 20 deletions
diff --git a/utils/MTP/beastpatcher/beastpatcher.c b/utils/MTP/beastpatcher/beastpatcher.c
index f0d9394f11..05993531ff 100644
--- a/utils/MTP/beastpatcher/beastpatcher.c
+++ b/utils/MTP/beastpatcher/beastpatcher.c
@@ -146,7 +146,7 @@ int beastpatcher(void)
return 1;
}
- printf("[INFO] Found device \"%s - %s\"\n", mtp_info.manufacturer,
+ printf("[INFO] Found device \"%s - %s\"\n", mtp_info.manufacturer,
mtp_info.modelname);
printf("[INFO] Device version: \"%s\"\n",mtp_info.version);
@@ -162,11 +162,11 @@ int beastpatcher(void)
if (fwbuf == NULL)
return 1;
-
+
if (mtp_send_firmware(&mtp_info, fwbuf, fwsize) == 0)
{
fprintf(stderr,"[INFO] Bootloader installed successfully.\n");
- }
+ }
else
{
fprintf(stderr,"[ERR] Bootloader install failed.\n");
diff --git a/utils/MTP/beastpatcher/main.c b/utils/MTP/beastpatcher/main.c
index 56d1a1e94c..1ccff72a79 100644
--- a/utils/MTP/beastpatcher/main.c
+++ b/utils/MTP/beastpatcher/main.c
@@ -38,16 +38,17 @@
****************************************************************************/
#include <stdio.h>
+#include <string.h>
#include "beastpatcher.h"
#include "mtp_common.h"
#if defined(__WIN32__) || defined(_WIN32)
#include <windows.h>
+#include "../MTP_DLL/MTP_DLL.h"
#endif
#define VERSION "1.0 with v1 bootloader"
-#include "../MTP_DLL/MTP_DLL.h"
static void print_usage(void)
{
@@ -56,7 +57,7 @@ static void print_usage(void)
fprintf(stderr,"Where [action] is one of the following options:\n");
fprintf(stderr," -i, --install (default)\n");
fprintf(stderr," -h, --help\n");
- fprintf(stderr," -s, --send nk.bin\n");
+ fprintf(stderr," -s, --send nk.bin\n");
fprintf(stderr,"\n");
}
@@ -65,27 +66,30 @@ int main(int argc, char* argv[])
{
int res;
char yesno[4];
- struct mtp_info_t mtp_info;
+ struct mtp_info_t mtp_info;
- fprintf(stderr,"beastpatcher v" VERSION " - (C) 2009 by the Rockbox developers\n");
+ fprintf(stderr,"beastpatcher v" VERSION " - (C) 2009 by the Rockbox developers\n");
fprintf(stderr,"This is free software; see the source for copying conditions. There is NO\n");
fprintf(stderr,"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n");
- if(argc == 1 || strcmp(argv[1],"-i")==0 || strcmp(argv[1],"--install")==0) {
- res = beastpatcher();
- /* don't ask for enter if started with command line arguments */
- if(argc == 1) {
- printf("\nPress ENTER to exit beastpatcher: ");
- fgets(yesno,4,stdin);
- }
- }
- else if((argc > 2) && ((strcmp(argv[1],"-s")==0) || (strcmp(argv[1],"--send")==0))) {
+ if(argc == 1 || strcmp(argv[1],"-i")==0 || strcmp(argv[1],"--install")==0) {
+ res = beastpatcher();
+ /* don't ask for enter if started with command line arguments */
+ if(argc == 1) {
+ printf("\nPress ENTER to exit beastpatcher: ");
+ fgets(yesno,4,stdin);
+ }
+ }
+ else if((argc > 2) && ((strcmp(argv[1],"-s")==0) || (strcmp(argv[1],"--send")==0))) {
+ mtp_init(&mtp_info);
+ mtp_scan(&mtp_info);
res = mtp_send_file(&mtp_info, argv[2]);
- }
- else {
- print_usage();
+ mtp_finished(&mtp_info);
+ }
+ else {
+ print_usage();
res = -1;
- }
+ }
return res;
}
diff --git a/utils/MTP/beastpatcher/mtp_libmtp.c b/utils/MTP/beastpatcher/mtp_libmtp.c
index 90477fb0e7..89b374cad9 100644
--- a/utils/MTP/beastpatcher/mtp_libmtp.c
+++ b/utils/MTP/beastpatcher/mtp_libmtp.c
@@ -211,6 +211,7 @@ int mtp_send_file(struct mtp_info_t* mtp_info, const char* filename)
ret = mtp_send_fileptr(mtp_info, fwfile, sb.st_size);
fclose(fwfile);
+
return ret;
}