LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-13-2007, 03:01 PM   #1
m_pahlevanzadeh
Member
 
Registered: Sep 2002
Location: Iran/Tehran
Distribution: Debian
Posts: 94

Rep: Reputation: 28
DVD device detectort


Dear all,
I wrote a script that it detect my DVD devices.But i have problem when i have more one devices.
Suppose my script founds two dvd devices for example : /dev/hdc & /dev/hdd
How i understand which device consists of DVD.Because my program need to play DVD.my script must knows which device is ready for now.It mean that which device has a DVD-ROM without eject & put a DVDROM.
Please help me....
 
Old 11-13-2007, 07:57 PM   #2
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 361Reputation: 361Reputation: 361Reputation: 361
It would probably help if you posted the script. Not really much anyone can do to help you improve it if we can't see it.
 
Old 11-13-2007, 11:06 PM   #3
m_pahlevanzadeh
Member
 
Registered: Sep 2002
Location: Iran/Tehran
Distribution: Debian
Posts: 94

Original Poster
Rep: Reputation: 28
It's my code:
PHP Code:
#!/bin/bash
###################Written By "Mohsen Pahlevanzadeh" <mohsen@pahlevanzadeh.org> ###########################
        
export parent="/proc/ide";
        
export loop0=0;
        
export loop1=0;
        
export flag=0;
        
cd  ${parent}
        for 
parent_loop0 in `ls`
        do

                
#echo $parent_loop;
                
if [ ! -"$parent_loop0] && [ "$parent_loop0!= "drivers" ]
                
then
                        let $loop0
+1;
                        
cd $parent/$parent_loop0;
                        for 
parent_loop1 in `ls`
                        do

                                if [ 
"$parent_loop1!= "channel" ] && [ "$parent_loop1!= "mate" ] && [ "$parent_loop1!= "model" ]
                                
then 

                                        grep 
"DVD" $parent/$parent_loop0/$parent_loop1/model
                                        
if [ "$?" -eq "0" ] ;then
                                                let $loop1
+1;
                                                if [ 
"$flag-eq "0" ] ;then
                                                        mkdir 
-/tmp/dvdplayer;
                                                        
export flag=1;
                                                
fi;

                                                
ln -s  /dev/$parent_loop1 /tmp/dvdplayer/DVDPlayer$loop1 ;

                                        
fi;#end of $? if
                                         
                                
fi;#end of parent_loops if
                        
done
                fi
;#end of $parent_loop0 if
        
done #main loop 
 
  


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
mount as a device: mount dvd-iso file in /dev/dvd sadarax Linux - General 21 02-02-2011 11:59 PM
How does Slackware know which device is my DVD? Lufbery Slackware 6 11-25-2006 09:56 PM
CD and DVD device probelms. n6Mycro Linux - General 4 12-03-2004 07:11 PM
Coudn't open DVD device: /dev/dvd eboggess Linux - Laptop and Netbook 3 10-18-2003 06:02 PM
DVD device not detected sumanjay Slackware 1 07-23-2003 09:24 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:37 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