95 lines
3.0 KiB
C

/*
* cybook.c
*
* Copyright 2009 Bookeen <yep@confucius>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/proc_fs.h>
//#include <linux/miscdevice.h>
//#include <linux/poll.h>
//#include <linux/sched.h>
//#include <linux/wait.h>
//#include <linux/delay.h>
//#include <linux/interrupt.h>
//#include <linux/pm.h>
#include <cybook.h>
struct proc_dir_entry *platform_type_Proc_File;
#define procfs_name "device"
int procfile_read(char *buffer,
char **buffer_location,
off_t offset, int buffer_length, int *eof, void *data)
{
int ret;
if (offset > 0) {
/* we have finished to read, return 0 */
ret = 0;
} else {
/* fill the buffer, return the buffer size */
/* Currently, this kernel branch will only support the Cybook Gen4 TwistEffect */
ret = sprintf(buffer, "CYBOOK_GEN4\n");
}
return ret;
}
// ---------------------------------------------------------------------------
// ===========================================================================
static int __init cybookInit(void)
{
printk("CIC [Cybook Initialisation Code]\n");
/* cybook proc file */
platform_type_Proc_File = create_proc_entry(procfs_name, 0644, NULL);
if (platform_type_Proc_File == NULL) {
remove_proc_entry(procfs_name, &proc_root);
printk(KERN_ALERT "Error: Could not initialize /proc/%s\n",
procfs_name);
}
platform_type_Proc_File->read_proc = procfile_read;
platform_type_Proc_File->owner = THIS_MODULE;
platform_type_Proc_File->mode = S_IFREG | S_IRUGO;
platform_type_Proc_File->uid = 0;
platform_type_Proc_File->gid = 0;
platform_type_Proc_File->size = 37;
return 0;
}
// ---------------------------------------------------------------------------
static void __exit cybookExit(void)
{
return;
}
// ---------------------------------------------------------------------------
module_init(cybookInit);
module_exit(cybookExit);
// ---------------------------------------------------------------------------
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Bookeen <developers@bookeen.com>");
MODULE_DESCRIPTION("Cybook Specialized functions");
MODULE_VERSION("2.0");
// ===================================================================