mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-17 17:12:39 -05:00
On linux, guess the mount point for ipods (tested) and sansas (untested).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13653 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
eb3e102d08
commit
5547c13b42
1 changed files with 37 additions and 1 deletions
|
|
@ -435,6 +435,29 @@ void DeviceSelectorCtrl::OnAutoDetect(wxCommandEvent& event)
|
||||||
AutoDetect();
|
AutoDetect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !(defined( __WXMSW__ ) || defined( __DARWIN__))
|
||||||
|
wxString resolve_mount_point( const wxString device )
|
||||||
|
{
|
||||||
|
FILE *fp = fopen( "/proc/mounts", "r" );
|
||||||
|
if( !fp ) return wxT("");
|
||||||
|
char *dev, *dir;
|
||||||
|
while( fscanf( fp, "%as %as %*s %*s %*s %*s", &dev, &dir ) != EOF )
|
||||||
|
{
|
||||||
|
if( wxString( dev, wxConvUTF8 ) == device )
|
||||||
|
{
|
||||||
|
wxString directory = wxString( dir, wxConvUTF8 );
|
||||||
|
free( dev );
|
||||||
|
free( dir );
|
||||||
|
return directory;
|
||||||
|
}
|
||||||
|
free( dev );
|
||||||
|
free( dir );
|
||||||
|
}
|
||||||
|
fclose( fp );
|
||||||
|
return wxT("");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void DeviceSelectorCtrl::AutoDetect()
|
void DeviceSelectorCtrl::AutoDetect()
|
||||||
{
|
{
|
||||||
struct ipod_t ipod;
|
struct ipod_t ipod;
|
||||||
|
|
@ -445,6 +468,12 @@ void DeviceSelectorCtrl::AutoDetect()
|
||||||
int index = gv->plat_bootloadername.Index(temp); // use the bootloader names..
|
int index = gv->plat_bootloadername.Index(temp); // use the bootloader names..
|
||||||
m_deviceCbx->SetValue(gv->plat_name[index]);
|
m_deviceCbx->SetValue(gv->plat_name[index]);
|
||||||
gv->curplat=gv->plat_id[index];
|
gv->curplat=gv->plat_id[index];
|
||||||
|
|
||||||
|
#if !(defined( __WXMSW__ ) || defined( __DARWIN__))
|
||||||
|
wxString tmp = resolve_mount_point(wxString(ipod.diskname,wxConvUTF8)+wxT("2"));
|
||||||
|
if( tmp != wxT("") )
|
||||||
|
gv->curdestdir = tmp;
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (n > 1)
|
else if (n > 1)
|
||||||
|
|
@ -461,6 +490,12 @@ void DeviceSelectorCtrl::AutoDetect()
|
||||||
int index = gv->plat_id.Index(wxT("sansae200"));
|
int index = gv->plat_id.Index(wxT("sansae200"));
|
||||||
m_deviceCbx->SetValue(gv->plat_name[index]);
|
m_deviceCbx->SetValue(gv->plat_name[index]);
|
||||||
gv->curplat=gv->plat_id[index];
|
gv->curplat=gv->plat_id[index];
|
||||||
|
|
||||||
|
#if !(defined( __WXMSW__ ) || defined( __DARWIN__))
|
||||||
|
wxString tmp = resolve_mount_point(wxString(ipod.diskname,wxConvUTF8)+wxT("1"));
|
||||||
|
if( tmp != wxT("") )
|
||||||
|
gv->curdestdir = tmp;
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (n2 > 1)
|
else if (n2 > 1)
|
||||||
|
|
@ -544,7 +579,8 @@ void DevicePositionCtrl::setDefault()
|
||||||
void DevicePositionCtrl::OnBrowseBtn(wxCommandEvent& event)
|
void DevicePositionCtrl::OnBrowseBtn(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
const wxString& temp = wxDirSelector(
|
const wxString& temp = wxDirSelector(
|
||||||
wxT("Please select the location of your audio device"), gv->curdestdir);
|
wxT("Please select the location of your audio device"), gv->curdestdir,
|
||||||
|
0, wxDefaultPosition, this);
|
||||||
|
|
||||||
if (!temp.empty())
|
if (!temp.empty())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue