Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hwdetect #5

Open
wants to merge 8 commits into
base: Mykhailo.Dehtiarov
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ GlobalLogic Kharkiv, 2020

This repository is aimed for sharing our exercises and your solutions in scope of the course.

Homeworks:
- hwdetect - detect attached hardware using user level script file


Please refer to wiki for details.
9 changes: 9 additions & 0 deletions device_tree/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
obj-m += i2c_dev.o

KERN_DIR ?= /lib/modules/$(shell uname -r)/build

all:
$(MAKE) -C $(KERN_DIR) M=$(PWD) modules

clean:
$(MAKE) -C $(KERN_DIR) M=$(PWD) clean
18 changes: 18 additions & 0 deletions device_tree/i2c_dev.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <linux/init.h>
#include <linux/module.h>
//#include <linux/i2c.h>
#include <linux/kernel.h>

static int __init i2c_device_init(void)
{
printk(KERN_INFO "hello form i2d device\n");
return 0;
}

static void __exit i2c_device_exit(void)
{
printk(KERN_INFO "i2c device exit\n");
}

module_init(i2c_device_init);
module_exit(i2c_device_exit);
10 changes: 10 additions & 0 deletions hwdetect/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Home work hot plugged hardware detector

Create the script 'hwdetect.sh' which detects connected hardware.
For monitor hardware from user level please use /dev folder,
output from lsusb and i2detect (optional).
Most interesting devices are:
- USB to TTL convertors,
- flash drives,
- SD cards,
- i2c devices.
2 changes: 1 addition & 1 deletion hwdetect/hwdetect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ while true; do
cur_log=$(ls /dev)
diff --new-line-format=$'--> %l\n' --old-line-format=$'<-- %l\n' --unchanged-group-format='' <(echo "$start_log") <(echo "$cur_log")
start_log=$cur_log
sleep 1
done