Hello Cate, You can remove a driver by unlinking the device node and closing all open references to the driver (provided that the driver properly implements the unlink method.)
nsh> rm /dev/node is one way. Calling unlink() is another. What exactly are you willing to do? Could you please describe your use case? BR, Alan On 11/18/20, Ecaterina FEDORENCO <ecaterina.fedore...@gmail.com> wrote: > Hello all, > > I have a question regarding the device nodes from /dev folder. > > The sequence I execute is the following: > 1. smart_initialize method - creates /dev/smart1d file > > *mtd_part = mtd_partition(mtd, partoffset, (partsize >> 2) * 8); > smart_initialize(1, mtd_part, partname);* > > * mount("/dev/smart1d", "/mnt/smart", "smartfs", 0, NULL);* > 2. ftl_initialize and bchdev_register - create /dev/mtd1 and > /dev/mtdblock1 > > > > > > > *mtd_part2 = mtd_partition(mtd, partoffset, (partsize>>2)*8); > ftl_initialize(1, mtd_part2); snprintf(blockname, 32, > "/dev/mtdblock%d", 1); snprintf(charname, 32, "/dev/mtd%d", > 1); bchdev_register(blockname, charname, false);* > Is there a way to remove the device nodes(files) from /dev folder? > > For the second step I found *int bchdev_unregister(FAR const char > *chardev),* which removes only */dev/mtd1 *node. > For the first step, *unregister_driver() *can be called to remove a device > driver, but I am not sure that these calls are sufficient. > > Thank you, > Cate >