diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2009-06-12 17:12:41 +0000 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2009-06-12 17:12:41 +0000 |
commit | 94823c65ac7555a7ed19521184064255902ff615 (patch) | |
tree | cf37d35ccfb2357c09b59393ab11178e33ac2e09 /utils/MTP/beastpatcher | |
parent | 11fa12c366a0d33b198fea657dca18bc9d658b61 (diff) | |
download | rockbox-94823c65ac7555a7ed19521184064255902ff615.tar.gz 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/beastpatcher')
-rw-r--r-- | utils/MTP/beastpatcher/beastpatcher.c | 6 | ||||
-rw-r--r-- | utils/MTP/beastpatcher/main.c | 38 | ||||
-rw-r--r-- | utils/MTP/beastpatcher/mtp_libmtp.c | 1 |
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) | |||
146 | return 1; | 146 | return 1; |
147 | } | 147 | } |
148 | 148 | ||
149 | printf("[INFO] Found device \"%s - %s\"\n", mtp_info.manufacturer, | 149 | printf("[INFO] Found device \"%s - %s\"\n", mtp_info.manufacturer, |
150 | mtp_info.modelname); | 150 | mtp_info.modelname); |
151 | printf("[INFO] Device version: \"%s\"\n",mtp_info.version); | 151 | printf("[INFO] Device version: \"%s\"\n",mtp_info.version); |
152 | 152 | ||
@@ -162,11 +162,11 @@ int beastpatcher(void) | |||
162 | 162 | ||
163 | if (fwbuf == NULL) | 163 | if (fwbuf == NULL) |
164 | return 1; | 164 | return 1; |
165 | 165 | ||
166 | if (mtp_send_firmware(&mtp_info, fwbuf, fwsize) == 0) | 166 | if (mtp_send_firmware(&mtp_info, fwbuf, fwsize) == 0) |
167 | { | 167 | { |
168 | fprintf(stderr,"[INFO] Bootloader installed successfully.\n"); | 168 | fprintf(stderr,"[INFO] Bootloader installed successfully.\n"); |
169 | } | 169 | } |
170 | else | 170 | else |
171 | { | 171 | { |
172 | fprintf(stderr,"[ERR] Bootloader install failed.\n"); | 172 | 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 @@ | |||
38 | ****************************************************************************/ | 38 | ****************************************************************************/ |
39 | 39 | ||
40 | #include <stdio.h> | 40 | #include <stdio.h> |
41 | #include <string.h> | ||
41 | #include "beastpatcher.h" | 42 | #include "beastpatcher.h" |
42 | #include "mtp_common.h" | 43 | #include "mtp_common.h" |
43 | 44 | ||
44 | #if defined(__WIN32__) || defined(_WIN32) | 45 | #if defined(__WIN32__) || defined(_WIN32) |
45 | #include <windows.h> | 46 | #include <windows.h> |
47 | #include "../MTP_DLL/MTP_DLL.h" | ||
46 | #endif | 48 | #endif |
47 | 49 | ||
48 | #define VERSION "1.0 with v1 bootloader" | 50 | #define VERSION "1.0 with v1 bootloader" |
49 | 51 | ||
50 | #include "../MTP_DLL/MTP_DLL.h" | ||
51 | 52 | ||
52 | static void print_usage(void) | 53 | static void print_usage(void) |
53 | { | 54 | { |
@@ -56,7 +57,7 @@ static void print_usage(void) | |||
56 | fprintf(stderr,"Where [action] is one of the following options:\n"); | 57 | fprintf(stderr,"Where [action] is one of the following options:\n"); |
57 | fprintf(stderr," -i, --install (default)\n"); | 58 | fprintf(stderr," -i, --install (default)\n"); |
58 | fprintf(stderr," -h, --help\n"); | 59 | fprintf(stderr," -h, --help\n"); |
59 | fprintf(stderr," -s, --send nk.bin\n"); | 60 | fprintf(stderr," -s, --send nk.bin\n"); |
60 | fprintf(stderr,"\n"); | 61 | fprintf(stderr,"\n"); |
61 | } | 62 | } |
62 | 63 | ||
@@ -65,27 +66,30 @@ int main(int argc, char* argv[]) | |||
65 | { | 66 | { |
66 | int res; | 67 | int res; |
67 | char yesno[4]; | 68 | char yesno[4]; |
68 | struct mtp_info_t mtp_info; | 69 | struct mtp_info_t mtp_info; |
69 | 70 | ||
70 | fprintf(stderr,"beastpatcher v" VERSION " - (C) 2009 by the Rockbox developers\n"); | 71 | fprintf(stderr,"beastpatcher v" VERSION " - (C) 2009 by the Rockbox developers\n"); |
71 | fprintf(stderr,"This is free software; see the source for copying conditions. There is NO\n"); | 72 | fprintf(stderr,"This is free software; see the source for copying conditions. There is NO\n"); |
72 | fprintf(stderr,"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"); | 73 | fprintf(stderr,"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"); |
73 | 74 | ||
74 | if(argc == 1 || strcmp(argv[1],"-i")==0 || strcmp(argv[1],"--install")==0) { | 75 | if(argc == 1 || strcmp(argv[1],"-i")==0 || strcmp(argv[1],"--install")==0) { |
75 | res = beastpatcher(); | 76 | res = beastpatcher(); |
76 | /* don't ask for enter if started with command line arguments */ | 77 | /* don't ask for enter if started with command line arguments */ |
77 | if(argc == 1) { | 78 | if(argc == 1) { |
78 | printf("\nPress ENTER to exit beastpatcher: "); | 79 | printf("\nPress ENTER to exit beastpatcher: "); |
79 | fgets(yesno,4,stdin); | 80 | fgets(yesno,4,stdin); |
80 | } | 81 | } |
81 | } | 82 | } |
82 | else if((argc > 2) && ((strcmp(argv[1],"-s")==0) || (strcmp(argv[1],"--send")==0))) { | 83 | else if((argc > 2) && ((strcmp(argv[1],"-s")==0) || (strcmp(argv[1],"--send")==0))) { |
84 | mtp_init(&mtp_info); | ||
85 | mtp_scan(&mtp_info); | ||
83 | res = mtp_send_file(&mtp_info, argv[2]); | 86 | res = mtp_send_file(&mtp_info, argv[2]); |
84 | } | 87 | mtp_finished(&mtp_info); |
85 | else { | 88 | } |
86 | print_usage(); | 89 | else { |
90 | print_usage(); | ||
87 | res = -1; | 91 | res = -1; |
88 | } | 92 | } |
89 | 93 | ||
90 | return res; | 94 | return res; |
91 | } | 95 | } |
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) | |||
211 | ret = mtp_send_fileptr(mtp_info, fwfile, sb.st_size); | 211 | ret = mtp_send_fileptr(mtp_info, fwfile, sb.st_size); |
212 | 212 | ||
213 | fclose(fwfile); | 213 | fclose(fwfile); |
214 | |||
214 | return ret; | 215 | return ret; |
215 | } | 216 | } |
216 | 217 | ||