OSDN Git Service

Treat removable UFS card as SD card
authorSubhash Jadavani <subhashj@codeaurora.org>
Thu, 6 Jul 2017 22:53:24 +0000 (15:53 -0700)
committerMichael Bestas <mkbestas@lineageos.org>
Sun, 23 Sep 2018 23:23:52 +0000 (02:23 +0300)
Removable UFS cards are alternative to SD cards and they are detected as
SCSI block devices. Currently these cards shows up "USB disk" as we
consider anything other than SD card as USB disks. As both UFS cards
and USB disks are SCSI block devices, we can't differentiate between
USB disks and UFS cards by MAJOR number of block device. This change
looks for "ufs" string in DEVPATH parameter of uevent to detect if it
is UFS card or not and treat it as SD card.

Change-Id: I88534190d0610ced515c8c3e53aaae1a49480fbf

VolumeManager.cpp

index 38b986b..58da887 100644 (file)
@@ -195,11 +195,12 @@ void VolumeManager::handleBlockEvent(NetlinkEvent *evt) {
     case NetlinkEvent::Action::kAdd: {
         for (const auto& source : mDiskSources) {
             if (source->matches(eventPath)) {
-                // For now, assume that MMC and virtio-blk (the latter is
-                // emulator-specific; see Disk.cpp for details) devices are SD,
-                // and that everything else is USB
+                // For now, assume that MMC, virtio-blk (the latter is
+                // emulator-specific; see Disk.cpp for details) and UFS card
+                // devices are SD, and that everything else is USB
                 int flags = source->getFlags();
                 if (major == kMajorBlockMmc
+                    || (eventPath.find("ufs") != std::string::npos)
                     || (android::vold::IsRunningInEmulator()
                     && major >= (int) kMajorBlockExperimentalMin
                     && major <= (int) kMajorBlockExperimentalMax)) {