-
Notifications
You must be signed in to change notification settings - Fork 399
Run USB as an idle task instead of a custom FD-based GSource #242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 4 commits
939b7cf
34ad068
98e899a
f4f0b32
4d91bce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -137,13 +137,17 @@ SR_API GSList *sr_buildinfo_libs_get(void) | |
| glib_binary_age, glib_interface_age)); | ||
| l = g_slist_append(l, m); | ||
|
|
||
| #ifdef CONF_ZLIB_VERSION | ||
| m = g_slist_append(NULL, g_strdup("zlib")); | ||
| m = g_slist_append(m, g_strdup_printf("%s", CONF_ZLIB_VERSION)); | ||
| l = g_slist_append(l, m); | ||
| #endif | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this solved a problem for you that's good, but I would recommend sticking this in a separate patch, not conflated with some serious core USB code. |
||
|
|
||
| #ifdef CONF_LIBZIP_VERSION | ||
| m = g_slist_append(NULL, g_strdup("libzip")); | ||
| m = g_slist_append(m, g_strdup_printf("%s", CONF_LIBZIP_VERSION)); | ||
| l = g_slist_append(l, m); | ||
| #endif | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In fact libzip is a required dependency, libsigrok will not build without it. So there is no need for this #ifdef.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK will do. Actually funny story, I am so dependent on CLion for my dev work that, in order to develop this patch, I reimplemented about half the libsigrok build system in CMake so that I could open the project in CLion. So that's how I found this, but I am happy to revert it. btw, if you guys are interested in a CMake build system option, I could see about polishing up that code some more and contributing it (though I am not 100% sure I still have it anymore) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @multiplemonomials I'm speaking for myself here, but I'd appreciate the move to cmake. IDE support being one of the reasons, although the autotools setup currently seems to work fine. I suggest you hit the mailing list and we can have a discussion there? |
||
|
|
||
| m = g_slist_append(NULL, g_strdup("minilzo")); | ||
| m = g_slist_append(m, g_strdup_printf("%s", lzo_version_string())); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -874,22 +874,6 @@ static void LIBUSB_CALL receive_transfer(struct libusb_transfer *transfer) | |
| resubmit_transfer(transfer); | ||
| } | ||
|
|
||
| static int receive_data(int fd, int revents, void *cb_data) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With this change, drivers no longer need to implement callbacks if all they are doing is calling libusb_handle_events_timeout(). I tried to update a few of them, but frankly IDK if I have the time & energy to update all of them.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Even if your USB source changes get merged, you should probably update the drivers in a separate patch. This just makes the patchset larger and harder to review. |
||
| { | ||
| struct timeval tv; | ||
| struct drv_context *drvc; | ||
|
|
||
| (void)fd; | ||
| (void)revents; | ||
|
|
||
| drvc = (struct drv_context *)cb_data; | ||
|
|
||
| tv.tv_sec = tv.tv_usec = 0; | ||
| libusb_handle_events_timeout(drvc->sr_ctx->libusb_ctx, &tv); | ||
|
|
||
| return TRUE; | ||
| } | ||
|
|
||
| static size_t to_bytes_per_ms(const struct sr_dev_inst *sdi) | ||
| { | ||
| const struct dev_context *const devc = sdi->priv; | ||
|
|
@@ -1028,8 +1012,6 @@ static void LIBUSB_CALL trigger_receive(struct libusb_transfer *transfer) | |
|
|
||
| SR_PRIV int dslogic_acquisition_start(const struct sr_dev_inst *sdi) | ||
| { | ||
| const unsigned int timeout = get_timeout(sdi); | ||
|
|
||
| struct sr_dev_driver *di; | ||
| struct drv_context *drvc; | ||
| struct dev_context *devc; | ||
|
|
@@ -1048,7 +1030,7 @@ SR_PRIV int dslogic_acquisition_start(const struct sr_dev_inst *sdi) | |
| devc->empty_transfer_count = 0; | ||
| devc->acq_aborted = FALSE; | ||
|
|
||
| usb_source_add(sdi->session, devc->ctx, timeout, receive_data, drvc); | ||
| usb_source_add(sdi->session, devc->ctx, 0, NULL, NULL); | ||
|
|
||
| if ((ret = command_stop_acquisition(sdi)) != SR_OK) | ||
| return ret; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These missing ifdefs caused me some issues when building the code, they really should be here