linux - Use custom driver over an existing driver -
i'm learning how write linux drivers , pick usb stick had laying around. while struggling getting probe function called when plugged in.
what happens probe called when unplug it,or atleast printk inside isn't called until then. disconnect function called. using bind , unbind drivers in /sys/bus/usb/drivers same thing.
may 24 21:09:12 localhost.localdomain kernel: probed may 24 21:09:12 localhost.localdomain kernel: usb 1-2: usb disconnect, device number 16 may 24 21:09:12 localhost.localdomain kernel: discconect usb
if rmmod uas
, rmmod usb-storage
plug in thumb drive works expected. i'm guessing these 2 existing modules causing kind of problem. there way drive use driver on usb-storage? module uas , usb-storage seem come on own.
there 1 driver register device. have unregistered current driver. otherwise device use register driver.
step 1 : run 'lsmode' command display modules loaded in linux kernel. step 2 : run 'modprobe -r <current register driver>' - remove loaded module. setp 3 : run 'insmod <your driver *.ko> - register driver.
now connect device. kernel match device id , if driver has same id. call driver probe.
once done driver , want load previous kernel driver again.
step 1 : run 'rmmod <your driver module>' - remove driver. step 2 : run 'modprobe < privous driver module>' - load previous module.
it'll applicable driver. use command 'sudo' if not in root.
Comments
Post a Comment