Beijer Electronics (formerly QSI Corporation)

Manufacturer of Mobile Data and Human Machine Interface Terminals.
It is currently Fri Nov 24, 2017 12:14 am

All times are UTC - 7 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Wed Sep 15, 2010 8:26 am 
Offline
User avatar

Joined: Thu Jan 14, 2010 10:20 am
Posts: 38
Please be aware that this does not persist across power cycles. You will need to run this code upon OS launch if you want the functionality to persist.

Code:
DWORD PIC_IO_GET_REG = 0x7;
DWORD PIC_IO_SET_REG = 0x8;

/* turn on/off F4 power-off function*/
//get current value
g_hPWDevice = CreateFile(TEXT("PIC1:"), GENERIC_READ|GENERIC_WRITE, 0, NULL,OPEN_EXISTING, 0, NULL);
BYTE reg[2];   
reg[0] = 0xc;

if (DeviceIoControl(g_hPWDevice, PIC_IO_GET_REG ,reg,sizeof(BYTE), reg+1, sizeof(BYTE),NULL,NULL))
{
   
}else{
   
}

reg[0]=0xC;   

if(_wtoi((const wchar_t*)argv[1])){
    printf("Turn on key F4 power-off function ");
    //enable
    reg[1]|=0x20;
}else{
    //disable
    printf("Turn off key F4 power-off function ");
    reg[1]&=~0x20;       
}   
//set the value
if (DeviceIoControl(g_hPWDevice, PIC_IO_SET_REG ,reg,2*sizeof(BYTE), NULL, 0,NULL,NULL))
{
    printf("succeeded.\r\n");
}else{
    printf("failed!\r\n");
}

if(!CloseHandle(g_hPWDevice))
{
    return 0;   
};


Also, command line utility for doing so:
http://www.qsicorp.com/engfiles/Support/Apps/CE6_ARM/M4KeyPowerOffCE.zip

command line usage to DISABLE powering functionality of button 4:
m4keypoweroffce 0
command line usage to ENABLE powering functionality of button 4:
m4keypoweroffce 1


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 7 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group