X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fumbim.git;a=blobdiff_plain;f=cli.c;h=cb107b7178f4e0f2f46d6d87fb1bb66fb6e1640b;hp=d3c11d33d7008d60b1b36696b221b34bfdd7abae;hb=7e534da0158d1d4ebe27285d8c9e2f49502ece74;hpb=7741d88cdfd36f0c4380f660a9ad7109df76b432 diff --git a/cli.c b/cli.c index d3c11d3..cb107b7 100644 --- a/cli.c +++ b/cli.c @@ -152,7 +152,7 @@ mbim_subscriber_response(void *buffer, int len) if (le32toh(state->readyinfo) & MBIM_READY_INFO_FLAG_PROTECT_UNIQUE_ID) printf(" dont display subscriberID: 1\n"); for (nr = 0; nr < le32toh(state->telephonenumberscount); nr++) { - struct mbim_string *str = buffer + le32toh(state->telephonenumbers) + (nr * sizeof(struct mbim_string)); + struct mbim_string *str = (void *)&state->telephonenumbers + (nr * sizeof(struct mbim_string)); char *number = mbim_get_string(str, buffer); printf(" number: %s\n", number); } @@ -177,8 +177,8 @@ mbim_attach_response(void *buffer, int len) mbim_enum_string(mbim_nw_error_values, le32toh(ps->nwerror))); printf(" packetservicestate: %04X - %s\n", le32toh(ps->packetservicestate), mbim_enum_string(mbim_packet_service_state_values, le32toh(ps->packetservicestate))); - printf(" uplinkspeed: %"PRIu64"\n", le64toh(ps->uplinkspeed)); - printf(" downlinkspeed: %"PRIu64"\n", le64toh(ps->downlinkspeed)); + printf(" uplinkspeed: %"PRIu64"\n", (uint64_t) le64toh(ps->uplinkspeed)); + printf(" downlinkspeed: %"PRIu64"\n", (uint64_t) le64toh(ps->downlinkspeed)); if (MBIM_PACKET_SERVICE_STATE_ATTACHED == le32toh(ps->packetservicestate)) return 0; @@ -323,11 +323,11 @@ mbim_connect_request(void) c->authprotocol = htole32(MBIM_AUTH_PROTOCOL_CHAP); else if (!strcmp(_argv[1], "mschapv2")) c->authprotocol = htole32(MBIM_AUTH_PROTOCOL_MSCHAPV2); - else - return -1; - mbim_encode_string(&c->username, _argv[2]); - mbim_encode_string(&c->password, _argv[3]); + if (c->authprotocol) { + mbim_encode_string(&c->username, _argv[2]); + mbim_encode_string(&c->password, _argv[3]); + } } return mbim_send_command_msg(); }