I'm on FreeBSD11. I want to get all devices that connect to my system and save their information with c++. for this reason I run camcontrol devlist
command. The output is:
<OCZ-VERTEX4 1.4.1.3> at scbus0 target 0 lun 0 (pass0,ada0)
<OCZ-AGILITY3 2.15> at scbus0 target 1 lun 0 (pass1,ada1)
<OCZ-AGILITY3 2.15> at scbus1 target 0 lun 0 (pass2,ada2)
<OCZ-AGILITY3 2.15> at scbus1 target 1 lun 0 (pass3,ada3)
<OCZ-AGILITY3 2.15> at scbus3 target 0 lun 0 (pass4,ada4)
< USB FLASH DRIVE PMAP> at scbus4 target 0 lun 0 (da0,pass5)
I put this output in a file, with getline
in c++, only get the line from at scbus0 target 0 lun 0 (pass0,ada0) and ignore first part.
I want to get ada0,ada1,ada2,ada3,ada4,da0 then with /usr/local/sbin/smartctl -i /dev/<device>
get it's information and for other like da0,cd0,... that won't have output in this command save their name.
I'm not sure if this is a good way or not. Please give me a better solution if exist, or help me to solve my problem.