CN1877550A - Method for implementing real-time hot-plug of USB memory under TV embedded Linux system - Google Patents
Method for implementing real-time hot-plug of USB memory under TV embedded Linux system Download PDFInfo
- Publication number
- CN1877550A CN1877550A CN 200610032841 CN200610032841A CN1877550A CN 1877550 A CN1877550 A CN 1877550A CN 200610032841 CN200610032841 CN 200610032841 CN 200610032841 A CN200610032841 A CN 200610032841A CN 1877550 A CN1877550 A CN 1877550A
- Authority
- CN
- China
- Prior art keywords
- storage device
- usb storage
- partition
- linux system
- real
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Landscapes
- Debugging And Monitoring (AREA)
Abstract
本发明涉及嵌入式操作系统领域,尤其是涉及一种在电视机嵌入式Linux系统下实时进行USB存储设备热拔插的方法。该方法的改进之处在于在核心程序与应用级程序之间创建一个守护进程,使应用级程序实时了解USB存储设备的连接情况,并根据USB存储设备插入或拔出情况进行分区自动挂载或分区卸载。该方法简单实用,不破坏内核完整性,且响应速度快,维护调试成本大大降低。在USB存储设备拔出后,不出现数据损坏。同时,提高了Linux系统的实时性。
The invention relates to the field of embedded operating systems, in particular to a method for real-time hot swapping of USB storage devices under the embedded Linux system of a TV set. The improvement of this method is to create a daemon process between the core program and the application-level program, so that the application-level program can understand the connection status of the USB storage device in real time, and automatically mount or partition the partition according to the insertion or removal of the USB storage device. The partition is unmounted. The method is simple and practical, does not destroy the integrity of the kernel, has fast response speed, and greatly reduces maintenance and debugging costs. No data corruption occurs after the USB storage device is pulled out. At the same time, the real-time performance of the Linux system is improved.
Description
技术领域technical field
本发明涉及嵌入式操作系统领域,尤其是涉及一种在电视机嵌入式Linux系统下实时进行USB存储设备热拔插的方法。The invention relates to the field of embedded operating systems, in particular to a method for real-time hot swapping of USB storage devices under a television embedded Linux system.
背景技术Background technique
采用USB接口的产品不能在它正在工作时进行拔插,特别是对USB移动存贮设备,可能损坏其中的数据,一般只有格式化后才能重新使用。另外不能在短时间内频繁拔插闪盘,因为当把产品插入USB接口后,系统需要一定时间,才能作出反应,而马上又把它拔下来,则很有可能造成系统错误。Products using the USB interface cannot be plugged in while it is working, especially for USB mobile storage devices, which may damage the data in it, and generally can only be reused after formatting. In addition, the flash drive should not be plugged and unplugged frequently in a short period of time, because when the product is plugged into the USB port, the system needs a certain time to respond, and if it is pulled out immediately, it is likely to cause a system error.
对于嵌入式Linux系统,这个问题尤其突出。在嵌入式Linux中,内核和设备支持都删减了许多;并且在嵌入式Linux中,针对USB存储设备并没有一套完整的热拔插和挂载机制。要建立这样一套机制,可以在内核中进行修改,不过这样修改技术难度较大,且不能保证内核完整性。For embedded Linux systems, this problem is particularly prominent. In embedded Linux, the kernel and device support are greatly reduced; and in embedded Linux, there is no complete hot-plug and mount mechanism for USB storage devices. To establish such a mechanism, modifications can be made in the kernel, but such modifications are technically difficult and cannot guarantee the integrity of the kernel.
发明内容Contents of the invention
本发明的目的在于提供一种在电视机嵌入式Linux系统下实时进行USB存储设备热拔插的方法。The purpose of the present invention is to provide a method for real-time hot swapping of USB storage devices under the embedded Linux system of the TV set.
本发明的目的是由以下技术方案实现的:这种电视机嵌入式Linux系统下USB存储设备实现实时热拔插的方法,其改进之处在于在核心程序与应用级程序之间创建一个守护进程,使应用级程序实时了解USB存储设备的连接情况,该方法包括:The object of the present invention is achieved by the following technical solutions: the method for realizing real-time hot plugging of USB storage devices under the embedded Linux system of this TV set is improved in that a daemon process is created between the core program and the application-level program , so that the application-level program can know the connection status of the USB storage device in real time, and the method includes:
当守护进程发现USB存储设备插入时,检查是否为存储设备;When the daemon finds that the USB storage device is plugged in, check whether it is a storage device;
若是,检查USB存储设备分区情况;If yes, check the partition status of the USB storage device;
根据分区情况挂载分区;Mount the partition according to the partition situation;
挂载完成后,向应用级程序发送成功信;After the mount is complete, send a success letter to the application-level program;
当守护进程发现挂载好的USB存储设备拔出时,发出警告信息给应用级程序;When the daemon finds that the mounted USB storage device is unplugged, it sends a warning message to the application-level program;
根据USB存储设备拔出情况进行分区卸载。Unmount partitions based on the removal of the USB storage device.
上述电视机嵌入式Linux系统下USB存储设备实现实时热拔插的方法,所述的守护进程独立于控制终端并且周期性地执行某种任务或等待处理某些发生的事件;其监测点可以是/proc/scsi/usb-storage目录下的数字文件,具体监测周期设定为秒级。The above-mentioned method for real-time hot-swapping of a USB storage device under the embedded Linux system of a TV set, the described daemon process is independent of the control terminal and periodically executes certain tasks or waits to process certain events that occur; its monitoring point can be For the digital files in the /proc/scsi/usb-storage directory, the specific monitoring period is set at the second level.
上述电视机嵌入式Linux系统下USB存储设备实现实时热拔插的方法,根据分区情况进行挂载分区时,采用同步写入的挂载方法。The method for realizing real-time hot plugging of the USB storage device under the embedded Linux system of the TV set mentioned above adopts the method of synchronous writing when mounting the partition according to the partition situation.
通过该方法可以在电视机嵌入式Linux系统下实时进行USB存储设备热拔插,而不会出现数据丢失的情况。该方法简单实用,不破坏内核完整性,而且响应速度快。由于不修改内核,维护调试成本大大降低。同时,提高了Linux的实时性。By means of the method, the USB storage device can be hot-swapped in real time under the embedded Linux system of the television without data loss. The method is simple and practical, does not destroy the integrity of the kernel, and has a fast response speed. Since the kernel is not modified, maintenance and debugging costs are greatly reduced. At the same time, the real-time performance of Linux is improved.
附图说明Description of drawings
图1为本发明的方法流程图。Fig. 1 is a flow chart of the method of the present invention.
具体实施方式Detailed ways
下面结合附图对本发明作进一步详细说明:Below in conjunction with accompanying drawing, the present invention is described in further detail:
请参阅图1所示,本发明在电视机嵌入式Linux上实时进行USB存储设备热拔插的方法是利用嵌入式Linux中守护进程(Daemon)来监视USB存储设备的拔插情况,并反馈给应用层的程序,由应用级程序来控制USB存储设备的挂载和卸载,从而实现实时的热拔插方法。Please refer to shown in Fig. 1, the method that the present invention carries out USB storage device hot plugging in real time on TV embedded Linux is to utilize daemon process (Daemon) in embedded Linux to monitor the plugging and unplugging situation of USB storage device, and feeds back to The program of the application layer is used to control the mounting and unmounting of the USB storage device by the application-level program, so as to realize the real-time hot plugging method.
首先创建一个Linux的守护进程(Daemon),让其不断监测USB设备的拔插情况。守护进程(Daemon)是运行在后台的一种特殊进程。它独立于控制终端并且周期性地执行某种任务或等待处理某些发生的事件。其监测点可以是/proc/scsi/usb-storage-?目录下的数字文件,具体监测周期可以视应用复杂度来决定,这里设定为秒级。First create a Linux daemon (Daemon), let it constantly monitor the plugging and unplugging of the USB device. Daemon is a special process running in the background. It is independent of the controlling terminal and periodically performs some task or waits for some event to occur. Its monitoring point can be /proc/scsi/usb-storage-? For the digital files in the directory, the specific monitoring period can be determined according to the complexity of the application, and it is set to the second level here.
当守护进程发现有USB设备插入时,就会检查是否为存储设备,若是,则检查设备的分区情况。同时,根据分区的情况进行挂载分区。挂载完成后,向其它的应用层的程序发送一条消息,以便其它程序进行处理。当根据分区情况进行挂载分区时,本方法采用了“同步写入”的挂载方法,使其写入缓存失效。这样做会降低一些性能,但是,由于USB存储设备速度快,且在读出时缓存仍有效,所以其性能降低不明显,却能显著提升其稳定性,在突然掉电、写入过程中拔出均能保证写入的可靠性。When the daemon process finds that a USB device is plugged in, it will check whether it is a storage device, and if so, check the partition status of the device. At the same time, mount the partition according to the situation of the partition. After the mounting is completed, send a message to other application layer programs so that other programs can process it. When the partition is mounted according to the partition situation, this method adopts the "synchronous write" mounting method to invalidate the write cache. Doing so will reduce some performance. However, because the USB storage device is fast and the cache is still valid when reading out, its performance is not significantly reduced, but its stability can be significantly improved. Both outputs can guarantee the reliability of writing.
当守护进程发现有挂载好的USB设备拔出时,会立即发出警告信息给应用层的程序,并从系统中删除挂载点。由于挂载时采用同步写入方式,突然的拔出不会给系统带来任何危害。When the daemon process finds that a mounted USB device is pulled out, it will immediately send a warning message to the application layer program and delete the mount point from the system. Since the synchronous writing method is adopted when mounting, sudden unplugging will not bring any harm to the system.
Claims (3)
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB2006100328416A CN100481040C (en) | 2006-01-13 | 2006-01-13 | Method for implementing real-time hot-plug of USB memory under TV embedded Linux system |
HK07103716.0A HK1096176B (en) | 2007-04-10 | A real-time plug in/out method of a usb device in an embedded linux system of a television |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB2006100328416A CN100481040C (en) | 2006-01-13 | 2006-01-13 | Method for implementing real-time hot-plug of USB memory under TV embedded Linux system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN1877550A true CN1877550A (en) | 2006-12-13 |
CN100481040C CN100481040C (en) | 2009-04-22 |
Family
ID=37509991
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CNB2006100328416A Expired - Fee Related CN100481040C (en) | 2006-01-13 | 2006-01-13 | Method for implementing real-time hot-plug of USB memory under TV embedded Linux system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN100481040C (en) |
Cited By (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101790052A (en) * | 2010-03-16 | 2010-07-28 | 青岛海信电器股份有限公司 | Method for realizing television USB Widget and television |
CN101847101A (en) * | 2009-03-24 | 2010-09-29 | Tcl集团股份有限公司 | Method for automatically mounting USB storage device under embedded Linux |
WO2011032453A1 (en) * | 2009-09-16 | 2011-03-24 | 研祥智能科技股份有限公司 | Compact peripheral component interconnection(cpci) hot swap system |
US7970974B2 (en) | 2007-11-29 | 2011-06-28 | International Business Machines Corporation | Method and system for adding or removing a logical unit of a USB mass storage device |
CN102411554A (en) * | 2011-08-09 | 2012-04-11 | Tcl集团股份有限公司 | USB storage device hot plug method, device and terminal device |
CN102455981A (en) * | 2010-10-19 | 2012-05-16 | 康佳集团股份有限公司 | Method for realizing hot plug of USB device based on QTE environment |
CN102866964A (en) * | 2012-09-18 | 2013-01-09 | 北京奇虎科技有限公司 | Method and device for protecting data on storage equipment |
CN103530124A (en) * | 2013-10-18 | 2014-01-22 | 中安消技术有限公司 | Method and device for sharing hot plug device in Linux system |
CN104461489A (en) * | 2013-09-22 | 2015-03-25 | 安一恒通(北京)科技有限公司 | Method and device for quickly popping up removable device and user device |
CN104700048A (en) * | 2012-09-18 | 2015-06-10 | 北京奇虎科技有限公司 | Method and device for protecting data on storage equipment |
CN104734979A (en) * | 2015-04-07 | 2015-06-24 | 北京极科极客科技有限公司 | Control method for storage device externally connected with router |
CN105589657A (en) * | 2014-10-23 | 2016-05-18 | 中兴通讯股份有限公司 | Method and device for realizing mounting of mobile storage |
CN106598798A (en) * | 2016-12-19 | 2017-04-26 | 四川长虹电器股份有限公司 | Method of Android intelligent device to detect USB device |
CN107831534A (en) * | 2017-12-15 | 2018-03-23 | 合肥国为电子有限公司 | Untethered memory-type seismic detector data acquisition device and method based on USB flash disk interaction |
CN118170443A (en) * | 2024-03-20 | 2024-06-11 | 苏州西默医疗科技有限公司 | U disk automatic identification and formatting method and system based on embedded system |
-
2006
- 2006-01-13 CN CNB2006100328416A patent/CN100481040C/en not_active Expired - Fee Related
Cited By (20)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7970974B2 (en) | 2007-11-29 | 2011-06-28 | International Business Machines Corporation | Method and system for adding or removing a logical unit of a USB mass storage device |
CN101847101A (en) * | 2009-03-24 | 2010-09-29 | Tcl集团股份有限公司 | Method for automatically mounting USB storage device under embedded Linux |
WO2011032453A1 (en) * | 2009-09-16 | 2011-03-24 | 研祥智能科技股份有限公司 | Compact peripheral component interconnection(cpci) hot swap system |
CN101790052A (en) * | 2010-03-16 | 2010-07-28 | 青岛海信电器股份有限公司 | Method for realizing television USB Widget and television |
CN102455981A (en) * | 2010-10-19 | 2012-05-16 | 康佳集团股份有限公司 | Method for realizing hot plug of USB device based on QTE environment |
CN102411554B (en) * | 2011-08-09 | 2015-04-29 | Tcl集团股份有限公司 | Hot-plugging method, apparatus and terminal device for USB (universal serial bus) storage devices |
CN102411554A (en) * | 2011-08-09 | 2012-04-11 | Tcl集团股份有限公司 | USB storage device hot plug method, device and terminal device |
CN102866964B (en) * | 2012-09-18 | 2015-06-03 | 北京奇虎科技有限公司 | Method and device for protecting data on storage equipment |
CN102866964A (en) * | 2012-09-18 | 2013-01-09 | 北京奇虎科技有限公司 | Method and device for protecting data on storage equipment |
CN104700048A (en) * | 2012-09-18 | 2015-06-10 | 北京奇虎科技有限公司 | Method and device for protecting data on storage equipment |
CN104700048B (en) * | 2012-09-18 | 2018-03-16 | 北京奇虎科技有限公司 | The method and device of data in a kind of protection storage device |
CN104461489A (en) * | 2013-09-22 | 2015-03-25 | 安一恒通(北京)科技有限公司 | Method and device for quickly popping up removable device and user device |
CN103530124A (en) * | 2013-10-18 | 2014-01-22 | 中安消技术有限公司 | Method and device for sharing hot plug device in Linux system |
CN103530124B (en) * | 2013-10-18 | 2017-01-25 | 中安消技术有限公司 | Method and device for sharing hot plug device in Linux system |
CN105589657A (en) * | 2014-10-23 | 2016-05-18 | 中兴通讯股份有限公司 | Method and device for realizing mounting of mobile storage |
CN104734979A (en) * | 2015-04-07 | 2015-06-24 | 北京极科极客科技有限公司 | Control method for storage device externally connected with router |
CN106598798A (en) * | 2016-12-19 | 2017-04-26 | 四川长虹电器股份有限公司 | Method of Android intelligent device to detect USB device |
CN106598798B (en) * | 2016-12-19 | 2019-11-19 | 四川长虹电器股份有限公司 | The method of Android intelligent equipment detection USB device |
CN107831534A (en) * | 2017-12-15 | 2018-03-23 | 合肥国为电子有限公司 | Untethered memory-type seismic detector data acquisition device and method based on USB flash disk interaction |
CN118170443A (en) * | 2024-03-20 | 2024-06-11 | 苏州西默医疗科技有限公司 | U disk automatic identification and formatting method and system based on embedded system |
Also Published As
Publication number | Publication date |
---|---|
HK1096176A1 (en) | 2007-05-25 |
CN100481040C (en) | 2009-04-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN100481040C (en) | Method for implementing real-time hot-plug of USB memory under TV embedded Linux system | |
US9146684B2 (en) | Storage architecture for server flash and storage array operation | |
US8380678B2 (en) | Tracking files which have been processed by a backup or a restore operation | |
US8892831B2 (en) | Memory subsystem hibernation | |
US10296593B2 (en) | Managing storage system metadata during data migration | |
CN104838365A (en) | Methods and systems for provisioning bootable image on to external drive | |
US20060136654A1 (en) | Method and computer program product to increase I/O write performance in a redundant array | |
JP2014154155A (en) | Method and system for reducing write latency in data storage system by using command-push model | |
WO2014190806A1 (en) | Application backup and restore | |
US20120102279A1 (en) | Preserving a deleted data volume | |
US20120054539A1 (en) | Computing device and restarting method of the computing device | |
US11868625B2 (en) | Alert tracking in storage | |
US10831657B2 (en) | Debug data recovery after PLI event | |
CN108170620A (en) | A kind of server hard disk extension system and method, hard disk signal enhancing method | |
CN108009101A (en) | A kind of solid state hard disc powered-off fault processing method, system, medium and equipment | |
CN107807791A (en) | A kind of hard disc of computer sequence binding method and system | |
CN105700817A (en) | Just Bunch of Discs JBOD apparatus | |
US9836359B2 (en) | Storage and control method of the same | |
CN1873632A (en) | Hot-swappable peripheral device identification system and method thereof | |
CN117131014A (en) | Database migration method, device, equipment and storage medium | |
CN102156529A (en) | Hard Disk Power Saving Method and Hard Disk Power Saving Device | |
US9128873B2 (en) | Memory bus attached input/output (‘I/O’) subsystem management in a computing system | |
US8554995B2 (en) | Connecting a storage subsystem and an electronic device with a control device that hides details of the storage subsystem | |
CN114968297A (en) | OTA (over the air) upgrading method, electronic equipment and chip system | |
CN101046781A (en) | Apparatus for bridging a host to a storage area network |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
REG | Reference to a national code |
Ref country code: HK Ref legal event code: DE Ref document number: 1096176 Country of ref document: HK |
|
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
REG | Reference to a national code |
Ref country code: HK Ref legal event code: GR Ref document number: 1096176 Country of ref document: HK |
|
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20090422 Termination date: 20160113 |