@@ -1038,7 +1038,6 @@ void qmi_result_print_tlvs(struct qmi_result *result)
}
}
-
static const void *tlv_get(const void *data, uint16_t size,
uint8_t type, uint16_t *length)
{
@@ -1122,6 +1121,35 @@ static void discover_data_free(gpointer user_data)
l_free(data);
}
+static void qmi_device_sync_callback(uint16_t message, uint16_t length,
+ const void *buffer, void *user_data)
+{
+ struct discover_data *data = user_data;
+
+ if (data->func)
+ data->func(data->user_data);
+
+ __qmi_device_discovery_complete(data->device, &data->super);
+}
+
+/* sync will release all previous clients */
+static bool qmi_device_sync(struct qmi_device *device,
+ struct discover_data *data)
+{
+ struct qmi_request *req;
+
+ __debug_device(device, "Sending sync to reset QMI");
+
+ req = __request_alloc(QMI_SERVICE_CONTROL, 0x00,
+ QMI_CTL_SYNC, NULL, 0,
+ qmi_device_sync_callback, data);
+
+ __request_submit(device, req);
+
+ return true;
+}
+
+
static void discover_callback(uint16_t message, uint16_t length,
const void *buffer, void *user_data)
{
@@ -1193,6 +1221,13 @@ done:
device->version_list = list;
device->version_count = count;
+ /* if the device support the QMI call SYNC over the CTL interface */
+ if ((device->control_major == 1 && device->control_minor >= 5) ||
+ device->control_major > 1) {
+ qmi_device_sync(data->device, data);
+ return;
+ }
+
if (data->func)
data->func(data->user_data);
@@ -1352,58 +1387,6 @@ bool qmi_device_shutdown(struct qmi_device *device, qmi_shutdown_func_t func,
return true;
}
-struct sync_data {
- qmi_sync_func_t func;
- void *user_data;
-};
-
-static void qmi_device_sync_callback(uint16_t message, uint16_t length,
- const void *buffer, void *user_data)
-{
- struct sync_data *data = user_data;
-
- if (data->func)
- data->func(data->user_data);
-
- l_free(data);
-}
-
-/* sync will release all previous clients */
-bool qmi_device_sync(struct qmi_device *device,
- qmi_sync_func_t func, void *user_data)
-{
- struct qmi_request *req;
- struct sync_data *func_data;
-
- if (!device)
- return false;
-
- __debug_device(device, "Sending sync to reset QMI");
-
- func_data = l_new(struct sync_data, 1);
- func_data->func = func;
- func_data->user_data = user_data;
-
- req = __request_alloc(QMI_SERVICE_CONTROL, 0x00,
- QMI_CTL_SYNC,
- NULL, 0,
- qmi_device_sync_callback, func_data);
-
- __request_submit(device, req);
-
- return true;
-}
-
-/* if the device support the QMI call SYNC over the CTL interface */
-bool qmi_device_is_sync_supported(struct qmi_device *device)
-{
- if (device == NULL)
- return false;
-
- return (device->control_major > 1 ||
- (device->control_major == 1 && device->control_minor >= 5));
-}
-
static bool get_device_file_name(struct qmi_device *device,
char *file_name, int size)
{
@@ -78,7 +78,6 @@ typedef void (*qmi_destroy_func_t)(void *user_data);
struct qmi_device;
typedef void (*qmi_debug_func_t)(const char *str, void *user_data);
-typedef void (*qmi_sync_func_t)(void *user_data);
typedef void (*qmi_shutdown_func_t)(void *user_data);
typedef void (*qmi_discover_func_t)(void *user_data);
@@ -101,10 +100,6 @@ bool qmi_device_has_service(struct qmi_device *device, uint16_t type);
bool qmi_device_get_service_version(struct qmi_device *device, uint16_t type,
uint16_t *major, uint16_t *minor);
-bool qmi_device_sync(struct qmi_device *device,
- qmi_sync_func_t func, void *user_data);
-bool qmi_device_is_sync_supported(struct qmi_device *device);
-
enum qmi_device_expected_data_format qmi_device_get_expected_data_format(
struct qmi_device *device);
bool qmi_device_set_expected_data_format(struct qmi_device *device,
@@ -364,13 +364,12 @@ error:
shutdown_device(modem);
}
-static void create_shared_dms(void *user_data)
+static void create_shared_dms(struct ofono_modem *modem)
{
- struct ofono_modem *modem = user_data;
struct gobi_data *data = ofono_modem_get_data(modem);
qmi_service_create_shared(data->device, QMI_SERVICE_DMS,
- create_dms_cb, modem, NULL);
+ create_dms_cb, modem, NULL);
}
static void discover_cb(void *user_data)
@@ -417,10 +416,7 @@ static void discover_cb(void *user_data)
return;
}
- if (qmi_device_is_sync_supported(data->device))
- qmi_device_sync(data->device, create_shared_dms, modem);
- else
- create_shared_dms(modem);
+ create_shared_dms(modem);
}
static int gobi_enable(struct ofono_modem *modem)