registering/unregistering a device using ioctl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi,
I am a fresh grad and new to the list.
I am writing a char driver that can have multiple devices.
I have two ioctl command -- one will register a device and the other will unregister the device.
The name of the device if also given by the application.
Currently I am able to register and unregister the device and the application can call open, read and write BUT once I unregister the device and then register again, I am not able to do open and write from the application.
Below is my dummy application code:
int main(void)
{
int file_desc;
char *hello = "hello world!";
printf("Before open\n");
file_desc = open("/dev/temp_dev", O_RDWR);
printf("Open OK\n");
write(file_desc, hello, strlen(hello));
close(file_desc);
return 0;
}
My processor hangs after "Open OK" is printed.
Also, I don't see my debug printk's that are in open function of driver under /var/log/messages.


I am adding my devices in a link list and for every open, I am traversing the link list to find the match and then opening it. When I unregister I am removing the node from the link list.

Can anyone give me a clue?
Please let me know if more info is needed.

Thanks a lot
J Kang

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar ? get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/



-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux