HI

Thanks for the power button info, that works. I have written
a script and workaround to at least put it into sleep instead
of the powerdown.

contribute, I was on a trip and needed tomtom to show me the way, but
for that particular destination my tomtom's internal application
was constantly crashing... OK I found the destination on the
"traditional" way, and they fixed it in latest navcore
but since now you can get large SD card dirt cheap and device
accepts 8GB cards, I decided to install true linux in this so I
started contributing :)

I also thought the power regulator support was never there (maybe
latest kernels have something but we need to somehow get them
running).

Your hint was very useful, this is how I read a power button
#!/bin/sh

OLDSTATE=`cat /proc/barcelona/onoff`
(
while true
do
ONOFF=`cat /proc/barcelona/onoff`
if [ "$ONOFF" != "$OLDSTATE" ]
then
  shutdown -h now
  exit
fi
sleep 1
done
) &


and my fix for the shutdown is to leave watchdog timer and
without refreshing (it would reset for 30 seconds) and then
I echo "mem" > /sys/power/state; sleep 60
that enters suspend to ram mode and kinda powers down.
when it wakes up it will sleep for 60 seconds but the watchdog
will restart the device in less than 30 seconds, so at least we can
get the shutdown-alike behaviour

Best regards, Davor


On 1/9/09, Christian Daniel - maintech GmbH <[email protected]> wrote:
> 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] |
> ---------------------------------------------------
>

Reply via email to