+static int scan_kecheng(struct sr_usb_dev_inst *usb, char **model)
+{
+ struct drv_context *drvc;
+ int len, ret;
+ unsigned char cmd, buf[32];
+
+ drvc = di->priv;
+ if (sr_usb_open(drvc->sr_ctx->libusb_ctx, usb) != SR_OK)
+ return SR_ERR;
+
+ cmd = CMD_IDENTIFY;
+ ret = libusb_bulk_transfer(usb->devhdl, EP_OUT, &cmd, 1, &len, 5);
+ if (ret != 0) {
+ libusb_close(usb->devhdl);
+ sr_dbg("Failed to send Identify command: %s", libusb_error_name(ret));
+ return SR_ERR;
+ }
+
+ ret = libusb_bulk_transfer(usb->devhdl, EP_IN, buf, 32, &len, 10);
+ if (ret != 0) {
+ libusb_close(usb->devhdl);
+ sr_dbg("Failed to receive response: %s", libusb_error_name(ret));
+ return SR_ERR;
+ }
+
+ libusb_close(usb->devhdl);
+ usb->devhdl = NULL;
+
+ if (len < 2 || buf[0] != (CMD_IDENTIFY | 0x80) || buf[1] > 30) {
+ sr_dbg("Invalid response to Identify command");
+ return SR_ERR;
+ }
+
+ buf[buf[1] + 2] = '\x0';
+ *model = g_strndup((const gchar *)buf + 2, 30);
+ //g_strstrip(*model);
+
+ return SR_OK;
+}
+