summaryrefslogtreecommitdiffstats
path: root/kamera/kioslave
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-08-29 14:36:09 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-08-29 14:36:09 -0500
commitbdf6051207176cc4343732a08f5797cff2f3bf7c (patch)
treec87e31456a93b68c9ca931c28e6b463300dac53a /kamera/kioslave
parent809db41f180a7899feb279c0981792a5ba5c0b58 (diff)
downloadtdegraphics-bdf6051207176cc4343732a08f5797cff2f3bf7c.tar.gz
tdegraphics-bdf6051207176cc4343732a08f5797cff2f3bf7c.zip
Allow camera device to be opened by USB node numbers only
Diffstat (limited to 'kamera/kioslave')
-rw-r--r--kamera/kioslave/kamera.cpp20
-rw-r--r--kamera/kioslave/kamera.h1
2 files changed, 15 insertions, 6 deletions
diff --git a/kamera/kioslave/kamera.cpp b/kamera/kioslave/kamera.cpp
index 5aefd632..66c007f1 100644
--- a/kamera/kioslave/kamera.cpp
+++ b/kamera/kioslave/kamera.cpp
@@ -91,6 +91,7 @@ m_camera(NULL)
m_context = gp_context_new();
actiondone = true;
cameraopen = false;
+ m_modelSpecified = true;
m_lockfile = locateLocal("tmp", "kamera");
idletime = 0;
}
@@ -163,6 +164,10 @@ bool KameraProtocol::openCamera(TQString &str) {
::unlink(m_lockfile.utf8());
setTimeoutSpecialCommand(1);
kdDebug(7123) << "openCamera succeeded at " << getpid() << endl;
+ if (!m_modelSpecified) {
+ gp_camera_get_abilities(m_camera, &m_abilities);
+ m_modelSpecified = true;
+ }
cameraopen = true;
}
}
@@ -761,12 +766,13 @@ void KameraProtocol::setHost(const TQString& host, int port, const TQString& use
idx = gp_abilities_list_lookup_model(abilities_list, tocstr(user));
if (idx < 0) {
gp_abilities_list_free(abilities_list);
- kdDebug(7123) << "Unable to get abilities for model: " << user << endl;
- error(KIO::ERR_UNKNOWN, gp_result_as_string(idx));
- return;
+ kdDebug(7123) << "Unable to get abilities for model: " << user << ", falling back to automatic model detection" << endl;
+ m_modelSpecified = false;
+ }
+ if (m_modelSpecified) {
+ gp_abilities_list_get_abilities(abilities_list, idx, &m_abilities);
+ gp_abilities_list_free(abilities_list);
}
- gp_abilities_list_get_abilities(abilities_list, idx, &m_abilities);
- gp_abilities_list_free(abilities_list);
// fetch port
GPPortInfoList *port_info_list;
@@ -800,7 +806,9 @@ void KameraProtocol::setHost(const TQString& host, int port, const TQString& use
// gp_camera_set_message_func(m_camera, ..., this)
// set model and port
- gp_camera_set_abilities(m_camera, m_abilities);
+ if (m_modelSpecified) {
+ gp_camera_set_abilities(m_camera, m_abilities);
+ }
gp_camera_set_port_info(m_camera, port_info);
gp_camera_set_port_speed(m_camera, 0); // TODO: the value needs to be configurable
kdDebug(7123) << "Opening camera model " << user << " at " << host << endl;
diff --git a/kamera/kioslave/kamera.h b/kamera/kioslave/kamera.h
index b75a0185..97c298f6 100644
--- a/kamera/kioslave/kamera.h
+++ b/kamera/kioslave/kamera.h
@@ -77,5 +77,6 @@ private:
int m_fileSize;
CameraFile *m_file;
bool actiondone, cameraopen;
+ bool m_modelSpecified;
};
#endif