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

no permission to read or write this serial port #24

Open
alisaya10 opened this issue Apr 17, 2022 · 1 comment
Open

no permission to read or write this serial port #24

alisaya10 opened this issue Apr 17, 2022 · 1 comment

Comments

@alisaya10
Copy link

alisaya10 commented Apr 17, 2022

hi dear i have the same issue too i do some stuff like bellow but still give me the no permission to read or write this serial port

i put this lines to androidManifest.xml
"
uses-permission android:name="android.things.permission.USE_PERIPHERAL_IO"
uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
"
get /system/xbin/su from command ( which su ) and put this to following code

async function example() {

    SerialPortAPI.setSuPath("/system/xbin/su");
    console.log("tp1")
   
    const serialPort = await SerialPortAPI.open("/dev/ttyS2", { baudRate: 38400 });

    // subscribe received data
    serialPort.onReceived(buff => {
        console.log(buff.toString('hex').toUpperCase());
    })

    

    // unsubscribe
    // sub.remove();

    // send data with hex format
    await serialPort.send('00FF');

    // close
    serlialPort.close();
}
example()
@bastengao
Copy link
Owner

May be you need a rooted device. I don't know.

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

No branches or pull requests

2 participants