IP Library Granted Patent US 9,223,739
Granted Patent B2
US 9,223,739 · App. 13/742,435 · Granted Dec 29, 2015

Detection method and apparatus for hot-swapping of SD card

View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 9,223,739
App. No.
13/742,435
Granted
Dec 29, 2015
Kind
B2
Abstract

A detection method for hot-swapping of a Secure Digital (SD) card is provided. The detection method includes steps of: transmitting an inquiry command to an card reader at a predetermined frequency; receiving a command return message replied in response to the inquiry command; determining whether the SD card is removed or plugged according to the command return message; and detecting a hot-swapping status of the SD card in real-time to provide an accurate status of the SD card for upper-layer applications.

Claims (27)

1. A method for detecting hot-swapping of a Secure Digital (SD) card in a Linux® operating system, comprising:

detecting whether a card reader is plugged to the Linux® operating system;

activating a Linux® operating system kernel mode polling thread corresponding to the card reader on a one-on-one basis and transmitting an inquiry command to the SD card in the card reader at a predetermined frequency when it is detected that the card reader is plugged to the Linux® operating system;

receiving a current command return message replied in response to the inquiry command, wherein the current command return message comprises information indicating whether the SD card is present;

determining whether the SD card has been newly removed or newly plugged in since the prior cycle of said predetermined frequency according to a comparison of a previous command return message and the current command return message;

when the previous command return message indicates the presence of the SD card and the current command return message indicates the absence of the SD card, determining that the SD card is newly removed and clearing information associated with the SD card from the procfs process filesystem and sysfs system filesystem of the Linux® operating system and transmitting KOBJ_REMOVE event through a uevent file; and

when the previous command return message indicates the absence of the SD card and the current command return message indicates the presence of the SD card, determining that the SD card is newly plugged in and recording the information associated with the SD card in the procfs process filesystem and sysfs system filesystem of the Linux® operating system and transmitting a KOBJ_ADD event.

2. The method according to claim 1 , further comprising:

detecting whether the card reader is removed; and

when it is detected that the card reader is removed, destroying the polling thread corresponding to the card reader.

3. The method according to claim 1 , wherein the step of determining the SD card is removed from or plugged to the card reader according to the previous command return message and the current command return message comprises:

when the previous command return message and the current command return message are both information indicative of the presence of the SD card, determining that the SD card is not removed from the card reader; and

when the previous command return message and the current command return message are both information indicative of the absence of the SD card, determining that the SD card is not plugged to the card reader.

4. An apparatus for detecting hot-swapping of an Secure Digital (SD) card in a Linux® operating system, comprising:

a detecting module, for detecting whether a card reader is plugged to the Linux® operating system;

a polling thread activation module, coupled to the detecting module, for activating a polling thread corresponding to the card reader on a one-on-one basis when it is detected that the card reader is plugged to the Linux® operating system;

a transmitting module, for transmitting an inquiry command to the SD card in the card reader at a predetermined frequency when the card reader is plugged to the Linux® operating system;

a receiving module, for receiving a current command return message replied in response to the inquiry command, wherein the current command return message comprises information indicating whether the SD card is present;

a determining module, coupled to the receiving module, for determining whether the SD card has been newly removed or newly plugged in since the prior cycle of said predetermined frequency according to a comparison of a previous command return message and the current command return message; and

an information processing module, coupled to the determining module, for clearing information associated with the SD card from the procfs process filesystem and sysfs system filesystem of the Linux® operating system and transmitting a KOBJ_REMOVE event through a uevent file when it is determined that the SD card is newly removed, and recording the information associated with the SD card in the procfs process filesystem and sysfs system filesystem of the Linux® operating system and transmitting a KOBJ_ADD event when it is determined that the SD card is plugged;

wherein, when a previous command return message indicates a presence of the SD card and the current command return message is information indicates an absence of the SD card, the determining module determines that SD card is newly removed; when the previous command return message indicates the absence of the SD card and the current command return message indicates the presence of the SD card, the determining module determines that the SD card is newly plugged in;

wherein the polling thread is in a kernel mode and has a same lifecycle as a hot-swapping cycle of the card reader.

5. The detection apparatus according to claim 4 , further comprising:

a polling thread destruction module, coupled to the detecting module, for destroying the polling thread corresponding to the card reader when it is detected that the card reader is removed.

6. The apparatus according to claim 4 , wherein when the previous command return message and the current command return message are both information indicative of the presence of the SD card, the detecting module determines that the SD card is not removed from the card reader; and when the previous command return message and the current command return message are both information indicative of the absence of the SD card, the detecting module determines that the SD card is not plugged to the card reader.

7. The apparatus according to claim 4 , further comprising:

a storage module, coupled to the information processing module, for replacing the current command return message with a next command return message for use of a next determination process.

Assignments (2)
MERGER Recorded Jun 8, 2020
From: MSTAR SEMICONDUCTOR, INC.
To: MEDIATEK INC.
Reel/Frame 052871/0833 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jan 16, 2013
From: YU, DE-JUN
To: MSTAR SEMICONDUCTOR, INC.
Reel/Frame 029636/0631 →