This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <fcntl.h> | |
#include <sys/stat.h> | |
#include <sys/types.h> | |
#include <stdint.h> | |
#include <unistd.h> | |
int main(int argc, char **argv) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <math.h> | |
#include <libavutil/opt.h> | |
#include <libavutil/mathematics.h> | |
#include <libavformat/avformat.h> | |
#include <libswscale/swscale.h> | |
#include <libswresample/swresample.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <dirent.h> | |
#include <sys/time.h> | |
#include <wpa_ctrl.h> | |
#define CTRL_INTERFACE_DIR "/var/run/wpa_supplicant/wlan0" | |
int main(int argc, char *argv[]) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <wpa_ctrl.h> | |
#define CTRL_INTERFACE_DIR "/var/run/wpa_supplicant/wlan0" | |
int main(int argc, char *argv[]) { | |
struct wpa_ctrl *ctrl_conn; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <errno.h> | |
#include <fcntl.h> | |
#include <sys/ioctl.h> // for open | |
#include <unistd.h> // for close | |
#define IOCTL_MISCDEV_SET 0x00 | |
#define IOCTL_MISCDEV_GET 0x01 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct miscdev_data { | |
int val; | |
char data[64]; | |
}; | |
#define IOCTL_MISCDEV_SET 0x00 | |
#define IOCTL_MISCDEV_GET 0x01 | |
static long mydev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static ssize_t | |
mydev_read(struct file *filp, char __user *buf, size_t count, loff_t *pos) | |
{ | |
char tmp[] = "Kernel says hello"; | |
printk("[%s][%d]\n", __func__, __LINE__); | |
copy_to_user(buf, tmp, sizeof(tmp)); | |
*pos = 0; | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static struct miscdevice my_miscdev = { | |
.minor = 11, | |
.name = "misc_dev", | |
.fops = &mydev_fops, | |
}; | |
static int __init init_modules(void) | |
{ | |
int ret; | |
ret = misc_register(&my_miscdev); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define BUZZER 23 | |
#define BUTTON 21 | |
static short int button_irq = 0; | |
static unsigned long flags = 0; | |
int buzzer_trigger = 0; | |
u32 trigger_jiffies; | |
static irqreturn_t button_isr(int irq, void *data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static ssize_t attr_store(struct device *dev, | |
struct device_attribute *attr, | |
const char *buf, size_t count) | |
{ | |
printk("[%s][%d]\n", __func__, __LINE__); | |
buzzer_trigger = simple_strtoul(buf, NULL, 10); | |
gpio_set_value(BUZZER, buzzer_trigger); | |
return count; | |
} |
NewerOlder