Skip to content

Commit

Permalink
[server] add print usage & support disabling usbmuxd's subscribe to s…
Browse files Browse the repository at this point in the history
…upport netmuxd
  • Loading branch information
NyaMisty committed Apr 16, 2022
1 parent 8284aae commit 3ae0255
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 9 deletions.
7 changes: 6 additions & 1 deletion src/AltServerApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2062,7 +2062,12 @@ fs::path AltServerApp::developerDisksDirectoryPath() const
void AltServerApp::Start(HWND windowHandle, HINSTANCE instanceHandle)
{
ConnectionManager::instance()->Start();
DeviceManager::instance()->Start();

// DeviceManager only needs
const char *isNoUSB = getenv("ALTSERVER_NO_SUBSCRIBE");
if (!isNoUSB) {
DeviceManager::instance()->Start();
}
}

void AltServerApp::Stop()
Expand Down
44 changes: 36 additions & 8 deletions src/AltServerMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,32 @@ int setupHeartbeatTimer() {
#define BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED
#include <boost/stacktrace.hpp>

#include <usbmuxd.h>

void print_help() {
printf("Usage: AltServer-Linux options [ ipa-file ]\n");
printf(
" -h --help Display this usage information.\n"
" -u --udid UDID Device's UDID, only needed when installing IPA.\n"
" -a --appleID AppleID Apple ID to sign the ipa, only needed when installing IPA.\n"
" -p --password passwd Password of Apple ID, only needed when installing IPA.\n"
" -d --debug Print debug output, can be used several times to increase debug level.\n"
"\n"
"The following environment var can be set for some special situation:\n"
" - ALTSERVER_ANISETTE_SERVER: Set to custom anisette server URL\n"
" if not set, the default one: https://armconverter.com/anisette/irGb3Quww8zrhgqnzmrx, is used\n"
" - ALTSERVER_NO_SUBSCRIBE: Please enable this for netmuxd / usbmuxd2, because they do not correctly usbmuxd_listen interfaces\n"
);
}

int main(int argc, char *argv[]) {
static struct option long_options[] =
{
{"udid", required_argument, 0, 'u'},
{"ipaddr", required_argument, 0, 'i'},
{"appleID", required_argument, 0, 'a'},
{"password", required_argument, 0, 'p'},
{"pairData", required_argument, 0, 'P'},
//{"ipaddr", required_argument, 0, 'i'},
//{"pairData", required_argument, 0, 'P'},
{"debug", no_argument, 0, 'd'},
{0, 0, 0, 0}
};
Expand All @@ -129,7 +147,7 @@ int main(int argc, char *argv[]) {
char *pairDataFile;

char *ipaPath = NULL;
bool debugLog = false;
int debugLogLevel = 0;

while (1) {
int this_option_optind = optind ? optind : 1;
Expand All @@ -155,13 +173,23 @@ int main(int argc, char *argv[]) {
pairDataFile = optarg;
break;
case 'd':
debugLog = true;
//debugLog = true;
debugLogLevel++;
break;
default:
case 'h':
print_help();
exit(0);
default:
printf("?? getopt returned character code 0%o ??\n", c);
print_help();
exit(1);
}
}

if (argc == 1) {
printf("No argument supplied, if you want for help, please use -h or --help\n");
}

bool installApp = true;
if (optind == argc) {
printf("Not supplying ipa, running in server mode!\n");
Expand All @@ -182,10 +210,10 @@ int main(int argc, char *argv[]) {

srand(time(NULL));

if (debugLog) {
idevice_set_debug_level(1);
if (debugLogLevel) {
idevice_set_debug_level(debugLogLevel);
libusbmuxd_set_debug_level(debugLogLevel - 2);
}


#ifndef NO_USBMUXD_STUB
setupPairInfo(udid, ipaddr, pairDataFile);
Expand Down

0 comments on commit 3ae0255

Please sign in to comment.