Diffstat (limited to 'libopie2/opiecore/device/odevice_simpad.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiecore/device/odevice_simpad.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp index 76f03a0..e62ea18 100644 --- a/libopie2/opiecore/device/odevice_simpad.cpp +++ b/libopie2/opiecore/device/odevice_simpad.cpp | |||
@@ -346,25 +346,25 @@ bool SIMpad::setDisplayBrightness ( int bright ) | |||
346 | 346 | ||
347 | if ( bright > 255 ) | 347 | if ( bright > 255 ) |
348 | bright = 255; | 348 | bright = 255; |
349 | if ( bright < 1 ) | 349 | if ( bright < 1 ) |
350 | bright = 0; | 350 | bright = 0; |
351 | 351 | ||
352 | if (( fd = ::open ( SIMPAD_BACKLIGHT_CONTROL, O_WRONLY )) >= 0 ) { | 352 | if (( fd = ::open ( SIMPAD_BACKLIGHT_CONTROL, O_WRONLY )) >= 0 ) { |
353 | int value = 255 - bright; | 353 | int value = 255 - bright; |
354 | const int mask = SIMPAD_BACKLIGHT_MASK; | 354 | const int mask = SIMPAD_BACKLIGHT_MASK; |
355 | value = value << 8; | 355 | value = value << 8; |
356 | value += mask; | 356 | value += mask; |
357 | char writeCommand[100]; | 357 | char writeCommand[100]; |
358 | const int count = sprintf( writeCommand, "0x%x\n", value ); | 358 | const int count = snprintf( writeCommand, sizeof(writeCommand), "0x%x\n", value ); |
359 | res = ( ::write ( fd, writeCommand, count ) != -1 ); | 359 | res = ( ::write ( fd, writeCommand, count ) != -1 ); |
360 | ::close ( fd ); | 360 | ::close ( fd ); |
361 | } | 361 | } |
362 | return res; | 362 | return res; |
363 | } | 363 | } |
364 | 364 | ||
365 | 365 | ||
366 | int SIMpad::displayBrightnessResolution() const | 366 | int SIMpad::displayBrightnessResolution() const |
367 | { | 367 | { |
368 | return 255; // All SIMpad models share the same display | 368 | return 255; // All SIMpad models share the same display |
369 | } | 369 | } |
370 | 370 | ||