Openmoko Flasher

Openmoko Flasher Commit Details

Date:2010-05-10 15:12:47 (2 years 8 days ago)
Author:Nikolaus Schaller
Branch:master
Commit:cfba2f824ccdd818a7be55923d9ae5e3949a3f5b
Message:initial import

Changes:
A.gitattributes (full)
A.gitignore (full)
AAppController.h (full)
AAppController.m (full)
AEnglish.lproj/InfoPlist.strings
AEnglish.lproj/MainMenu.nib/classes.nib (full)
AEnglish.lproj/MainMenu.nib/info.nib (full)
AEnglish.lproj/MainMenu.nib/keyedobjects.nib
AIcon.icns
AInfo.plist (full)
AOpenMoko Flasher.xcodeproj/project.pbxproj (full)
Amain.m (full)

File differences

.gitattributes
1
2
*.pbxproj -crlf -diff -merge
.gitignore
1
2
3
4
5
6
7
# xcode noise
build/*
*.pbxuser
*.perspective*
*.mode1*
.svn
.DS_Store
AppController.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//
// AppController.h
// OpenMoko Flasher
//
// Created by H. Nikolaus Schaller on 01.08.07.
// Copyright 2007 Golden Delicious Computers GmbH&Co. KG. All rights reserved.
// Licensed under GPLv2 - see www.fsf.org
//
#import <Cocoa/Cocoa.h>
@interface AppController : NSObject {
IBOutlet NSPopUpButton *region;
IBOutlet NSTableView *table;
IBOutlet NSButton *loadButton;
IBOutlet NSButton *flashButton;
IBOutlet NSButton *removeButton;
IBOutlet NSButton *refreshButton;
IBOutlet NSTextView *logView;
IBOutlet NSProgressIndicator *progress;
IBOutlet NSComboBox *repositoryView;
NSTask *flasher;
NSString *currentFile;
NSMutableArray *repositories;
NSMutableArray *packages;// URLs (either http:// or file://)
NSMutableDictionary *moreInfo;// e.g. date
NSMutableArray *filtered;
NSMutableArray *downloads;// running downloads
}
- (IBAction) add:(id) sender;// manually add file to cache
- (IBAction) remove:(id) sender;// remove from cache
- (IBAction) refresh:(id) sender;// refresh list
- (IBAction) load:(id) sender;// load selected to cache
- (IBAction) flash:(id) sender;// flash selected from cache
- (IBAction) filter:(id) sender;// change filter
- (IBAction) didchange:(id) sender;// repository did change
- (IBAction) go:(id) sender;
@end
AppController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
//
// AppController.m
// OpenMoko Flasher
//
// Created by H. Nikolaus Schaller on 01.08.07.
// Copyright 2007 Golden Delicious Computers GmbH&Co. KG. All rights reserved.
// Licensed under GPLv2 - see www.fsf.org
//
#import "AppController.h"
@implementation NSString (Reverse)
- (NSComparisonResult) reverseCaseInsensitiveCompare:(NSString *)aString
{
NSComparisonResult r=[self caseInsensitiveCompare:aString];
return -r;
}
@end
enum
{// this must match the tag of the popup button values
TYPE_UBOOT=1,
TYPE_2,
TYPE_KERNEL,
TYPE_SPLASH,
TYPE_ROOTFS
};
@implementation AppController
- (BOOL) applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
{
return YES;
}
- (NSString *) cachePath:(NSString *) package;
{ // path may be either a file or some http:// address
NSMutableString *r=[package mutableCopy];
NSString *str;
[r replaceOccurrencesOfString:@"file://" withString:@"" options:0 range:NSMakeRange(0, [r length])];
[r replaceOccurrencesOfString:@"http://" withString:@":" options:0 range:NSMakeRange(0, [r length])];
[r replaceOccurrencesOfString:@"/" withString:@":" options:0 range:NSMakeRange(0, [r length])];
str=[NSHomeDirectory() stringByAppendingFormat:@"/Library/Caches/OpenMoko Flasher/%@", r];
[r autorelease];
#if 0
NSLog(@"cachePath %@ -> %@", package, str);
#endif
return str;
}
- (NSString *) urlPath:(NSString *) cacheFile;
{ // path may be either a file or some http:// address
NSMutableString *r=[cacheFile mutableCopy];
[r replaceOccurrencesOfString:@":" withString:@"/" options:0 range:NSMakeRange(1, [r length]-1)];
if([r replaceOccurrencesOfString:@":" withString:@"http://" options:0 range:NSMakeRange(0, 1)] == 0)
[r insertString:@"file://" atIndex:0];// has no initial :
[r autorelease];
#if 0
NSLog(@"urlPath %@ -> %@", cacheFile, r);
#endif
return r;
}
- (NSString *) serverFor:(NSString *) cacheFile;
{ // path may be either a file or some http:// address
NSMutableArray *c=[[cacheFile componentsSeparatedByString:@"/"] mutableCopy];
NSString *r;
[c removeLastObject];
r=[c componentsJoinedByString:@"/"];
[c release];
#if 0
NSLog(@"serverFor %@ -> %@", cacheFile, r);
#endif
return r;
}
- (BOOL) downloading:(NSString *) pack;
{ // check if we are currently downloading this package
NSEnumerator *e=[downloads objectEnumerator];
NSURLDownload *d;
while((d=[e nextObject]))
{
if([[[[d request] URL] absoluteString] isEqualToString:pack])
return YES;
}
return NO;
}
- (BOOL) cached:(NSString *) pack;
{ // already cached?
return [[NSFileManager defaultManager] fileExistsAtPath:[self cachePath:pack]];
}
- (void) loadCached;
{ // loads all from cache
NSString *dir=[self cachePath:@""];
NSArray *cached=[[NSFileManager defaultManager] directoryContentsAtPath:dir];
NSEnumerator *e=[cached objectEnumerator];
NSString *cacheFile;
[packages removeAllObjects];
while((cacheFile=[e nextObject]))
{
NSString *path;
if([cacheFile hasPrefix:@"."])
continue;// skip
if([cacheFile length] < 8)
continue;// too short (is some cache file)
path=[self urlPath:cacheFile];
[packages addObject:path];
if([path hasPrefix:@"file:"])
continue;// don't add
path=[self serverFor:path];
if(![repositories containsObject:path])
{ // add to known repositories
[repositories addObject:path];
[repositoryView reloadData];
}
}
[self filter:nil];
}
- (void) updateButtons;
{
int row=[table selectedRow];
BOOL flag=row >= 0;
NSString *pkg=(row >= 0 && row <[filtered count])?[filtered objectAtIndex:row]:nil;
[loadButton setEnabled:flag && ![self cached:pkg] && ![self downloading:pkg]];
//[stopButton setEnabled:flag && [self downloading:pkg]];
[removeButton setEnabled:flag && ([self cached:pkg] || [self downloading:pkg])];// can also stop a download
[removeButton setTitle:[self downloading:pkg]?@"Cancel":@"Uncache"];
[refreshButton setEnabled:[[repositoryView stringValue] hasPrefix:@"http://"]];
[flashButton setEnabled:flag && [self cached:pkg] && ![self downloading:pkg] && !flasher];
[progress setHidden:!(flasher || [downloads count] > 0)];
if(![progress isHidden])
[progress startAnimation:nil];
}
- (void) awakeFromNib;
{
[table setDoubleAction:@selector(doubleClick:)];
[self tableViewSelectionDidChange:nil];
packages=[[NSMutableArray alloc] initWithCapacity:100];
moreInfo=[[NSMutableDictionary alloc] initWithCapacity:100];
downloads=[[NSMutableArray alloc] initWithCapacity:5];
repositories=[[[NSBundle mainBundle] objectForInfoDictionaryKey:@"Repositories"] mutableCopy];
[repositoryView reloadData];
[repositoryView setStringValue:[repositories objectAtIndex:1]];// preselect first (should we remember by user defaults?)
#if 0
NSLog(@"repositories=%@", repositories);
#endif
[[NSFileManager defaultManager] createDirectoryAtPath:[self cachePath:@""] attributes:nil];
[self loadCached];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(readNotification:) name:NSFileHandleReadCompletionNotification object:nil];
}
- (void) applicationDidFinishLaunching:(NSNotification *)aNotification
{ // refresh initial repository
[self performSelector:@selector(refresh:) withObject:nil afterDelay:0.1];
}
- (id) comboBox:(NSComboBox *)aComboBox objectValueForItemAtIndex:(int)index
{
return [repositories objectAtIndex:index];
}
- (int) numberOfItemsInComboBox:(NSComboBox *)aComboBox
{
#if 0
NSLog(@"items=%d", [repositories count]);
#endif
return [repositories count];
}
- (IBAction) refresh:(id) sender;// refresh list
{
NSString *repos=[repositoryView stringValue];
NSURL *url=[NSURL URLWithString:repos];
NSError *err;
NSString *str;
//NSAttributedString *astr;
//NSDictionary *attribs;
if(!url)
{
[self updateButtons];
[self filter:nil];
return;
}
[progress setHidden:NO];
[progress startAnimation:nil];
//astr=[[NSAttributedString alloc] initWithURL:url options:nil documentAttributes:&attribs error:&err];
str=[NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:&err];
[self loadCached];
if(!str)
{
NSRunAlertPanel(@"OpenMoko Flasher", @"Can't access %@ due to %@", @"Ok", nil, nil, url, err);
}
else
{
unsigned pos=0;
unsigned len=[str length];
while(YES)
{
// should be reworked to use NSScanner!
NSRange f=[str rangeOfString:@"href=\"" options:NSCaseInsensitiveSearch range:NSMakeRange(pos, len-pos)];
NSRange g;
NSString *name;
NSString *date;
if(f.location == NSNotFound)
break;// no more locations
f.location+=f.length;// advance to start of href string
g=[str rangeOfString:@"\">" options:NSCaseInsensitiveSearch range:NSMakeRange(f.location, len-f.location)];// find closing location
if(g.location == NSNotFound)
break;// some error
name=[str substringWithRange:NSMakeRange(f.location, g.location-f.location)];
if([[repositoryView stringValue] hasSuffix:@"/"])
name=[[repositoryView stringValue] stringByAppendingString:name];
else
name=[[repositoryView stringValue] stringByAppendingFormat:@"/%@", name];// make URL package name
//NSLog(@"pkg=%@--", name);
if([name hasSuffix:@".bin"] ||
[name hasSuffix:@".tgz"] ||
[name hasSuffix:@".gz"] ||
[name hasSuffix:@".jffs2"])
{ // candidate
if(![packages containsObject:name])
{ // new
[packages addObject:name];
[moreInfo setObject:[NSMutableDictionary dictionaryWithCapacity:3] forKey:name];
}
g=[str rangeOfString:@"</a> " options:NSCaseInsensitiveSearch range:NSMakeRange(g.location, len-g.location)];// find closing location
if(g.location != NSNotFound)
{
int pos=g.location+g.length;
while(pos < [str length] && [str characterAtIndex:pos] == ' ')
pos++;
date=[str substringWithRange:NSMakeRange(pos, 17)];
}
else
date=@"?";
// should convert to real NSDate for better sorting
NSLog(@"add date=%@ name=%@", date, name);
[[moreInfo objectForKey:name] setObject:date forKey:@"date"];
}
pos=g.location;
}
}
[self updateButtons];
[self filter:nil];
}
- (IBAction) add:(id) sender;// manually add file to cache
{
NSOpenPanel *o=[NSOpenPanel openPanel];
NSString *pack;
if([o runModalForDirectory:nil file:nil types:[NSArray arrayWithObjects:@"jffs2", @"bin", @"gz", nil]] != NSFileHandlingPanelOKButton)
return;// ignore
pack=[@"file://" stringByAppendingString:[[o filename] lastPathComponent]];
if([[NSFileManager defaultManager] fileExistsAtPath:[self cachePath:pack]])
NSRunAlertPanel(@"OpenMoko Flasher", @"Already exists in cache: %@", @"Ok", nil, nil, [o filename]);
else if(![[NSFileManager defaultManager] copyPath:[o filename] toPath:[self cachePath:pack] handler:nil])
NSRunAlertPanel(@"OpenMoko Flasher", @"Can't add %@", @"Ok", nil, nil, [o filename]);
else
{
if(![packages containsObject:pack])
[packages addObject:pack];// cache as file:name
}
[self filter:nil];// reload
}
- (IBAction) remove:(id) sender;// remove from cache
{
NSString *path;
NSString *package;
int row=[table selectedRow];
NSEnumerator *e=[downloads objectEnumerator];
NSURLDownload *d;
if(row < 0)
return;
package=[filtered objectAtIndex:row];
path=[self cachePath:package];
while((d=[e nextObject]))
{
NSURL *url=[[d request] URL];
if([[url absoluteString] isEqualToString:package])
{
[d cancel];
#if 1// cancel should have deleted the file?
[[NSFileManager defaultManager] removeFileAtPath:path handler:nil];
#endif
[downloads removeObject:d];
NSLog(@"cancelled %@", d);
NSLog(@"downloads %@", downloads);
[self filter:nil];// show result
return;
}
}
if(![self cached:package])
return;// not cached
if(NSRunAlertPanel(@"OpenMoko Flasher", @"Do you really want to delete %@ from the cache?", @"Ok", @"Cancel", nil, package) != NSAlertDefaultReturn)
return;
[[NSFileManager defaultManager] removeFileAtPath:path handler:nil];
[self filter:nil];// show result
}
- (IBAction) load:(id) sender;// load selected to cache
{
NSString *path;
NSString *package;
int row=[table selectedRow];
if(row < 0)
return;
package=[filtered objectAtIndex:row];
path=[self cachePath:package];
if(![self cached:package] || ![self downloading:package])
{ // does not exist
NSURL *url=[NSURL URLWithString:package];
NSURLRequest *request=[NSURLRequest requestWithURL:url];
NSURLDownload *download=[[NSURLDownload alloc] initWithRequest:request delegate:self];
NSLog(@"url=%@", url);
NSLog(@"request=%@", request);
[download setDestination:path allowOverwrite:YES];
[download setDeletesFileUponFailure:YES];
[downloads addObject:download];// add to list
NSLog(@"downloads=%@", downloads);
[download release];
[self filter:nil];// needs a refresh to show downloading status
}
}
- (void) readNotification:(NSNotification *) n;
{
NSFileHandle *f=[n object];
NSData *d=[[n userInfo] objectForKey:NSFileHandleNotificationDataItem];
NSAttributedString *astr;
NSString *str;
if([d length] == 0)
{
NSLog(@"flashing done");
[flasher waitUntilExit];
if([flasher terminationStatus] == 0)
{ // flashed ok
[[NSUserDefaults standardUserDefaults] setObject:[currentFile lastPathComponent] forKey:[[region selectedItem] title]];
}
else
NSRunAlertPanel(@"Access OpenMoko", @"Flashing failed. Try to unplug/replug the USB connection. And, try twice.", @"Ok", nil, nil);
[table reloadData];// update status
[flasher release];
flasher=nil;
[currentFile release];
[self updateButtons];// stop progress indicator
return;// done
}
NSLog(@"received %d bytes", [d length]);
str=[[NSString alloc] initWithData:d encoding:NSUTF8StringEncoding];
astr=[[NSAttributedString alloc] initWithString:str];
[str release];
[[logView textStorage] appendAttributedString:astr];
[astr release];
[logView scrollRangeToVisible:NSMakeRange([[logView string] length], 0)];// scroll to bottom
[[logView window] display];
[f readInBackgroundAndNotify];// continue
}
- (int) packageType:(NSString *) file
{
if([file hasPrefix:@"u-boot-"] && [file hasSuffix:@".bin"])
return TYPE_UBOOT;
if([file hasSuffix:@"-u-boot.bin"])
return TYPE_UBOOT;
if([file hasSuffix:@"u-boot_env"])
return TYPE_2;
if([file hasPrefix:@"uImage-"] && [file hasSuffix:@".bin"])
return TYPE_KERNEL;
if([file hasSuffix:@".uImage.bin"])
return TYPE_KERNEL;
if([file hasSuffix:@".splash.gz"])
return TYPE_SPLASH;
if([file hasSuffix:@".jffs2"])
return TYPE_ROOTFS;
return NSNotFound;
}
- (IBAction) flash:(id) sender;// flash selected file from cache
{
NSBundle *b=[NSBundle mainBundle];
NSString *path;
NSString *package;
NSPipe *pipe;
int type;
NSString *mappedType=nil;
int row=[table selectedRow];
if(row < 0)
return;
if([self downloading:package])
return;
package=[filtered objectAtIndex:row];
type=[self packageType:[package lastPathComponent]];
switch(type)
{
case TYPE_UBOOT: mappedType=@"u-boot"; break;
case TYPE_2: mappedType=@"2"; break;
case TYPE_KERNEL: mappedType=@"kernel"; break;
case TYPE_SPLASH: mappedType=@"splash"; break;
case TYPE_ROOTFS: mappedType=@"rootfs"; break;
default:
return;// unknown type
}
path=[self cachePath:package];
if(!path)
return;// can't load
currentFile=[path retain];
#if 1
{
NSString *cmd=[NSString stringWithFormat:@"export DYLD_LIBRARY_PATH=\"%@:${DYLD_LIBRARY_PATH}\"; '%@' -a %@ -R -D '%@'",
[b resourcePath], [b pathForAuxiliaryExecutable:@"dfu-util"], mappedType, path];
NSLog(@"\n%@", cmd);
}
#endif
if(NSRunAlertPanel(@"Access OpenMoko", @"Do you really want to flash a new file?\nThis may damage your device!\n\nTo turn on Flashing mode, press the AUX buton while switching on the OpenMoko. Leave the device in the BOOT menu. If it fails, unplug/replug USB. And try again (twice is better than once).", @"Ok", @"Cancel", nil) != NSOKButton)
return;
flasher=[[NSTask alloc] init];
#if 0
[flasher setLaunchPath:@"/bin/echo"];
#else
[flasher setLaunchPath:[b pathForAuxiliaryExecutable:@"dfu-util"]];
#endif
[flasher setArguments:[NSArray arrayWithObjects:
//@"dfu-util",
@"-a",
mappedType,
@"-R",
@"-D",
path,
nil]];
[flasher setEnvironment:[NSDictionary dictionaryWithObjectsAndKeys:
[b resourcePath], @"DYLD_LIBRARY_PATH",
nil]];
#if 1
NSLog(@"%@ %@ %@", [flasher launchPath], [flasher arguments], [flasher environment]);
// write virtual command(s) to log window
#endif
pipe=[NSPipe pipe];
[flasher setStandardOutput:pipe];
[flasher setStandardError:pipe];
[[pipe fileHandleForReading] readInBackgroundAndNotify];
[flasher launch];
[self updateButtons];// start progress indicator
}
// should be effective for every change!!!
- (IBAction) didchange:(id) sender;
{
// check if it really did change...
if(sender == repositoryView)
{
[self refresh:nil];
}
else
{
[self filter:nil];// update filter
[self updateButtons];
}
}
- (IBAction) filter:(id) sender;// change filter
{
[filtered release];// clear cache
filtered=nil;
[table reloadData];
}
- (IBAction) go:(id) sender;
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:[repositoryView stringValue]]];
[sender setState:NSOffState];
}
- (BOOL) validateMenuItem:(id <NSMenuItem>)menuItem
{
NSString *action=NSStringFromSelector([menuItem action]);
if([action isEqualToString:@"load:"])
return [loadButton isEnabled];
if([action isEqualToString:@"flash:"])
return [flashButton isEnabled];
return YES;
}
// table callbacks
- (IBAction) doubleClick:(id) sender;
{
int row=[sender clickedRow];
NSString *pack;
if(row < 0)
return;
pack=[filtered objectAtIndex:row];
if([self cached:pack])
[[NSWorkspace sharedWorkspace] selectFile:[self cachePath:pack] inFileViewerRootedAtPath:@""];
}
- (int) numberOfRowsInTableView:(NSTableView *)aTableView
{
if(!filtered)
{
int tag=[[region selectedItem] tag];
NSEnumerator *e=[packages objectEnumerator];
NSString *package;
NSString *repos=[repositoryView stringValue];
if([repos hasSuffix:@"/"])
repos=[repos substringToIndex:[repos length]-1];
filtered=[[NSMutableArray alloc] initWithCapacity:100];
while((package=[e nextObject]))
{
NSString *loc=[self serverFor:package];
NSString *file=[package lastPathComponent];
if([repos hasPrefix:@"http://"] && ![loc isEqualToString:repos])
{
#if 0
NSLog(@"no match: %@ - %@", loc, repos);
#endif
continue;// filter by repository
}
if(tag != 0 && [self packageType:file] != tag)
continue;// didn't pass filter
[filtered addObject:package];// did go through filter
}
[filtered sortUsingSelector:@selector(reverseCaseInsensitiveCompare:)];
[self updateButtons];// may change button status
}
return [filtered count];
}
- (id) tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
{
NSString *ident=[aTableColumn identifier];
if([ident isEqualToString:@"status"])
{ // get status
NSString *name=[filtered objectAtIndex:rowIndex];
NSString *current=[[NSUserDefaults standardUserDefaults] objectForKey:[[region selectedItem] title]];
if([current isEqualToString:name])
return @"Flashed";
if([self downloading:name])
return @"Loading";
if([self cached:name])
return @"Cached";
return @"";
}
if([ident isEqualToString:@"type"])
{
switch([self packageType:[[filtered objectAtIndex:rowIndex] lastPathComponent]])
{
case TYPE_UBOOT:return @"BootLD";
case TYPE_KERNEL: return @"Kernel";
case TYPE_SPLASH: return @"Splash";
case TYPE_ROOTFS: return @"RootFS";
default: @"?";
}
}
if([ident isEqualToString:@"package"])
{
if([[repositoryView stringValue] hasPrefix:@"http://"])
return [[filtered objectAtIndex:rowIndex] lastPathComponent];// show filename only
return [filtered objectAtIndex:rowIndex];// show full path
}
if([ident isEqualToString:@"date"])
{
NSString *package=[filtered objectAtIndex:rowIndex];
NSDictionary *more=[moreInfo objectForKey:package];
return [more objectForKey:@"date"];
}
if([ident isEqualToString:@"size"])
{
NSString *package=[filtered objectAtIndex:rowIndex];
if([self cached:package])
{ // get cached file size
NSString *path=[self cachePath:package];
NSDictionary *stat=[[NSFileManager defaultManager] fileAttributesAtPath:path traverseLink:YES];
if(stat)
{ // get (real) file size
return [[stat objectForKey:NSFileSize] description];
}
}
return @"?";
}
return @"?";
}
- (void) tableViewSelectionDidChange:(NSNotification *)aNotification
{
[self updateButtons];
}
- (void) downloadDidFinish:(NSURLDownload *)download
{
NSLog(@"download finished %@", download);
[downloads removeObject:download];
[self filter:nil];
}
- (void)download:(NSURLDownload *)download didReceiveDataOfLength:(unsigned)length
{ // show new file length
static NSDate *last;
if(!last || [[NSDate date] timeIntervalSinceDate:last] > 0.2)
{ // refresh
[table reloadData];
[last release];
last=[[NSDate alloc] init];
}
}
- (void) download:(NSURLDownload *)download didFailWithError:(NSError *)error
{
NSLog(@"download error %@ for %@", error, download);
[downloads removeObject:download];
[self filter:nil];
}
@end
English.lproj/MainMenu.nib/classes.nib
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{
IBClasses = (
{
ACTIONS = {
add = id;
didchange = id;
filter = id;
flash = id;
go = id;
load = id;
refresh = id;
remove = id;
};
CLASS = AppController;
LANGUAGE = ObjC;
OUTLETS = {
flashButton = NSButton;
loadButton = NSButton;
logView = NSTextView;
progress = NSProgressIndicator;
refreshButton = NSButton;
region = NSPopUpButton;
removeButton = NSButton;
repositoryView = NSComboBox;
table = NSTableView;
};
SUPERCLASS = NSObject;
},
{
ACTIONS = {
add = id;
flash = id;
load = id;
refresh = id;
};
CLASS = FirstResponder;
LANGUAGE = ObjC;
SUPERCLASS = NSObject;
}
);
IBVersion = 1;
}
English.lproj/MainMenu.nib/info.nib
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>143 545 356 240 0 0 1920 1178 </string>
<key>IBEditorPositions</key>
<dict>
<key>29</key>
<string>100 347 360 44 0 0 1920 1178 </string>
</dict>
<key>IBFramework Version</key>
<string>489.0</string>
<key>IBLockedObjects</key>
<array/>
<key>IBOldestOS</key>
<integer>4</integer>
<key>IBOpenObjects</key>
<array>
<integer>21</integer>
<integer>29</integer>
</array>
<key>IBSystem Version</key>
<string>9G55</string>
</dict>
</plist>
Info.plist
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>Icon</string>
<key>CFBundleIdentifier</key>
<string>com.goldelico.OpenMokoFlasher</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.5.1</string>
<key>CFBundleShortVersionString</key>
<string>1.5.1</string>
<key>NSHumanReadableCopyright</key>
<string>©Golden Delicious Computers, 2008-2009. Licensed under GPL2</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>Repositories</key>
<array>
<string>All known</string>
<string>http://downloads.openmoko.org/daily</string>
<string>http://downloads.openmoko.org/distro/releases/Om2008.12</string>
<string>http://downloads.openmoko.org/distro/releases/Om2008.9</string>
<string>http://downloads.openmoko.org/distro/obsolete-images/Om2008.8</string>
<string>http://downloads.openmoko.org/distro/obsolete-images/Om2008.4</string>
<string>http://downloads.openmoko.org/distro/obsolete-images/Om2007.11/images/neo1973/</string>
<string>http://other.lastnetwork.net/OpenMoko/</string>
<string>http://people.openmoko.org/sean_mcneil/</string>
<string>http://compartida.net/openmoko/FDOM/</string>
<string>http://openmoko.truebox.co.uk/mirror/compartida.net/</string>
<string>http://downloads.freesmartphone.org/fso-stable/milestone5/om-gta02/</string>
<string>http://www.quantum-step.com/download/OpenMoko-Edition/GTA01b4</string>
<string>http://downloads.openmoko.org/obsolete/asu</string>
<string>http://downloads.openmoko.org/obsolete/recommended</string>
<string>http://chooseopen.com/openmoko/build/2007.1</string>
<string>http://carrierclass.net/openmoko/images/2007.01</string>
<string>http://people.openmoko.org/mickey/images</string>
</array>
</dict>
</plist>
OpenMoko Flasher.xcodeproj/project.pbxproj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 42;
objects = {
/* Begin PBXAggregateTarget section */
EE26E0C00D6085E100116FAC /* dfu */ = {
isa = PBXAggregateTarget;
buildConfigurationList = EE26E0D30D6085EE00116FAC /* Build configuration list for PBXAggregateTarget "dfu" */;
buildPhases = (
EE26E0BF0D6085E100116FAC /* ShellScript */,
);
dependencies = (
);
name = dfu;
productName = dfu;
};
EE42F32E0CA25131006FA8F6 /* Sources */ = {
isa = PBXAggregateTarget;
buildConfigurationList = EE42F3310CA25151006FA8F6 /* Build configuration list for PBXAggregateTarget "Sources" */;
buildPhases = (
EE42F32D0CA25131006FA8F6 /* ShellScript */,
);
dependencies = (
);
name = Sources;
productName = Sources;
};
EEA6A06B0D6887C3005582FB /* libusb */ = {
isa = PBXAggregateTarget;
buildConfigurationList = EEA6A0720D6887D6005582FB /* Build configuration list for PBXAggregateTarget "libusb" */;
buildPhases = (
EEA6A06A0D6887C3005582FB /* ShellScript */,
);
dependencies = (
);
name = libusb;
productName = libusb;
};
EEA6A34F0D69CFA7005582FB /* All */ = {
isa = PBXAggregateTarget;
buildConfigurationList = EEA6A3560D69CFD0005582FB /* Build configuration list for PBXAggregateTarget "All" */;
buildPhases = (
EEA6A34E0D69CFA7005582FB /* ShellScript */,
);
dependencies = (
EEA6A3510D69CFAF005582FB /* PBXTargetDependency */,
EEA6A3530D69CFB2005582FB /* PBXTargetDependency */,
);
name = All;
productName = All;
};
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; };
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
EE9BF3D90C9FD8F2008BADF3 /* OpenMokoFlasher.app in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8D1107320486CEB800E47090 /* OpenMokoFlasher.app */; };
EEC7F8130C61703800762819 /* AppController.m in Sources */ = {isa = PBXBuildFile; fileRef = EEC7F8120C61703800762819 /* AppController.m */; };
EED58DEE0C7865C20048859C /* Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = EED58DED0C7865C20048859C /* Icon.icns */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
EE26E0E40D60870300116FAC /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
proxyType = 1;
remoteGlobalIDString = EE26E0C00D6085E100116FAC;
remoteInfo = dfu;
};
EEA6A2F00D698EAB005582FB /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
proxyType = 1;
remoteGlobalIDString = EEA6A06B0D6887C3005582FB;
remoteInfo = libusb;
};
EEA6A3500D69CFAF005582FB /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
proxyType = 1;
remoteGlobalIDString = 8D1107260486CEB800E47090;
remoteInfo = "OpenMoko Flasher";
};
EEA6A3520D69CFB2005582FB /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
proxyType = 1;
remoteGlobalIDString = EE42F32E0CA25131006FA8F6;
remoteInfo = Sources;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
EE9BF3D70C9FD8DC008BADF3 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = $HOME/Applications;
dstSubfolderSpec = 0;
files = (
EE9BF3D90C9FD8F2008BADF3 /* OpenMokoFlasher.app in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
29B97319FDCFA39411CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MainMenu.nib; sourceTree = "<group>"; };
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
32CA4F630368D1EE00C91783 /* OpenMokoFlasher_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenMokoFlasher_Prefix.pch; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8D1107320486CEB800E47090 /* OpenMokoFlasher.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OpenMokoFlasher.app; sourceTree = BUILT_PRODUCTS_DIR; };
EE5B85ED0E8F8DAC00264951 /* Readme.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = Readme.rtf; sourceTree = "<group>"; };
EEA6A0FC0D68983E005582FB /* libusb-0.1.4.4.4.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = "libusb-0.1.4.4.4.dylib"; sourceTree = "<group>"; };
EEA6A0FD0D68983E005582FB /* libusb-0.1.4.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = "libusb-0.1.4.dylib"; sourceTree = "<group>"; };
EEA6A0FE0D68983E005582FB /* libusb.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libusb.dylib; sourceTree = "<group>"; };
EEA6A1000D68983E005582FB /* libusb-0.1.4.4.4.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = "libusb-0.1.4.4.4.dylib"; sourceTree = "<group>"; };
EEA6A1010D68983E005582FB /* libusb-0.1.4.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = "libusb-0.1.4.dylib"; sourceTree = "<group>"; };
EEA6A1020D68983E005582FB /* libusb.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libusb.dylib; sourceTree = "<group>"; };
EEC7F7A20C616B7F00762819 /* dfu-util */ = {isa = PBXFileReference; lastKnownFileType = folder; path = "dfu-util"; sourceTree = "<group>"; };
EEC7F8110C61703800762819 /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = "<group>"; };
EEC7F8120C61703800762819 /* AppController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppController.m; sourceTree = "<group>"; };
EED58DED0C7865C20048859C /* Icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Icon.icns; sourceTree = "<group>"; };
EEDD83C10C63468200D2CF87 /* ToDo */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ToDo; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
8D11072E0486CEB800E47090 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
080E96DDFE201D6D7F000001 /* Classes */ = {
isa = PBXGroup;
children = (
EEC7F8110C61703800762819 /* AppController.h */,
EEC7F8120C61703800762819 /* AppController.m */,
);
name = Classes;
sourceTree = "<group>";
};
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
);
name = "Linked Frameworks";
sourceTree = "<group>";
};
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = {
isa = PBXGroup;
children = (
29B97324FDCFA39411CA2CEA /* AppKit.framework */,
13E42FB307B3F0F600E4EEF1 /* CoreData.framework */,
29B97325FDCFA39411CA2CEA /* Foundation.framework */,
);
name = "Other Frameworks";
sourceTree = "<group>";
};
19C28FACFE9D520D11CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
8D1107320486CEB800E47090 /* OpenMokoFlasher.app */,
);
name = Products;
sourceTree = "<group>";
};
29B97314FDCFA39411CA2CEA /* OpenMokoFlasher */ = {
isa = PBXGroup;
children = (
EEDD83C10C63468200D2CF87 /* ToDo */,
EE5B85ED0E8F8DAC00264951 /* Readme.rtf */,
EEA6A0FA0D68983E005582FB /* libusb */,
EEC7F7A20C616B7F00762819 /* dfu-util */,
080E96DDFE201D6D7F000001 /* Classes */,
29B97315FDCFA39411CA2CEA /* Other Sources */,
29B97317FDCFA39411CA2CEA /* Resources */,
29B97323FDCFA39411CA2CEA /* Frameworks */,
19C28FACFE9D520D11CA2CBB /* Products */,
);
name = OpenMokoFlasher;
sourceTree = "<group>";
};
29B97315FDCFA39411CA2CEA /* Other Sources */ = {
isa = PBXGroup;
children = (
32CA4F630368D1EE00C91783 /* OpenMokoFlasher_Prefix.pch */,
29B97316FDCFA39411CA2CEA /* main.m */,
);
name = "Other Sources";
sourceTree = "<group>";
};
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
EED58DED0C7865C20048859C /* Icon.icns */,
8D1107310486CEB800E47090 /* Info.plist */,
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
29B97318FDCFA39411CA2CEA /* MainMenu.nib */,
);
name = Resources;
sourceTree = "<group>";
};
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
isa = PBXGroup;
children = (
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */,
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */,
);
name = Frameworks;
sourceTree = "<group>";
};
EEA6A0FA0D68983E005582FB /* libusb */ = {
isa = PBXGroup;
children = (
EEA6A0FB0D68983E005582FB /* i386 */,
EEA6A0FF0D68983E005582FB /* ppc */,
);
path = libusb;
sourceTree = "<group>";
};
EEA6A0FB0D68983E005582FB /* i386 */ = {
isa = PBXGroup;
children = (
EEA6A0FC0D68983E005582FB /* libusb-0.1.4.4.4.dylib */,
EEA6A0FD0D68983E005582FB /* libusb-0.1.4.dylib */,
EEA6A0FE0D68983E005582FB /* libusb.dylib */,
);
path = i386;
sourceTree = "<group>";
};
EEA6A0FF0D68983E005582FB /* ppc */ = {
isa = PBXGroup;
children = (
EEA6A1000D68983E005582FB /* libusb-0.1.4.4.4.dylib */,
EEA6A1010D68983E005582FB /* libusb-0.1.4.dylib */,
EEA6A1020D68983E005582FB /* libusb.dylib */,
);
path = ppc;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
8D1107260486CEB800E47090 /* OpenMoko Flasher */ = {
isa = PBXNativeTarget;
buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "OpenMoko Flasher" */;
buildPhases = (
8D1107290486CEB800E47090 /* Resources */,
8D11072C0486CEB800E47090 /* Sources */,
8D11072E0486CEB800E47090 /* Frameworks */,
EEC7F7E20C616E9F00762819 /* ShellScript */,
EE9BF3D70C9FD8DC008BADF3 /* CopyFiles */,
);
buildRules = (
);
dependencies = (
EEA6A2F10D698EAB005582FB /* PBXTargetDependency */,
EE26E0E50D60870300116FAC /* PBXTargetDependency */,
);
name = "OpenMoko Flasher";
productInstallPath = "$(HOME)/Applications";
productName = OpenMokoFlasher;
productReference = 8D1107320486CEB800E47090 /* OpenMokoFlasher.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "OpenMoko Flasher" */;
compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
mainGroup = 29B97314FDCFA39411CA2CEA /* OpenMokoFlasher */;
projectDirPath = "";
projectRoot = "";
targets = (
EEA6A34F0D69CFA7005582FB /* All */,
8D1107260486CEB800E47090 /* OpenMoko Flasher */,
EE42F32E0CA25131006FA8F6 /* Sources */,
EE26E0C00D6085E100116FAC /* dfu */,
EEA6A06B0D6887C3005582FB /* libusb */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
8D1107290486CEB800E47090 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */,
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
EED58DEE0C7865C20048859C /* Icon.icns in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
EE26E0BF0D6085E100116FAC /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# shell script goes here\n\nPATH=/usr/local/bin:/opt/local/bin:/opt/local/sbin:$PATH\n\nHERE=$PWD\n\ncd dfu-util\n\n./autogen.sh\n\nARCHS=\"i386 ppc\"\n\nfor ARCH in $ARCHS\n\tdo\n\trm -f src/Makefile\n\t./configure --host Darwin CFLAGS=\" -I/opt/local/include -L$HERE/libusb -arch $ARCH\" LIBS=\"-Wl,-framework -Wl,IOKit -Wl,-framework -Wl,CoreFoundation -lusb\" \n\tmake\n\tcp -f src/dfu-util dfu-util.$ARCH\n\tmake clean\n\tdone\n\n# make universal binary\n\nlipo dfu-util.ppc dfu-util.i386 -create -output dfu-util\n\n# fix to use libusb in our bundle http://qin.laya.com/tech_coding_help/dylib_linking.html\n\notool -L dfu-util\ninstall_name_tool -change /opt/local/lib/libusb-0.1.4.dylib @executable_path/../Resources/libusb-0.1.4.dylib dfu-util\notool -L dfu-util\n\nexit 0";
};
EE42F32D0CA25131006FA8F6 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# shell script goes here\n# Copyright H. N. Schaller, Golden Delicious Computers GmbH&Co. KG\n# Licensed under GPL\n\ntar cvzf 'OpenMoko Flasher Sources.tgz' \\\n\t--exclude 'OpenMoko Flasher Sources.tgz' \\\n\t--exclude .svn \\\n\t--exclude 'hns*' \\\n\t--exclude '*.tgz' \\\n\t--exclude .gdb_history \\\n\t--exclude .DS_Store \\\n\t--exclude .deps \\\n\t--exclude build .\n\nexit 0";
};
EEA6A06A0D6887C3005582FB /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# shell script goes here\n\n# fails:\n# sudo port install libusb +universal\n\ncd libusb\n\nlipo i386/libusb-0.1.4.4.4.dylib ppc/libusb-0.1.4.4.4.dylib -create -output libusb-0.1.4.4.4.dylib\n\nexit 0";
};
EEA6A34E0D69CFA7005582FB /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# shell script goes here\n\ntar cvzf \"OpenMoko Flasher.tgz\" \"OpenMoko Flasher Sources.tgz\" -C build/Debug \"OpenMoko Flasher.app\"\n\nexit 0";
};
EEC7F7E20C616E9F00762819 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "cp dfu-util/dfu-util \"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_FOLDER_PATH}\"\n(cd libusb; tar czf - libusb*.dylib ) | (cd \"${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}\" && tar xvzf -)\n#rm -rf \"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_FOLDER_PATH}/Sources\"\n#mkdir -p \"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_FOLDER_PATH}/Sources\"\n#cp -R dfu-util \"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_FOLDER_PATH}/Sources\"\n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
8D11072C0486CEB800E47090 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8D11072D0486CEB800E47090 /* main.m in Sources */,
EEC7F8130C61703800762819 /* AppController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
EE26E0E50D60870300116FAC /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = EE26E0C00D6085E100116FAC /* dfu */;
targetProxy = EE26E0E40D60870300116FAC /* PBXContainerItemProxy */;
};
EEA6A2F10D698EAB005582FB /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = EEA6A06B0D6887C3005582FB /* libusb */;
targetProxy = EEA6A2F00D698EAB005582FB /* PBXContainerItemProxy */;
};
EEA6A3510D69CFAF005582FB /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 8D1107260486CEB800E47090 /* OpenMoko Flasher */;
targetProxy = EEA6A3500D69CFAF005582FB /* PBXContainerItemProxy */;
};
EEA6A3530D69CFB2005582FB /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = EE42F32E0CA25131006FA8F6 /* Sources */;
targetProxy = EEA6A3520D69CFB2005582FB /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
089C165DFE840E0CC02AAC07 /* English */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
29B97318FDCFA39411CA2CEA /* MainMenu.nib */ = {
isa = PBXVariantGroup;
children = (
29B97319FDCFA39411CA2CEA /* English */,
);
name = MainMenu.nib;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
C01FCF4B08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = (
ppc,
i386,
);
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
PRODUCT_NAME = "OpenMoko Flasher";
WRAPPER_EXTENSION = app;
ZERO_LINK = YES;
};
name = Debug;
};
C01FCF4C08A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = (
ppc,
i386,
);
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_MODEL_TUNING = G5;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
PRODUCT_NAME = OpenMokoFlasher;
WRAPPER_EXTENSION = app;
};
name = Release;
};
C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
};
name = Debug;
};
C01FCF5008A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
};
name = Release;
};
EE26E0D40D6085EE00116FAC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
PRODUCT_NAME = dfu;
};
name = Debug;
};
EE26E0D50D6085EE00116FAC /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = YES;
GCC_ENABLE_FIX_AND_CONTINUE = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
PRODUCT_NAME = dfu;
ZERO_LINK = NO;
};
name = Release;
};
EE42F3320CA25151006FA8F6 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
PRODUCT_NAME = Sources;
};
name = Debug;
};
EE42F3330CA25151006FA8F6 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = YES;
GCC_ENABLE_FIX_AND_CONTINUE = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
PRODUCT_NAME = Sources;
ZERO_LINK = NO;
};
name = Release;
};
EEA6A0730D6887D6005582FB /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
PRODUCT_NAME = libusb;
};
name = Debug;
};
EEA6A0740D6887D6005582FB /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = YES;
GCC_ENABLE_FIX_AND_CONTINUE = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
PRODUCT_NAME = libusb;
ZERO_LINK = NO;
};
name = Release;
};
EEA6A3570D69CFD0005582FB /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
PRODUCT_NAME = All;
};
name = Debug;
};
EEA6A3580D69CFD0005582FB /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = YES;
GCC_ENABLE_FIX_AND_CONTINUE = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
PRODUCT_NAME = All;
ZERO_LINK = NO;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "OpenMoko Flasher" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C01FCF4B08A954540054247B /* Debug */,
C01FCF4C08A954540054247B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C01FCF4E08A954540054247B /* Build configuration list for PBXProject "OpenMoko Flasher" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C01FCF4F08A954540054247B /* Debug */,
C01FCF5008A954540054247B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
EE26E0D30D6085EE00116FAC /* Build configuration list for PBXAggregateTarget "dfu" */ = {
isa = XCConfigurationList;
buildConfigurations = (
EE26E0D40D6085EE00116FAC /* Debug */,
EE26E0D50D6085EE00116FAC /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
EE42F3310CA25151006FA8F6 /* Build configuration list for PBXAggregateTarget "Sources" */ = {
isa = XCConfigurationList;
buildConfigurations = (
EE42F3320CA25151006FA8F6 /* Debug */,
EE42F3330CA25151006FA8F6 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
EEA6A0720D6887D6005582FB /* Build configuration list for PBXAggregateTarget "libusb" */ = {
isa = XCConfigurationList;
buildConfigurations = (
EEA6A0730D6887D6005582FB /* Debug */,
EEA6A0740D6887D6005582FB /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
EEA6A3560D69CFD0005582FB /* Build configuration list for PBXAggregateTarget "All" */ = {
isa = XCConfigurationList;
buildConfigurations = (
EEA6A3570D69CFD0005582FB /* Debug */,
EEA6A3580D69CFD0005582FB /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
}
main.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//
// main.m
// OpenMokoFlasher
//
// Created by H. Nikolaus Schaller on 01.08.07.
// Copyright Golden Delicious Computers GmbH&Co. KG 2007. All rights reserved.
// Licensed under GPLv2 - see www.fsf.org
//
#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[])
{
return NSApplicationMain(argc, (const char **) argv);
}

Archive Download the corresponding diff file

Branches