Skip to content

Instantly share code, notes, and snippets.

View sandeepbhuyan's full-sized avatar

SandeepBhuyanLinux sandeepbhuyan

  • Hyderabad,India
View GitHub Profile
@sandeepbhuyan
sandeepbhuyan / hello.c
Created June 7, 2018 16:37 — forked from itrobotics/hello.c
hello world of the linux module
#include <linux/module.h>
#include <linux/init.h>
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void)
{
printk("Hello world!\n");
return 0;
}
@sandeepbhuyan
sandeepbhuyan / hello_tasklet.c
Created June 7, 2018 16:37 — forked from itrobotics/hello_tasklet.c
a simple example of work_queue in Linux kernel
/*******************************************************************************
* Copyright (c) 2015 Song Yang @ ittraining
*
* All rights reserved.
* This program is free to use, but the ban on selling behavior.
* Modify the program must keep all the original text description.
*
* 保留所有權利
* 本程式可任意使用但是禁止販售行為
* 修改程式時必須保留所有原有文字說明
@sandeepbhuyan
sandeepbhuyan / hello_tasklet.c
Created June 7, 2018 16:37 — forked from itrobotics/hello_tasklet.c
simple example for tasklet in Linux kernel
/*******************************************************************************
* Copyright (c) 2015 Song Yang @ ittraining
*
* All rights reserved.
* This program is free to use, but the ban on selling behavior.
* Modify the program must keep all the original text description.
*
* 保留所有權利
* 本程式可任意使用但是禁止販售行為
* 修改程式時必須保留所有原有文字說明
@sandeepbhuyan
sandeepbhuyan / LCD1602_hello.py
Created June 7, 2018 16:36 — forked from itrobotics/LCD1602_hello.py
The simple hello world example code of Python for LCD1602 module
#!/usr/bin/env python
#-*-coding:utf8-*-
import RPi.GPIO as GPIO
from time import sleep
RS = 38
RW = 40
EN = 29
D4 = 31
D5 = 33
@sandeepbhuyan
sandeepbhuyan / my_waitqueue.c
Created June 7, 2018 16:36 — forked from itrobotics/my_waitqueue.c
a simple wait queue example for linux kernel
/*******************************************************************************
* Copyright (c) 2015 Song Yang @ ittraining
*
* All rights reserved.
* This program is free to use, but the ban on selling behavior.
* Modify the program must keep all the original text description.
*
* 保留所有權利
* 本程式可任意使用但是禁止販售行為
* 修改程式時必須保留所有原有文字說明
@sandeepbhuyan
sandeepbhuyan / my_waitqueue_never_wakeup.c
Created June 7, 2018 16:36 — forked from itrobotics/my_waitqueue_never_wakeup.c
a simple wait queue example code but it will never wake up.....
/*******************************************************************************
* Copyright (c) 2015 Song Yang @ ittraining
*
* All rights reserved.
* This program is free to use, but the ban on selling behavior.
* Modify the program must keep all the original text description.
*
* 保留所有權利
* 本程式可任意使用但是禁止販售行為
* 修改程式時必須保留所有原有文字說明
@sandeepbhuyan
sandeepbhuyan / my_timer.c
Created June 7, 2018 16:36 — forked from itrobotics/my_timer.c
a simple timer example of Linux module
/*******************************************************************************
* Copyright (c) 2015 Song Yang @ ittraining
*
* All rights reserved.
* This program is free to use, but the ban on selling behavior.
* Modify the program must keep all the original text description.
*
* 保留所有權利
* 本程式可任意使用但是禁止販售行為
* 修改程式時必須保留所有原有文字說明
@sandeepbhuyan
sandeepbhuyan / chrdev.c
Created June 7, 2018 16:36 — forked from itrobotics/chrdev.c
a simple char device example for linux module
/*******************************************************************************
* Copyright (c) 2015 Song Yang @ ittraining
*
* All rights reserved.
* This program is free to use, but the ban on selling behavior.
* Modify the program must keep all the original text description.
*
* 保留所有權利
* 本程式可任意使用但是禁止販售行為
* 修改程式時必須保留所有原有文字說明
@sandeepbhuyan
sandeepbhuyan / chrdev_test.c
Created June 7, 2018 16:36 — forked from itrobotics/chrdev_test.c
a simple file to test the module : chrdev.c
#include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<unistd.h>
#include<fcntl.h>
#include<time.h>
int main(int argc,char *argv[]){
int dev_0 = open("/dev/mydev_0",O_RDWR);
[ 788.476664]
[ 788.476664] *****Some body is opening me at major 200 minor 0*****
[ 788.476729]
[ 788.476729] *****Some body is opening me at major 200 minor 1*****
[ 798.479961] *****Some body is closing me at major 0*****
[ 798.480004] *****Some body is closing me at major 1*****
[ 814.005473] Goodbye
[ 829.987718] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[ 829.998678] pgd = d9ef0000
[ 830.002707] [00000000] *pgd=1b2be831, *pte=00000000, *ppte=00000000