Hi everybody,
I'm amazed how much is going on about the TomTom devices after such a
long time. A almost thought, the community was gone... but now
everything seems to be pretty much alive again. I will see that I start
contributing again as well :)
That said, I have to tell you that the power-button stuff is pretty much
messed up... I originally wroten an event device driver for TomTom but
they decided to drop it in one of the more recent kernel versions and
switch so a more screwed up kind of way:
There are to ways to read the power button: Either monitor the value of
/proc/barcelona/onoff (which changes after you hold the button down for
a while) or you open /dev/hwstatus (which is character device 240,0)
poll the following ioctl:
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <sys/ioctl.h>
#include <stdlib.h>
typedef struct {
quint8 u8ChargeStatus;
quint16 u8InputStatus;
quint8 u8DockStatus;
} HARDWARE_STATUS;
#define GPIO_DRIVER_MAGIC 'U'
#define IOR_HWSTATUS _IOR(GPIO_DRIVER_MAGIC, 0, HARDWARE_STATUS)
void pollStatus(int devHWStatus)
{
HARDWARE_STATUS hwstatus;
if(ioctl(devHWStatus, IOR_HWSTATUS, &hwstatus) < 0) {
fprintf(stderr, "could not read hardware status: %s",
strerror(errno));
return;
}
if(hwstatus.u8InputStatus & 1) {
fprintf(stderr, "power button");
system("killall gltt");
sleep(1);
system("sync");
system("halt");
}
}
Unfortunately the halt/reboot syscalls are broken in the kernel. TomTom
only puts the device into sleep mode - so I suspect they don't test
powerdown too much. I someone is willing to search the power regulator
shutdown GPIO, a fix for that problem should be pretty easy.
Best regards,
Christian
davor emard schrieb:
HI
Does someone know how to correctly operate on-off function
of the tomtom?
For my debian to nicely shutdown I'd like to read power button
state but how? On the event interface there's only touchscreen
and power button press event doesn't show.
Can someone post a code snippet
that reads button state or better that can execute some program
upon button press?
Second, how to correctly power down the tomtom ?
(without using suspend to RAM). If I just execute shudown
from debian, the screen turns down and everything looks good
EXCEPT it's not real shutown, it continues draining battery
(also is still discoverable on bluetooth although LCD
is off)
Best regards, Davor
--
---------------------------------------------------
| maintech # Dipl. Inf (FH) Christian Daniel |
| GmbH ### Otto-Hahn-Str. 15 · D-97204 Höchberg |
---------------------------------------------------
| AG Würzburg, HRB 8790 Tax-ID DE242279645 |
---------------------------------------------------
| http://www.maintech.de [email protected] |
---------------------------------------------------