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-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