Skip to content
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

implement ReadTimeout #22

Merged
merged 3 commits into from
Feb 6, 2024
Merged

implement ReadTimeout #22

merged 3 commits into from
Feb 6, 2024

Conversation

bpedman
Copy link
Contributor

@bpedman bpedman commented Jun 3, 2019

Add ability to perform a read with a specified timeout

Note: This is the same as #11, I just implemented it slightly different. I don't really care which one is used just wanted to give the option to the maintainer.

Add ability to perform a read with a specified timeout
ocraviotto pushed a commit to ocraviotto/hid that referenced this pull request Dec 28, 2020
The original Read() method was a wrapper to C.hid_read.
C.hid_read checks for the device blocking field
to pass a timeout value to C.hid_read_timeout accordingly:
if blocking is enabled, -1, else 0.

The changed introduced in karalabe#22
and merged in this fork breaks that and incorrectly assumes that
a 0 timeout means a blocking read. This commit allows to maintain
the original use of Read() while also allowing a package user to
make use of ReadTimeout(b, t)
ReadTimeout() was previously missing from hid_disable.go
ocraviotto pushed a commit to ocraviotto/hid that referenced this pull request Dec 28, 2020
The original Read() method was a wrapper to C.hid_read.
C.hid_read checks for the device blocking field
to pass a timeout value to C.hid_read_timeout accordingly:
if blocking is enabled, -1, else 0.

The changed introduced in karalabe#22
and merged in this fork breaks that and incorrectly assumes that
a 0 timeout means a blocking read. This commit allows to maintain
the original use of Read() while also allowing a package user to
make use of ReadTimeout(b, t)
ReadTimeout() was previously missing from hid_disable.go
ocraviotto pushed a commit to ocraviotto/hid that referenced this pull request Dec 28, 2020
The original Read() method was a wrapper to C.hid_read.
C.hid_read checks for the device blocking field
to pass a timeout value to C.hid_read_timeout accordingly:
if blocking is enabled, -1, else 0.

The changed introduced in karalabe#22
and merged in this fork breaks that and incorrectly assumes that
a 0 timeout means a blocking read. This commit allows to maintain
the original use of Read() while also allowing a package user to
make use of ReadTimeout(b, t)
ReadTimeout() was previously missing from hid_disable.go
ocraviotto added a commit to ocraviotto/hid that referenced this pull request Dec 28, 2020
The original Read() method was a wrapper to C.hid_read.
C.hid_read checks for the device blocking field
to pass a timeout value to C.hid_read_timeout accordingly:
if blocking is enabled, -1, else 0.

The changed introduced in karalabe#22
and merged in this fork breaks that and incorrectly assumes that
a 0 timeout means a blocking read. This commit allows to maintain
the original use of Read() while also allowing a package user to
make use of ReadTimeout(b, t)
ReadTimeout() was previously missing from hid_disable.go
ocraviotto added a commit to ocraviotto/hid that referenced this pull request Dec 28, 2020
The original Read() method was a wrapper to C.hid_read.
C.hid_read checks for the device blocking field
to pass a timeout value to C.hid_read_timeout accordingly:
if blocking is enabled, -1, else 0.

The changed introduced in karalabe#22
and merged in this fork breaks that and incorrectly assumes that
a 0 timeout means a blocking read. This commit allows to maintain
the original use of Read() while also allowing a package user to
make use of ReadTimeout(b, t)
ReadTimeout() was previously missing from hid_disable.go
Copy link
Collaborator

@holiman holiman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@holiman holiman changed the title Implement ReadTimeout implement ReadTimeout Feb 6, 2024
@holiman holiman merged commit 98572d5 into karalabe:master Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants