summaryrefslogtreecommitdiffstats
path: root/kcontrol
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2013-11-09 20:29:39 +0100
committerSlávek Banko <slavek.banko@axis.cz>2013-11-09 20:29:57 +0100
commita60f9a11459e3a8c3709e2f95f0613e0886e724e (patch)
tree17e97af205a743524976ac7006cd28981e57fd56 /kcontrol
parent853f2558ab5b324106b1256d9804fc5db5d4ee10 (diff)
downloadtdebase-a60f9a11459e3a8c3709e2f95f0613e0886e724e.tar.gz
tdebase-a60f9a11459e3a8c3709e2f95f0613e0886e724e.zip
Fix remaing kcm mouse module crashes
Diffstat (limited to 'kcontrol')
-rw-r--r--kcontrol/input/logitechmouse.cpp36
1 files changed, 24 insertions, 12 deletions
diff --git a/kcontrol/input/logitechmouse.cpp b/kcontrol/input/logitechmouse.cpp
index 1b77896d8..2798ce1de 100644
--- a/kcontrol/input/logitechmouse.cpp
+++ b/kcontrol/input/logitechmouse.cpp
@@ -132,13 +132,15 @@ void LogitechMouse::updateCordlessStatus()
{
TQByteArray status(8);
- int result = usb_control_msg( m_usbDeviceHandle,
+ int result = (m_usbDeviceHandle != 0
+ ? usb_control_msg( m_usbDeviceHandle,
USB_TYPE_VENDOR | USB_ENDPOINT_IN,0x09,
(0x0003 | m_useSecondChannel),
(0x0000 | m_useSecondChannel),
status.data(),
0x0008,
- 1000);
+ 1000)
+ : -1);
if (0 > result) {
// We probably have a permission problem
@@ -253,14 +255,16 @@ void LogitechMouse::updateResolution()
{
char resolution;
- int result = usb_control_msg( m_usbDeviceHandle,
+ int result = (m_usbDeviceHandle != 0
+ ? usb_control_msg( m_usbDeviceHandle,
USB_TYPE_VENDOR | USB_ENDPOINT_IN,
0x01,
0x000E,
0x0000,
&resolution,
0x0001,
- 100);
+ 100)
+ : -1);
// kdDebug() << "resolution is: " << resolution << endl;
if (0 > result) {
@@ -273,14 +277,16 @@ void LogitechMouse::updateResolution()
void LogitechMouse::setLogitechTo800()
{
- int result = usb_control_msg( m_usbDeviceHandle,
+ int result = (m_usbDeviceHandle != 0
+ ? usb_control_msg( m_usbDeviceHandle,
USB_TYPE_VENDOR,
0x02,
0x000E,
4,
NULL,
0x0000,
- 100);
+ 100)
+ : -1);
if (0 > result) {
kdWarning() << "Error setting resolution on device: " << usb_strerror() << endl;
}
@@ -288,14 +294,16 @@ void LogitechMouse::setLogitechTo800()
void LogitechMouse::setLogitechTo400()
{
- int result = usb_control_msg( m_usbDeviceHandle,
+ int result = (m_usbDeviceHandle != 0
+ ? usb_control_msg( m_usbDeviceHandle,
USB_TYPE_VENDOR,
0x02,
0x000E,
3,
NULL,
0x0000,
- 100);
+ 100)
+ : -1);
if (0 > result) {
kdWarning() << "Error setting resolution on device: " << usb_strerror() << endl;
}
@@ -319,14 +327,16 @@ bool LogitechMouse::isDualChannelCapable()
void LogitechMouse::setChannel1()
{
- int result = usb_control_msg( m_usbDeviceHandle,
+ int result = (m_usbDeviceHandle != 0
+ ? usb_control_msg( m_usbDeviceHandle,
USB_TYPE_VENDOR,
0x02,
(0x0008 | m_useSecondChannel),
(0x0000 | m_useSecondChannel),
NULL,
0x0000,
- 1000);
+ 1000)
+ : -1);
if (0 > result) {
kdWarning() << "Error setting mouse to channel 1 : " << usb_strerror() << endl;
@@ -336,14 +346,16 @@ void LogitechMouse::setChannel1()
void LogitechMouse::setChannel2()
{
- int result = usb_control_msg( m_usbDeviceHandle,
+ int result = (m_usbDeviceHandle != 0
+ ? usb_control_msg( m_usbDeviceHandle,
USB_TYPE_VENDOR,
0x02,
(0x0008 | m_useSecondChannel),
(0x0001 | m_useSecondChannel),
NULL,
0x0000,
- 1000);
+ 1000)
+ : -1);
if (0 > result) {
kdWarning() << "Error setting mouse to channel 2 : " << usb_strerror() << endl;