I had a question about the JNI part, and posted it on stack. Here 
<http://stackoverflow.com/questions/32533619/how-to-implement-elaborate-functions-in-a-jni-project>
 is 
what they say. If you or anyone else can help please do. I did not post 
here since I was not sure if JNI discussion is relevant to this group's 
topic.

On Friday, September 11, 2015 at 2:01:10 AM UTC-4, Durga wrote:
>
> I believe you are on the right track. Did your HelloJNI work ?
>
> Also, JNI may be a preferred way; but not a must. You should be able to 
> use JAVA APIs (BufferedReader & friends) from your app to interact with 
> these files. Watch out for permission issues etc..
>
> Thanks,
> Durga
>
> On Fri, Sep 11, 2015 at 12:51 AM, Shahin Ansari <perss...@gmail.com 
> <javascript:>> wrote:
>
>> Greetings-
>> In order to learn more about the device drivers on the Android platform, 
>> I built an tutorial code and was able to interface with it from a user 
>> program. 
>> Here is the code I used for device driver:
>> /* Example Minimal Character Device Driver */
>> #include <linux/module.h>
>> static int __init hello_init(void)
>> {
>> printk("Hello Example Init\n");
>> return 0;
>> }
>> static void __exit hello_exit(void)
>> {
>> printk("Hello Example Exit\n");
>> }
>> module_init(hello_init);
>> module_exit(hello_exit);
>> MODULE_DESCRIPTION("Hello World Example");
>> MODULE_LICENSE("GPL");
>>
>> Here is the code for the user space executable:
>> #include <stdio.h>
>> #include <stdlib.h>
>> #include <sys/types.h>
>> #include <sys/stat.h>
>> #include <fcntl.h>
>> #include <unistd.h>
>> int main(int argc, char **argv)
>> {
>> /* Our file descriptor */
>> int fd;
>> int rc = 0;
>> char *rd_buf[16];
>> printf("%s: entered\n", argv[0]);
>> /* Open the device */
>> fd = open("/dev/hello1", O_RDWR);
>> if ( fd == -1 ) {
>> perror("open failed");
>> rc = fd;
>> exit(-1);
>> }
>> printf("%s: open: successful\n", argv[0]);
>> /* Issue a read */
>> rc = read(fd, rd_buf, 0);
>> if ( rc == -1 ) {
>> perror("read failed");
>> close(fd);
>> exit(-1);
>> }
>> printf("%s: read: returning %d bytes!\n", argv[0], rc);
>> close(fd);
>> return 0;
>> }
>>
>> ***********************************************
>> Now I want to move this into an apk, and run it as an app. The only way I 
>> know of doing this is via JNI. So I created a HelloJNI project using 
>> another online tutorial. I need help with verifying I am on the right 
>> track, and what are some of the next steps to get my user program code into 
>> my JNI project and run it as an apk. I have already posted to a JNI forum, 
>> but I have not heard anything back. I think doing kernel development is a 
>> very unique skill, and that may be why other forums can not help me. I have 
>> seen similar discussions on this list and have reviewed them to ensure I 
>> provide all the information I should.
>> Thanks in Advance,
>> Sean
>>
>> -- 
>> -- 
>> unsubscribe: android-kerne...@googlegroups.com <javascript:>
>> website: http://groups.google.com/group/android-kernel
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Android Linux Kernel Development" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to android-kerne...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Regards
> Durgadoss
>

-- 
-- 
unsubscribe: android-kernel+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-kernel
--- 
You received this message because you are subscribed to the Google Groups 
"Android Linux Kernel Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-kernel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to