From 201e1ff5bf2054fcb1c0cc3cd7ba1e229dbde3fa Mon Sep 17 00:00:00 2001 From: Zach C Date: Wed, 11 Mar 2009 22:04:38 -0700 Subject: Fixes a compile error and two usbmux bugs Signed-off-by: Matt Colyer --- src/AFC.h | 41 +++++++++++++++++++++++++++-------------- src/usbmux.c | 7 ++++--- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/src/AFC.h b/src/AFC.h index de4e071..62ec659 100644 --- a/src/AFC.h +++ b/src/AFC.h @@ -58,21 +58,34 @@ struct iphone_afc_file_int { enum { AFC_ERROR = 0x00000001, - AFC_GET_INFO = 0x0000000a, - AFC_GET_DEVINFO = 0x0000000b, - AFC_LIST_DIR = 0x00000003, - AFC_MAKE_DIR = 0x00000009, - AFC_DELETE = 0x00000008, - AFC_TRUNCATE = 0x00000007, - AFC_RENAME = 0x00000018, AFC_SUCCESS_RESPONSE = 0x00000002, - AFC_FILE_OPEN = 0x0000000d, - AFC_FILE_CLOSE = 0x00000014, - AFC_FILE_SEEK = 0x00000011, - AFC_FILE_TRUNCATE = 0x00000015, - AFC_FILE_HANDLE = 0x0000000e, - AFC_READ = 0x0000000f, - AFC_WRITE = 0x00000010 + AFC_LIST_DIR = 0x00000003, // ReadDir + // 0x00000004 // ReadFile + // 0x00000005 // WriteFile + // 0x00000006 // WritePart + AFC_TRUNCATE = 0x00000007, // Truncate + AFC_DELETE = 0x00000008, // RemovePath + AFC_MAKE_DIR = 0x00000009, // MakeDir + AFC_GET_INFO = 0x0000000a, // GetFileInfo + AFC_GET_DEVINFO = 0x0000000b, // GetDeviceInfo + // 0x0000000c // same as 5, but writes to temp file, then renames it. + AFC_FILE_OPEN = 0x0000000d, // FileRefOpen + AFC_FILE_HANDLE = 0x0000000e, // _unknownPacket + AFC_READ = 0x0000000f, // FileRefRead + AFC_WRITE = 0x00000010, // FileRefWrite + AFC_FILE_SEEK = 0x00000011, // FileRefSeek + AFC_FILE_TELL = 0x00000012, // FileRefTell + // 0x00000013 // _unknownPacket + AFC_FILE_CLOSE = 0x00000014, // FileRefClose + AFC_FILE_TRUNCATE = 0x00000015, // FileRefSetFileSize (ftruncate) + // 0x00000016 // SetFatalError + // 0x00000017 // SetConnectionOptions + AFC_RENAME = 0x00000018, // RenamePath + // 0x00000019 // SetFSBlockSize (0x800000) + // 0x0000001A // SetBlockSize (0x800000) + AFC_FILE_LOCK = 0x0000001B, // FileRefLock + AFC_MAKE_LINK = 0x0000001C // MakeLink }; uint32 iphone_afc_get_file_handle(iphone_afc_file_t file); + diff --git a/src/usbmux.c b/src/usbmux.c index c7ac7ef..d8e6b44 100644 --- a/src/usbmux.c +++ b/src/usbmux.c @@ -309,7 +309,8 @@ iphone_error_t iphone_mux_recv(iphone_umux_client_t client, char *data, uint32_t } // Since we were able to fill the data straight from our buffer, we can just return datalen. See 2a above. - return datalen; + *recv_bytes = datalen; + return IPHONE_E_SUCCESS; } else { memcpy(data, client->recv_buffer, client->r_len); free(client->recv_buffer); // don't need to deal with anymore, but... @@ -361,10 +362,10 @@ iphone_error_t iphone_mux_recv(iphone_umux_client_t client, char *data, uint32_t if ((bytes - 28) > datalen) { // Copy what we need into the data, buffer the rest because we can. memcpy(data + offset, buffer + 28, datalen); // data+offset: see #2b, above - complex = client->r_len + (bytes - 28) - datalen; + complex = client->r_len + ((bytes - 28) - datalen); client->recv_buffer = (char *) realloc(client->recv_buffer, (sizeof(char) * complex)); client->r_len = complex; - complex = client->r_len - (bytes - 28) - datalen; + complex = client->r_len - ((bytes - 28) - datalen); memcpy(client->recv_buffer + complex, buffer + 28 + datalen, (bytes - 28) - datalen); free(buffer); client->header->ocnt += bytes - 28; -- cgit v1.1-32-gdbae