Windows Mobile – the no-go world of Function Keys

Hello

I want to summarize the role of function keys in Windows Mobile, former Pocket PC, as I got several questions each week on how to use or enable Function keys in this or that application.

Here is a simple information about how function keys work in Windows Mobile.

Continue reading ‘Windows Mobile – the no-go world of Function Keys’ »

Enigma2 OpenEmbedded Enhanced Movie Center Trashfolder CleanUp

We own a great VuPlus Solo2 Linux based Satelit Receiver. We record some series and films and then delete them. The deleted media files are not deleted directly when using EMC to view and delete. The media files are moved to a trash folder first and should be automatically deleted after x days. But that does not work for whatever reason.

Recently I checked the trash folders I found, as I wondered why the box’s hard disk is getting filled up. And I found many, many old ‘deleted’ files, that are not removed from the hard disk.

I decided to write my own script (/home/root/deltrasholder7days.sh, yes, there is a typo ;-)) ) to finally remove ‘deleted’ files after 7 days. The script was then added to the root’s crontab.

#!/bin/sh
# delete old files
# delete trash files older than 7 days
/usr/bin/find /mnt/hdd/movie_trash -type f -mtime +7 -delete
/usr/bin/find /mnt/hdd/movie/trashcan -type f -mtime +7 -delete
cd /mnt/hdd/movie_trash/
rm last_cleanup*
touch last_cleanup_$( date '+%Y-%m-%d_%H-%M-%S' )
cd /mnt/hdd/movie/trashcan/
rm last_cleanup*
touch last_cleanup_$( date '+%Y-%m-%d_%H-%M-%S' )

The script deletes all files at /mnt/hdd/movie_trash and /mnt/hdd/movie/trashcan with a modification date of 7 days before current day. Then it adds a file with a timestamp as name to let me know, that the script has worked at what time.
… and the crontab (/etc/cron/crontabs/root):

1 1 * * * /home/root/deltrasholder7days.sh

This starts the script every day at 1pm.

That’s all, thank’s to the author of the find utility.

Brother MFC-235C and phpSANE plus Scan-to-eMail etc.

I had some challenge to get phpSANE to work with the flatbed scanner of my MFC-235C.

Although phpSANE should create a scanner ini file with the available settings of the scanner, this does not work out of the box with a simple install of phpSANE. To get the available settings of the sanner, scanimage -L is used. Using this manually reveals which SANE features are supported by the scanner:

Options specific to device `net:localhost:brother2:bus5;dev1':
  Mode:
    --mode Black & White|Gray[Error Diffusion]|True Gray|24bit Color [24bit Color]
        Select the scan mode
    --resolution 100|150|200|300|400|600|1200|2400|4800|9600dpi [200]
        Sets the resolution of the scanned image.
    --source FlatBed [FlatBed]
        Selects the scan source (such as a document-feeder).
    --brightness -50..50% (in steps of 1) [inactive]
        Controls the brightness of the acquired image.
    --contrast -50..50% (in steps of 1) [inactive]
        Controls the contrast of the acquired image.
  Geometry:
    -l 0..215.9mm (in steps of 0.0999908) [0]
        Top-left x position of scan area.
    -t 0..355.6mm (in steps of 0.0999908) [0]
        Top-left y position of scan area.
    -x 0..215.9mm (in steps of 0.0999908) [215.88]
        Width of scan-area.
    -y 0..355.6mm (in steps of 0.0999908) [355.567]
        Height of scan-area.

But most of these values are not recognized by phpSANE. So I hardcoded some of the features directly in the phpSANE code.

Fixes and changes

  • Missing directories (output, scanners, tmp), incorrect permissions prevented phpSane to create a scanner ini for the scanner.
  • The Mode selection list was not filled as phpSane expects the special mode names Gray, Color and Lineart. I hard coded the mode_list and changed security.php to allow spaces, [, ] and &
  • The pnm output of the scanimage command for the brother is corrupted. I added a pipe into pamfixtrunc in the cmd used to generate files or preview (scan.php)
  • changed config.php to meet the scanners features. I.e. the lowest res supported is 100 and not 75.
  • although scanimage says the scanner supports brightness and contrast, phpSane was unable to read the correct values. I hardcoded brightness and contrast default, min and max values (0,-50, 50).

See my code at https://github.com/hjgode/phpSANE

brscan-skey

I was unable to get the scripts provided to work with my Linux Debian installation, so I just coded some new scripts and replaced the original ones.

Here is my scan-to-email script (scantoemail-0.2.4-1.sh) using sendEmail package:

#!/bin/sh
FILENAME="/tmp/$(date "+%Y-%m-%d_%H-%M-%S").jpg"
SENDTO='nameofreceiptient@mail.com'
SCANCMD="/usr/bin/scanimage -d 'brother2:bus5;dev1' --mode 'True Gray' --resolution 150dpi -l 5mm -x 210mm -y 297mm | /usr/bin/pamfixtrunc | /usr/bin/pnmtojpeg > "$FILENAME
SENDEMAIL="/usr/bin/sendEmail -f 'yournamel@mail.com' -t "${SENDTO}" -u 'Scanned to email' -m 'Im Anhang das gescannte Dokument' -a "$FILENAME" -s 'smtp.gmail.com:587' -xu 'yourname@gmail.com' -xp 'yourepassword' -o tls=auto -o message-charset=utf-8"
eval ${SCANCMD}
eval ${SENDEMAIL}
exit 0

Fix corrupted pnm output of scanimage

Unfortunately the pnm out put of scanimage is corrupted with the MFC-235 bu can be fixed on-the-fly with the use of pamfixtrunc. This was used in my scan-to-email replacement and in my phpSANE setup.

NPAPI – a plugin to retrieve device information

Some times ago I wrote a barcode scanner NPAPI plugin for the HTML5 browser by zetakey. It is based on code supplied as MySensor in the motorola knowledge base. The plugin is for Windows Mobile 6.x based devices by Intermec and another one for M3 devices.

The MySensor plugin based on npruntime was the only sample I could get to compile and work correctly. The barcode scanner fork I wrote does also work very well. The new MyDevinfo plugin retrieves model code, battery level and WLAN RSSI value of the Intermec device and allows to present this information to a HTML5 browser user when needed.

npapi_simple

The above shows the web page of MyDevinfo_simple.htm.

Continue reading ‘NPAPI – a plugin to retrieve device information’ »

WICD does not reconnect after suspend: obtaining IP address

My Debian 8 Jessie installed Acer Aspire One netbook had problems reconnecting after suspend resume.

WICD showed obtaining IP address for a long time and finally gave up or so. Tried dhclient and dhcpcd, no change. Tried debug mode, which results in the netbook sometimes did not resume to the OS and I had to do a hard reset :-(. Disabled debug logging option in wicd.conf again. Could not live with hard resets.

Changed dhcp server from integrated one in router (tested with different models) to my Linux Debian SID server, no change.

I added the option nolink (for buggy interfaces, found in man dhcpcd and dhcp.conf and inspried by LinuxQuestions.Org) to /etc/dhcpcd.conf and now WICD reconnects fine and fast after setting dhcpcd as external DHCP Client. WICD is version 1.7.24.

Issue solved 🙂

UPDATE 31.8.2016:

Bad news: WICD still does not resolve DHCP address. I mostly have to Cancel the ‘Obtaining IP address…’ process and manually connect. Some times it connects on first time but some times on second or thrird attempt.

Now tested connman. But it behaves alsoe strange. After first install everything looked fine. But after reboot it stated no services available or other strange errors about no wifi and sh.. After some more tests I relaized that connman is not really integrated into Debian. Maybe it is good for ArchLinux? Fortunately I always got a connection using ifdown/ifup for wlan0.

Finally I switched to network-manager and network-manager-gnome. And that impressed me. It connects very, very fast. Hopefully that will be reliable. Suspend and resume also works fine without fiddeling in any conf files so far.

BTW: I am running two Cisco APs with same SSID/WPA2 passphrase, so the devices can roam (no AP controller, just the Cisco APs). Possibly that makes WICD nervous?