summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--iphone.c45
-rw-r--r--libusbmuxd.c6
-rw-r--r--main.c6
-rw-r--r--sock_stuff.c2
4 files changed, 13 insertions, 46 deletions
diff --git a/iphone.c b/iphone.c
index 21b8281..c759899 100644
--- a/iphone.c
+++ b/iphone.c
@@ -314,7 +314,7 @@ iphone_error_t iphone_get_specific_device(int bus_n, int dev_n, iphone_device_t
// Set the device configuration
for (bus = usb_get_busses(); bus; bus = bus->next)
- if (bus->location == bus_n)
+ //if (bus->location == bus_n)
for (dev = bus->devices; dev != NULL; dev = dev->next)
if (dev->devnum == dev_n) {
phone->__device = dev;
@@ -374,41 +374,6 @@ iphone_error_t iphone_get_specific_device(int bus_n, int dev_n, iphone_device_t
return IPHONE_E_UNKNOWN_ERROR; // if it got to this point it's gotta be bad
}
-
-/**
- * Scans all USB busses and devices for a known AFC-compatible device and
- * returns a handle to the first such device it finds. Known devices include
- * those with vendor ID 0x05ac and product ID between 0x1290 and 0x1293
- * inclusive.
- *
- * This function is convenient, but on systems where higher-level abstractions
- * (such as HAL) are available it may be preferable to use
- * iphone_get_specific_device instead, because it can deal with multiple
- * connected devices as well as devices not known to libiphone.
- *
- * @param device Upon calling this function, a pointer to a location of type
- * iphone_device_t, which must have the value NULL. On return, this location
- * will be filled with a handle to the device.
- * @return IPHONE_E_SUCCESS if ok, otherwise an error code.
- */
-iphone_error_t iphone_get_device(iphone_device_t * device)
-{
- struct usb_bus *bus;
- struct usb_device *dev;
-
- usb_init();
- usb_find_busses();
- usb_find_devices();
-
- for (bus = usb_get_busses(); bus != NULL; bus = bus->next)
- for (dev = bus->devices; dev != NULL; dev = dev->next)
- if (dev->descriptor.idVendor == 0x05ac
- && dev->descriptor.idProduct >= 0x1290 && dev->descriptor.idProduct <= 0x1293)
- return iphone_get_specific_device(bus->location, dev->devnum, device);
-
- return IPHONE_E_NO_DEVICE;
-}
-
/** Cleans up an iPhone structure, then frees the structure itself.
* This is a library-level function; deals directly with the iPhone to tear
* down relations, but otherwise is mostly internal.
@@ -845,7 +810,7 @@ iphone_error_t iphone_mux_send(iphone_umux_client_t client, const char *data, ui
ntoh_header(client->header);
// update counts ONLY if the send succeeded.
- if (sendresult == blocksize) {
+ if ((uint32_t)sendresult == blocksize) {
// Re-calculate scnt
client->header->scnt += datalen;
client->wr_window -= blocksize;
@@ -863,7 +828,7 @@ iphone_error_t iphone_mux_send(iphone_umux_client_t client, const char *data, ui
else if (sendresult < 0) {
return IPHONE_E_UNKNOWN_ERROR;
}
- else if (sendresult == blocksize) {
+ else if ((uint32_t)sendresult == blocksize) {
// actual number of data bytes sent.
*sent_bytes = sendresult - HEADERLEN;
return IPHONE_E_SUCCESS;
@@ -1097,7 +1062,7 @@ int iphone_mux_pullbulk(iphone_device_t phone)
// now that we have a header, check if there is sufficient data
// to construct a full packet, including its data
uint32_t packetlen = ntohl(header->length);
- if (phone->usbReceive.leftover < packetlen) {
+ if ((uint32_t)phone->usbReceive.leftover < packetlen) {
fprintf(stderr, "%s: not enough data to construct a full packet\n", __func__);
break;
}
@@ -1205,7 +1170,7 @@ iphone_error_t iphone_mux_recv_timeout(iphone_umux_client_t client, char *data,
*recv_bytes = 0;
if (client->recv_buffer != NULL && client->r_len > 0) {
uint32_t foolen = datalen;
- if (foolen > client->r_len) foolen = client->r_len;
+ if ((int)foolen > client->r_len) foolen = client->r_len;
memcpy(data, client->recv_buffer, foolen);
*recv_bytes = foolen;
diff --git a/libusbmuxd.c b/libusbmuxd.c
index c12a7c0..edd585c 100644
--- a/libusbmuxd.c
+++ b/libusbmuxd.c
@@ -28,7 +28,7 @@ static int usbmuxd_get_result(int sfd, uint32_t tag, uint32_t *result)
return -errno;
} else {
if ((recv_len == sizeof(res))
- && (res.header.length == recv_len)
+ && (res.header.length == (uint32_t)recv_len)
&& (res.header.reserved == 0)
&& (res.header.type == USBMUXD_RESULT)
) {
@@ -68,7 +68,7 @@ int usbmuxd_scan(usbmuxd_scan_result **available_devices)
s_req.header.tag = 2;
// send scan request packet
- if (send_buf(sfd, &s_req, s_req.header.length) == s_req.header.length) {
+ if (send_buf(sfd, &s_req, s_req.header.length) == (int)s_req.header.length) {
res = -1;
// get response
if (usbmuxd_get_result(sfd, s_req.header.tag, &res) && (res == 0)) {
@@ -99,7 +99,7 @@ int usbmuxd_scan(usbmuxd_scan_result **available_devices)
if (recv_len <= 0) {
fprintf(stderr, "%s: Error when receiving device info record\n", __func__);
break;
- } else if (recv_len < pktlen) {
+ } else if ((uint32_t)recv_len < pktlen) {
fprintf(stderr, "%s: received less data than specified in header!\n", __func__);
} else {
//fprintf(stderr, "%s: got device record with id %d, UUID=%s\n", __func__, dev_info_pkt.device_info.device_id, dev_info_pkt.device_info.serial_number);
diff --git a/main.c b/main.c
index 8fb36ef..c9bf884 100644
--- a/main.c
+++ b/main.c
@@ -95,7 +95,7 @@ static pthread_mutex_t usb_mutex = PTHREAD_MUTEX_INITIALIZER;
* @param prio The logging priority.
* @param format The message to be printed.
*/
-static void logmsg(int prio, char *format, ...)
+static void logmsg(int prio, const char *format, ...)
{
va_list args;
va_start(args, format);
@@ -179,7 +179,7 @@ static int usbmuxd_get_request(int fd, void **data, size_t len)
uint32_t pktlen;
int recv_len;
- if (peek_buf(fd, &pktlen, sizeof(pktlen)) < sizeof(pktlen)) {
+ if (peek_buf(fd, &pktlen, sizeof(pktlen)) < (int)sizeof(pktlen)) {
return -errno;
}
@@ -193,7 +193,7 @@ static int usbmuxd_get_request(int fd, void **data, size_t len)
}
recv_len = recv_buf(fd, *data, pktlen);
- if ((recv_len > 0) && (recv_len < pktlen)) {
+ if ((recv_len > 0) && ((uint32_t)recv_len < pktlen)) {
if (verbose >= 2) logmsg(LOG_WARNING, "%s: Uh-oh, we got less than the packet's size, %d instead of %d...", __func__, recv_len, pktlen);
}
diff --git a/sock_stuff.c b/sock_stuff.c
index 8a06135..43fdf0e 100644
--- a/sock_stuff.c
+++ b/sock_stuff.c
@@ -224,6 +224,8 @@ int check_fd(int fd, fd_mode fdm, unsigned int timeout)
case FD_EXCEPT:
sret = select(fd+1,NULL,NULL,&fds,&to);
break;
+ default:
+ return -1;
}
if (sret < 0) {