qmicli,wds: allow specifying network data handle in hex

E.g. to give the global packet data handle, which is 0xFFFFFFFF.
This commit is contained in:
Aleksander Morgado 2015-10-10 12:44:00 +02:00
parent 47d83f020a
commit 120306f8b6
1 changed files with 6 additions and 4 deletions

View File

@ -1282,16 +1282,18 @@ qmicli_wds_run (QmiDevice *device,
if (stop_network_str) {
gulong packet_data_handle;
packet_data_handle = strtoul (stop_network_str, NULL, 10);
if (!packet_data_handle ||
packet_data_handle > G_MAXUINT32) {
if (g_str_has_prefix (stop_network_str, "0x"))
packet_data_handle = strtoul (stop_network_str, NULL, 16);
else
packet_data_handle = strtoul (stop_network_str, NULL, 10);
if (!packet_data_handle || packet_data_handle > G_MAXUINT32) {
g_printerr ("error: invalid packet data handle given '%s'\n",
stop_network_str);
operation_shutdown (FALSE);
return;
}
g_debug ("Asynchronously stopping network...");
g_debug ("Asynchronously stopping network (%lu)...", packet_data_handle);
internal_stop_network (ctx->cancellable, (guint32)packet_data_handle);
return;
}