@@ -110,14 +110,32 @@ int setupHeartbeatTimer() {
110110#define BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED
111111#include < boost/stacktrace.hpp>
112112
113+ #include < usbmuxd.h>
114+
115+ void print_help () {
116+ printf (" Usage: AltServer-Linux options [ ipa-file ]\n " );
117+ printf (
118+ " -h --help Display this usage information.\n "
119+ " -u --udid UDID Device's UDID, only needed when installing IPA.\n "
120+ " -a --appleID AppleID Apple ID to sign the ipa, only needed when installing IPA.\n "
121+ " -p --password passwd Password of Apple ID, only needed when installing IPA.\n "
122+ " -d --debug Print debug output, can be used several times to increase debug level.\n "
123+ " \n "
124+ " The following environment var can be set for some special situation:\n "
125+ " - ALTSERVER_ANISETTE_SERVER: Set to custom anisette server URL\n "
126+ " if not set, the default one: https://armconverter.com/anisette/irGb3Quww8zrhgqnzmrx, is used\n "
127+ " - ALTSERVER_NO_SUBSCRIBE: Please enable this for netmuxd / usbmuxd2, because they do not correctly usbmuxd_listen interfaces\n "
128+ );
129+ }
130+
113131int main (int argc, char *argv[]) {
114132 static struct option long_options[] =
115133 {
116134 {" udid" , required_argument, 0 , ' u' },
117- {" ipaddr" , required_argument, 0 , ' i' },
118135 {" appleID" , required_argument, 0 , ' a' },
119136 {" password" , required_argument, 0 , ' p' },
120- {" pairData" , required_argument, 0 , ' P' },
137+ // {"ipaddr", required_argument, 0, 'i'},
138+ // {"pairData", required_argument, 0, 'P'},
121139 {" debug" , no_argument, 0 , ' d' },
122140 {0 , 0 , 0 , 0 }
123141 };
@@ -129,7 +147,7 @@ int main(int argc, char *argv[]) {
129147 char *pairDataFile;
130148
131149 char *ipaPath = NULL ;
132- bool debugLog = false ;
150+ int debugLogLevel = 0 ;
133151
134152 while (1 ) {
135153 int this_option_optind = optind ? optind : 1 ;
@@ -155,13 +173,23 @@ int main(int argc, char *argv[]) {
155173 pairDataFile = optarg;
156174 break ;
157175 case ' d' :
158- debugLog = true ;
176+ // debugLog = true;
177+ debugLogLevel++;
159178 break ;
160- default :
179+ case ' h' :
180+ print_help ();
181+ exit (0 );
182+ default :
161183 printf (" ?? getopt returned character code 0%o ??\n " , c);
184+ print_help ();
185+ exit (1 );
162186 }
163187 }
164188
189+ if (argc == 1 ) {
190+ printf (" No argument supplied, if you want for help, please use -h or --help\n " );
191+ }
192+
165193 bool installApp = true ;
166194 if (optind == argc) {
167195 printf (" Not supplying ipa, running in server mode!\n " );
@@ -182,10 +210,10 @@ int main(int argc, char *argv[]) {
182210
183211 srand (time (NULL ));
184212
185- if (debugLog) {
186- idevice_set_debug_level (1 );
213+ if (debugLogLevel) {
214+ idevice_set_debug_level (debugLogLevel);
215+ libusbmuxd_set_debug_level (debugLogLevel - 2 );
187216 }
188-
189217
190218#ifndef NO_USBMUXD_STUB
191219 setupPairInfo (udid, ipaddr, pairDataFile);
0 commit comments