<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>i.MX Processors中的主题 USB SD Card detect insertion?</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/USB-SD-Card-detect-insertion/m-p/352698#M49113</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;Hi folks,&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt; &lt;SPAN style="font-size: 11pt; line-height: 1.5em;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;I have a USB SD card reader on an i.MX6, running Android.&amp;nbsp; I am trying to get the kernel to detect when a card is inserted.&amp;nbsp; Right now, it properly detects the card only if it is plugged in before the USB reader is plugged into the system.&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;I have tested the behavior on multiple PCs, and the USB SD card reader behaves as expected.&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;In Android, mounting is controlled by vold.&amp;nbsp; vold appears to be working correctly, so I enabled extra logs so I see all netlink/uevents that are produced.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;When I plug in the reader, /sys/class/block/sda shows up regardless of if a device is in it—that is expected.&amp;nbsp; Then, when I insert a card, I get no uevent.&amp;nbsp; I echoed 2000 into /sys/module/block/parameters/events_dfl_poll_msecs, and now when I insert a card (and wait about 2 seconds), I get an event:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;DEVPATH=/devices/blah/blah/blah/block/sda&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;DISK_MEDIA_CHANGE=1&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;MAJOR=8&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;MINOR=32&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;DEVNAME=sda&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;DEVTYPE=disk&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;NPARTS=0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;There are no further events after that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;All of that looks fine, except… NPARTS=0!?!?!&amp;nbsp; The card has one partition, and if I unplug the reader, insert the card into the reader, and plug the reader in, I get&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;DEVPATH=/devices/blah/blah/blah/block/sda&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;MAJOR=8&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;MINOR=32&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;DEVNAME=sda&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;DEVTYPE=disk&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;NPARTS=1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;I expect additional events, like a block-&amp;gt;disk event and a block-&amp;gt;partition event after block-&amp;gt;DISK_MEDIA_CHANGE.&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;&lt;SPAN style="font-size: 11pt; text-indent: -0.25in; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;&lt;SPAN style="font-size: 11pt; text-indent: -0.25in; line-height: 1.5em;"&gt;Is this something I need to configure?&amp;nbsp; If not, if this is something that is simply not supported, I believe I need to set it up so that on DISK_MEDIA_CHANGE, the kernel also rescans for partitions.&amp;nbsp; Any thoughts on where to do it?&amp;nbsp; I see code like that in block/sd.c, fs/block_dev.c, and fs/genhd.c.&amp;nbsp; (A USB SD card reader touches lots of parts of the kernel!)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 26 Oct 2014 15:50:24 GMT</pubDate>
    <dc:creator>adamwolf</dc:creator>
    <dc:date>2014-10-26T15:50:24Z</dc:date>
    <item>
      <title>USB SD Card detect insertion?</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/USB-SD-Card-detect-insertion/m-p/352698#M49113</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;Hi folks,&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt; &lt;SPAN style="font-size: 11pt; line-height: 1.5em;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;I have a USB SD card reader on an i.MX6, running Android.&amp;nbsp; I am trying to get the kernel to detect when a card is inserted.&amp;nbsp; Right now, it properly detects the card only if it is plugged in before the USB reader is plugged into the system.&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;I have tested the behavior on multiple PCs, and the USB SD card reader behaves as expected.&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;In Android, mounting is controlled by vold.&amp;nbsp; vold appears to be working correctly, so I enabled extra logs so I see all netlink/uevents that are produced.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;When I plug in the reader, /sys/class/block/sda shows up regardless of if a device is in it—that is expected.&amp;nbsp; Then, when I insert a card, I get no uevent.&amp;nbsp; I echoed 2000 into /sys/module/block/parameters/events_dfl_poll_msecs, and now when I insert a card (and wait about 2 seconds), I get an event:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;DEVPATH=/devices/blah/blah/blah/block/sda&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;DISK_MEDIA_CHANGE=1&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;MAJOR=8&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;MINOR=32&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;DEVNAME=sda&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;DEVTYPE=disk&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;NPARTS=0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;There are no further events after that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;All of that looks fine, except… NPARTS=0!?!?!&amp;nbsp; The card has one partition, and if I unplug the reader, insert the card into the reader, and plug the reader in, I get&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;DEVPATH=/devices/blah/blah/blah/block/sda&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;MAJOR=8&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;MINOR=32&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;DEVNAME=sda&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;DEVTYPE=disk&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;NPARTS=1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;I expect additional events, like a block-&amp;gt;disk event and a block-&amp;gt;partition event after block-&amp;gt;DISK_MEDIA_CHANGE.&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;&lt;SPAN style="font-size: 11pt; text-indent: -0.25in; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;&lt;SPAN style="font-size: 11pt; text-indent: -0.25in; line-height: 1.5em;"&gt;Is this something I need to configure?&amp;nbsp; If not, if this is something that is simply not supported, I believe I need to set it up so that on DISK_MEDIA_CHANGE, the kernel also rescans for partitions.&amp;nbsp; Any thoughts on where to do it?&amp;nbsp; I see code like that in block/sd.c, fs/block_dev.c, and fs/genhd.c.&amp;nbsp; (A USB SD card reader touches lots of parts of the kernel!)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 11pt; font-family: Calibri, sans-serif; color: #000000;"&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Oct 2014 15:50:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/USB-SD-Card-detect-insertion/m-p/352698#M49113</guid>
      <dc:creator>adamwolf</dc:creator>
      <dc:date>2014-10-26T15:50:24Z</dc:date>
    </item>
    <item>
      <title>Re: USB SD Card detect insertion?</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/USB-SD-Card-detect-insertion/m-p/352699#M49114</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think the problem you are having it is in the USB more than in the SD Card drvier itself, do you have a Log, so we can review how the device it is enumerated, do you have an schematic of the USB part to see how is the OTG or it is in a FSL board?,&amp;nbsp; If you can use a USB Sniffer to see what it is happening when you plug the SD would be great.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Nov 2014 17:09:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/USB-SD-Card-detect-insertion/m-p/352699#M49114</guid>
      <dc:creator>jamesbone</dc:creator>
      <dc:date>2014-11-04T17:09:34Z</dc:date>
    </item>
  </channel>
</rss>

