mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-01-23 13:42:55 +08:00
The store confirm times, and surport the old version hardware
This commit is contained in:
parent
b0b91469b8
commit
7053af0a8f
@ -2007,6 +2007,8 @@ namespace pv
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case DSV_MSG_SAVE_COMPLETE:
|
case DSV_MSG_SAVE_COMPLETE:
|
||||||
|
_session->clear_store_confirm_flag();
|
||||||
|
|
||||||
if (_is_auto_switch_device)
|
if (_is_auto_switch_device)
|
||||||
{
|
{
|
||||||
_is_auto_switch_device = false;
|
_is_auto_switch_device = false;
|
||||||
|
@ -199,6 +199,10 @@ public:
|
|||||||
bool is_first_store_confirm();
|
bool is_first_store_confirm();
|
||||||
bool get_capture_status(bool &triggered, int &progress);
|
bool get_capture_status(bool &triggered, int &progress);
|
||||||
|
|
||||||
|
inline void clear_store_confirm_flag(){
|
||||||
|
_confirm_store_time_id = _work_time_id;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<view::Signal*>& get_signals();
|
std::vector<view::Signal*>& get_signals();
|
||||||
|
|
||||||
bool add_decoder(srd_decoder *const dec, bool silent, DecoderStatus *dstatus,
|
bool add_decoder(srd_decoder *const dec, bool silent, DecoderStatus *dstatus,
|
||||||
|
@ -190,7 +190,7 @@ static GSList *scan(GSList *options)
|
|||||||
struct libusb_device_descriptor des;
|
struct libusb_device_descriptor des;
|
||||||
libusb_device **devlist;
|
libusb_device **devlist;
|
||||||
libusb_device *device_handle = NULL;
|
libusb_device *device_handle = NULL;
|
||||||
int devcnt, ret, i, j;
|
int ret, i, j;
|
||||||
const char *conn;
|
const char *conn;
|
||||||
enum libusb_speed usb_speed;
|
enum libusb_speed usb_speed;
|
||||||
struct sr_usb_dev_inst *usb_dev_info;
|
struct sr_usb_dev_inst *usb_dev_info;
|
||||||
@ -316,16 +316,21 @@ static GSList *scan(GSList *options)
|
|||||||
address = libusb_get_device_address(device_handle);
|
address = libusb_get_device_address(device_handle);
|
||||||
sr_info("Found a new device,handle:%p", device_handle);
|
sr_info("Found a new device,handle:%p", device_handle);
|
||||||
|
|
||||||
|
if (dsl_check_conf_profile(device_handle)) {
|
||||||
|
/* Already has the firmware, so fix the new address. */
|
||||||
|
sr_info("Found a DSCope device,name:\"%s\",handle:%p", prof->model, device_handle);
|
||||||
|
|
||||||
devc = DSCope_dev_new(prof);
|
devc = DSCope_dev_new(prof);
|
||||||
if (!devc)
|
if (devc == NULL){
|
||||||
return NULL;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
sdi = sr_dev_inst_new(channel_modes[devc->ch_mode].mode, SR_ST_INITIALIZING,
|
sdi = sr_dev_inst_new(channel_modes[devc->ch_mode].mode, SR_ST_INITIALIZING,
|
||||||
prof->vendor, prof->model, prof->model_version);
|
prof->vendor, prof->model, prof->model_version);
|
||||||
|
|
||||||
if (!sdi) {
|
if (sdi == NULL) {
|
||||||
g_free(devc);
|
free(devc);
|
||||||
return NULL;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
@ -337,46 +342,37 @@ static GSList *scan(GSList *options)
|
|||||||
if (dsl_setup_probes(sdi, channel_modes[devc->ch_mode].num) != SR_OK){
|
if (dsl_setup_probes(sdi, channel_modes[devc->ch_mode].num) != SR_OK){
|
||||||
sr_err("dsl_setup_probes() error");
|
sr_err("dsl_setup_probes() error");
|
||||||
dev_destroy(sdi);
|
dev_destroy(sdi);
|
||||||
return NULL;
|
break;
|
||||||
}
|
}
|
||||||
devices = g_slist_append(devices, sdi);
|
|
||||||
num++;
|
|
||||||
|
|
||||||
if (dsl_check_conf_profile(device_handle)) {
|
|
||||||
/* Already has the firmware, so fix the new address. */
|
|
||||||
sr_info("Found a DSCope device,name:\"%s\",handle:%p", prof->model, device_handle);
|
|
||||||
|
|
||||||
usb_dev_info = sr_usb_dev_inst_new(bus, address);
|
usb_dev_info = sr_usb_dev_inst_new(bus, address);
|
||||||
usb_dev_info->usb_dev = device_handle;
|
usb_dev_info->usb_dev = device_handle;
|
||||||
sdi->conn = usb_dev_info;
|
sdi->conn = usb_dev_info;
|
||||||
sdi->status = SR_ST_INACTIVE;
|
sdi->status = SR_ST_INACTIVE;
|
||||||
|
|
||||||
|
devices = g_slist_append(devices, sdi);
|
||||||
|
num++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
char *firmware;
|
char *firmware;
|
||||||
char *res_path = DS_RES_PATH;
|
char *res_path = DS_RES_PATH;
|
||||||
if (!(firmware = malloc(strlen(res_path)+strlen(prof->firmware) + 5))) {
|
if (!(firmware = malloc(strlen(res_path)+strlen(prof->firmware) + 5))) {
|
||||||
sr_err("Firmware path malloc error!");
|
sr_err("Firmware path malloc error!");
|
||||||
return NULL;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(firmware, res_path);
|
strcpy(firmware, res_path);
|
||||||
strcat(firmware, "/");
|
strcat(firmware, "/");
|
||||||
strcat(firmware, prof->firmware);
|
strcat(firmware, prof->firmware);
|
||||||
|
|
||||||
sr_info("Install firmware bin file, device:\"%s\", file:\"%s\"", prof->model, firmware);
|
sr_info("Install firmware bin file, device:\"%s\", file:\"%s\"", prof->model, firmware);
|
||||||
|
|
||||||
if (ezusb_upload_firmware(device_handle, USB_CONFIGURATION,
|
if (ezusb_upload_firmware(device_handle, USB_CONFIGURATION, firmware) != SR_OK){
|
||||||
firmware) == SR_OK)
|
sr_err("Firmware upload failed for device %s", prof->model);
|
||||||
/* Store when this device's FW was updated. */
|
}
|
||||||
devc->fw_updated = g_get_monotonic_time();
|
|
||||||
else
|
|
||||||
sr_err("Firmware upload failed for "
|
|
||||||
"device %d.", devcnt);
|
|
||||||
g_free(firmware);
|
g_free(firmware);
|
||||||
|
|
||||||
usb_dev_info = sr_usb_dev_inst_new(bus, 0xff);
|
sr_info("Waitting for device reconnect, name:\"%s\"", prof->model);
|
||||||
usb_dev_info->usb_dev = device_handle;
|
|
||||||
sdi->conn = usb_dev_info;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1824,14 +1824,7 @@ SR_PRIV int dsl_dev_open(struct sr_dev_driver *di, struct sr_dev_inst *sdi, gboo
|
|||||||
* Just wait for renumerate -> detach -> attach
|
* Just wait for renumerate -> detach -> attach
|
||||||
*/
|
*/
|
||||||
ret = SR_ERR;
|
ret = SR_ERR;
|
||||||
if (devc->fw_updated > 0) {
|
|
||||||
sr_info("%s: Firmware upload have done.", __func__);
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
sr_info("%s: Firmware upload was not needed.", __func__);
|
|
||||||
ret = hw_dev_open(di, sdi);
|
ret = hw_dev_open(di, sdi);
|
||||||
}
|
|
||||||
|
|
||||||
if (ret != SR_OK) {
|
if (ret != SR_OK) {
|
||||||
sr_err("%s: Unable to open device.", __func__);
|
sr_err("%s: Unable to open device.", __func__);
|
||||||
@ -1963,7 +1956,15 @@ SR_PRIV int dsl_dev_close(struct sr_dev_inst *sdi)
|
|||||||
{
|
{
|
||||||
struct sr_usb_dev_inst *usb;
|
struct sr_usb_dev_inst *usb;
|
||||||
|
|
||||||
|
assert(sdi);
|
||||||
|
|
||||||
usb = sdi->conn;
|
usb = sdi->conn;
|
||||||
|
|
||||||
|
if (usb == NULL){
|
||||||
|
sdi->status = SR_ST_INACTIVE;
|
||||||
|
return SR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
if (usb->devhdl == NULL){
|
if (usb->devhdl == NULL){
|
||||||
sr_detail("dsl_dev_close(),libusb_device_handle is null.");
|
sr_detail("dsl_dev_close(),libusb_device_handle is null.");
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
@ -276,7 +276,7 @@ static GSList *scan(GSList *options)
|
|||||||
struct libusb_device_descriptor des;
|
struct libusb_device_descriptor des;
|
||||||
libusb_device **devlist;
|
libusb_device **devlist;
|
||||||
libusb_device *device_handle = NULL;
|
libusb_device *device_handle = NULL;
|
||||||
int devcnt, ret, i, j;
|
int ret, i, j;
|
||||||
const char *conn;
|
const char *conn;
|
||||||
enum libusb_speed usb_speed;
|
enum libusb_speed usb_speed;
|
||||||
struct sr_usb_dev_inst *usb_dev_info;
|
struct sr_usb_dev_inst *usb_dev_info;
|
||||||
@ -404,16 +404,22 @@ static GSList *scan(GSList *options)
|
|||||||
address = libusb_get_device_address(device_handle);
|
address = libusb_get_device_address(device_handle);
|
||||||
sr_info("Found a new device,handle:%p", device_handle);
|
sr_info("Found a new device,handle:%p", device_handle);
|
||||||
|
|
||||||
|
if (dsl_check_conf_profile(device_handle)) {
|
||||||
|
/* Already has the firmware, so fix the new address. */
|
||||||
|
sr_info("Found a DSLogic device,name:\"%s\",handle:%p", prof->model,device_handle);
|
||||||
|
|
||||||
devc = DSLogic_dev_new(prof);
|
devc = DSLogic_dev_new(prof);
|
||||||
if (!devc)
|
if (devc == NULL){
|
||||||
return NULL;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
sdi = sr_dev_inst_new(channel_modes[devc->ch_mode].mode, SR_ST_INITIALIZING,
|
sdi = sr_dev_inst_new(channel_modes[devc->ch_mode].mode, SR_ST_INITIALIZING,
|
||||||
prof->vendor, prof->model, prof->model_version);
|
prof->vendor, prof->model, prof->model_version);
|
||||||
if (!sdi) {
|
if (sdi == NULL) {
|
||||||
g_free(devc);
|
free(devc);
|
||||||
return NULL;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
sdi->priv = devc;
|
sdi->priv = devc;
|
||||||
sdi->driver = di;
|
sdi->driver = di;
|
||||||
sdi->dev_type = DEV_TYPE_USB;
|
sdi->dev_type = DEV_TYPE_USB;
|
||||||
@ -423,26 +429,23 @@ static GSList *scan(GSList *options)
|
|||||||
if (dsl_setup_probes(sdi, channel_modes[devc->ch_mode].num) != SR_OK){
|
if (dsl_setup_probes(sdi, channel_modes[devc->ch_mode].num) != SR_OK){
|
||||||
sr_err("dsl_setup_probes() error");
|
sr_err("dsl_setup_probes() error");
|
||||||
dev_destroy(sdi);
|
dev_destroy(sdi);
|
||||||
return NULL;
|
break;
|
||||||
}
|
}
|
||||||
devices = g_slist_append(devices, sdi);
|
|
||||||
num++;
|
|
||||||
|
|
||||||
if (dsl_check_conf_profile(device_handle)) {
|
|
||||||
/* Already has the firmware, so fix the new address. */
|
|
||||||
sr_info("Found a DSLogic device,name:\"%s\",handle:%p", prof->model,device_handle);
|
|
||||||
|
|
||||||
usb_dev_info = sr_usb_dev_inst_new(bus, address);
|
usb_dev_info = sr_usb_dev_inst_new(bus, address);
|
||||||
usb_dev_info->usb_dev = device_handle;
|
usb_dev_info->usb_dev = device_handle;
|
||||||
sdi->conn = usb_dev_info;
|
sdi->conn = usb_dev_info;
|
||||||
sdi->status = SR_ST_INACTIVE;
|
sdi->status = SR_ST_INACTIVE;
|
||||||
|
|
||||||
|
devices = g_slist_append(devices, sdi);
|
||||||
|
num++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
char *firmware;
|
char *firmware;
|
||||||
char *res_path = DS_RES_PATH;
|
char *res_path = DS_RES_PATH;
|
||||||
if (!(firmware = malloc(strlen(res_path)+strlen(prof->firmware) + 5))) {
|
if (!(firmware = malloc(strlen(res_path)+strlen(prof->firmware) + 5))) {
|
||||||
sr_err("Firmware path malloc error!");
|
sr_err("Firmware path malloc error!");
|
||||||
return NULL;
|
break;
|
||||||
}
|
}
|
||||||
strcpy(firmware, res_path);
|
strcpy(firmware, res_path);
|
||||||
strcat(firmware, "/");
|
strcat(firmware, "/");
|
||||||
@ -450,18 +453,13 @@ static GSList *scan(GSList *options)
|
|||||||
|
|
||||||
sr_info("Install firmware bin file, device:\"%s\", file:\"%s\"", prof->model, firmware);
|
sr_info("Install firmware bin file, device:\"%s\", file:\"%s\"", prof->model, firmware);
|
||||||
|
|
||||||
if (ezusb_upload_firmware(device_handle, USB_CONFIGURATION,
|
if (ezusb_upload_firmware(device_handle, USB_CONFIGURATION, firmware) != SR_OK){
|
||||||
firmware) == SR_OK)
|
sr_err("Firmware upload failed for device %s.", prof->model);
|
||||||
/* Store when this device's FW was updated. */
|
}
|
||||||
devc->fw_updated = g_get_monotonic_time();
|
|
||||||
else
|
|
||||||
sr_err("Firmware upload failed for "
|
|
||||||
"device %d.", devcnt);
|
|
||||||
g_free(firmware);
|
|
||||||
|
|
||||||
usb_dev_info = sr_usb_dev_inst_new(bus, 0xff);
|
free(firmware);
|
||||||
usb_dev_info->usb_dev = device_handle;
|
|
||||||
sdi->conn = usb_dev_info;
|
sr_info("Waitting for device reconnect, name:\"%s\"", prof->model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1362,6 +1362,7 @@ static void process_detach_event()
|
|||||||
struct sr_dev_driver *driver_ins;
|
struct sr_dev_driver *driver_ins;
|
||||||
libusb_device *ev_dev;
|
libusb_device *ev_dev;
|
||||||
int ev;
|
int ev;
|
||||||
|
int bFind;
|
||||||
|
|
||||||
sr_info("Process device detach event.");
|
sr_info("Process device detach event.");
|
||||||
|
|
||||||
@ -1375,6 +1376,7 @@ static void process_detach_event()
|
|||||||
}
|
}
|
||||||
lib_ctx.detach_device_handle = NULL;
|
lib_ctx.detach_device_handle = NULL;
|
||||||
|
|
||||||
|
bFind = 0;
|
||||||
pthread_mutex_lock(&lib_ctx.mutext);
|
pthread_mutex_lock(&lib_ctx.mutext);
|
||||||
|
|
||||||
for (l = lib_ctx.device_list; l; l = l->next)
|
for (l = lib_ctx.device_list; l; l = l->next)
|
||||||
@ -1397,14 +1399,17 @@ static void process_detach_event()
|
|||||||
destroy_device_instance(dev);
|
destroy_device_instance(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bFind = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&lib_ctx.mutext);
|
pthread_mutex_unlock(&lib_ctx.mutext);
|
||||||
|
|
||||||
// Tell user a new device detached, and the list is updated.
|
// Tell user a new device detached, and the list is updated.
|
||||||
|
if (bFind){
|
||||||
post_event_async(ev);
|
post_event_async(ev);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void usb_hotplug_process_proc()
|
static void usb_hotplug_process_proc()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user