Skip to content

Commit

Permalink
Use libusbmuxd_version() to construct client version string
Browse files Browse the repository at this point in the history
  • Loading branch information
nikias committed Dec 30, 2024
1 parent 3fdaed7 commit 6b09092
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/libusbmuxd.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ static char* stpncpy(char *dst, const char *src, size_t len)
#endif

#include <plist/plist.h>
#define PLIST_CLIENT_VERSION_STRING PACKAGE_STRING
#define PLIST_LIBUSBMUX_VERSION 3

static char *bundle_id = NULL;
Expand All @@ -116,6 +115,9 @@ static int libusbmuxd_debug = 0;
#ifndef PACKAGE
#define PACKAGE "libusbmuxd"
#endif
#ifndef PACKAGE_NAME
#define PACKAGE_NAME PACKAGE
#endif
#define LIBUSBMUXD_DEBUG(level, format, ...) if (level <= libusbmuxd_debug) fprintf(stderr, ("[" PACKAGE "] " format), __VA_ARGS__); fflush(stderr);
#define LIBUSBMUXD_ERROR(format, ...) LIBUSBMUXD_DEBUG(0, format, __VA_ARGS__)

Expand Down Expand Up @@ -722,6 +724,9 @@ static void get_prog_name()

static plist_t create_plist_message(const char* message_type)
{
char client_version[128];
snprintf(client_version, 128, PACKAGE_NAME " %s", libusbmuxd_version());
printf("%s\n", client_version);
if (!bundle_id) {
get_bundle_id();
}
Expand All @@ -732,7 +737,7 @@ static plist_t create_plist_message(const char* message_type)
if (bundle_id) {
plist_dict_set_item(plist, "BundleID", plist_new_string(bundle_id));
}
plist_dict_set_item(plist, "ClientVersionString", plist_new_string(PLIST_CLIENT_VERSION_STRING));
plist_dict_set_item(plist, "ClientVersionString", plist_new_string(client_version));
plist_dict_set_item(plist, "MessageType", plist_new_string(message_type));
if (prog_name) {
plist_dict_set_item(plist, "ProgName", plist_new_string(prog_name));
Expand Down

3 comments on commit 6b09092

@leodeve
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,
Is it possible to remove the line printf("%s\n", client_version);?
It displays the libusbmuxd version in the terminal.

Examples:

> idevice_id
libusbmuxd 2.1.0-14-g6b09092
00008020-000815E82E06002E (USB)
00008020-000815E82E06002E (Network)
> afcclient
libusbmuxd 2.1.0-14-g6b09092
libusbmuxd 2.1.0-14-g6b09092
libusbmuxd 2.1.0-14-g6b09092
libusbmuxd 2.1.0-14-g6b09092
libusbmuxd 2.1.0-14-g6b09092
libusbmuxd 2.1.0-14-g6b09092
libusbmuxd 2.1.0-14-g6b09092
libusbmuxd 2.1.0-14-g6b09092
afc:/ >

@nikias
Copy link
Member Author

@nikias nikias commented on 6b09092 Dec 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Damn, didn't see that 🤦‍♂️

@nikias
Copy link
Member Author

@nikias nikias commented on 6b09092 Jan 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed with 6ddeccc

Please sign in to comment.