Skip to content

Commit

Permalink
add direct mode info
Browse files Browse the repository at this point in the history
This will output the card SSID and password for connecting in direct mode.

This is very lightly tested.

Thanks again to Makesh for the tips on finding these!
  • Loading branch information
hansendc committed Oct 8, 2017
1 parent f9857ee commit b9cee8c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 7 deletions.
2 changes: 2 additions & 0 deletions eyefi-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ enum card_info_subcommand {
UNKNOWN_15 = 15, // always returns {0x01, 0x1d} as far as I've seen
TRANSFER_MODE = 17,
ENDLESS = 27, // 0x1b
DIRECT_MODE_SSID = 0x22, // 0 == "direct mode off"
DIRECT_MODE_PASS = 0x23, // set to 60 when direct mode off
DIRECT_WAIT_FOR_CONNECTION = 0x24, // 0 == "direct mode off"
DIRECT_WAIT_AFTER_TRANSFER = 0x25, // set to 60 when direct mode off
UPLOAD_KEY = 0xfd, //
Expand Down
41 changes: 34 additions & 7 deletions eyefi-unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,25 @@ void print_configured_nets(void)
}
}

void print_direct_mode_info(void)
{
struct pascal_string *direct_mode_ssid;
struct pascal_string *direct_mode_pass;
debug_printf(2, "%s()\n", __func__);

card_info_cmd(DIRECT_MODE_SSID);
direct_mode_ssid = eyefi_response();
printf("Direct mode SSID: '");
print_pascal_string(direct_mode_ssid);
printf("'\n");

card_info_cmd(DIRECT_MODE_PASS);
direct_mode_pass = eyefi_response();
printf("Direct mode password: '");
print_pascal_string(direct_mode_pass);
printf("'\n");
}

int try_connection_to(char *essid, char *ascii_password)
{
int i;
Expand Down Expand Up @@ -349,6 +368,7 @@ void usage(void)
printf(" --endless fetch endless storage information\n");
printf(" --endless=<NN> set the endless storage percentage\n");
printf(" --endless=[enable/disable]\n");
printf(" --direct-mode-info\n");
exit(4);
}

Expand Down Expand Up @@ -428,15 +448,17 @@ int main(int argc, char *argv[])
static int wifi_radio_on = 0;
static int endless = 0;
static int eject = 0;
static int direct_mode_info = 0;
static int debug_level_opt = 0;
static struct option long_options[] = {
{"force", 0, &force, 1},
{"help", 0, NULL, 'h'},
{"transfer-mode", 2, &transfer_mode, 1},
{"wifi-radio", 2, &wifi_radio_on, 1},
{"endless", 2, &endless, 1},
{"eject", 2, &eject, 1},
{"debug", 2, &debug_level_opt, 'd'},
{"force", 0, &force, 1},
{"help", 0, NULL, 'h'},
{"transfer-mode", 2, &transfer_mode, 1},
{"wifi-radio", 2, &wifi_radio_on, 1},
{"endless", 2, &endless, 1},
{"eject", 2, &eject, 1},
{"debug", 2, &debug_level_opt, 'd'},
{"direct-mode-info", 2, &direct_mode_info, 1},
{0, 0, 0, 0}
};

Expand Down Expand Up @@ -486,6 +508,11 @@ int main(int argc, char *argv[])
endless = 0;
continue;
}
if (direct_mode_info) {
print_direct_mode_info();
direct_mode_info = 0;
continue;
}
switch (c) {
case 0:
// was a long argument
Expand Down

0 comments on commit b9cee8c

Please sign in to comment.