I'm attempting to make a simple app to change a value on my AOSP device's GPIO directory to toggle a peripheral device. I'm trying to do this by running a shell command from within the app, but my code doesn't seem to be doing anything:
private fun toggle(zeroOrOne: String) {
try {
val command = "echo $zeroOrOne > /sys/class/gpio/gpio690/value"
val process = Runtime.getRuntime().exec(command)
val reader = BufferedReader(InputStreamReader(process.inputStream))
val line: String? = ""
while ((reader.readLine()) != null) {
println(line)
}
} catch (t: Throwable) {
t.printStackTrace()
}
}
Nothing is printing and the peripheral isn't responding. Is there something I'm missing?