2 * uqmi -- tiny QMI support implementation
4 * Copyright (C) 2014-2015 Felix Fietkau <nbd@openwrt.org>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301 USA.
27 #include <libubox/uloop.h>
28 #include <libubox/ustream.h>
30 #include "qmi-message.h"
33 void dump_packet(const char *prefix
, void *ptr
, int len
);
35 static inline void dump_packet(const char *prefix
, void *ptr
, int len
)
40 #define __qmi_services \
41 __qmi_service(QMI_SERVICE_WDS), \
42 __qmi_service(QMI_SERVICE_DMS), \
43 __qmi_service(QMI_SERVICE_NAS), \
44 __qmi_service(QMI_SERVICE_QOS), \
45 __qmi_service(QMI_SERVICE_WMS), \
46 __qmi_service(QMI_SERVICE_PDS), \
47 __qmi_service(QMI_SERVICE_AUTH), \
48 __qmi_service(QMI_SERVICE_AT), \
49 __qmi_service(QMI_SERVICE_VOICE), \
50 __qmi_service(QMI_SERVICE_CAT2), \
51 __qmi_service(QMI_SERVICE_UIM), \
52 __qmi_service(QMI_SERVICE_PBM), \
53 __qmi_service(QMI_SERVICE_LOC), \
54 __qmi_service(QMI_SERVICE_SAR), \
55 __qmi_service(QMI_SERVICE_RMTFS), \
56 __qmi_service(QMI_SERVICE_CAT), \
57 __qmi_service(QMI_SERVICE_RMS), \
58 __qmi_service(QMI_SERVICE_OMA), \
59 __qmi_service(QMI_SERVICE_WDA)
61 #define __qmi_service(_n) __##_n
72 typedef void (*request_cb
)(struct qmi_dev
*qmi
, struct qmi_request
*req
, struct qmi_msg
*msg
);
83 } service_data
[__QMI_SERVICE_LAST
];
85 uint32_t service_connected
;
86 uint32_t service_keep_cid
;
87 uint32_t service_release_cid
;
96 struct list_head list
;
108 extern bool cancel_all_requests
;
109 int qmi_device_open(struct qmi_dev
*qmi
, const char *path
);
110 void qmi_device_close(struct qmi_dev
*qmi
);
112 int qmi_request_start(struct qmi_dev
*qmi
, struct qmi_request
*req
, request_cb cb
);
113 void qmi_request_cancel(struct qmi_dev
*qmi
, struct qmi_request
*req
);
114 int qmi_request_wait(struct qmi_dev
*qmi
, struct qmi_request
*req
);
116 static inline bool qmi_request_pending(struct qmi_request
*req
)
121 int qmi_service_connect(struct qmi_dev
*qmi
, QmiService svc
, int client_id
);
122 int qmi_service_get_client_id(struct qmi_dev
*qmi
, QmiService svc
);
123 int qmi_service_release_client_id(struct qmi_dev
*qmi
, QmiService svc
);
124 QmiService
qmi_service_get_by_name(const char *str
);
125 const char *qmi_get_error_str(int code
);