Skip to content

Instantly share code, notes, and snippets.

@sepfy
sepfy / ioctl.c
Last active October 4, 2020 05:02
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)
{
#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
@sepfy
sepfy / control.c
Last active February 14, 2021 13:59
libwpa_client control example
#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;
@sepfy
sepfy / monitor.c
Created February 14, 2021 14:00
libwpa_client monitor example
#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[]) {
@sepfy
sepfy / muxing.c
Last active February 17, 2021 02:13
#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>
#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) {