看板 AndroidDev 關於我們 聯絡資訊
不曉得有沒有人用過這個api http://code.google.com/p/android-serialport-api/ 直接用他的範例在HTC-Aria來跑 雖然看起來像是可以正常的執行 device 和 rate 都可以選擇 但想要進行Console 或是 Loopback 的動作時 就會跳出來一個 "You do not have read/weite permission to the serial port" 查了一點資料有看到人家說要改chmod 將原來的666 改為 777 /* Check access permission */ if (!device.canRead() || !device.canWrite()) { try { /* Missing read/write permission, trying to chmod the file */ Process su; su = Runtime.getRuntime().exec("/system/bin/su"); String cmd = "chmod 777 " + device.getAbsolutePath() + "\n" + "exit\n"; su.getOutputStream().write(cmd.getBytes()); if ((su.waitFor() != 0) || !device.canRead() || !device.canWrite()) { throw new SecurityException(); } } catch (Exception e) { e.printStackTrace(); throw new SecurityException(); } } 但結果還是一樣沒有存取的權限 有人有成功解決過這個問題嗎? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.171.240.107
fasthall:這是不是需要root啊? 04/12 01:38
Killercat:應該是chmod 777這步需要root, 在emu上能跑的話就是root 04/12 07:28
Killercat:的問題了 04/12 07:28
secondsee:可以請教該如何設定嗎?模擬器上跑也是失敗 04/12 09:46
secondsee:http://i.imgur.com/3Q1Nz.jpg 04/12 09:46
gpc:上一篇就有教你關於root的東西了 04/12 12:29