qmi_request_wait(qmi, &req);
}
+int qmi_service_release_client_id(struct qmi_dev *qmi, QmiService svc)
+{
+ int idx = qmi_get_service_idx(svc);
+ qmi->service_keep_cid &= ~(1 << idx);
+ return 0;
+}
+
static void qmi_close_all_services(struct qmi_dev *qmi)
{
uint32_t connected = qmi->service_connected;
static const struct option uqmi_getopt[] = {
__uqmi_commands,
{ "device", required_argument, NULL, 'd' },
- { "keep-client-id", required_argument, NULL, 'K' },
+ { "keep-client-id", required_argument, NULL, 'k' },
+ { "release-client-id", required_argument, NULL, 'r' },
{ NULL, 0, NULL, 0 }
};
#undef __uqmi_command
" --device=NAME, -d NAME: Set device name to NAME (required)\n"
" --keep-client-id <name>: Keep Client ID for service <name>\n"
" (implies --keep-client-id)\n"
+ " --release-client-id <name>: Release Client ID after exiting\n"
"\n"
"Services: dms, nas, pds, wds, wms\n"
"\n"
qmi_service_get_client_id(qmi, svc);
}
+static void release_client_id(struct qmi_dev *qmi, const char *optarg)
+{
+ QmiService svc = qmi_service_get_by_name(optarg);
+ if (svc < 0) {
+ fprintf(stderr, "Invalid service %s\n", optarg);
+ exit(1);
+ }
+ qmi_service_release_client_id(qmi, svc);
+}
+
static void handle_exit_signal(int signal)
{
cancel_all_requests = true;
}
switch(ch) {
+ case 'r':
+ release_client_id(&dev, optarg);
+ break;
case 'k':
keep_client_id(&dev, optarg);
break;
int qmi_service_connect(struct qmi_dev *qmi, QmiService svc, int client_id);
int qmi_service_get_client_id(struct qmi_dev *qmi, QmiService svc);
+int qmi_service_release_client_id(struct qmi_dev *qmi, QmiService svc);
QmiService qmi_service_get_by_name(const char *str);
const char *qmi_get_error_str(int code);