2013年11月24日 星期日
2013年11月18日 星期一
自己寫Driver Installer
1. 要先有Driver的inf, cat, sys檔案
2. 可以使用很多付費工具像是Advanced Installer, installshield, Wise Package Studio之類的
或者可以使用Wix, Visual Studio等等
3. 大部分的人都喜歡使用Wix,而且有官方教學Wix Tutorial
4. 或者使用visual studio建立setup project產生msi檔案
再利用Orca去做修改Install usb device
但我自己是使用Visual Studio 2005寫一個安裝driver程式產生exe 设计驱动安装程序
最後再讓msi去執行
5. 很多人說可以使用Driver Install Frameworks (DIFx), Device Console (devcon), SetupAPI等等
但都是說說沒有例子
最後,
1)
我決定寫一個安裝driver的執行程式exe檔案
使用的是setupapi 但要注意 setupapi.h和setupapi.lib該如何使用
首先在程式裡面使用SetupCopyOEMInf,這個程式會安裝inf檔案到windows系統內
第二,需要安裝device,使用UpdateDriverForPlugAndPlayDevices
2)
解除安裝一樣要分inf與device
所以要先使用SetupUninstallOEMInf
再來使用SetupDiRemoveDevice去解除安裝device 可以參考如何自動移除驅動程式
另外,可以使用CM_Locate_DevNode, CM_Reenumerate_DevNode去掃描安裝完成的Driver
3)
使用visual studio建立setup project
建立custom action去執行exe檔
可參考
Custom Action in Visual Studio setup projects
Launching Your Application After Install using Visual Studio 2005
但我的執行程式再安裝的時候怎麼都執行不起來
所以我在msi安裝完成後才執行程式 可參考Run exe after msi installation
最後,我需要判斷我的電腦是64bit或32bit可參考Getting Processor architecture in x86 and x64 bit platform.
2. 可以使用很多付費工具像是Advanced Installer, installshield, Wise Package Studio之類的
或者可以使用Wix, Visual Studio等等
3. 大部分的人都喜歡使用Wix,而且有官方教學Wix Tutorial
4. 或者使用visual studio建立setup project產生msi檔案
再利用Orca去做修改Install usb device
但我自己是使用Visual Studio 2005寫一個安裝driver程式產生exe 设计驱动安装程序
最後再讓msi去執行
5. 很多人說可以使用Driver Install Frameworks (DIFx), Device Console (devcon), SetupAPI等等
但都是說說沒有例子
最後,
1)
我決定寫一個安裝driver的執行程式exe檔案
使用的是setupapi 但要注意 setupapi.h和setupapi.lib該如何使用
首先在程式裡面使用SetupCopyOEMInf,這個程式會安裝inf檔案到windows系統內
第二,需要安裝device,使用UpdateDriverForPlugAndPlayDevices
2)
解除安裝一樣要分inf與device
所以要先使用SetupUninstallOEMInf
再來使用SetupDiRemoveDevice去解除安裝device 可以參考如何自動移除驅動程式
另外,可以使用CM_Locate_DevNode, CM_Reenumerate_DevNode去掃描安裝完成的Driver
3)
使用visual studio建立setup project
建立custom action去執行exe檔
可參考
Custom Action in Visual Studio setup projects
Launching Your Application After Install using Visual Studio 2005
但我的執行程式再安裝的時候怎麼都執行不起來
所以我在msi安裝完成後才執行程式 可參考Run exe after msi installation
最後,我需要判斷我的電腦是64bit或32bit可參考Getting Processor architecture in x86 and x64 bit platform.
2013年11月4日 星期一
Windows Hardware Quality Lab - WHQL認證Driver
WHQL功能: 自己查
官方網站: http://msdn.microsoft.com/zh-TW/windows/hardware/
目的: 測手機的Driver通過WHQL
我的環境:
1. Android Phone
2. Server Computer: Windows Server 2008 R2
3. Test Computer: Windows 7 x64
首先,要知道我們要測什麼東西,需要什麼環境,可參考 Certification Kit Support Matrix
基本上沒有人在使用WLK1.6了,除非特殊情況,windows好像也要收起來了
所以一般來說都會使用Windows HCK
先去Windows Hardware Certification Kit (HCK) downloads 把WHCK download下來
然後按照Windows hardware certification: start here步驟走
基本上就沒問題了
以下是我自己的流程
1)
2)
以上這兩種是從WLK文件而來,安裝方法基本上更簡單
我是屬於第二種,所以我在server computer安裝HCK直接安裝studio+controller即可
另外test computer使用區域網路連到server computer在\\\HCKInstall\Client\Setup.exe .執行setup即可
其步驟
你只要在官網的左上角進入DASHBOARD即可
你需要一個microsoft帳號,登入後就會出現 Establish a company ...
再來直接點連結purchase..... 去symentec 購買一個認證
需要注意的是,要在安裝HCK STUDIO的電腦申請,而且到申請完成之前都不可以重灌或換電腦,認證會辨別電腦。
照著步驟走
下載
使用signtool sign winqual.exe再上傳
signtool可以參考signtool.exe
接下來可能需要一個測試認證,可以參考簽署裝置驅動程式套件的步驟
就完成了這個階段
接下來就按照步驟走,就沒問題了 =)
需要注意的是,create project -> configure, create test machine pool, and check client computer is ready -> 接下來選擇測試的機器,可以在左邊直接選擇driver即可,不必整個system都去測試
測試完成之後
把結果跟driver一起打包
進入DASHBOARD
-> create hck submission 填好選項之後送出
大概幾個小時就會有結果
最後進入manager submission ->選擇你的submission之後右下角可以直接下載sign file
sign file 內容就是已經通過whql的driver!!
DONE~
官方網站: http://msdn.microsoft.com/zh-TW/windows/hardware/
目的: 測手機的Driver通過WHQL
我的環境:
1. Android Phone
2. Server Computer: Windows Server 2008 R2
3. Test Computer: Windows 7 x64
首先,要知道我們要測什麼東西,需要什麼環境,可參考 Certification Kit Support Matrix
基本上沒有人在使用WLK1.6了,除非特殊情況,windows好像也要收起來了
所以一般來說都會使用Windows HCK
先去Windows Hardware Certification Kit (HCK) downloads 把WHCK download下來
然後按照Windows hardware certification: start here步驟走
基本上就沒問題了
以下是我自己的流程
1. 架環境 兩種情況
1)
2)
以上這兩種是從WLK文件而來,安裝方法基本上更簡單
我是屬於第二種,所以我在server computer安裝HCK直接安裝studio+controller即可
另外test computer使用區域網路連到server computer在\\
2. 申請VeriSign certificate
其步驟
- Establish a company
- Get a VeriSign certificate
- Add a user or migrate an account
- Sign legal agreements
- Sign in to the hardware dashboard
你只要在官網的左上角進入DASHBOARD即可
你需要一個microsoft帳號,登入後就會出現 Establish a company ...
再來直接點連結purchase..... 去symentec 購買一個認證
需要注意的是,要在安裝HCK STUDIO的電腦申請,而且到申請完成之前都不可以重灌或換電腦,認證會辨別電腦。
照著步驟走
下載
- Download the Winqual.exe file
使用signtool sign winqual.exe再上傳
signtool可以參考signtool.exe
接下來可能需要一個測試認證,可以參考簽署裝置驅動程式套件的步驟
就完成了這個階段
3. 測試Driver
接下來就按照步驟走,就沒問題了 =)
需要注意的是,create project -> configure, create test machine pool, and check client computer is ready -> 接下來選擇測試的機器,可以在左邊直接選擇driver即可,不必整個system都去測試
測試完成之後
把結果跟driver一起打包
進入DASHBOARD
-> create hck submission 填好選項之後送出
大概幾個小時就會有結果
最後進入manager submission ->選擇你的submission之後右下角可以直接下載sign file
sign file 內容就是已經通過whql的driver!!
DONE~
2013年10月3日 星期四
Android Tab View
[Android] 建立Tab View的三種方式(上)
第一種,將每個tab的內容寫在同個Activity
第二種,不同tab的內容分別寫在不同的Activity
將mTabHost.addTab(mTabHost.newTabSpec("tab2").setIndicator("TAB2").setContent(this));
的setContent帶入參數intent即可!
第一種,將每個tab的內容寫在同個Activity
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity"
android:orientation="vertical" >
<TabHost
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
</TabWidget>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</FrameLayout>
</LinearLayout>
</TabHost>
</LinearLayout>
public class MainActivity extends TabActivity implements TabContentFactory {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TabHost mTabHost = getTabHost();
mTabHost.clearAllTabs();
mTabHost.addTab(mTabHost.newTabSpec("tab1").setIndicator("TAB1").setContent(this));
mTabHost.addTab(mTabHost.newTabSpec("tab2").setIndicator("TAB2").setContent(this));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
//getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public View createTabContent(String tag) {
TextView textView = new TextView(this);
textView.setText("I'm " + tag);
return textView;
}
}
第二種,不同tab的內容分別寫在不同的Activity
將mTabHost.addTab(mTabHost.newTabSpec("tab2").setIndicator("TAB2").setContent(this));
的setContent帶入參數intent即可!
行動是唯一答案
“You may never know what results come of your action, but if you do nothing there will be no result.”
– Mahatma Gandhi, Statesman
「你可能永遠不知道你的行為能帶來什麼結果, 但沒有行動就不會有結果。」– 甘地 (政治家)
增加Android emulator速度
ADT中通过Android SDK Manager安装Intel Hardware Accelerated Execution Manager
1. Android SDK Manager安裝 Intel x86 Emulator Accelerator (HAXM)
基本上 沒安裝的都把他裝一裝
2. 測試 打開CMD
輸入sc query intelhaxm
如果是以下結果
[SC] EnumQueryServicesStatus:OpenService FAILED 1060:
The specified service does not exist as an installed service.
去對應的sdk\extras\intel\Hardware_Accelerated_Execution_Manager 路徑下
安裝...\sdk\extras\intel\Hardware_Accelerated_Execution_Manager\IntelHaxm.exe
3.打開CMD
輸入sc query intelhaxm
如果出現
SERVICE_NAME: intelhaxm
TYPE : 1 KERNEL_DRIVER
STATE : 4 RUNNING
(STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
表示成功
4.打開Android Virtual Device Manager
去Edit你的Device
CPU/ABI選項可以選擇了
1. Android SDK Manager安裝 Intel x86 Emulator Accelerator (HAXM)
基本上 沒安裝的都把他裝一裝
2. 測試 打開CMD
輸入sc query intelhaxm
如果是以下結果
[SC] EnumQueryServicesStatus:OpenService FAILED 1060:
The specified service does not exist as an installed service.
去對應的sdk\extras\intel\Hardware_Accelerated_Execution_Manager 路徑下
安裝...\sdk\extras\intel\Hardware_Accelerated_Execution_Manager\IntelHaxm.exe
3.打開CMD
輸入sc query intelhaxm
如果出現
SERVICE_NAME: intelhaxm
TYPE : 1 KERNEL_DRIVER
STATE : 4 RUNNING
(STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
表示成功
4.打開Android Virtual Device Manager
去Edit你的Device
CPU/ABI選項可以選擇了
選一個CPU吧,我個人覺得效果不大 =)
2013年10月2日 星期三
好歌手分享 Sistars
http://grooveshark.com/#!/sistars
不是韓國的那個SISTAR唷
http://en.wikipedia.org/wiki/Sistars
雖然韓國的長的又正又美
但是這位波蘭女歌手的歌,讓我有陽光的感覺
不是韓國的那個SISTAR唷
http://en.wikipedia.org/wiki/Sistars
雖然韓國的長的又正又美
但是這位波蘭女歌手的歌,讓我有陽光的感覺
2013年5月6日 星期一
2013年4月24日 星期三
BREW 3.1.5 OEM Font
The BREW System using
IFont Interface to Draw Text/Chars internal. Actually, It is used by
IDisplay_DrawText.
The important concept is,
two type font: Logical Font & Physical Font.
1)The Logical Font is as :
// Logical font type
enum {
AEE_FONT_NORMAL=0x8000,
AEE_FONT_BOLD,
AEE_FONT_LARGE,
AEE_FONT_ITALIC,
AEE_FONT_BOLD_ITALIC,
AEE_FONT_LARGE_ITALIC,
AEE_FONT_NORMAL_SCH,
AEE_FONT_USER_1,
AEE_FONT_USER_2,
AEE_FONT_TOTAL
};
enum {
AEE_FONT_NORMAL=0x8000,
AEE_FONT_BOLD,
AEE_FONT_LARGE,
AEE_FONT_ITALIC,
AEE_FONT_BOLD_ITALIC,
AEE_FONT_LARGE_ITALIC,
AEE_FONT_NORMAL_SCH,
AEE_FONT_USER_1,
AEE_FONT_USER_2,
AEE_FONT_TOTAL
};
2)The Phisical Font is The
detail implemented IFont Interface
For, IDisplay, It will
associate one logical font type with one phisical font instance. And When you
Call IDisplay_DrawText, passed the logical font type, IDisplay inside will
using the associated IFont instance to draw chars, such as IFONT_DrawText.
Now, I give the basic flow
for BREW Font management:
When BREW Init, BREW will
create some system Font instance(physical Font) with such as
AEECLSID_FONTSYSNORMAL,
AEECLSID_FONTSYSLARGE,
AEECLSID_FONTSYSBOLD,
And Call
IDISPLAY_SetFont to associate them with logical font type:
AEE_FONT_NORMAL,
AEE_FONT_LARGE,
AEE_FONT_BOLD
Then, When App Call
IDISPLAY_DrawText, and passed logical font type, BREW will using the related
IFont instance to draw chars.
If App want to change the
default physical font, Then, Developer can implement their own IFont Interface.
Create this IFont instance in run-time, Then Call IDisplay_SetFont, Passed this
IFont Instance and the logical font type which you want to associated, assume,
AEE_FONT_BOLD .
OK, from now on, When you using IDisplay_Drawtext with
AEE_FONT_BOLD , BREW will use your own IFont instance to draw the text.
修改自己的FONT三種方法
1)使用BREW Font Extension
2)從底層OEM層修改AEECLSID_FONTSYSNORMAL, AEECLSID_FONTSYSLARGE, AEECLSID_FONTSYSBOLD
3)在程式內撰寫IDisplay_SetFont
訂閱:
文章 (Atom)


