2014年2月11日 星期二

How To Clean Up Com Port To Use?

  1. Click start → Run → type regedit and click OK button
  2. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\COM Name Arbiter
  3. Now on the right panel, you can see the key ComDB. Right-click it and click modify
  4. In value Data section select all and delete reset to Zero (0)
    Its 32 bytes with 8 bits in each byte. A set bit makes a port number (1...256) reserved. 
  5. Close Registry editor and then restart your computer. All COM ports are now Free.
    You may need to reinstall any USB-to-serial converter.

How do I clean up COM ports in use?

2014年2月4日 星期二

How to Change COM PORT for a USB Device.

To change the com port (in Windows XP):
  1. Click on the Start menu
  2. Right click on My Computer
  3. Select Manage
  4. Select Device Manager from the list on the left.
You will now have Device Manager showing in the right hand pane.
  1. Expand the group Ports (COM & LPT)
  2.  Double click on your device from the list (it will probably say USB Serial Port (COM20) or similar)
  3. Select the Port Settings tab
  4. Click on Advanced
You now have the Advanced Settings window showing. Here you can change the port number - for best results, select a number between 5 and 16.
If all these port numbers appear to be taken, you can select one anyway (often they are marked as still being in use when they are no longer used).



Changing the COM port for a USB device

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.









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. 架環境 兩種情況


1)














 2)

以上這兩種是從WLK文件而來,安裝方法基本上更簡單

我是屬於第二種,所以我在server computer安裝HCK直接安裝studio+controller即可

另外test computer使用區域網路連到server computer在\\\HCKInstall\Client\Setup.exe.執行setup即可


2. 申請VeriSign certificate


其步驟
  1. Establish a company
  2. Get a VeriSign certificate
  3. Add a user or migrate an account
  4. Sign legal agreements
  5. Sign in to the hardware dashboard
基本上不用這麼複雜

你只要在官網的左上角進入DASHBOARD即可

你需要一個microsoft帳號,登入後就會出現 Establish a company ...

再來直接點連結purchase..... 去symentec 購買一個認證

需要注意的是,要在安裝HCK STUDIO的電腦申請,而且到申請完成之前都不可以重灌或換電腦,認證會辨別電腦。

照著步驟走
下載
  • Download the Winqual.exe file
download signtool 基本上就是安裝WDK Windows SDK for Windows 7

使用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日 星期四

Youtube music channel

https://www.youtube.com/user/goldddiggaa


Android Tab View

[Android] 建立Tab View的三種方式(上)

第一種,將每個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選項可以選擇了

選一個CPU吧,我個人覺得效果不大 =)

2013年10月2日 星期三