summaryrefslogtreecommitdiff
path: root/libopie/odevice.cpp
authoreilers <eilers>2003-11-17 17:32:06 (UTC)
committer eilers <eilers>2003-11-17 17:32:06 (UTC)
commitd46685864bb18ffa82d5dac4fcfb1ae96471e89a (patch) (unidiff)
treeab5e53d5d777aea2b8baf62eeca8cd9d5605bbcf /libopie/odevice.cpp
parente8bba52dc9443d3aadcc2c221fa62ba37ea5c712 (diff)
downloadopie-d46685864bb18ffa82d5dac4fcfb1ae96471e89a.zip
opie-d46685864bb18ffa82d5dac4fcfb1ae96471e89a.tar.gz
opie-d46685864bb18ffa82d5dac4fcfb1ae96471e89a.tar.bz2
Shit .. missed a wrong ")".. Odevice compiles now.. !
Diffstat (limited to 'libopie/odevice.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/odevice.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 58254a7..71ed9e4 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -1334,385 +1334,385 @@ bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, b
1334 newkeycode = Key_unknown; 1334 newkeycode = Key_unknown;
1335 break; 1335 break;
1336 } 1336 }
1337 } 1337 }
1338 1338
1339 if ( newkeycode != keycode ) { 1339 if ( newkeycode != keycode ) {
1340 if ( newkeycode != Key_unknown ) 1340 if ( newkeycode != Key_unknown )
1341 QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); 1341 QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat );
1342 return true; 1342 return true;
1343 } 1343 }
1344 else 1344 else
1345 return false; 1345 return false;
1346} 1346}
1347 1347
1348void iPAQ::timerEvent ( QTimerEvent * ) 1348void iPAQ::timerEvent ( QTimerEvent * )
1349{ 1349{
1350 killTimer ( m_power_timer ); 1350 killTimer ( m_power_timer );
1351 m_power_timer = 0; 1351 m_power_timer = 0;
1352 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); 1352 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false );
1353 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); 1353 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false );
1354} 1354}
1355 1355
1356 1356
1357void iPAQ::alarmSound ( ) 1357void iPAQ::alarmSound ( )
1358{ 1358{
1359#ifndef QT_NO_SOUND 1359#ifndef QT_NO_SOUND
1360 static Sound snd ( "alarm" ); 1360 static Sound snd ( "alarm" );
1361 int fd; 1361 int fd;
1362 int vol; 1362 int vol;
1363 bool vol_reset = false; 1363 bool vol_reset = false;
1364 1364
1365 if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { 1365 if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) {
1366 if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { 1366 if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) {
1367 Config cfg ( "qpe" ); 1367 Config cfg ( "qpe" );
1368 cfg. setGroup ( "Volume" ); 1368 cfg. setGroup ( "Volume" );
1369 1369
1370 int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); 1370 int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 );
1371 if ( volalarm < 0 ) 1371 if ( volalarm < 0 )
1372 volalarm = 0; 1372 volalarm = 0;
1373 else if ( volalarm > 100 ) 1373 else if ( volalarm > 100 )
1374 volalarm = 100; 1374 volalarm = 100;
1375 volalarm |= ( volalarm << 8 ); 1375 volalarm |= ( volalarm << 8 );
1376 1376
1377 if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) 1377 if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 )
1378 vol_reset = true; 1378 vol_reset = true;
1379 } 1379 }
1380 } 1380 }
1381 1381
1382 snd. play ( ); 1382 snd. play ( );
1383 while ( !snd. isFinished ( )) 1383 while ( !snd. isFinished ( ))
1384 qApp-> processEvents ( ); 1384 qApp-> processEvents ( );
1385 1385
1386 if ( fd >= 0 ) { 1386 if ( fd >= 0 ) {
1387 if ( vol_reset ) 1387 if ( vol_reset )
1388 ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); 1388 ::ioctl ( fd, MIXER_WRITE( 0 ), &vol );
1389 ::close ( fd ); 1389 ::close ( fd );
1390 } 1390 }
1391#endif 1391#endif
1392} 1392}
1393 1393
1394 1394
1395bool iPAQ::setSoftSuspend ( bool soft ) 1395bool iPAQ::setSoftSuspend ( bool soft )
1396{ 1396{
1397 bool res = false; 1397 bool res = false;
1398 int fd; 1398 int fd;
1399 1399
1400 if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { 1400 if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) {
1401 if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) 1401 if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 )
1402 res = true; 1402 res = true;
1403 else 1403 else
1404 ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); 1404 ::perror ( "write to /proc/sys/ts/suspend_button_mode" );
1405 1405
1406 ::close ( fd ); 1406 ::close ( fd );
1407 } 1407 }
1408 else 1408 else
1409 ::perror ( "/proc/sys/ts/suspend_button_mode" ); 1409 ::perror ( "/proc/sys/ts/suspend_button_mode" );
1410 1410
1411 return res; 1411 return res;
1412} 1412}
1413 1413
1414 1414
1415bool iPAQ::setDisplayBrightness ( int bright ) 1415bool iPAQ::setDisplayBrightness ( int bright )
1416{ 1416{
1417 bool res = false; 1417 bool res = false;
1418 int fd; 1418 int fd;
1419 1419
1420 if ( bright > 255 ) 1420 if ( bright > 255 )
1421 bright = 255; 1421 bright = 255;
1422 if ( bright < 0 ) 1422 if ( bright < 0 )
1423 bright = 0; 1423 bright = 0;
1424 1424
1425 if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { 1425 if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) {
1426 FLITE_IN bl; 1426 FLITE_IN bl;
1427 bl. mode = 1; 1427 bl. mode = 1;
1428 bl. pwr = bright ? 1 : 0; 1428 bl. pwr = bright ? 1 : 0;
1429 bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255; 1429 bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255;
1430 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); 1430 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 );
1431 ::close ( fd ); 1431 ::close ( fd );
1432 } 1432 }
1433 return res; 1433 return res;
1434} 1434}
1435 1435
1436int iPAQ::displayBrightnessResolution ( ) const 1436int iPAQ::displayBrightnessResolution ( ) const
1437{ 1437{
1438 switch ( model ( )) { 1438 switch ( model ( )) {
1439 case Model_iPAQ_H31xx: 1439 case Model_iPAQ_H31xx:
1440 case Model_iPAQ_H36xx: 1440 case Model_iPAQ_H36xx:
1441 case Model_iPAQ_H37xx: 1441 case Model_iPAQ_H37xx:
1442 return 128; // really 256, but >128 could damage the LCD 1442 return 128; // really 256, but >128 could damage the LCD
1443 1443
1444 case Model_iPAQ_H38xx: 1444 case Model_iPAQ_H38xx:
1445 case Model_iPAQ_H39xx: 1445 case Model_iPAQ_H39xx:
1446 return 64; 1446 return 64;
1447 case Model_iPAQ_H5xxx: 1447 case Model_iPAQ_H5xxx:
1448 return 255; 1448 return 255;
1449 1449
1450 default: 1450 default:
1451 return 2; 1451 return 2;
1452 } 1452 }
1453} 1453}
1454 1454
1455 1455
1456bool iPAQ::hasLightSensor ( ) const 1456bool iPAQ::hasLightSensor ( ) const
1457{ 1457{
1458 return true; 1458 return true;
1459} 1459}
1460 1460
1461int iPAQ::readLightSensor ( ) 1461int iPAQ::readLightSensor ( )
1462{ 1462{
1463 int fd; 1463 int fd;
1464 int val = -1; 1464 int val = -1;
1465 1465
1466 if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) { 1466 if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) {
1467 char buffer [8]; 1467 char buffer [8];
1468 1468
1469 if ( ::read ( fd, buffer, 5 ) == 5 ) { 1469 if ( ::read ( fd, buffer, 5 ) == 5 ) {
1470 char *endptr; 1470 char *endptr;
1471 1471
1472 buffer [4] = 0; 1472 buffer [4] = 0;
1473 val = ::strtol ( buffer + 2, &endptr, 16 ); 1473 val = ::strtol ( buffer + 2, &endptr, 16 );
1474 1474
1475 if ( *endptr != 0 ) 1475 if ( *endptr != 0 )
1476 val = -1; 1476 val = -1;
1477 } 1477 }
1478 ::close ( fd ); 1478 ::close ( fd );
1479 } 1479 }
1480 1480
1481 return val; 1481 return val;
1482} 1482}
1483 1483
1484int iPAQ::lightSensorResolution ( ) const 1484int iPAQ::lightSensorResolution ( ) const
1485{ 1485{
1486 return 256; 1486 return 256;
1487} 1487}
1488 1488
1489/************************************************** 1489/**************************************************
1490 * 1490 *
1491 * Zaurus 1491 * Zaurus
1492 * 1492 *
1493 **************************************************/ 1493 **************************************************/
1494 1494
1495// Check whether this device is the sharp zaurus.. 1495// Check whether this device is the sharp zaurus..
1496bool Zaurus::isZaurus() 1496bool Zaurus::isZaurus()
1497{ 1497{
1498 1498
1499 // If the special devices by embedix exist, it is quite simple: it is a Zaurus ! 1499 // If the special devices by embedix exist, it is quite simple: it is a Zaurus !
1500 if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ) ){ 1500 if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ) ){
1501 return true; 1501 return true;
1502 } 1502 }
1503 1503
1504 // On non-embedix kernels, we have to look closer. 1504 // On non-embedix kernels, we have to look closer.
1505 bool is_zaurus = false; 1505 bool is_zaurus = false;
1506 QFile f ( "/proc/cpuinfo" ); 1506 QFile f ( "/proc/cpuinfo" );
1507 if ( f. open ( IO_ReadOnly ) ) { 1507 if ( f. open ( IO_ReadOnly ) ) {
1508 QString model; 1508 QString model;
1509 QFile f ( "/proc/cpuinfo" ); 1509 QFile f ( "/proc/cpuinfo" );
1510 1510
1511 QTextStream ts ( &f ); 1511 QTextStream ts ( &f );
1512 QString line; 1512 QString line;
1513 while( line = ts. readLine ( ) ) { 1513 while( line = ts. readLine ( ) ) {
1514 if ( line. left ( 8 ) == "Hardware" ) 1514 if ( line. left ( 8 ) == "Hardware" )
1515 break; 1515 break;
1516 } 1516 }
1517 int loc = line. find ( ":" ); 1517 int loc = line. find ( ":" );
1518 if ( loc != -1 ) 1518 if ( loc != -1 )
1519 model = line. mid ( loc + 2 ). simplifyWhiteSpace( ); 1519 model = line. mid ( loc + 2 ). simplifyWhiteSpace( );
1520 1520
1521 if ( model == "Sharp-Collie" 1521 if ( model == "Sharp-Collie"
1522 || model == "Collie" 1522 || model == "Collie"
1523 || model == "SHARP Corgi" 1523 || model == "SHARP Corgi"
1524 || model == "SHARP Shepherd" 1524 || model == "SHARP Shepherd"
1525 || model == "SHARP Poodle" 1525 || model == "SHARP Poodle"
1526 || model == "SHARP Husky" ) 1526 || model == "SHARP Husky"
1527 ) 1527 )
1528 is_zaurus = true; 1528 is_zaurus = true;
1529 1529
1530 } 1530 }
1531 return is_zaurus; 1531 return is_zaurus;
1532} 1532}
1533 1533
1534 1534
1535void Zaurus::init ( ) 1535void Zaurus::init ( )
1536{ 1536{
1537 d-> m_vendorstr = "Sharp"; 1537 d-> m_vendorstr = "Sharp";
1538 d-> m_vendor = Vendor_Sharp; 1538 d-> m_vendor = Vendor_Sharp;
1539 m_embedix = true; // Not openzaurus means: It has an embedix kernel ! 1539 m_embedix = true; // Not openzaurus means: It has an embedix kernel !
1540 1540
1541 // QFile f ( "/proc/filesystems" ); 1541 // QFile f ( "/proc/filesystems" );
1542 QString model; 1542 QString model;
1543 1543
1544 // It isn't a good idea to check the system configuration to 1544 // It isn't a good idea to check the system configuration to
1545 // detect the distribution ! 1545 // detect the distribution !
1546 // Otherwise it may happen that any other distribution is detected as openzaurus, just 1546 // Otherwise it may happen that any other distribution is detected as openzaurus, just
1547 // because it uses a jffs2 filesystem.. 1547 // because it uses a jffs2 filesystem..
1548 // (eilers) 1548 // (eilers)
1549 // if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) { 1549 // if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) {
1550 QFile f ("/etc/oz_version"); 1550 QFile f ("/etc/oz_version");
1551 if ( f.exists() ){ 1551 if ( f.exists() ){
1552 d-> m_vendorstr = "OpenZaurus Team"; 1552 d-> m_vendorstr = "OpenZaurus Team";
1553 d-> m_systemstr = "OpenZaurus"; 1553 d-> m_systemstr = "OpenZaurus";
1554 d-> m_system = System_OpenZaurus; 1554 d-> m_system = System_OpenZaurus;
1555 1555
1556 if ( f. open ( IO_ReadOnly )) { 1556 if ( f. open ( IO_ReadOnly )) {
1557 QTextStream ts ( &f ); 1557 QTextStream ts ( &f );
1558 d-> m_sysverstr = ts. readLine ( );//. mid ( 10 ); 1558 d-> m_sysverstr = ts. readLine ( );//. mid ( 10 );
1559 f. close ( ); 1559 f. close ( );
1560 } 1560 }
1561 1561
1562 // Openzaurus sometimes uses the embedix kernel! 1562 // Openzaurus sometimes uses the embedix kernel!
1563 // => Check whether this is an embedix kernel 1563 // => Check whether this is an embedix kernel
1564 FILE *uname = popen("uname -r", "r"); 1564 FILE *uname = popen("uname -r", "r");
1565 QString line; 1565 QString line;
1566 if ( f.open(IO_ReadOnly, uname) ) { 1566 if ( f.open(IO_ReadOnly, uname) ) {
1567 QTextStream ts ( &f ); 1567 QTextStream ts ( &f );
1568 line = ts. readLine ( ); 1568 line = ts. readLine ( );
1569 int loc = line. find ( "embedix" ); 1569 int loc = line. find ( "embedix" );
1570 if ( loc != -1 ) 1570 if ( loc != -1 )
1571 m_embedix = true; 1571 m_embedix = true;
1572 else 1572 else
1573 m_embedix = false; 1573 m_embedix = false;
1574 f. close ( ); 1574 f. close ( );
1575 } 1575 }
1576 pclose(uname); 1576 pclose(uname);
1577 } 1577 }
1578 else { 1578 else {
1579 d-> m_systemstr = "Zaurus"; 1579 d-> m_systemstr = "Zaurus";
1580 d-> m_system = System_Zaurus; 1580 d-> m_system = System_Zaurus;
1581 } 1581 }
1582 1582
1583 f. setName ( "/proc/cpuinfo" ); 1583 f. setName ( "/proc/cpuinfo" );
1584 if ( f. open ( IO_ReadOnly ) ) { 1584 if ( f. open ( IO_ReadOnly ) ) {
1585 QTextStream ts ( &f ); 1585 QTextStream ts ( &f );
1586 QString line; 1586 QString line;
1587 while( line = ts. readLine ( ) ) { 1587 while( line = ts. readLine ( ) ) {
1588 if ( line. left ( 8 ) == "Hardware" ) 1588 if ( line. left ( 8 ) == "Hardware" )
1589 break; 1589 break;
1590 } 1590 }
1591 int loc = line. find ( ":" ); 1591 int loc = line. find ( ":" );
1592 if ( loc != -1 ) 1592 if ( loc != -1 )
1593 model = line. mid ( loc + 2 ). simplifyWhiteSpace( ); 1593 model = line. mid ( loc + 2 ). simplifyWhiteSpace( );
1594 } 1594 }
1595 1595
1596 if ( model == "SHARP Corgi" ) { 1596 if ( model == "SHARP Corgi" ) {
1597 d-> m_model = Model_Zaurus_SLC7x0; 1597 d-> m_model = Model_Zaurus_SLC7x0;
1598 d-> m_modelstr = "Zaurus SL-C700"; 1598 d-> m_modelstr = "Zaurus SL-C700";
1599 } else if ( model == "SHARP Shepherd" ) { 1599 } else if ( model == "SHARP Shepherd" ) {
1600 d-> m_model = Model_Zaurus_SLC7x0; 1600 d-> m_model = Model_Zaurus_SLC7x0;
1601 d-> m_modelstr = "Zaurus SL-C750"; 1601 d-> m_modelstr = "Zaurus SL-C750";
1602 } else if ( model == "SHARP Husky" ) { 1602 } else if ( model == "SHARP Husky" ) {
1603 d-> m_model = Model_Zaurus_SLC7x0; 1603 d-> m_model = Model_Zaurus_SLC7x0;
1604 d-> m_modelstr = "Zaurus SL-C760"; 1604 d-> m_modelstr = "Zaurus SL-C760";
1605 } else if ( model == "SHARP Poodle" ) { 1605 } else if ( model == "SHARP Poodle" ) {
1606 d-> m_model = Model_Zaurus_SLB600; 1606 d-> m_model = Model_Zaurus_SLB600;
1607 d-> m_modelstr = "Zaurus SL-B500 or SL-5600"; 1607 d-> m_modelstr = "Zaurus SL-B500 or SL-5600";
1608 } else if ( model == "Sharp-Collie" || model == "Collie" ) { 1608 } else if ( model == "Sharp-Collie" || model == "Collie" ) {
1609 d-> m_model = Model_Zaurus_SL5500; 1609 d-> m_model = Model_Zaurus_SL5500;
1610 d-> m_modelstr = "Zaurus SL-5500 or SL-5000d"; 1610 d-> m_modelstr = "Zaurus SL-5500 or SL-5000d";
1611 } else { 1611 } else {
1612 d-> m_model = Model_Zaurus_SL5500; 1612 d-> m_model = Model_Zaurus_SL5500;
1613 d-> m_modelstr = "Zaurus (Model unknown)"; 1613 d-> m_modelstr = "Zaurus (Model unknown)";
1614 } 1614 }
1615 1615
1616 bool flipstate = false; 1616 bool flipstate = false;
1617 switch ( d-> m_model ) { 1617 switch ( d-> m_model ) {
1618 case Model_Zaurus_SLA300: 1618 case Model_Zaurus_SLA300:
1619 d-> m_rotation = Rot0; 1619 d-> m_rotation = Rot0;
1620 break; 1620 break;
1621 case Model_Zaurus_SLC7x0: 1621 case Model_Zaurus_SLC7x0:
1622 // Note: need to 1) set flipstate based on physical screen orientation 1622 // Note: need to 1) set flipstate based on physical screen orientation
1623 // and 2) check to see if the user overrode the rotation direction 1623 // and 2) check to see if the user overrode the rotation direction
1624 // using appearance, and if so, remove that item from the Config to 1624 // using appearance, and if so, remove that item from the Config to
1625 // ensure the rotate applet flips us back to the previous state. 1625 // ensure the rotate applet flips us back to the previous state.
1626 if ( flipstate ) { 1626 if ( flipstate ) {
1627 // 480x640 1627 // 480x640
1628 d-> m_rotation = Rot0; 1628 d-> m_rotation = Rot0;
1629 d-> m_direction = CW; 1629 d-> m_direction = CW;
1630 } else { 1630 } else {
1631 // 640x480 1631 // 640x480
1632 d-> m_rotation = Rot270; 1632 d-> m_rotation = Rot270;
1633 d-> m_direction = CCW; 1633 d-> m_direction = CCW;
1634 } 1634 }
1635 break; 1635 break;
1636 case Model_Zaurus_SLB600: 1636 case Model_Zaurus_SLB600:
1637 case Model_Zaurus_SL5500: 1637 case Model_Zaurus_SL5500:
1638 case Model_Zaurus_SL5000: 1638 case Model_Zaurus_SL5000:
1639 default: 1639 default:
1640 d-> m_rotation = Rot270; 1640 d-> m_rotation = Rot270;
1641 break; 1641 break;
1642 } 1642 }
1643 m_leds [0] = Led_Off; 1643 m_leds [0] = Led_Off;
1644} 1644}
1645 1645
1646void Zaurus::initButtons ( ) 1646void Zaurus::initButtons ( )
1647{ 1647{
1648 if ( d-> m_buttons ) 1648 if ( d-> m_buttons )
1649 return; 1649 return;
1650 1650
1651 d-> m_buttons = new QValueList <ODeviceButton>; 1651 d-> m_buttons = new QValueList <ODeviceButton>;
1652 1652
1653 struct z_button * pz_buttons; 1653 struct z_button * pz_buttons;
1654 int buttoncount; 1654 int buttoncount;
1655 switch ( d-> m_model ) { 1655 switch ( d-> m_model ) {
1656 case Model_Zaurus_SLC7x0: 1656 case Model_Zaurus_SLC7x0:
1657 pz_buttons = z_buttons_c700; 1657 pz_buttons = z_buttons_c700;
1658 buttoncount = ARRAY_SIZE(z_buttons_c700); 1658 buttoncount = ARRAY_SIZE(z_buttons_c700);
1659 break; 1659 break;
1660 default: 1660 default:
1661 pz_buttons = z_buttons; 1661 pz_buttons = z_buttons;
1662 buttoncount = ARRAY_SIZE(z_buttons); 1662 buttoncount = ARRAY_SIZE(z_buttons);
1663 break; 1663 break;
1664 } 1664 }
1665 1665
1666 for ( int i = 0; i < buttoncount; i++ ) { 1666 for ( int i = 0; i < buttoncount; i++ ) {
1667 struct z_button *zb = pz_buttons + i; 1667 struct z_button *zb = pz_buttons + i;
1668 ODeviceButton b; 1668 ODeviceButton b;
1669 1669
1670 b. setKeycode ( zb-> code ); 1670 b. setKeycode ( zb-> code );
1671 b. setUserText ( QObject::tr ( "Button", zb-> utext )); 1671 b. setUserText ( QObject::tr ( "Button", zb-> utext ));
1672 b. setPixmap ( Resource::loadPixmap ( zb-> pix )); 1672 b. setPixmap ( Resource::loadPixmap ( zb-> pix ));
1673 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ), 1673 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ),
1674 zb-> fpressedaction )); 1674 zb-> fpressedaction ));
1675 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ), 1675 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ),
1676 zb-> fheldaction )); 1676 zb-> fheldaction ));
1677 1677
1678 d-> m_buttons-> append ( b ); 1678 d-> m_buttons-> append ( b );
1679 } 1679 }
1680 1680
1681 reloadButtonMapping ( ); 1681 reloadButtonMapping ( );
1682 1682
1683 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 1683 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
1684 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), 1684 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )),
1685 this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 1685 this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
1686} 1686}
1687 1687
1688#include <unistd.h> 1688#include <unistd.h>
1689#include <fcntl.h> 1689#include <fcntl.h>
1690#include <sys/ioctl.h> 1690#include <sys/ioctl.h>
1691 1691
1692//#include <asm/sharp_char.h> // including kernel headers is evil ... 1692//#include <asm/sharp_char.h> // including kernel headers is evil ...
1693 1693
1694#define SHARP_DEV_IOCTL_COMMAND_START 0x5680 1694#define SHARP_DEV_IOCTL_COMMAND_START 0x5680
1695 1695
1696 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 1696 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
1697#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 1697#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
1698 1698
1699#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ 1699#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
1700#define SHARP_BUZ_KEYSOUND 2 /* key sound */ 1700#define SHARP_BUZ_KEYSOUND 2 /* key sound */
1701#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ 1701#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
1702 1702
1703/* --- for SHARP_BUZZER device --- */ 1703/* --- for SHARP_BUZZER device --- */
1704 1704
1705 //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 1705 //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
1706//#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 1706//#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
1707 1707
1708#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) 1708#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1)
1709#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) 1709#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2)
1710#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) 1710#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3)
1711#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) 1711#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4)
1712#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) 1712#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5)
1713 1713
1714//#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ 1714//#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
1715//#define SHARP_BUZ_KEYSOUND 2 /* key sound */ 1715//#define SHARP_BUZ_KEYSOUND 2 /* key sound */
1716 1716
1717//#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ 1717//#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */
1718//#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ 1718//#define SHARP_PDA_WARNSOUND 4 /* warning occurred */