diff options
| author | 2010-05-13 05:59:36 -0400 | |
|---|---|---|
| committer | 2010-05-13 05:59:36 -0400 | |
| commit | a57e39d7180ae1c7ce28105fb0c735121dec6f0d (patch) | |
| tree | f435bddb3658cb310cb9f5e57b20775f32ec26c7 /src/irecovery.c | |
| parent | 2e8feabfe1ec82e75434663d5e3128e1769f34c5 (diff) | |
| download | libirecovery-a57e39d7180ae1c7ce28105fb0c735121dec6f0d.tar.gz libirecovery-a57e39d7180ae1c7ce28105fb0c735121dec6f0d.tar.bz2 | |
Began work. Added basic Makefile and implemented irecv_init(), irecv_open(), irecv_close(), and irecv_exit()
Needs to be tested on MacOSX and Windows, and Makefile needs to be updated for these platforms.
Diffstat (limited to 'src/irecovery.c')
| -rw-r--r-- | src/irecovery.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/irecovery.c b/src/irecovery.c new file mode 100644 index 0000000..dfcf422 --- /dev/null +++ b/src/irecovery.c | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | /** | ||
| 2 | * iRecovery - Utility for DFU 2.0, WTF and Recovery Mode | ||
| 3 | * Copyright (C) 2008 - 2009 westbaer | ||
| 4 | * | ||
| 5 | * This program is free software: you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation, either version 3 of the License, or | ||
| 8 | * (at your option) any later version. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 17 | **/ | ||
| 18 | |||
| 19 | #include <stdio.h> | ||
| 20 | #include <libirecovery.h> | ||
| 21 | |||
| 22 | int main(int argc, char** argv) { | ||
| 23 | irecv_device* device = NULL; | ||
| 24 | if(irecv_init(&device) < 0) { | ||
| 25 | fprintf(stderr, "Unable to initialize libirecovery\n"); | ||
| 26 | return -1; | ||
| 27 | } | ||
| 28 | |||
| 29 | if(irecv_open(device) < 0) { | ||
| 30 | fprintf(stderr, "Unable to open device\n"); | ||
| 31 | return -1; | ||
| 32 | } | ||
| 33 | |||
| 34 | switch (device->mode) { | ||
| 35 | case kRecoveryMode: | ||
| 36 | printf("Found device in recovery mode\n"); | ||
| 37 | break; | ||
| 38 | |||
| 39 | case kDfuMode: | ||
| 40 | printf("Found device in DFU mode\n"); | ||
| 41 | break; | ||
| 42 | |||
| 43 | case kKernelMode: | ||
| 44 | printf("Found device in kernel mode\n"); | ||
| 45 | break; | ||
| 46 | |||
| 47 | default: | ||
| 48 | printf("No device found\n"); | ||
| 49 | break; | ||
| 50 | } | ||
| 51 | |||
| 52 | irecv_exit(device); | ||
| 53 | return 0; | ||
| 54 | } | ||
| 55 | |||
