+ data->need_response = true;
+ send_messages(data, msgs, ARRAY_SIZE(msgs));
+}
+
+static void handle_mbim(struct usbdev_data *data, struct blob_attr **tb)
+{
+ int j;
+
+ if (data->desc.bNumConfigurations < 2)
+ return;
+
+ for (j = 0; j < data->desc.bNumConfigurations; j++) {
+ struct libusb_config_descriptor *config;
+ int i;
+
+ libusb_get_config_descriptor(data->dev, j, &config);
+
+ for (i = 0; i < config->bNumInterfaces; i++) {
+ if (config->interface[i].altsetting[0].bInterfaceClass == 2) {
+ if (config->interface[i].altsetting[0].bInterfaceSubClass == 0x0e) {
+ struct libusb_config_descriptor *active;
+ int count = 5;
+
+ libusb_get_active_config_descriptor(data->dev, &active);
+ if (active->bConfigurationValue == config->bConfigurationValue)
+ return;
+ while ((libusb_set_configuration(data->devh, config->bConfigurationValue) < 0) && --count)
+ libusb_detach_kernel_driver(data->devh, active->interface[0].altsetting[0].bInterfaceNumber);
+
+ libusb_free_config_descriptor(config);
+ return;
+ }
+ }
+ }
+
+ libusb_free_config_descriptor(config);
+ }
+}
+
+static void handle_quanta(struct usbdev_data *data, struct blob_attr **tb)
+{
+ int type = LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_IN;
+
+ detach_driver(data);
+ send_control_packet(data, type, 0xff, 0, 0, 8);
+}
+
+static void handle_blackberry(struct usbdev_data *data, struct blob_attr **tb)
+{
+ int type = LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_IN;
+
+ detach_driver(data);
+ send_control_packet(data, type, 0xb1, 0x0000, 0, 8);
+ send_control_packet(data, type, 0xa9, 0x000e, 0, 8);
+}
+
+static void handle_pantech(struct usbdev_data *data, struct blob_attr **tb)
+{
+ int type = LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_OUT;
+ int val = 1;
+
+ if (tb[DATA_MODEVAL])
+ val = blobmsg_get_u32(tb[DATA_MODEVAL]);
+ detach_driver(data);
+ if (val > 1)
+ send_control_packet(data, type, 0x70, val, 0, 0);
+}
+
+static void set_alt_setting(struct usbdev_data *data, int setting)
+{
+ if (libusb_claim_interface(data->devh, data->interface))
+ return;
+
+ libusb_set_interface_alt_setting(data->devh, data->interface, setting);
+ libusb_release_interface(data->devh, data->interface);