Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
huangzhicong
/
SmartCanteen
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b4333db8
authored
Sep 09, 2019
by
patpat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复优卡特机型非当前机型崩溃的问题
parent
1dd3a031
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
5 deletions
+2
-5
app/src/main/java/android_serialport_api/SerialPort.java
+2
-5
No files found.
app/src/main/java/android_serialport_api/SerialPort.java
View file @
b4333db8
package
android_serialport_api
;
package
android_serialport_api
;
import
android.util.Log
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileDescriptor
;
import
java.io.FileDescriptor
;
import
java.io.FileInputStream
;
import
java.io.FileInputStream
;
import
java.io.FileOutputStream
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
...
@@ -30,11 +27,11 @@ public class SerialPort {
...
@@ -30,11 +27,11 @@ public class SerialPort {
String
cmd
=
"chmod 666 "
+
device
.
getAbsolutePath
()
+
"\n"
+
"exit\n"
;
String
cmd
=
"chmod 666 "
+
device
.
getAbsolutePath
()
+
"\n"
+
"exit\n"
;
su
.
getOutputStream
().
write
(
cmd
.
getBytes
());
su
.
getOutputStream
().
write
(
cmd
.
getBytes
());
if
((
su
.
waitFor
()
!=
0
)
||
!
device
.
canRead
()
||
!
device
.
canWrite
())
{
if
((
su
.
waitFor
()
!=
0
)
||
!
device
.
canRead
()
||
!
device
.
canWrite
())
{
throw
new
SecurityException
()
;
return
null
;
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
throw
new
SecurityException
()
;
return
null
;
}
}
}
}
...
...
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