Dear Sir,

I am a Linux developer. My application code reads sectors from an USB
floppy.

While testing this code, I noticed that if I start the application and after
doing some read calls if I remove the cable of USB floppy from the drive,
then read system call never returns. When I take "ps -efl" listing for that
process, the state column shows "D", uninterruptible sleep. After a while
complete machine freezes and I need to reboot the machine by pressing power
switch.

May you please guide me, how can I avoid this read() system call to go into
this state?

I tried doing the same thing with USB CD drive, but in that read system call
did not block, rather it came out and reported an error.

Also, I tried to use O_NONBLOCK flag while opening the device with open(),
but still read blocks and problem persists.

Please guide on this. I perceive that driver should have the capability to
detect whether the device has been removed, while performing syscalls such
as read, write, etc.

Please let me know your views on this.

Thanks and Best Regards,
Ganesh Borse




-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users

Reply via email to