cybook.c 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * cybook.c
  3. *
  4. * Copyright 2009 Bookeen <yep@confucius>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  18. * MA 02110-1301, USA.
  19. */
  20. #include <linux/init.h>
  21. #include <linux/kernel.h>
  22. #include <linux/module.h>
  23. #include <linux/proc_fs.h>
  24. //#include <linux/miscdevice.h>
  25. //#include <linux/poll.h>
  26. //#include <linux/sched.h>
  27. //#include <linux/wait.h>
  28. //#include <linux/delay.h>
  29. //#include <linux/interrupt.h>
  30. //#include <linux/pm.h>
  31. #include <cybook.h>
  32. struct proc_dir_entry *platform_type_Proc_File;
  33. #define procfs_name "device"
  34. int procfile_read(char *buffer,
  35. char **buffer_location,
  36. off_t offset, int buffer_length, int *eof, void *data)
  37. {
  38. int ret;
  39. if (offset > 0) {
  40. /* we have finished to read, return 0 */
  41. ret = 0;
  42. } else {
  43. /* fill the buffer, return the buffer size */
  44. /* Currently, this kernel branch will only support the Cybook Gen4 TwistEffect */
  45. ret = sprintf(buffer, "CYBOOK_GEN4\n");
  46. }
  47. return ret;
  48. }
  49. // ---------------------------------------------------------------------------
  50. // ===========================================================================
  51. static int __init cybookInit(void)
  52. {
  53. printk("CIC [Cybook Initialisation Code]\n");
  54. /* cybook proc file */
  55. platform_type_Proc_File = create_proc_entry(procfs_name, 0644, NULL);
  56. if (platform_type_Proc_File == NULL) {
  57. remove_proc_entry(procfs_name, &proc_root);
  58. printk(KERN_ALERT "Error: Could not initialize /proc/%s\n",
  59. procfs_name);
  60. }
  61. platform_type_Proc_File->read_proc = procfile_read;
  62. platform_type_Proc_File->owner = THIS_MODULE;
  63. platform_type_Proc_File->mode = S_IFREG | S_IRUGO;
  64. platform_type_Proc_File->uid = 0;
  65. platform_type_Proc_File->gid = 0;
  66. platform_type_Proc_File->size = 37;
  67. return 0;
  68. }
  69. // ---------------------------------------------------------------------------
  70. static void __exit cybookExit(void)
  71. {
  72. return;
  73. }
  74. // ---------------------------------------------------------------------------
  75. module_init(cybookInit);
  76. module_exit(cybookExit);
  77. // ---------------------------------------------------------------------------
  78. MODULE_LICENSE("GPL");
  79. MODULE_AUTHOR("Bookeen <developers@bookeen.com>");
  80. MODULE_DESCRIPTION("Cybook Specialized functions");
  81. MODULE_VERSION("2.0");
  82. // ===================================================================