Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Sunxi Tools
Commits
9d30ca8e
Commit
9d30ca8e
authored
May 19, 2013
by
Henrik Nordstrom
Browse files
fel: Detach (and reattach on exit) the awusb kernel driver if loaded
parent
6829404a
Changes
1
Show whitespace changes
Inline
Side-by-side
fel.c
View file @
9d30ca8e
...
@@ -278,6 +278,7 @@ int main(int argc, char **argv)
...
@@ -278,6 +278,7 @@ int main(int argc, char **argv)
{
{
int
rc
;
int
rc
;
libusb_device_handle
*
handle
=
NULL
;
libusb_device_handle
*
handle
=
NULL
;
int
iface_detached
=
-
1
;
rc
=
libusb_init
(
NULL
);
rc
=
libusb_init
(
NULL
);
assert
(
rc
==
0
);
assert
(
rc
==
0
);
...
@@ -301,6 +302,13 @@ int main(int argc, char **argv)
...
@@ -301,6 +302,13 @@ int main(int argc, char **argv)
exit
(
1
);
exit
(
1
);
}
}
rc
=
libusb_claim_interface
(
handle
,
0
);
rc
=
libusb_claim_interface
(
handle
,
0
);
#if defined(__linux__)
if
(
rc
!=
LIBUSB_SUCCESS
)
{
libusb_detach_kernel_driver
(
handle
,
0
);
iface_detached
=
0
;
rc
=
libusb_claim_interface
(
handle
,
0
);
}
#endif
assert
(
rc
==
0
);
assert
(
rc
==
0
);
while
(
argc
>
1
)
{
while
(
argc
>
1
)
{
...
@@ -345,5 +353,10 @@ int main(int argc, char **argv)
...
@@ -345,5 +353,10 @@ int main(int argc, char **argv)
argv
+=
skip
;
argv
+=
skip
;
}
}
#if defined(__linux__)
if
(
iface_detached
>=
0
)
libusb_attach_kernel_driver
(
handle
,
iface_detached
);
#endif
return
0
;
return
0
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment