Medium change detection

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

 



Hello,
I am a developer of the Rockbox project and I am facing an issue
related to how medium are handled in SCSI. I don't know if this is a
Rockbox and/or kernel issue, or just a mistunderstanding of the
specification. I tried with many kernel version between 2.6.38 and
3.11.

I have a device with a micro-sd port and which get reported as a
removable LUN. If the micro-sd is initially inserted, TEST UNIT READY
will report Good and the kernel will probe capacity and everything
works.
If I remove the micro-sd (without ejecting on the host before),
nothing happen until the host tries to read/write at which point it
will:
- on old kernel versions: error out and mark the medium as not present
- on recent kernel versions: error out, notify capacity change to 0
and mark medium as not present

Here is my first question: the old kernel versions used to send TEST
UNIT READY all the time, so why isn't the media change notified until
I actually try to read/write it ? On newer kernel versions, TEST UNIT
READY is only sent before read/write, why was this behaviour changed
(and when ?) and has the kernel any way to get notified immediately on
eject ?

At that point, if I insert my micro-sd again, nothing happen on the
host side, both on old and recent kernels, no capacity change, no
medium change. If I try to read/write, I always get a "No medium
present" error even though the medium is present. This is puzzling for
two reasons:
- on old kernel versions: since the kernel sends TEST UNIT READY all
the time, is has the capacity to detect insertion when LUN becomes
Good again ?
- on recent kernel versions: since TEST UNIT READY is not sent and the
scsi layer somehow caches the medium state, is there any way for the
kernel to actually detect that the medium is back ?

Finally I should note that this behaviour is not Rockbox specific,
even with the vendor implementation of Mass Storage, this problem
arises. I am thus wondering if this the expected behaviour, because
the device reports the LUN as removable so I assumed that removable
meant both remove and insert !

Thanks for your time

Amaury Pouly
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux