author | mickeyl <mickeyl> | 2005-01-01 17:34:32 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-01-01 17:34:32 (UTC) |
commit | a62cf9bfb9814a6f5ce5aa8d59fbe5b0cfb8414a (patch) (unidiff) | |
tree | ce7f0961815c32782c92009efc197a606b0ab86b /libopie2/opiecore | |
parent | 8467a23d6a7f4b52619b60462c8ba80d8a736a9e (diff) | |
download | opie-a62cf9bfb9814a6f5ce5aa8d59fbe5b0cfb8414a.zip opie-a62cf9bfb9814a6f5ce5aa8d59fbe5b0cfb8414a.tar.gz opie-a62cf9bfb9814a6f5ce5aa8d59fbe5b0cfb8414a.tar.bz2 |
clean up a bit and start w/ introducing SL-6000 support
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 106 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.h | 47 |
2 files changed, 76 insertions, 77 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index ebe1949..1894e15 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp | |||
@@ -2,5 +2,5 @@ | |||
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> | 3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> |
4 | =. | 4 | =. Copyright (C) 2003-2005 Michael 'Mickey' Lauer <mickey@Vanille.de> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
@@ -108,5 +108,6 @@ struct z_button z_buttons_c700 [] = { | |||
108 | // Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) | 108 | // Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) |
109 | // Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) | 109 | // Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) |
110 | // Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, and C860) | 110 | // Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000) |
111 | // Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000) | ||
111 | // | 112 | // |
112 | // Only question right now is: Do we really need to do it? Because as soon | 113 | // Only question right now is: Do we really need to do it? Because as soon |
@@ -135,5 +136,5 @@ void Zaurus::init(const QString& cpu_info) | |||
135 | // sysver already gathered | 136 | // sysver already gathered |
136 | 137 | ||
137 | // Openzaurus sometimes uses the embedix kernel, check if this is one | 138 | // OpenZaurus sometimes uses the embedix kernel, check if this is one |
138 | FILE *uname = popen("uname -r", "r"); | 139 | FILE *uname = popen("uname -r", "r"); |
139 | QFile f; | 140 | QFile f; |
@@ -168,5 +169,5 @@ void Zaurus::init(const QString& cpu_info) | |||
168 | } else if ( model == "SHARP Husky" ) { | 169 | } else if ( model == "SHARP Husky" ) { |
169 | d->m_model = Model_Zaurus_SLC7x0; | 170 | d->m_model = Model_Zaurus_SLC7x0; |
170 | d->m_modelstr = "Zaurus SL-C760"; | 171 | d->m_modelstr = "Zaurus SL-C760 or SL-C860"; |
171 | } else if ( model == "SHARP Poodle" ) { | 172 | } else if ( model == "SHARP Poodle" ) { |
172 | d->m_model = Model_Zaurus_SLB600; | 173 | d->m_model = Model_Zaurus_SLB600; |
@@ -185,5 +186,5 @@ void Zaurus::init(const QString& cpu_info) | |||
185 | // set initial rotation | 186 | // set initial rotation |
186 | switch ( d->m_model ) { | 187 | switch ( d->m_model ) { |
187 | case Model_Zaurus_SL6000: | 188 | case Model_Zaurus_SL6000: // fallthrough |
188 | case Model_Zaurus_SLA300: | 189 | case Model_Zaurus_SLA300: |
189 | d->m_rotation = Rot0; | 190 | d->m_rotation = Rot0; |
@@ -193,6 +194,6 @@ void Zaurus::init(const QString& cpu_info) | |||
193 | d->m_direction = direction(); | 194 | d->m_direction = direction(); |
194 | break; | 195 | break; |
195 | case Model_Zaurus_SLB600: | 196 | case Model_Zaurus_SLB600: // fallthrough |
196 | case Model_Zaurus_SL5500: | 197 | case Model_Zaurus_SL5500: // fallthrough |
197 | case Model_Zaurus_SL5000: | 198 | case Model_Zaurus_SL5000: |
198 | default: | 199 | default: |
@@ -241,52 +242,5 @@ void Zaurus::initButtons() | |||
241 | } | 242 | } |
242 | 243 | ||
243 | #include <unistd.h> | ||
244 | #include <fcntl.h> | ||
245 | #include <sys/ioctl.h> | ||
246 | |||
247 | //#include <asm/sharp_char.h> // including kernel headers is evil ... | ||
248 | |||
249 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 | ||
250 | |||
251 | #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | ||
252 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | ||
253 | |||
254 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | ||
255 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ | ||
256 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | ||
257 | |||
258 | /* --- for SHARP_BUZZER device --- */ | ||
259 | 244 | ||
260 | //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | ||
261 | //#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | ||
262 | |||
263 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) | ||
264 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) | ||
265 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) | ||
266 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) | ||
267 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) | ||
268 | |||
269 | //#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | ||
270 | //#define SHARP_BUZ_KEYSOUND 2 /* key sound */ | ||
271 | |||
272 | //#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ | ||
273 | //#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ | ||
274 | //#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ | ||
275 | //#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ | ||
276 | //#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ | ||
277 | //#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ | ||
278 | //#define SHARP_PDA_APPSTART 9 /* application start */ | ||
279 | //#define SHARP_PDA_APPQUIT 10 /* application ends */ | ||
280 | |||
281 | //#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | ||
282 | //#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ | ||
283 | //#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ | ||
284 | //#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ | ||
285 | // | ||
286 | |||
287 | #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | ||
288 | #define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) | ||
289 | |||
290 | #define SHARP_IOCTL_GET_ROTATION 0x413c | ||
291 | 245 | ||
292 | typedef struct sharp_led_status { | 246 | typedef struct sharp_led_status { |
@@ -295,19 +249,4 @@ int status; /* set new led status if you call SHARP_LED_SETSTATUS */ | |||
295 | } sharp_led_status; | 249 | } sharp_led_status; |
296 | 250 | ||
297 | #define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ | ||
298 | |||
299 | #define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ | ||
300 | #define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ | ||
301 | #define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ | ||
302 | |||
303 | // #include <asm/sharp_apm.h> // including kernel headers is evil ... | ||
304 | |||
305 | #define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) | ||
306 | #define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) | ||
307 | #define APM_EVT_POWER_BUTTON (1 << 0) | ||
308 | |||
309 | #define FL_IOCTL_STEP_CONTRAST 100 | ||
310 | |||
311 | |||
312 | void Zaurus::buzzer ( int sound ) | 251 | void Zaurus::buzzer ( int sound ) |
313 | { | 252 | { |
@@ -317,5 +256,6 @@ void Zaurus::buzzer ( int sound ) | |||
317 | // Not all devices have real sound | 256 | // Not all devices have real sound |
318 | if ( d->m_model == Model_Zaurus_SLC7x0 | 257 | if ( d->m_model == Model_Zaurus_SLC7x0 |
319 | || d->m_model == Model_Zaurus_SLB600 ){ | 258 | || d->m_model == Model_Zaurus_SLB600 |
259 | || d->m_model == Model_Zaurus_SL6000 ) { | ||
320 | 260 | ||
321 | switch ( sound ){ | 261 | switch ( sound ){ |
@@ -465,5 +405,4 @@ bool Zaurus::setSoftSuspend ( bool soft ) | |||
465 | } | 405 | } |
466 | 406 | ||
467 | |||
468 | bool Zaurus::setDisplayBrightness ( int bright ) | 407 | bool Zaurus::setDisplayBrightness ( int bright ) |
469 | { | 408 | { |
@@ -485,5 +424,20 @@ bool Zaurus::setDisplayBrightness ( int bright ) | |||
485 | int value = ( bright == 1 ) ? 1 : static_cast<int>( bright * ( 17.0 / 255.0 ) ); | 424 | int value = ( bright == 1 ) ? 1 : static_cast<int>( bright * ( 17.0 / 255.0 ) ); |
486 | char writeCommand[100]; | 425 | char writeCommand[100]; |
487 | const int count = sprintf( writeCommand, "0x%x\n", value ); | 426 | const int count = sprintf( writeCommand, "%x\n", value ); |
427 | res = ( ::write ( fd, writeCommand, count ) != -1 ); | ||
428 | ::close ( fd ); | ||
429 | } | ||
430 | return res; | ||
431 | } | ||
432 | else | ||
433 | if ( d->m_model == Model_Zaurus_SL6000 ) | ||
434 | { | ||
435 | //qDebug( "using special treatment for devices with the tosa backlight interface" ); | ||
436 | // special treatment for devices with the tosa backlight interface | ||
437 | if (( fd = ::open ( "/proc/driver/fl/tosa-bl", O_WRONLY )) >= 0 ) | ||
438 | { | ||
439 | int value = ( bright == 1 ) ? 1 : static_cast<int>( bright * ( 17.0 / 255.0 ) ); | ||
440 | char writeCommand[100]; | ||
441 | const int count = sprintf( writeCommand, "%x\n", value ); | ||
488 | res = ( ::write ( fd, writeCommand, count ) != -1 ); | 442 | res = ( ::write ( fd, writeCommand, count ) != -1 ); |
489 | ::close ( fd ); | 443 | ::close ( fd ); |
@@ -615,8 +569,14 @@ int Zaurus::displayBrightnessResolution() const | |||
615 | { | 569 | { |
616 | if (m_embedix) | 570 | if (m_embedix) |
617 | return d->m_model == Model_Zaurus_SLC7x0 ? 18 : 5; | 571 | { |
572 | if ( d->m_model == Model_Zaurus_SLC7x0 ) return 18; | ||
573 | if ( d->m_model == Model_Zaurus_SL6000 ) return 18; | ||
574 | return 5; | ||
575 | } | ||
618 | else | 576 | else |
577 | { | ||
619 | return 256; | 578 | return 256; |
620 | } | 579 | } |
580 | } | ||
621 | 581 | ||
622 | bool Zaurus::hasHingeSensor() const | 582 | bool Zaurus::hasHingeSensor() const |
diff --git a/libopie2/opiecore/device/odevice_zaurus.h b/libopie2/opiecore/device/odevice_zaurus.h index 76a40d6..dc21546 100644 --- a/libopie2/opiecore/device/odevice_zaurus.h +++ b/libopie2/opiecore/device/odevice_zaurus.h | |||
@@ -2,5 +2,5 @@ | |||
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> | 3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> |
4 | =. | 4 | =. Copyright (C) 2003-2005 Michael 'Mickey' Lauer <mickey@Vanille.de> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
@@ -38,7 +38,5 @@ | |||
38 | 38 | ||
39 | // _IO and friends are only defined in kernel headers ... | 39 | // _IO and friends are only defined in kernel headers ... |
40 | |||
41 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) | 40 | #define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) |
42 | |||
43 | #define OD_IO(type,number) OD_IOC(0,type,number,0) | 41 | #define OD_IO(type,number) OD_IOC(0,type,number,0) |
44 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) | 42 | #define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) |
@@ -46,4 +44,46 @@ | |||
46 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) | 44 | #define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) |
47 | 45 | ||
46 | // Audio | ||
47 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 | ||
48 | |||
49 | #define SHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | ||
50 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | ||
51 | |||
52 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | ||
53 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ | ||
54 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | ||
55 | |||
56 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) | ||
57 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) | ||
58 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) | ||
59 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) | ||
60 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) | ||
61 | |||
62 | // LED | ||
63 | #define SHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | ||
64 | #define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) | ||
65 | #define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ | ||
66 | |||
67 | #define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ | ||
68 | #define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ | ||
69 | #define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ | ||
70 | |||
71 | // Rotation and Power Management | ||
72 | #define SHARP_IOCTL_GET_ROTATION 0x413c | ||
73 | |||
74 | #define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) | ||
75 | #define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) | ||
76 | #define APM_EVT_POWER_BUTTON (1 << 0) | ||
77 | |||
78 | // Brightness | ||
79 | #define FL_IOCTL_STEP_CONTRAST 100 | ||
80 | |||
81 | #define CORGI_TOSA_BL_IOCTL_ON 1 | ||
82 | #define CORGI_TOSA_BL_IOCTL_OFF 2 | ||
83 | #define CORGI_TOSA_BL_IOCTL_STEP_CONTRAST 100 | ||
84 | #define CORGI_TOSA_BL_IOCTL_GET_STEP_CONTRAST 101 | ||
85 | #define CORGI_TOSA_BL_IOCTL_GET_STEP 102 | ||
86 | #define CORGI_BL_PROC_DEVICE corgi-bl | ||
87 | #define TOSA_BL_PROC_DEVICE tosa-bl | ||
48 | 88 | ||
49 | namespace Opie { | 89 | namespace Opie { |
@@ -52,5 +92,4 @@ namespace Internal { | |||
52 | class Zaurus : public ODevice | 92 | class Zaurus : public ODevice |
53 | { | 93 | { |
54 | |||
55 | protected: | 94 | protected: |
56 | virtual void init(const QString&); | 95 | virtual void init(const QString&); |