Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HighBlueParsers
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Paul Best
HighBlueParsers
Commits
e68dfb51
Commit
e68dfb51
authored
6 years ago
by
Jan Schlüter
Browse files
Options
Downloads
Patches
Plain Diff
Correctly claim and release USB interface
parent
13ad7cd0
No related branches found
No related tags found
2 merge requests
!2
HighBlueParser dev branch merged to empty main branch
,
!1
High blue rec
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
CMakeLists.txt
+1
-2
1 addition, 2 deletions
CMakeLists.txt
src/recorder.cpp
+5
-0
5 additions, 0 deletions
src/recorder.cpp
with
6 additions
and
2 deletions
CMakeLists.txt
+
1
−
2
View file @
e68dfb51
...
...
@@ -4,7 +4,7 @@ if(POLICY CMP0063)
endif
()
project
(
jasonrec
)
set
(
JASONREC_VERSION
"1.
0
"
)
set
(
JASONREC_VERSION
"1.
1
"
)
add_definitions
(
-DJASONREC_VERSION=
"
${
JASONREC_VERSION
}
"
)
find_path
(
LIBUSB_INCLUDE_DIR
...
...
@@ -15,4 +15,3 @@ find_library(LIBUSB_LIBRARY
PATH_SUFFIXES
"lib"
"lib32"
"lib64"
)
add_subdirectory
(
src
)
This diff is collapsed.
Click to expand it.
src/recorder.cpp
+
5
−
0
View file @
e68dfb51
...
...
@@ -44,6 +44,7 @@ JasonRecorder::JasonRecorder() {
JasonRecorder
::~
JasonRecorder
()
{
// free handle
if
(
handle
)
{
libusb_release_interface
(
handle
,
0
);
libusb_close
(
handle
);
}
// free devices
...
...
@@ -60,6 +61,7 @@ size_t JasonRecorder::get_device_count() {
void
JasonRecorder
::
set_device
(
size_t
number
)
{
if
(
handle
)
{
libusb_release_interface
(
handle
,
0
);
libusb_close
(
handle
);
handle
=
NULL
;
}
...
...
@@ -69,6 +71,9 @@ void JasonRecorder::set_device(size_t number) {
if
(
libusb_open
(
devices
[
number
],
&
handle
)
<
0
)
{
throw
std
::
runtime_error
(
"could not open USB device (try again as root)"
);
}
if
(
libusb_claim_interface
(
handle
,
0
)
<
0
)
{
throw
std
::
runtime_error
(
"could not claim USB interface"
);
}
}
void
JasonRecorder
::
send_message
(
std
::
uint8_t
cmd
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment