Hi, I was trying to change permissions of the i2c files in /dev/i2c-x (x: 
from 0 to 3) adding the lines "chmod 777 /dev/i2c-x" inside the "on 
early-boot"  action. But trying to run i2cdetectx from shell still throws 
"permission denied".

Could someone show me where should I change permissions inside the init.rc 
file? Or another way of doing the same but not in "init.rc"? I'm using AOSP 
9.

Thanks!
El miércoles, 1 de julio de 2020 a las 12:03:54 UTC-3, 
davemcla...@gmail.com escribió:

> Not likely as Android apps tend to work with phones which don't have the 
> need for I2C or UART comms etc.
>
> I wrote a couple of JNI libraries to handle GPIO, I2C and UART, you can 
> find it here. This can be added to your project.
>
> http://www.axoninstruments.biz/download/gpioserial.zip
>
> This is just the library for I2C and UART. This is very basic code for the 
> I2C (I omitted the required exception handling)
>
> Open the I2C device
>
>             fileHandle = i2c.open("/dev/i2c-0");
>
> Read I2C
>
>         i2c.read(fileHandle, slaveAddr, buf, 3);
>
> Write I2C
>
> i2c.write(fileHandle, slaveAddr, 0, buf, 1);
>
> Close the device
>
> i2c.close(fileHandle);
>
> Buf is an int array. slaveAddr is the 7 bit address of the device you want 
> to talk to.
>
> Serial Port is pretty much similar. I used this with a Modbus library. You 
> only need to allocate the file handle to the streams for this to work. 
> Search for modbus4j by Serotonin. This works great with Android. 
>
> I hope this helps?
>
> On Tuesday, 30 June 2020 23:31:00 UTC+7, NANDAKUMAR S wrote:
>>
>> Thanks for your reply,
>>
>> I have tty in /dev directory. I'll check with permissions. 
>>
>> Can i get any readily available app for testing.
>>
>>
>>>
-- 
This email and any of its attachments may contain privileged and 
confidential information and are intended only for the review of the party 
to whom it is addressed. If you are not the intended addressee of this 
e-mail or his representative, please be aware that any kind of review, 
publication, reproduction or retransmission of the content of this e-mail 
is prohibited and may be unlawful. Furthermore, if you have received this 
email in error, please notify the sender immediately by reply email and 
then delete this email. Normal e-mails are not protected against access by 
third parties and consequently their confidentiality may not be assured in 
certain circumstances. Should any virus enter your systems in connection 
with this e-mail despite our use of antivirus software, we cannot be held 
liable for any possible damages.

-- 
-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-porting

--- 
You received this message because you are subscribed to the Google Groups 
"android-porting" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-porting+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-porting/8d569110-437d-4686-a876-d1de567a9d59n%40googlegroups.com.

Reply via email to