| 36 | |
---|
| 37 | #ifdef ENABLE_BEBOB |
---|
| 38 | #include "bebob/bebob_avdevice.h" |
---|
| 39 | #include "maudio/maudio_avdevice.h" |
---|
| 40 | #endif |
---|
| 41 | |
---|
| 42 | #ifdef ENABLE_BOUNCE |
---|
| 43 | #include "bounce/bounce_avdevice.h" |
---|
| 44 | #include "bounce/bounce_slave_avdevice.h" |
---|
| 45 | #endif |
---|
| 46 | |
---|
| 47 | #ifdef ENABLE_MOTU |
---|
| 48 | #include "motu/motu_avdevice.h" |
---|
| 49 | #endif |
---|
| 50 | |
---|
| 51 | #ifdef ENABLE_RME |
---|
| 52 | #include "rme/rme_avdevice.h" |
---|
| 53 | #endif |
---|
| 54 | |
---|
| 55 | #ifdef ENABLE_DICE |
---|
| 56 | #include "dice/dice_avdevice.h" |
---|
| 57 | #endif |
---|
| 58 | |
---|
| 59 | #ifdef ENABLE_METRIC_HALO |
---|
| 60 | #include "metrichalo/mh_avdevice.h" |
---|
| 61 | #endif |
---|
39 | | |
---|
40 | | #include "libstreaming/StreamProcessor.h" |
---|
41 | | |
---|
42 | | #ifdef ENABLE_BEBOB |
---|
43 | | #include "bebob/bebob_avdevice.h" |
---|
44 | | #include "maudio/maudio_avdevice.h" |
---|
45 | | #endif |
---|
46 | | |
---|
47 | | #ifdef ENABLE_BOUNCE |
---|
48 | | #include "bounce/bounce_avdevice.h" |
---|
49 | | #include "bounce/bounce_slave_avdevice.h" |
---|
50 | | #endif |
---|
51 | | |
---|
52 | | #ifdef ENABLE_MOTU |
---|
53 | | #include "motu/motu_avdevice.h" |
---|
54 | | #endif |
---|
55 | | |
---|
56 | | #ifdef ENABLE_RME |
---|
57 | | #include "rme/rme_avdevice.h" |
---|
58 | | #endif |
---|
59 | | |
---|
60 | | #ifdef ENABLE_DICE |
---|
61 | | #include "dice/dice_avdevice.h" |
---|
62 | | #endif |
---|
63 | | |
---|
64 | | #ifdef ENABLE_METRIC_HALO |
---|
65 | | #include "metrichalo/mh_avdevice.h" |
---|
66 | | #endif |
---|
| 66 | #include <sys/stat.h> |
---|
511 | | if ( asprintf( &pCachePath, "%s/cache/libfreebob/", CACHEDIR ) < 0 ) { |
---|
512 | | debugError( "saveCache: Could not create path string for cache pool (trying '/var/cache/freebob' instead)\n" ); |
---|
513 | | cachePath == "/var/cache/freebob/"; |
---|
| 507 | if ( asprintf( &pCachePath, "%s/cache/libffado/", CACHEDIR ) < 0 ) { |
---|
| 508 | debugError( "Could not create path string for cache pool (trying '/var/cache/libffado' instead)\n" ); |
---|
| 509 | cachePath == "/var/cache/libffado/"; |
---|
529 | | Glib::ustring sFileName = getCachePath() + pAvDevice->getConfigRom().getGuidString() + ".xml"; |
---|
| 526 | // the path looks like this: |
---|
| 527 | // PATH_TO_CACHE + GUID + CONFIGURATION_ID |
---|
| 528 | |
---|
| 529 | Glib::ustring sDevicePath = getCachePath() + pAvDevice->getConfigRom().getGuidString(); |
---|
| 530 | struct stat buf; |
---|
| 531 | if ( stat( sDevicePath.c_str(), &buf ) == 0 ) { |
---|
| 532 | if ( !S_ISDIR( buf.st_mode ) ) { |
---|
| 533 | debugError( "\"%s\" is not a directory\n", sDevicePath.c_str() ); |
---|
| 534 | return false; |
---|
| 535 | } |
---|
| 536 | } else { |
---|
| 537 | if ( mkdir( sDevicePath.c_str(), S_IRWXU | S_IRWXG ) != 0 ) { |
---|
| 538 | debugError( "Could not create \"%s\" directory\n", sDevicePath.c_str() ); |
---|
| 539 | return false; |
---|
| 540 | } |
---|
| 541 | } |
---|
| 542 | |
---|
| 543 | char* configId; |
---|
| 544 | asprintf(&configId, "%08x", pBeBoBDevice->getConfigurationId() ); |
---|
| 545 | if ( !configId ) { |
---|
| 546 | debugError( "Could not create id string\n" ); |
---|
| 547 | return false; |
---|
| 548 | } |
---|
| 549 | Glib::ustring sFileName = sDevicePath + "/" + configId + ".xml"; |
---|
| 550 | free( configId ); |
---|