>As per my understanding of your question is, like if user want to open >the application and driver is not yet loaded and how to convey message >to the user. Open function should take and provide appropriate message >to the application and it can be done thru ioctl also (Please correct me >if I'm wrong).
Actually, you don't/not suppose to have an ioctl doing this, kernel will take care with the open call itself. Think about any user using standard usb app where your custom IOCTL return a value which cannot be interpreted by the application. The open call return value carries enough number error codes through which the user application can interpret what exactly the error is. Does it make sense? Iqbal -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Thursday, October 27, 2005 12:58 AM To: [EMAIL PROTECTED]; [email protected] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [linux-usb-devel] Device surprise removal-kernel panic Hi Savitha, Even I faced same problem while disconnecting the device and what Mr Alan said is absolutely fine and we should follow the same. But, before freeing the device structure, make sure that open count is initialized to 0 and whether this particular device is opened, if so you need to free this device otherwise you don't have to free the device structure just disconnect will work. I hope you understand this. As per my understanding of your question is, like if user want to open the application and driver is not yet loaded and how to convey message to the user. Open function should take and provide appropriate message to the application and it can be done thru ioctl also (Please correct me if I'm wrong). Regards, Shalini -----Original Message----- From: Savita H. Neelannava [mailto:[EMAIL PROTECTED] Sent: Thursday, October 27, 2005 9:54 AM To: [email protected] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; Shalini Rao (WT01 - Voice & Next Generation Networks) Subject: RE: [linux-usb-devel] Device surprise removal-kernel panic Hi All, As Mr.Alan Suggested there was one resource freeing which was still in use by Application. That is Driver Specific structure, which is soted in file->private_data in open system call. When disconnected was called i was freeing this structure also which i think i should not free. Because Even though device is disconnected application does not know about it yet. So it may call further system calls on it, like read, write, ioctl... In those function the first usual step we do is ... struct scanner_dev *dev; dev = (struct scanner_dev *)file->private_data; if(!dev) // or if(!dev->device_present) return -EBADF; As soon as i free this dev structure in disconnect, there was kernel panic!!! ( Correct me if i am wrong) One question: What if probe function fails for some reason n user do insmod driver.ko... User doesn't understand any printk's of driver n tries to open application n fail. Is there anyway to tell him or notify him not to do that( other than printing some Msg to console)? this may be very silly question but plz ans me... Thanks alot for inputs Savita ------------------------------------------------------- This SF.Net email is sponsored by the JBoss Inc. Get Certified Today * Register for a JBoss Training Course Free Certification Exam for All Training Attendees Through End of 2005 Visit http://www.jboss.com/services/certification for more information _______________________________________________ [email protected] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel ------------------------------------------------------- This SF.Net email is sponsored by the JBoss Inc. Get Certified Today * Register for a JBoss Training Course Free Certification Exam for All Training Attendees Through End of 2005 Visit http://www.jboss.com/services/certification for more information _______________________________________________ [email protected] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
