Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
6
600SeriesAndroidUploader
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
cgm
uploader
600SeriesAndroidUploader
Commits
b2e46f3c
Commit
b2e46f3c
authored
8 years ago
by
Lennart Goedhart
Browse files
Options
Downloads
Patches
Plain Diff
Fix for Crashlytics
#1
parent
56aac588
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/src/main/java/info/nightscout/android/USB/UsbHidDriver.java
+13
-18
13 additions, 18 deletions
...c/main/java/info/nightscout/android/USB/UsbHidDriver.java
with
13 additions
and
18 deletions
app/src/main/java/info/nightscout/android/USB/UsbHidDriver.java
+
13
−
18
View file @
b2e46f3c
...
...
@@ -8,7 +8,6 @@ import android.hardware.usb.UsbManager;
import
android.util.Log
;
import
java.io.IOException
;
import
java.util.Iterator
;
//import com.hoho.android.usbserial.driver.UsbId;
...
...
@@ -17,8 +16,8 @@ import java.util.Iterator;
*
* @author mike wakerly (opensource@hoho.com), Lennart Goedhart (lennart@omnibase.com.au)
* @see <a
*
href="http://www.usb.org/developers/devclass_docs/usbcdc11.pdf">Universal
*
Serial Bus Class Definitions for Communication Devices, v1.1</a>
* href="http://www.usb.org/developers/devclass_docs/usbcdc11.pdf">Universal
* Serial Bus Class Definitions for Communication Devices, v1.1</a>
*/
public
class
UsbHidDriver
extends
CommonUsbDriver
{
...
...
@@ -35,17 +34,14 @@ public class UsbHidDriver extends CommonUsbDriver {
super
(
device
,
connection
);
}
public
static
UsbHidDriver
acquire
(
UsbManager
usbManager
,
int
vendorId
,
int
productId
)
{
Iterator
<
UsbDevice
>
deviceIterator
=
usbManager
.
getDeviceList
().
values
().
iterator
();
public
static
UsbHidDriver
acquire
(
UsbManager
usbManager
,
int
vendorId
,
int
productId
)
{
// Iterate all the available devices and find ours.
while
(
deviceIterator
.
hasNext
()
){
UsbDevice
device
=
deviceIterator
.
next
();
for
(
UsbDevice
device
:
usbManager
.
getDeviceList
().
values
())
{
if
(
device
.
getProductId
()
==
productId
&&
device
.
getVendorId
()
==
vendorId
)
{
final
UsbDevice
mDevice
=
device
;
final
UsbDeviceConnection
mConnection
=
usbManager
.
openDevice
(
mDevice
);
final
UsbDeviceConnection
mConnection
=
usbManager
.
openDevice
(
device
);
return
new
UsbHidDriver
(
mD
evice
,
mConnection
);
return
new
UsbHidDriver
(
d
evice
,
mConnection
);
}
}
...
...
@@ -54,14 +50,11 @@ public class UsbHidDriver extends CommonUsbDriver {
@Override
public
void
open
()
throws
IOException
{
Log
.
d
(
TAG
,
"claiming interfaces, count="
+
mDevice
.
getInterfaceCount
());
int
count
=
mDevice
.
getInterfaceCount
();
Log
.
d
(
TAG
,
"Claiming HID interface."
);
mInterface
=
mDevice
.
getInterface
(
0
);
Log
.
d
(
TAG
,
"data iface="
+
mInterface
);
if
(!
mConnection
.
claimInterface
(
mInterface
,
true
))
{
isConnectionOpen
=
false
;
isConnectionOpen
=
false
;
throw
new
IOException
(
"Could not claim data interface."
);
}
...
...
@@ -75,7 +68,9 @@ public class UsbHidDriver extends CommonUsbDriver {
@Override
public
void
close
()
{
mConnection
.
close
();
if
(
mConnection
!=
null
)
{
mConnection
.
close
();
}
isConnectionOpen
=
false
;
}
...
...
@@ -136,8 +131,8 @@ public class UsbHidDriver extends CommonUsbDriver {
return
offset
;
}
@Override
public
boolean
isConnectionOpen
(){
return
isConnectionOpen
;
@Override
public
boolean
isConnectionOpen
()
{
return
isConnectionOpen
;
}
}
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