-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathipodinfo.c
More file actions
78 lines (74 loc) · 2 KB
/
ipodinfo.c
File metadata and controls
78 lines (74 loc) · 2 KB
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
/*
* ipodinfo.c - output iPod revision and fstype
*
* Copyright (C) 2005 Courtney Cavin, Alastair Stuart
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
#include <unistd.h>
#include "ipod.h"
int main(int argc, char **argv) {
int ch;
ipod_lcd_info *lcd;
char buf[64];
buf[0] = '\0';
while ((ch = getopt(argc, argv, "grflc")) != -1) {
switch (ch) {
case 'g':
sprintf(buf, "%d", (int)(ipod_get_hw_version() >> 16));
break;
case 'r':
sprintf(buf, "%lx", ipod_get_hw_version());
break;
case 'f':
sprintf(buf, "%c", ipod_get_fs_type());
break;
case 'l':
lcd = ipod_lcd_get_info();
sprintf(buf, "%dx%d %d", lcd->width, lcd->height, lcd->type);
free(lcd);
break;
case 'c':
lcd = ipod_lcd_get_info();
#ifdef IPOD
ipod_lcd_alloc_fb(lcd);
memset(lcd->fb, 0xff, lcd->fblen);
memset(lcd->fb + (lcd->fblen/2), 0xcc, (lcd->fblen/2));
ipod_fb_video();
ipod_lcd_update(lcd, 0, 0, lcd->width, lcd->height);
sleep(5);
ipod_lcd_free_fb(lcd);
ipod_fb_text();
#endif
free(lcd);
break;
case '?':
default:
fprintf(stderr, "%s [-r|-f|-l]\n"
"\t-r get ipod revision\n"
"\t-f get filesystem type F|H\n"
"\t-l get lcd info\n",
argv[0]);
return 1;
}
puts(buf);
}
return 0;
}