LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 10-03-2014, 07:22 PM   #1
EmmanuelJ
LQ Newbie
 
Registered: Oct 2014
Posts: 2

Rep: Reputation: Disabled
SD card autodetect and scan


Hi

I am using linux 2.6.39 and a USB-SD card controller (Ultra Fast Media by Generic). I would like to detect and scan SD card upon instertion even. I googled about it and I could not find a complete solution.

I read about enabling in kernel polling etc. I dont know how to use it for sd card autodetection.

Please let me know. Thanks a lot

Emmanuel
 
Old 10-04-2014, 07:56 PM   #2
aus9
LQ 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

Rep: Reputation: Disabled
kernel polling howto
http://ignorantguru.github.io/spacef...vices-kernpoll

2) What file manager you use and what settings it has.

eg I use thunar from XFCE and go into preferences (=settings) and enable volume management
then in volume management which is linked to either by thunar preferences or xfce settings....removeable drives and media
I have these settings
--hot-plugging enabled
--auto mount removeable media when inserted
--browser media when inserted

good luck
 
Old 10-06-2014, 07:10 PM   #3
EmmanuelJ
LQ Newbie
 
Registered: Oct 2014
Posts: 2

Original Poster
Rep: Reputation: Disabled
SD card autodetect and scan

Thanks aus9 for your reply. The link you provided is more clear on how to enable kernel-polling.

I am harding coding the kernel driver block/genhd.c to enable in-kernel-polling.

In disk_add_events()
ev->disk = disk;
spin_lock_init(&ev->lock);
ev->block = 1;
ev->poll_msecs = 2000;
INIT_DELAYED_WORK(&ev->dwork, disk_events_workfn);

Then I added some prints in disk_events_workfn(), which is called every 2 seconds.
disk_events_workfn() checks for events and strobes a KOBJ_CHANGE event if there is media change.
If I reboot my board without SD card inserted and with the above changes in kernel, I see prints in the disk_events_workfn() every two seconds.

Now here is my problem:
If I reboot my board with SD card inserted and with the above changes in kernel, I see the my SD card is scanned and see prints of its size and partition name sda1... But I dont see my prints in disk_events_workfn(), which may mean the polling is stopped.
Is that normal? once the SD card card is scanned there wont be any more polling? I want the polling to be on, so that it should be rescanned even if I replace it with another SD card or inserted it again.


I am working an embedded platform, and not sure about the filesystem manager.

Thanks again
Emmanuel
 
Old 10-13-2014, 07:17 PM   #4
aus9
LQ 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

Rep: Reputation: Disabled
sorry I have no experience of embedded devices

for me, if I want to swap something in my usb hub card reader I remove the card reader and swap sdcards and re-insert.
its simple but it works for me
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
My brothers MFC j430w printer,prints but won't scan, I'm using xsane scan program , jbander Linux - Hardware 4 08-01-2013 05:04 PM
[SOLVED] Debian - no access points from iwlist wlan0 scan using Broadcom card and b43 module ehrenbrav Linux - Wireless Networking 3 02-28-2010 02:54 PM
Wireless Sis900 network Card iwlist scan not working Arrowx7 Linux - Wireless Networking 7 07-10-2005 01:47 PM
Help with a PCI scan for a video card. vash_stewy Linux - General 1 10-10-2004 02:17 PM
Cannot scan for APs with my card mrboris Linux - Wireless Networking 0 05-18-2004 12:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 11:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration