-
Notifications
You must be signed in to change notification settings - Fork 360
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
Run USB as an idle task instead of a custom FD-based GSource #242
Open
multiplemonomials
wants to merge
5
commits into
sigrokproject:master
Choose a base branch
from
multiplemonomials:dev/use-idle-for-usb
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
939b7cf
Use idle for USB
multiplemonomials 34ad068
Fix missing destroy callback causing device to get "stuck on", switch…
multiplemonomials 98e899a
A few cleanups
multiplemonomials f4f0b32
Add note about callback
multiplemonomials 4d91bce
Restore removal behavior
multiplemonomials File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
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. |
||
{ | ||
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; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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