2

I'm trying to trigger keyboard LED flashing, that I already can based on this example: http://www.tldp.org/LDP/lkmpg/2.6/html/x1194.html

But somehow I need to reach an API and use the response of it. Is it possible to use curl inside a Linux kernel module? Or how should I do it otherwise?

Isty001
  • 144
  • 1
  • 11
  • You can create an API inside your kernel model that you call to enable the led, based on the external curl response. – Kiloreux Apr 18 '16 at 19:43
  • You mean call a module function from a userspace code? I tried to look for it but with not much luck. Could you provide some resources on the subject please? – Isty001 Apr 18 '16 at 20:08
  • 1
    check this out https://web.archive.org/web/20160127023537/http://people.ee.ethz.ch/~arkeller/linux/kernel_user_space_howto.html , I hope it will be helpful for you. – Kiloreux Apr 18 '16 at 20:58
  • Thanks, that's what I needed! – Isty001 Apr 20 '16 at 17:14

1 Answers1

2

There's a working kernel module here

Isolate Kernel Module to a Specific Core Using Cpuset

This creates a device /dev/toy

To do what you want edit the following function to blink your LED.

static int toy_open(struct inode *inodep, struct file *filep) {
  ....
  printk(KERN_INFO "open: called\n");
  return 0;
}

To trigger that function use this

cat /dev/toy
Community
  • 1
  • 1
Harry
  • 11,298
  • 1
  • 29
  • 43