2010年8月14日土曜日

Fonera 2202にWillcom/Emobileを接続 その4

 

今回は、Lua/Luci によるGUIとなります。lua/htmファイルはそのままFonera 2202にコピーします。luaファイルについては開発環境に追加するとbinaryにすることができますが、今回はメンテナンス性も考慮してソースコードのままとします。Binary化してのPackageが便利とは思いますが、まだそこまで構築方法の調査が進んでいません。

その1で安定していると書きましたが、負荷テストをしてみたところ、

  • WSIM IO Data接続の場合には、10MBのファイルのダウンロードにおいて、PPPの取りこぼしが発生することがある。PPPのdisconnect/reconnectになる。
  • H12HWの場合には、10MBのファイルダウンロードは成功しましたが、接続したままの放置状態にしておくと、何度か接続が切れてしまうことがありました。

となりました。WSIMについては、logreadを読むとCPUの性能が足らない可能性があるかと思われます。H12HWについては、(田舎ですので)emobileの通信状態もしくはこのところの暑さで発熱の可能性もありますが、どちらについても原因の追及はできていません。

 

1. GUI概要
TOP画面 
ff1  
「設定」をクリックします。

fon_admin画面
ff2
「ダイヤルアップ」アイコンをクリックします。アイコン自身はフリーのアイコンをダウンロードしているので、他のアイコンのマッチングはとれていません。

ダイヤルアップ画面
ff3 
登録済みの設定が一覧表示れています。各表示について、設定内容の編集ボタンと設定削除のボタンがあります。「編集」ボタンをクリックすると、編集画面が開きます。「削除」ボタンのクリックでは確認画面なしに設定が削除されます。そのうち追加はしたいと考えています。
ここでは、EmobileはOEM元のHuaweiをベンダー名としています。

設定編集画面
ff4 
設定の変更後、「保存」ボタンを押すと/etc/config/ttyusbに登録さている情報を更新します。VIDPIDが更新された場合には、登録されている情報を一旦削除してから、新規に登録します。
設定画面では入力値のチェック(空文字列も含む)は行っていません。/lib/uci/schema/default/ttyusbを参照しての入力値チェックをそのうち追加したいと考えています。Luci / Modelによって記述した画面ならば、何もせずとも入力値のチェックがされるのかもしれませんが。

設定の追加画面
 ff5
設定の追加画面においても、入力値のチェックは行っていません。VIDPIDは必須です。接続速度については、IO Data WSIMの場合には115200(bps)が上限のようです。これ以上の速度では chat scriptに対してWSIMの反応がありません。Foneraにてlogreadの結果を見るとchat scriptにてtime outが発生します。接続コマンドについては、-T<Phone number>の部分を書き換えます。Emobileの場合には、ダイヤル先が *99#なので、接続コマンドは、
/tmp/chat_dialer –s –v –T*99#
となります。

 

 

2. /usr/lib/lua/luci/controller/dialup.lua

--[[
  File: dialup.lua
  Description: dialup configration control file.
  Page transition:
    edit.htm: a html template to edit a ppp configuration
    remove.lua: a lua file to remove a ppp configuration
    addentry.htm: a html template to add a net configuratin
    ttyregsit.lua: a lua file to regist a ppp configuratin.
  Revision history:
    2010-08-14: Initial release
--]]

module("luci.controller.dialup", package.seeall)

function index()
        require("luci.i18n")
        luci.i18n.loadc("dialup")

        local page = entry({"fon_admin", "fon_dialup"}, template("dialup/dialup"),
                     luci.i18n.translate("dialup", "dialup"))
        page.i18n = "dialup_dialup"
        page.sysauth = "root"
        page.icon_path = "/luci-static/resources/icons"
        page.icon = "dialup.png"
        page.page_icon = "dialup.png"

        local epage = entry({"fon_admin", "fon_dialup", "edit"},
                      template("dialup/edit"),
                      luci.i18n.translate("dialup_edit", "Edit"))

        local epage = entry({"fon_admin", "fon_dialup", "remove"},
                      cbi("dialup/remove",
                      {on_success_to = {"fon_admin/fon_dialup"}}), "remove")

        local cpage = entry({"fon_admin", "fon_dialup", "addentry"},
                      template("dialup/addentry"),
                      luci.i18n.translate("dialup_addentry", "Add entry"))

        local rpage = entry({"fon_admin", "fon_dialup", "ttyregist"},
                      cbi("dialup/ttyregist",
                      {on_success_to = {"fon_admin/fon_dialup"}}), "ttyregist")

end

ダイヤルアップ接続のコントロール定義となります。メイン画面(dailup.htm)、編集画面(edit.htm)、追加画面(addentry.htm)、削除処理(remove.lua)、登録処理(ttyregist.lua)を記載します。viewのhtmファイルはtemplate(), model/cbiのluaファイルはcbi()を使います。

 

3. /usr/lib/lua/luci/view/dialup/dialup.htm

<!--
  File: dailup.htm
  Description: PPP dailup configration main.
  Page transition:
     dailup.htm -> edit.htm
                   remvoe.lua
       addentry: -> addentry.htm
       cancel: -> fon_admin

  Revision history:
    2010-08-14: Initial release
-->

<% boxcolor="darkorange" %>
<%+header%>
<h2><%:dialup_title %></h2>
<p><%:dialup_desc %></p>
<%
local uci = require("luci.model.uci").cursor()
local http = require("luci.http")

-- Get a temporary file name for vidpid list file.
local vidpid_list = os.tmpname()
local vendor, product

-- Get the list of vidpids defined in the configuration file. And store it into a temporary file.
local cmdline="/sbin/uci show ttyusb | cut -f2 -d\'.\' | cut -f1 -d\'=\' | uniq > "..vidpid_list
local ret = os.execute(cmdline)

-- Open the vidpid list file.
local fd = io.open(vidpid_list, "r")

-- Prepare FORM/ACTION URLs.
local url_edit     = luci.dispatcher.build_url("fon_admin", "fon_dialup", "edit")
local url_remove   = luci.dispatcher.build_url("fon_admin", "fon_dialup", "remove")
local url_addentry = luci.dispatcher.build_url("fon_admin", "fon_dialup", "addentry")
local url_cancel   = luci.dispatcher.build_url("fon_admin")
%>

<table class="cbi-section-table">
<thead>
<tr class="cbi-section-table-titles">
<th class="cbi-section-table-cell"><%:dialup_vendor %></th>
<th class="cbi-section-table-cell"><%:dialup_product %></th>
<th class="cbi-section-table-cell"><%:dialup_edit %></th>
<th class="cbi-section-table-cell"><%:dialup_remove %></th>
</tr>
</thead>

<%
if (fd ~= nil)
then
  while true
  do
    line = fd:read()
    if (line == nil or line == "") then
      break
    end

    vendor=uci:get("ttyusb."..line..".vendor")
    product=uci:get("ttyusb."..line..".product")
    if (product == nil or product == "") then
      break
    end
%>

<tbody>
<tr>
<td>
<% write (vendor) %>
</td><td>
<% write (product) %>
</td>
<td>
<form method="POST" ACTION="<% write (url_edit) %>">
<button type="submit" name="fon_dialup.edit" value="<% write (line) %>"><%:dialup_edit %></button>
</form>
</td>
<td>
<form method="POST" ACTION="<% write (url_remove) %>">
<button type="submit" name="fon_dialup.remove" value="<% write (line) %>" ><%:dialup_remove %></button>
</form>
</td>
</tr>

<%
  end
end
%>

</tbody>
</table>

<!-- Add edntry and cancel buttons -->
<div>
<form method="POST" ACTION="<% write (url_addentry) %>">
<button type="submit" name="fon_dialup.addentry" value="addentry"><%:dialup_addentry %></button>
<input type="submit" name="fon_dialup.cancel" value="<%:cancel %>"
onclick="document.location='<%=url_cancel%>'; return false;" />
</form>
</div>

<%
fd:close()
os.remove(vidpid_list)
%>
<%+footer%>

ダイヤルアップ設定のメイン画面となります。/etc/config/ttyusb に登録されている各設定の一覧を表示し、「編集」、「削除」ボタンをそれぞれの設定に対して表示します。一覧の作成については、shell commandを起動しています。これはLuci utiliesを利用して書き直しを検討しています。

「編集」、「削除」については、POSTからそれぞれのluaが起動されます。「設定の追加」においては、対応するviewが起動されます。「削除」の場合には、確認のdialogは表示されません。中止(キャンセル)の場合には管理画面(fon_admin)に戻ります。

 

4. /usr/lib/lua/luci/view/dialup/addentry.htm

<!--
  File: addentry.htm
  Description: Add a new ppp configuration.
  Page transition:
      dailup.htm -> addentry.htm
                      save: -> ttyregist.lua
                      cancel: -> fon_admin
  Revision history:
    2010-08-14: Initial release
-->

<% boxcolor="darkorange" %>
<%+header%>
<h2><%:dialup_addentry_title %></h2>
<p><%:dialup_addentry_desc %></p>
<%
local uci = require("luci.model.uci").cursor()

-- Prepare FORM/ACTION URLs.
local url_ttyregist = luci.dispatcher.build_url("fon_admin", "fon_dialup", "ttyregist")
local url_cancel    = luci.dispatcher.build_url("fon_admin")
%>

<form method="POST" ACTION="<% write(url_ttyregist) %>">

<div class="cbi-map" id="cbi-fon">
<fieldset class="cbi-section" id="cbi-fon-dialup-addentry">

<div class="cbi-section-node" id="cbi-fon-dialup-addentry">

<!-- Textbox for Vendor name -->
<div class="cbi-js-loadable line" id="cbi-fon-dialup-addentry-vendor">
<label class="cbi-value-title" for="fon_dialup.tty_vendor"><%:dialup_vendor %></label>
<input type="text" class="textField" onchange="cbi_d_update(this.id)"
  name="fon_dialup.tty_vendor" id="fon_dialup.tty_vendor" value="" />
</div>

<!-- Textbox for Product name -->
<div class="cbi-js-loadable line" id="cbi-fon-dialup-addentry-product">
<label class="cbi-value-title" for="fon_dialup.tty_product"><%:dialup_product %></label>
<input type="text" class="textField" onchange="cbi_d_update(this.id)"
  name="fon_dialup.tty_product" id="fon_dialup.tty_product" value="" />
</div>

<!-- Textbox for VIDPID (Vendor ID/Product ID) -->
<div class="cbi-js-loadable line" id="cbi-fon-dialup-addentry-vidpid">
<label class="cbi-value-title" for="fon_dialup.tty_vidpid"><%:dialup_vidpid %></label>
<input type="text" class="textField" onchange="cbi_d_update(this.id)"
  name="fon_dialup.tty_vidpid" id="fon_dialup.tty_vidpid" value="" />
</div>

<!-- Select List for tty driver -->
<div class="cbi-js-loadable line" id="fon_dialup.tty_driver">
<label class="cbi-value-title" for="fon_dialup.tty_driver"><%:dialup_driver %></label>
<select class="cbi-input-select" onchange="cbi_d_update(this.id)"
  id="fon_dialup.tty_driver" name="fon_dialup.tty_driver" size="1">
<%
  local driver = "pl2303"
  local driver_list = "pl2303 option usbserial"

  for idriver in string.gmatch(driver_list, "%w+") do
    if (idriver == driver) then
%>
      <option id="fon_dialup.tty_driver" selected="<% write (idriver) %>"> <% write (idriver) %>
<%  else %>
      <option id="fon_dialup.tty_driver" value="<% write (idriver) %>" > <% write (idriver) %>
<%
    end
  end
%>
</select>
</div>

<!-- Select list for modem type: dialup or 3gumts -->
<div class="cbi-js-loadable line" id="fon_dialup.tty_modemtype">
<label class="cbi-value-title" for="fon_dialup.tty_modemtype"><%:dialup_modemtype %></label>
<select class="cbi-input-select" onchange="cbi_d_update(this.id)"
  id="fon_dialup.tty_modemtype" name="fon_dialup.tty_modemtype" size="1">
<%
  local modemtype = "dialup"
  local modem_list = "dialup 3gumts"

  for imodem in string.gmatch(modem_list, "%w+") do
    if (imodem == modemtype) then
%>
      <option id="fon_dialup.tty_modemtype" selected="<% write (imodem) %>"> <% write (imodem) %>
<%  else %>
      <option id="fon_dialup.tty_modemtype" value="<% write (imodem) %>" > <% write (imodem) %>
<%
    end
  end
%>
</select>
</div>

<!-- Textbox for PPP account username -->
<div class="cbi-js-loadable line" id="cbi-fon-dialup-addentry-username">
<label class="cbi-value-title" for="fon_dialup.tty_username"><%:username %></label>
<input type="text" class="textField" onchange="cbi_d_update(this.id)"
  name="fon_dialup.tty_username" id="fon_dialup.tty_username" value="" />
</div>

<!-- Textbox for PPP account password -->
<div class="cbi-js-loadable line" id="cbi-fon-dialup-addentry-password">
<label class="cbi-value-title" for="fon_dialup.tty_password"><%:password %></label>
<input type="password" class="textField" onchange="cbi_d_update(this.id)"
  name="fon_dialup.tty_password" id="fon_dialup.tty_password" value="" />
</div>

<!-- Textbox for connection chat command line -->
<div class="cbi-js-loadable line" id="cbi-fon-dialup-addentry-connectcmd">
<label class="cbi-value-title" for="fon_dialup.tty_connectcmd"><%:dialup_connectcmd %></label>
<input type="text" class="textField" onchange="cbi_d_update(this.id)"
  name="fon_dialup.tty_connectcmd" id="fon_dialup.tty_connectcmd"
  value="/tmp/chat_dialer -s -v -T&lt;Phone number&gt;" />
</div>

<!-- Select list for interface speed -->
<div class="cbi-js-loadable line" id="fon_dialup.tty_speed">
<label class="cbi-value-title" for="fon_dialup.tty_speed"><%:dialup_speed %></label>
<select class="cbi-input-select" onchange="cbi_d_update(this.id)"
  id="fon_dialup.tty_speed" name="fon_dialup.tty_speed" size="1">
<%
  local speed = "115200"
  local speed_list = "9600 19200 38400 57600 115200 230400 460800 921600"

  for ispeed in string.gmatch(speed_list, "%w+") do
    if (ispeed == speed) then
%>
      <option id="fon_dialup.tty_speed" selected="<% write (ispeed) %>"> <% write (ispeed) %>
<%  else %>
      <option id="fon_dialup.tty_spped" value="<% write (ispeed) %>" > <% write (ispeed) %>
<%
    end
  end
%>
</select>
</div>

<!-- Textbox for modem inital command -->
<div class="cbi-js-loadable line" id="cbi-fon-dialup-addentry-atinit">
<label class="cbi-value-title" for="fon_dialup.tty_atinit"><%:dialup_atinit %></label>
<input type="text" class="textField" onchange="cbi_d_update(this.id)"
  name="fon_dialup.tty_atinit" id="fon_dialup.tty_atinit" value="" />
</div>

</div>
</fieldset>
</br>
</div>

<!--- Save and cancel buttons -->
<div>
<button type="submit" name="fon_dialup.tty_save" value="save"><%:save %></button>
<input type="submit" name="fon_dialup.cancel" value="<%:cancel %>"
onclick="document.location='<%=url_cancel%>'; return false;" />
</div>

</form>
<br />

<%+footer%>

ダイヤルアップ設定の追加画面となります。既存の自動生成されるhtmlに合わせて header / footerおよびclassを指定します。個々の設定項目を取り込んで、ttyregistにPOSTします。保存の場合には、値は”save”としています。中止(キャンセル)の場合には、JavaScriptにて、admin画面に戻ります

 

5. /usr/lib/lua/luci/view/dialup/edit.htm

<!--
  File: edit.htm
  Description: Edit a ppp configuration.
  Page transition:
    dailup.htm -> edit.htm
                    save: -> ttyregist.lua
                    cancel: -> fon_admin
  Revision history:
      2010-08-14: Initial release
-->

<% boxcolor="darkorange" %>
<%+header%>
<h2><%:dialup_edit_title %></h2>
<p><%:dialup_edit_desc %></p>
<%
local uci = require("luci.model.uci").cursor()
local http = require("luci.http")

-- Get post 'fon_dialup.edit' value.
local post_vidpid = http.formvalue("fon_dialup.edit")

-- Prepare FOM/ACTION URLs.
local url_ttyregist = luci.dispatcher.build_url("fon_admin", "fon_dialup", "ttyregist")
local url_cancel    = luci.dispatcher.build_url("fon_admin")

-- Retrieve config values.
local vidpid     = uci:get("ttyusb", post_vidpid, "vidpid")
local vendor     = uci:get("ttyusb", vidpid, "vendor", vendor)
local product    = uci:get("ttyusb", vidpid, "product", product)
local driver     = uci:get("ttyusb", vidpid, "driver", driver)
local modemtype  = uci:get("ttyusb", vidpid, "modemtype", modemtype)
local username   = uci:get("ttyusb", vidpid, "username", username)
local password   = uci:get("ttyusb", vidpid, "password", password)
local connectcmd = uci:get("ttyusb", vidpid, "connectcmd", connectcmd)
local speed      = uci:get("ttyusb", vidpid, "speed", speed)
local atinit     = uci:get("ttyusb", vidpid, "atinit", atinit)

%>

<form method="POST" ACTION="<% write(url_ttyregist) %>">

<div class="cbi-map" id="cbi-fon">
<fieldset class="cbi-section" id="cbi-fon-dialup-edit">

<div class="cbi-section-node" id="cbi-fon-dialup-edit">

<!-- Textbox for Vendor name -->
<div class="cbi-js-loadable line" id="cbi-fon-dialup-edit-vendor">
<label class="cbi-value-title" for="fon_dialup.tty_vendor"><%:dialup_vendor %></label>
<input type="text" class="textField" onchange="cbi_d_update(this.id)"
  name="fon_dialup.tty_vendor" id="fon_dialup.tty_vendor" value="<% write (vendor) %>" />
</div>

<!-- Textbox for Product name -->
<div class="cbi-js-loadable line" id="cbi-fon-dialup-edit-product">
<label class="cbi-value-title" for="fon_dialup.tty_product"><%:dialup_product %></label>
<input type="text" class="textField" onchange="cbi_d_update(this.id)"
  name="fon_dialup.tty_product" id="fon_dialup.tty_product" value="<% write (product) %>" />
</div>

<!-- Textbox for VIDPID (Vendor ID/Product ID) -->
<div class="cbi-js-loadable line" id="cbi-fon-dialup-edit-vidpid">
<label class="cbi-value-title" for="fon_dialup.tty_vidpid"><%:dialup_vidpid %></label>
<input type="text" class="textField" onchange="cbi_d_update(this.id)"
  name="fon_dialup.tty_vidpid" id="fon_dialup.tty_vidpid" value="<% write (vidpid) %>" />
</div>

<!-- Select List for tty driver -->
<div class="cbi-js-loadable line" id="fon_dialup.tty_driver">
<label class="cbi-value-title" for="fon_dialup.tty_driver"><%:dialup_driver %></label>
<select class="cbi-input-select" onchange="cbi_d_update(this.id)"
  id="fon_dialup.tty_driver" name="fon_dialup.tty_driver" size="1">
<%
  local driver_list = "pl2303 option usbserial"

  for idriver in string.gmatch(driver_list, "%w+") do
    if (idriver == driver) then
%>
      <option id="fon_dialup.tty_driver" selected="<% write (idriver) %>"> <% write (idriver) %>
<%  else %>
      <option id="fon_dialup.tty_driver" value="<% write (idriver) %>" > <% write (idriver) %>
<%
    end
  end
%>
</select>
</div>

<!-- Select List for modem type: dialup or 3gumts -->
<div class="cbi-js-loadable line" id="fon_dialup.tty_modemtype">
<label class="cbi-value-title" for="fon_dialup.tty_modemtype"><%:dialup_modemtype %></label>
<select class="cbi-input-select" onchange="cbi_d_update(this.id)"
  id="fon_dialup.tty_modemtype" name="fon_dialup.tty_modemtype" size="1">
<%
  local modem_list = "dialup 3gumts"

  for imodem in string.gmatch(modem_list, "%w+") do
    if (imodem == modemtype) then
%>
      <option id="fon_dialup.tty_modemtype" selected="<% write (imodem) %>"> <% write (imodem) %>
<%  else %>
      <option id="fon_dialup.tty_modemtype" value="<% write (imodem) %>" > <% write (imodem) %>
<%
    end
  end
%>
</select>
</div>

<!-- Textbox for PPP account username -->
<div class="cbi-js-loadable line" id="cbi-fon-dialup-edit-username">
<label class="cbi-value-title" for="fon_dialup.tty_username"><%:username %></label>
<input type="text" class="textField" onchange="cbi_d_update(this.id)"
  name="fon_dialup.tty_username" id="fon_dialup.tty_username" value="<% write (username) %>" />
</div>

<!-- Textbox for PPP account password -->
<div class="cbi-js-loadable line" id="cbi-fon-dialup-edit-password">
<label class="cbi-value-title" for="fon_dialup.tty_password"><%:password %></label>
<input type="password" class="textField" onchange="cbi_d_update(this.id)"
  name="fon_dialup.tty_password" id="fon_dialup.tty_password" value="<% write (password) %>" />
</div>

<!-- Textbox for connection chat command line -->
<div class="cbi-js-loadable line" id="cbi-fon-dialup-edit-connectcmd">
<label class="cbi-value-title" for="fon_dialup.tty_connectcmd"><%:dialup_connectcmd %></label>
<input type="text" class="textField" onchange="cbi_d_update(this.id)"
  name="fon_dialup.tty_connectcmd" id="fon_dialup.tty_connectcmd"
  value="<% write (connectcmd) %>" />
</div>

<!-- Select List for interface speed -->
<div class="cbi-js-loadable line" id="fon_dialup.tty_speed">
<label class="cbi-value-title" for="fon_dialup.tty_speed"><%:dialup_speed %></label>
<select class="cbi-input-select" onchange="cbi_d_update(this.id)"
  id="fon_dialup.tty_speed" name="fon_dialup.tty_speed" size="1">
<%
  local speed_list = "9600 19200 38400 57600 115200 230400 460800 921600"

  for ispeed in string.gmatch(speed_list, "%w+") do
    if (ispeed == speed) then
%>
      <option id="fon_dialup.tty_speed" selected="<% write (ispeed) %>"> <% write (ispeed) %>
<%  else %>
      <option id="fon_dialup.tty_spped" value="<% write (ispeed) %>" > <% write (ispeed) %>
<%
    end
  end
%>
</select>
</div>

<!-- Textbox for modem inital command -->
<div class="cbi-js-loadable line" id="cbi-fon-dialup-edit-atinit">
<label class="cbi-value-title" for="fon_dialup.tty_atinit"><%:dialup_atinit %></label>
<input type="text" class="textField" onchange="cbi_d_update(this.id)"
  name="fon_dialup.tty_atinit" id="fon_dialup.tty_atinit" value="<% write (atinit) %>" />
</div>

</div>
</fieldset>
</br>
</div>

<!-- Save and cancel buttons -->
<div>
<button type="submit" name="fon_dialup.tty_save" value="save"><%:save %></button>
<input type="submit" name="fon_dialup.cancel" value="<%:cancel %>"
onclick="document.location='<%=url_cancel%>'; return false;" />
</div>

</form>

<br />

<%+footer%>

選択したダイヤルアップ設定の編集画面となります。既存の自動生成されるhtmlに合わせて header / footerおよびclassを指定します。保存を押した場合には、ttyregistにPOSTします。

 

6. /usr/lib/lua/luci/model/cbi/dialup/remove.lua

--[[
  File: remove.lua
  Description: Remove a ppp configuration which has the specified vidpid.
  Page transition:
    dailup.htm -> remove.lua
  Revision history:
    2010-08-14: Initial release
--]]

local uci = require("luci.model.uci").cursor()
local http = require("luci.http")
require("luci.tools.webadmin")

local val = http.formvalue("fon_dialup.remove")
local vidpid = val

-- The value of POST is the vidpid.
if (vidpid ~= nil) then
  uci:delete_all("ttyusb", "ttyusb", {vidpid = vidpid})
  uci:save("ttyusb")
  uci:commit("ttyusb")
  http.redirect(".")
end

return

/etc/config/ttyusbの該当する情報を削除するluaになります。POSTのvalueとして削除対象のvidpidが渡されます。

 

7. /usr/lib/lua/luci/model/cbi/dialup/ttyregist.lua

--[[
  File: ttyregist.lua
  Description: store a ppp configuration
  Page transition:
    dailup.htm -> addentry.htm -> ttyregist.lua
                  edit.htm -> ttyregist.lua
  Revision history:
    2010-08-14: Initial release
--]]

local uci = require("luci.model.uci").cursor()
local http = require("luci.http")

local val = http.formvalue("fon_dialup.tty_cancel")
if (val ~= nil) then
  http.redirect("..")
  return
end

val = http.formvalue("fon_dialup.tty_save")
if (val ~= nil) then
  local vendor     = http.formvalue("fon_dialup.tty_vendor")
  local product    = http.formvalue("fon_dialup.tty_product")
  local vidpid     = http.formvalue("fon_dialup.tty_vidpid")
  local driver     = http.formvalue("fon_dialup.tty_driver")
  local modemtype  = http.formvalue("fon_dialup.tty_modemtype")
  local username   = http.formvalue("fon_dialup.tty_username")
  local password   = http.formvalue("fon_dialup.tty_password")
  local connectcmd = http.formvalue("fon_dialup.tty_connectcmd")
  local speed      = http.formvalue("fon_dialup.tty_speed")
  local atinit     = http.formvalue("fon_dialup.tty_atinit")

--[[ When the vidpid was modifed, old vidpid is passed as the form value.
     POSTed value and 'vidpid' value aren't same.
     First, remove the old vidpid section then create a new vidpid section.
--]]
  if (val ~= vidpid) then
    uci:delete_all("ttyusb", "ttyusb", {vidpid = val})
  end

  uci:set("ttyusb", vidpid, "ttyusb")
  uci:set("ttyusb", vidpid, "vendor", vendor)
  uci:set("ttyusb", vidpid, "product", product)
  uci:set("ttyusb", vidpid, "vidpid", vidpid)
  uci:set("ttyusb", vidpid, "driver", driver)
  uci:set("ttyusb", vidpid, "modemtype", modemtype)
  uci:set("ttyusb", vidpid, "username", username)
  uci:set("ttyusb", vidpid, "password", password)
  uci:set("ttyusb", vidpid, "connectcmd", connectcmd)
  uci:set("ttyusb", vidpid, "speed", speed)
  uci:set("ttyusb", vidpid, "atinit", atinit)
  uci:save("ttyusb")
  uci:commit("ttyusb")
end

http.redirect(".")
return

/etc/config/ttyusbに対して、更新処理を行います。formvalueが”save”のときに更新処理を行います。vidpidが変更されている場合には、先に削除処理を実行します。その後で更新された情報を登録します。

 

9. /usr/lib/lua/luci/i18n/dialup.en.lua

dialup = "Dialup"
dialup_desc = "Configure dialup connection."
dialup_title = "Dialup connection"
dialup_vendor = "Vendor name"
dialup_product = "Product name"
dialup_vidpid = "VIDPID"
dialup_driver = "Device driver"
dialup_modemtype = "Modem type"
dialup_connectcmd = "Connect command"
dialup_speed = "Interface speed"
dialup_atinit = "AT initial command"
dialup_edit = "Edit"
dialup_remove = "Remove"
dialup_edit_title = "Edit"
dialup_edit_desc = "Edit dialup configuration"
dialup_addentry = "Add entry"
dialup_addentry_title = "Add entry"
dialup_addentry_desc = "Add a dialup configration entry"

GUIの英語メッセージとなります。

 

10. /usr/lib/lua/luci/i18n/dialup.ja.lua (UTF-8にします)

dialup = "ダイヤルアップ"
dialup_desc = "ダイヤルアップ接続の設定を行います。"
dialup_title = "ダイヤルアップ接続設定"
dialup_vendor = "ベンダー名"
dialup_product = "製品名"
dialup_vidpid = "VIDPID"
dialup_driver = "デバイスドライバー"
dialup_modemtype = "モデムタイプ"
dialup_connectcmd = "接続コマンド"
dialup_speed = "接続速度"
dialup_atinit = "AT初期コマンド"
dialup_edit = "編集"
dialup_remove = "削除"
dialup_edit_title = "編集"
dialup_edit_desc = "ダイヤルアップ設定の編集"
dialup_addentry = "設定の追加"
dialup_addentry_title = "設定の追加"
dialup_addentry_desc = "ダイヤルアップ接続の追加"

GUIの日本語メッセージとなります。UTF-8にて保存します。

 

10. dialup iconファイルの設定
# cd /www/luci-static/resources/icons
# wget http://www.iconarchive.com/icons/iconica/pastel/48/dialup-networking-icon.png
# mv dialup-networking-icon.png dialup.png

 

 

12. 更新履歴
  • 2010/08/14: Initail release

2010年8月8日日曜日

IBM T210 QXGAモニターとLinux X11 Windows System その2

1. 前回からの続き

HD4350とCCC 10.7の組み合わせでは、Modelineを認識させてリフレッシュレートを下げるには至りませんでした。試したことは以下の通りです。
(1) Option “monito-xxx”とOption “RROutputOrder”によるモニター指定。
/etc/X11/xorg.confの抜粋

Section "Monitor"
        Identifier   "IBM-T210-VGA"
        VendorName "IBM"
        ModelName "T210 6659-HG2" 
        Option      "DPMS" "true"
        Option      "ReducedBlanking"
        VertRefresh  60
        Modeline "2048x1536_60.00"  266.95  2048 2200 2424 2800  1536 1537 1540 1589  -HSync +Vsync
EndSection
Section "Monitor"
        Identifier   "IBM-T210-DVI"
        VendorName "IBM"
        ModelName "T210 6659-HG2"
        Option      "DPMS" "true"
        Option      "ReducedBlanking"
VertRefresh  35-55
        Modeline "2048x1536_45.00"  195.17  2048 2176 2400 2752  1536 1537 1540 1576  -HSync +Vsync

EndSection
Section "Device"
    Identifier  "HD4350"
    Driver      "fglrx"
    BusID       "PCI:1:0:0"
    Option "monitor-DFP1" "IBM-T210-VGA"
    Option "monitor-DFP5" "IBM-T210-DVI"
    Option "RROutputOrder" "IBM-T210-DVI"

EndSection
Section "Screen"
    Identifier "Screen0"
    Device     "HD4350"
    Monitor    "IBM-T210-DVI"
    DefaultDepth     24
    SubSection "Display"
        Viewport   0 0
        Depth     24
    EndSubSection
EndSection
結果は、Xserverが起動途中で止まり、画面はblack outのままとなります。直前のOSDによりリフレッシュレートは60Hzのままでした。Xorg.0.logの抜粋は以下のようになります。
(II) fglrx(0): Output DFP1 using monitor section IBM-T210-VGA
(II) fglrx(0): Output DFP5 using monitor section IBM-T210-DVI
(II) fglrx(0): Output CRT1 has no monitor section
(II) fglrx(0): Output CRT2 has no monitor section
(WW) fglrx(0): Only one display is connnected, single mode is enabled
(II) fglrx(0): Output DFP1 disconnected
(II) fglrx(0): Output DFP5 connected
(II) fglrx(0): Output CRT1 disconnected
(II) fglrx(0): Output CRT2 disconnected
(WW) fglrx(0): Unable to find initial modes
(EE) fglrx(0): Output DFP5 enabled but has no modes
(EE) fglrx(0): Display Infrastructure Failed
(EE) fglrx(0): PreInit failed
(II) fglrx(0): === [atiddxPreInit] === end


xorg.confのDisplay subsectionにModes “2048x1536” “1600x1200” “1280x1024”を追加してみましたが、現象に変化はありませんでした。


(2) aticonfigのオプション指定 (enable-monitor, force-monitor)


# aticonfig –force-monitor=”dfp5” –enable-monitor=”dfp5”


Xserverの起動途中でblack outする現象に変化はあまりせんでした。


2. CCC down grade


このような場合の常套手段なのですが、CCCのdown gradeをしてみました。CCC 9.10まで戻したところ、Xorg.0.logでのモニターの認識がDFPだけとなり、Modelineを指定したところ、そのリフレッシュレートの設定が有効となりました。


http://support.amd.com/us/gpudownload/linux/previous/Pages/radeon_linux.aspx

CCC version Monitor Results
10.1 DFP1とDFP5で変わらず × モニターはblack out
9.12 DFP1とDFP5で変わらず × モニターはblack out
9.11 DFP1とDFP5で変わらず × モニターはblack out
9.10 ※1 DFPのみ ◎ Modeline指定は有効


※1 9.10のリンクをクリックするとリンク切れとなっており、9.10のリンクをクリックすると9.10のdownload pageとなりました。



CCC 9.10のテストにて、Modeline設定が有効になったときのxorg.conf。モニター名の変更を行う前のものです。



# Xorg configuration created by system-config-display
Section "ServerLayout"
        Identifier     "single head configuration"
        Screen      0  "aticonfig-Screen[0]-0" 0 0
        InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
EndSection

Section "Module"
EndSection

Section "InputDevice"
        Identifier  "Keyboard0"
        Driver      "kbd"
        Option      "XkbModel" "pc105"
        Option      "XkbLayout" "us"
EndSection

Section "Monitor"
        Identifier   "aticonfig-Monitor[0]-0"
        Option      "VendorName" "ATI Proprietary Driver"
        Option      "ModelName" "Generic Autodetecting Monitor"
        Option      "DPMS" "true"
        VertRefresh  35-55
# 2048x1536 @ 45.00 Hz (GTF) hsync: 70.92 kHz; pclk: 195.17 MHz
       Modeline "2048x1536_45.00"  195.17  2048 2176 2400 2752  1536 1537 1540 1576  -HSync +Vsync
EndSection
Section "Device"
        Identifier  "aticonfig-Device[0]-0"
        Driver      "fglrx"
        BusID       "PCI:1:0:0"
EndSection
Section "Screen"
        Identifier "aticonfig-Screen[0]-0"
        Device     "aticonfig-Device[0]-0"
        Monitor    "aticonfig-Monitor[0]-0"
        DefaultDepth     24
        SubSection "Display"
                Viewport   0 0
                Depth     24
        EndSubSection
EndSection



xorg.confは aticonfig –initial -f にて生成されたものに 45HzのModelineを津を得たものです。





/var/log/Xorg.0.logの抜粋です。



(II) fglrx(0): ***Display: ConnectedDisplayTypes=0x00000400, disabled=0x00000000

(II) fglrx(0): Connected Display1: DFP 5 [dfp5]

(II) fglrx(0): Display1 EDID data ---------------------------



(II) fglrx(0): End of Display1 EDID data --------------------

(WW) fglrx(0): Only one display is connnected,so single mode is enabled
(II) fglrx(0): Primary Controller - DFP 5
(II) fglrx(0): Internal Desktop Setting: 0x00000001
(==) fglrx(0): QBS disabled
(==) fglrx(0): FAST_SWAP disabled
(==) fglrx(0):  PseudoColor visuals disabled
(==) fglrx(0): Using gamma correction (1.0, 1.0, 1.0)
(==) fglrx(0): Center Mode is disabled
(==) fglrx(0): TMDS coherent mode is enabled



認識されるモニターがDFP 5だけとなっています。


45Hzのリフレッシュレートにて半日ほど利用しました。なので、とりあえずこれで常用してみるつもりです。
  • モニターのsuspend状態からの復帰時に画面が乱れることなかった。
  • モニターの電源をOFFにして、離席。戻ってからモニター電源をONしたところ、一度だけ、ON後の画面が乱れることがあった。再度の電源OFF/ONで復帰。 



    3. その他


    • CCC 9.11~10.7のDFP1/DFP5の件については、AMD(ATI)のサポートに聞いてみたいが、問い合わせ先の情報はないようだ。Graghics cardの玄人志向もサポートFAQがあるだけ。
    • “Output DFP5 using monitor section xxx”, “Unable to find initial modes”などを記録している部分をXserver source codeより見つけて、原因を類推する。
    • 英語のページも検索してみたが、CCC 9.11~10.7の現象について報告はあるものの解決策はないようだ。
    • CCC 9.11のrelease noticeに関係するような記載はない。


    4. 更新履歴


    • 2010/8/8: Initial release

    2010年8月4日水曜日

    IBM T210 QXGAモニターとLinux X11 Windows System

    X11の場合は、Monitor sectionにModelineを追加するだけと思っていましたが、そうは簡単はいきませんでした。AMD 690G のXpress 1250 graphics chipを利用している場合には、DVI single linkの表示が可能となるまでリフレッシュレートを下げて対応できました。ですが、HD4350のPCI exporess graphics cardの場合には、xorg.confに定義した内容がDVI接続しているモニターとは一致しないために、xorg.confに記載したModelineが使われていませんでした。

    参考リンクのモニター記載方法の記述を見つけて、xorg.confのモニターの記載方法を変更したところ、HD4350でもCCC(Catalyst Control Center)がインストールされていない状態ならば、リフレッシュレートを下げ、T210にQXGA表示をした場合でも、ゴーストや陰が見えなくなりました。

    ですが、HD4350 + CCC 10.7の環境でモニターの記載方法を変更するとX11 Serverの処理が止まってしまい、画面がblack outします。この対策はまだ見つけられていません。

     

    環境 結果
    HD4350 + CCC 10.7の環境において、xorg.confのModelineを追加 × リフレッシュレートは60Hzのまま。ゴーストやピングの陰は発生する。
    複数モニターがあるため、xorg.confのMonitorと接続したモニターが異なっているために定義が適用されないためらしい。
    X1250 + CCC 9.3 環境でxorg.confにModelineを追加 ○ リフレッシュレートを35Hzまで下げたところ、ゴースト・陰の発生がなくなった。しかし、レートが低いためマウスポインターの追従性が悪い。
    HD4350 + 標準ドライバーにおいてモニター記載方法を変更 ○ リフレッシュレートを45Hzまで下げたところ、ゴースト・陰の発生がなくなった。マウスカーソルの追従性も許容できる範囲であろう。※1
    HD4350 + CCC 10.7 においてモニター記載方法を変更 × X11 Serverの起動途中で処理が止まり、画面がblack out。システムリセットが必要となる。

    ※1: その後、システム再起動を繰り返したところ、45Hzでもゴーストの発生や画面が右半分に圧縮されてしまう現象が確認されました。DVIのSingle linkになっているのかもしれません。38Hzまで下げるとシステム再起動を繰り返しても、問題の発生は見られませんでした。

    今回の環境は以下の通りです。

    • M/B: Gigabyte GA-MA69SM-S2H, CPU: AMD X2 BE-2400, 6GB Memory
    • Linux: CentOS 5.5 64bit
    • X windows system: 7.1.1 x86_64
    • ATI Xpress 1250 (AMD 690G chip set integrated)
    • ATI HD4350 256MB (玄人志向)
    • IBM T210 QXGAモニター (ATS Direct, DVI dual link cable)

     

    1. ×HD4350 + CCC 10.7, リフレッシュレート変更不可

    /etc/X11/xorg.confの一部を示します。リフレッシュレート(VerRefresh)の51.72はWindows 7のPowerStripにて動作した周波数です。T210は60Hzのままで動作し、ピンクの陰とゴーストは発生します。Modelineの値は

    % gtf 2048 1536 51.72

    の結果です。

    Section "Monitor"
            Identifier   "IBM-T210"
            VendorName   "IBM"
            ModelName    "T210 6659-HG2"
            HorizSync    70 - 90
            VertRefresh  51.72
            Modeline "2048x1536_51.72"  227.78  2048 2192 2416 2784  1536 1537 1540 1582  -HSync +Vsync
            Option      "DPMS" "true"
    EndSection
    Section "Device"
            Identifier  "aticonfig-Device[0]-0"
            Driver      "fglrx"
            BusID       "PCI:1:0:0"
    EndSection
    Section "Screen"
            Identifier "aticonfig-Screen[0]-0"
            Device     "aticonfig-Device[0]-0"
            Monitor    "IBM-T210"
            DefaultDepth     24
            SubSection "Display"
                    Viewport   0 0
                    Depth     24
            EndSubSection
    EndSection

    この修正をxorg.confに適用して、X11 Serverを再起動しても、T210が示すリフレッシュレートは60Hzのままです。

     

    このときの /var/log/Xorg.0.logには以下のようなログがあります。


    (II) fglrx(0): Connected Display0: DFP 5 [dfp5]
    (II) fglrx(0): Display0 EDID data ---------------------------
    (II) fglrx(0): Manufacturer: IBM  Model: 1a03  Serial#: 16843009



    (II) fglrx(0): Output DFP1 using monitor section IBM-T210
    (II) fglrx(0): Output DFP5 has no monitor section

    (II) fglrx(0): Output CRT1 has no monitor section
    (II) fglrx(0): Output CRT2 has no monitor section
    (WW) fglrx(0): Only one display is connnected, single mode is enabled
    (II) fglrx(0): Output DFP1 disconnected
    (II) fglrx(0): Output DFP5 connected

    (II) fglrx(0): Output CRT1 disconnected
    (II) fglrx(0): Output CRT2 disconnected
    (II) fglrx(0): Using exact sizes for initial modes
    (II) fglrx(0): Output DFP5 using initial mode 2048x1536
    (II) fglrx(0): DPI set to (75, 75)
    (==) fglrx(0): Using gamma correction (1.0, 1.0, 1.0)
    (II) fglrx(0): Adapter ATI Radeon HD 4300/4500 Series has 2 configurable heads and 1 displays connected.
    (==) fglrx(0): QBS disabled
    (==) fglrx(0):  PseudoColor visuals disabled

    以下はログの推測です。

    • DFP5 (Digital Flat Panel)は、IBM T210に接続されている。インターフェースはDVI-D port。
    • DFP1 は、xort.confのMontor section ‘IBM-T210’を使っているが、モニターが接続されてはいない。

    玄人志向HD4350 graphics cardには、DVI-D, HDMI, D-sub15の三つのInterfaceがあります。DFP5がDVI-D, HDMIがDFP1なのかもしれません。この辺り、ADMのサイトに資料は見当たらないように思えます。

     

    2. X1250 + CCC 9.3 Single Link, リフレッシュレート変更可

    HD4350がうまくいかないのならば、on board VGAのX1250はどうかと、BIOSで切り替えし、CCC 9.3に入れ替えてみました。xorg.confを書き換えて、リフレッシュレートを51Hzにしてみしまた。モニターの表示が60Hzではなくて、2048x1536 51Hzとなっています。ただし、DVIはsingle linkになってしまうようで、画面が半分になり、表示の乱れも大きいです。そこで、50Hzから5Hzずつリフレッシュレートを下げていったところ、35Hzにて表示の安定した画面が得られました。

    35Hzのときのxorg.confの抜粋を以下に示します。Modelineはgtf 2048 1536 35 の結果です。VerRefreshは決めうちにしていました。

    Section "Monitor"
            Identifier   "IBM-T210"
            Option      "VendorName" "IBM"
            Option      "ModelName" "T210 6659-HG2"
            Option      "DPMS" "true"
            VertRefresh  35
      Modeline "2048x1536_35.00"  149.18  2048 2168 2384 2720  1536 1537 1540 1567  -HSync +Vsync

    EndSection
    Section "Device"
            Identifier  "aticonfig-Device[0]-0"
            Driver      "fglrx"
            BusID       "PCI:1:5:0"
    EndSection
    Section "Screen"
            Identifier "aticonfig-Screen[0]-0"
            Device     "aticonfig-Device[0]-0"
            Monitor    "IBM-T210"
            DefaultDepth     24
            SubSection "Display"
                    Viewport   0 0
                    Depth     24
            EndSubSection
    EndSection

    また、このときのXorg.0.logの内容は下記のようになります。


    (II) fglrx(0): ***Display: ConnectedDisplayTypes=0x00000080, disabled=0x00000000
    (II) fglrx(0): Connected Display1: DFP on secondary TMDS [tmds2i]
    (II) fglrx(0): Display1 EDID data ---------------------------



    (WW) fglrx(0): Only one display is connnected,so single mode is enabled
    (II) fglrx(0): Primary Controller - DFP on secondary TMDS
    (II) fglrx(0): Internal Desktop Setting: 0x00000001
    (II) fglrx(0): POWERplay not supported on this hardware
    (WW) fglrx(0): Only one display is connnected,so single mode is enabled

    これで良ければ、HD4350 graphics cardやDVI-D dual link cableを買うことはなかったのですが。リフレッシュレートが35Hzでは、マウスカーソルの追従性が心持ち良くないようです。

    dvi-35
    DVI 35HzのときのT210 モニター表示です。

     

    3.  HD4350 + 標準ドライバー、リフレッシュレート変更可

    X1250をBIOSからdisableとして、CCC 9.3をuninstallしたところで、HD4350 + 標準ドライバーR500にて、リフレッシュレートの変更を試してみました。50Hzから1Hzずつ下げていったところ、45Hzにて画面表示の乱れがなくなりました。ですが、このリフレッシュレートでも表示の乱れが発生することもあり、38Hzまで下げたところで安定した表示になりました。

    45Hzのときのxorg.confの抜粋を以下に示します。Modelineはgtf 2048 1536 45 の結果です。

    Section "Monitor"
            Identifier   "IBM-T210-VGA"
            VendorName "IBM"
            ModelName "T210 6659-HG2"
            Option "monitor-VGA-0" "IBM-T210-VGA"
            Option      "DPMS" "true"
            Option      "ReducedBlanking"
            VertRefresh  60
            Modeline "2048x1536_60.00"  266.95  2048 2200 2424 2800  1536 1537 1540 1589  -HSync +Vsync
    EndSection
    Section "Monitor"
            Identifier   "IBM-T210-DVI"
            VendorName "IBM"
            ModelName "T210 6659-HG2"
            Option "monitor-DVI-0" "IBM-T210-DVI"
            Option      "DPMS" "true"
            Option      "ReducedBlanking"
            VertRefresh  35-55
            Modeline "2048x1536_45.00"  195.17  2048 2176 2400 2752  1536 1537 1540 1576  -HSync +Vsync

    EndSection
    Section "Device"
        Identifier  "Videocard0"
        Driver      "r500"
        Option "monitor-VGA-0" "IBM-T210-VGA"
        Option "monitor-DVI-0" "IBM-T210-DVI"
        Option "RROutputOrder" "IBM-T210-DVI"

    EndSection
    Section "Screen"
        Identifier "Screen0"
        Device     "Videocard0"
        Monitor    "IBM-T210-DVI"
        DefaultDepth     24
        SubSection "Display"
            Viewport   0 0
            Depth     24
        EndSubSection
    EndSection

    “IBM-T210-VGA”をD-sub 15 analog VGA用として定義しました。こちらのリフレッシュレートは 60Hzです。DVI用には”IBM-T210-DVI”を定義しました。

     

    また、このときのXorg.0.logの内容は下記のようになります。


    (II) R500(0): Output VGA-0 using monitor section IBM-T210-VGA
    (II) R500(0): I2C bus "VGA-0" initialized.

    (II) R500(0): Output HDMI-0 has no monitor section
    (II) R500(0): I2C bus "HDMI-0" initialized.
    (II) R500(0): Output DVI-0 using monitor section IBM-T210-DVI
    (II) R500(0): I2C bus "DVI-0" initialized.

    (II) R500(0): Port0:
      XRANDR name: VGA-0

      Connector: VGA
      CRT2: INTERNAL_KLDSCP_DAC2
      DDC reg: 0x7e50
    (II) R500(0): Port1:
      XRANDR name: HDMI-0
      Connector: HDMI-B
      DFP1: INTERNAL_UNIPHY
      DDC reg: 0x7e40
    (II) R500(0): Port2:
      XRANDR name: DVI-0
      Connector: DVI-I

      CRT1: INTERNAL_KLDSCP_DAC1
      DFP2: INTERNAL_UNIPHY2
      DDC reg: 0x7f10
    (II) R500(0): I2C device "VGA-0:E-EDID segment register" registered at address 0x60.
    (II) R500(0): I2C device "VGA-0:ddc2" registered at address 0xA0.
    (II) R500(0): Output: VGA-0, Detected Monitor Type: 0
    Dac detection success
    finished output detect: 0
    (II) R500(0): I2C device "HDMI-0:E-EDID segment register" registered at address 0x60.
    (II) R500(0): I2C device "HDMI-0:ddc2" registered at address 0xA0.
    (II) R500(0): Output: HDMI-0, Detected Monitor Type: 0
    finished output detect: 1
    (II) R500(0): I2C device "DVI-0:E-EDID segment register" registered at address 0x60.
    (II) R500(0): I2C device "DVI-0:ddc2" registered at address 0xA0.
    (II) R500(0): Output: DVI-0, Detected Monitor Type: 3
    (II) R500(0): EDID data from the display on output: DVI-0
    ----------------------
    (II) R500(0): Manufacturer: IBM  Model: 1a03  Serial#: 16843009



    (II) R500(0): Output: VGA-0, Detected Monitor Type: 0
    Dac detection success
    (II) R500(0): EDID for output VGA-0
    (II) R500(0): Output: HDMI-0, Detected Monitor Type: 0
    (II) R500(0): EDID for output HDMI-0
    (II) R500(0): EDID for output DVI-0
    (II) R500(0): Manufacturer: IBM  Model: 1a03  Serial#: 16843009

    D-sub 15pinのVGAは”VGA-0”、DVIは”DVI-0”となっているようです。また、ぞれぞれに用意したMontor sectionが割り当てられています。

     

    dvi-45
    45Hzのときのモニター表示です。

     

    4. × HD4350 + CCC 10.7, リフレッシュレート変更失敗

    CCC 10.7を再度導入します。DFP5にMonitor sectionを割り当てる設定としましたが、X11 Serverの起動途中で止まってしまいます。そのためシステムリセットをする必要があります。ファイルシステムが壊れてしまう可能性があるため、別途環境を用意して、テストを行う予定です。

     

    5. 番外

    夜半からの雨で気温の低い早朝のことですが、5分間くらい HD4350 + DVI-D dual linkの環境で60Hz駆動のときに陰やゴーストが見えないことがありました。しばらくするとピンクの陰が出てきました。このことからすると、一番熱の発生が高いGraphics cardが定格の2048x1536 dots, 60Hzに追従できていない可能性があります。モニターはファン内蔵ですから、ほとんど熱を持ちませんし、DVIケーブルもそんなに発熱するものとも思えません。Graphics cardにはフィンのみで放熱ファンはありません。早朝と夜間のみ利用するものでも、ここのところの高温でPCケースの廃熱が間に合わないのかもしれません。冷却スプレーとまでは行かなくとも、ケースを開けて、ファンで冷やせば動作が変わる可能性はあります。

    3,450円のgraphics cardに高望みしすぎるとは思いますが、ゲームをするわけではないので、高性能なカードの購入には踏み切れません。

     

    6. 参考リンク

     

    7. 更新履歴

    • 2010/08/04: Initial release
    • 2010/08/08: Fix typo

    2010年8月1日日曜日

    IBM T210 QXGA モニターとWindows 7

    中古のIBM T210 6659-HG2 QXGA モニターを手にいれました。結論から書きますと、DVI dual link 対応のgraphics card, cableとPowerStripによってWindows 7でのQXGA(2048x1536)のdigital表示が可能となりました。

    1. 早速、つないでみました。


    PC 接続 結果
    Thinkpad X61 Tablet 。Windows 7 Pro X61 Tabletのanalog portからT210のanalogへRGB接続
    QXGA表示OK
    Desktop: Gigabyte GA-MA69GM-S2H (ATI X1250)。Windows 7 Enterprise(評価版) ※1 GA-MA69GM-S2Hのanalog portからT210のanalog portへRGB接続
    QXGA表示OK
    同上 GA-MA69GM-S2HのDVI portからT210のDVI portへDVI-D(single link)接続 ×
    QXGAではあるが、画面の左半分に圧縮されて表示される。※2
    ※1: ATI CatalystはWindows 7 対応バージョンがないため導入しませんでした。
    ※2: QXGA(2048x1536)が画面の左半分に圧縮されて表示。右版分はメモリ内容がそのまま表示されていると思われる。解像度を変更(1600x1200, 1024x768)しても左半分に表示されるのは変わらず。
    f1
    Analog RGB接続でも十分なのですが、やはり小さい文字などシャープな表示になりません。

    2. Graphics boardを買いました。

    T210のユーザーガイドによると、DVI-D portはdual linkの仕様であるとのこと。AMD 690G chipsetの Xpress 1250は、DVI-Dがsingle かdual か不明であるため、とりあえず近所のPCデポさんにdual link可能なgraphics boardとDVI-Dケーブルを買いに行きました。
    DVI-Dのdual linkケーブルは在庫なしとのことで、graphics boardは一番安かった「玄人志向 RH4350-LE256HD/HS」を購入しました。
    Graphics boardのみdual linkになっても、画面の左半分のみに表示される現象は変わりません。

    PC 接続 結果
    Desktop: Gigabyte GA-MA69GM-S2H, HD4350 。Windows 7 Enterprise(評価版) + ATI Catalyst 10.7 RH4350のDVI portからDVI single link cableでT210のDVI portに接続 ×
    QXGAではあるが、画面の左半分に圧縮されて表示される。

    3. DVI-D dual link cableを買いました

    PCデポさんの入荷待ちよりは通販のほうが早いだろうということで、ATS DirectさんのDVI-D dual link cableを注文しました。
    f3 f2
    Connectorのpin配列はdual link対応です。ですが、ディスプレイケーブルに付きもののフェライトコアが見当たりません。
    ConnectorとCableの連結部にpackageされているのでしょうか。
    http://www.amazon.co.jp/gp/product/images/B002X4WV62/ref=dp_image_0?ie=UTF8&n=3210981&s=electronics
    兎に角、DVI-D single cableに変えて、dual link cableで接続してみました。結果、QXGAがフルスクリーンで表示されました。
    f4
    ですが、数ドット程度の縦線をみると薄いピンクの陰ができています。信号の位相の少しズレているような感じでしょうか。さらに具合の悪いことには、T210モニターの電源OFF/ON、Windowsのlogoff/logon、suspend/resumeすると画面全体に水平方向のゴーストが出たような感じになってしまいます。PCの機動直後からゴーストが出るようなこともありました。
    f5 f6
    左のWindows logon iconでは、薄いピンクの陰が出てします。右のアイコンではゴーストが出たような感じになっています。
    PC 接続 結果
    Desktop: Gigabyte GA-MA69GM-S2H (ATI X1250)。Windows 7 Enterprise(評価版) + ATI Catalyst 10.7 RH4350のDVI portがDVI dual link cableでT210のDVI portに接続 ×
    QXGA全画面表示でいるが、点や線に薄いピンクの陰ができる。また、水平にゴーストがでることもある。
    当然ですが、この状態でscreen shotをとると、まったく陰もゴーストもありません。Graphics boardのRAMDAC, dispaly cable, T210 モニターのどこかで発生しているものと思われます。やはり、中古の古いモニター(OSDのInformationでは 2002年の製造でした)が、経年変化のために追従できなくっているのでしょうか。サンプルが少ないためになんとも結論できないところですけれども。

    4. Catalyst Control Centerで調整

    Catalyst Control Centerで調整できないものかと、menuを眺めていたら、それらしい項目がありました。
    f8
    CCC (Catalyst Control Center)をadvanced modeにして、Desktop & Displaysを選択します。そこで画面の下部にあるモニターのiconを右ボタンクリックして、「Configure…」を選択します。

    f9
    ここで、「DVI Settings」セクションにある 「Reduce DVI frequency on high-resolution displays」のチェックボックスにチェックを入れ、「Apply」を押します。
    いけました。水平方向のゴーストのようなものは消えました。しかし、ピンクの陰は消えません。また、Windows のlog off/on, PCのsuspend/resumeでゴーストが戻ってしまうこともあります。「Reduce DVI frequency on high-resolution displays」のチェックを繰り返すとゴーストは直りますが、いまいちです。
    PC 接続 結果
    Desktop: Gigabyte GA-MA69GM-S2H (ATI X1250)。Windows 7 Enterprise(評価版) + ATI Catalyst 10.7 設定変更 RH4350のDVI portがDVI dual link cableでT210のDVI portに接続
    QXGA全画面表示でいるが、点や線に薄いピンクの陰が残る。また、水平ゴーストがでることもある。

    5. PowerStripで調整

    CCCの設定変更で多少の改善が見られたということは、CRTの時代と同じくRefresh rateの変更で効果が見られるかもしれません。
    T210 QXGA refrsh rate screen half などのkeywordで検索をかけたところ、英語blogですが、PowerStripでRefrsh rateを下げて利用しているとの情報がありました。
    f10
    PowerStripの導入後、PowerStripのiconから右ボタンクリックで、「Display profiles」→「Configure…」とします。

    f11
    Display profilesのdialogueが開きますので、Refresh rate sectionの鍵iconをクリックして、Custom timingを有効にします。次いでAdvanced timing optionsを栗つくします。
    f12
    Advanced timing optionsの画面にて、Vertical geomertyのRefresh rateを下げていきます。水平ゴーストやピンクの陰が消えたところで保存します。
    • PCを起動するとWindowsのlogin画面では、ピンクの陰が出ますが、loginして PowerStripが有効になると陰が消えます。
    • T210の電源を切ると水平ゴーストやピンクの陰が出るようになってしまいます。 Refresh rateの値を変更するか、PowerStripの再起動で直るようです。
    • Windowsの電源管理でモニターオフとなった後に、マウスの移動・キー入力などのイベントでオンに戻った場合、表示の乱れは発生しませんでした。
    digital接続に比較するとanalogのRGB接続は文字など多少ぼんやりした感じに見えます。
    PC 接続 結果
    Desktop: Gigabyte GA-MA69GM-S2H (ATI X1250)。Windows 7 Enterprise(評価版) + ATI Catalyst 10.7 + PowerStrip RH4350のDVI portがDVI dual link cableでT210のDVI portに接続
    QXGA全画面表示OK。

     

    ※ 2010/08/15 追記

    Linux接続が一段落したので、HDDをWindows7に戻しました。リフレッシュレートは45Hzもしくは40Hzあたりが、私の環境ではよろしいようです。50Hz前後では、起動直後やsuspend/resume後に画面の乱れが発生することがありました。
    DVIケーブルについては、エレコム制の2mのものを買ってみました。2048x1536 60Hzでは、常にピンクの陰がありますし、たまに水平のゴーストが発生します。

     

     

    6. これから

    • 検索するとDVIケーブルの交換で表示の乱れが直ったような記載も見かけられましたので、そのうちに試してみたいと考えています。
    • Desktopは元々CentOSで利用しています。X Windows Systemでの設定も試します。

     

    7. 参考リンク

    WikiにT210接続に関して情報が掲載されているのに気がつきました。

     


    8. 更新履歴

    • 2010/08/01: Inital release
    • 2010/08/01: Fix typo
    • 2010/08/15: 参考リンクとリフレッシュレートについての記載追加

    2010年7月28日水曜日

    Fonera 2202でWillcom/Emobile接続 その3  PPP設定

     

    PPP設定の各ファイルについて記載します。

    1. /etc/config/network

    /etc/config/network - 下記のPPP設定をファイルの最後に追加します。device, speed, username, password, connectcmdは、hotplug in処理の際に該当するUSB modemの設定情報から書き換えられます。

    config 'interface' 'ppp'
        option 'ifname' 'wan'
        option 'proto' 'ppp'
        option 'mtu' '1500'
        option 'linkname' 'wan'
        option 'ipparam' 'wan'
        option 'device' '/dev/ttyUSB0' 
        option 'speed' '921600'
        option 'username' 'em'
        option 'password' 'em'
        option 'connectcmd' '/tmp/chat_dialer -s -v -T*99#'

        option 'attached' '0'

    config ‘interface’ ‘ppp’: PPP接続用のセクションです。

    ifname: pppdに渡すparameterとなります。今回は’wan’固定となります。

    proto: Protocol指定となります。今回は’ppp’固定となります。

    mtu: 1500固定です。

    linkname: pppdに渡すlink nameです。今回は’wan’固定となります。

    ipparam: ‘wan’固定となります。

    device: ppp通信用のdevice file nameとなります。D02HW, H12HWを接続すると制御用ポートの /dev/ttyUSB1 も作成されます。3GUMTSでは /dev/ttyUSB1も利用しますが、ppp dialup接続では /dev/ttyUSB0 のみの利用となります。

    speed: 回線のinterface速度です。USB dialup modemのhotplug in処理中にttyusbから、コピーされます。

    username: ppp接続アカウント名です。Emobileの場合には固定の’em’となります。Willcomの場合には、個別のアカウントとなります。USB dialup modemのhotplug in処理中にttyusbから、コピーされます。

    password: ppp接続パスワードです。Emobileの場合には固定の’em’となります。Willcomの場合には、個別のアカウントとなります。USB dialup modemのhotplug in処理中にttyusbから、コピーされます。

    connectcmd: chat scriptのコマンドラインとなります。USB dialup modemのhotplug in処理中にttyusbから、コピーされます。同じく /tmp/chat_dailerもhotplug in処理中に作成されます。

    attached: D02HW, H12HWのような3GUMTS対応のmodemを利用した場合に、/dev/ttyUSB0と/dev/ttyUSB1の2回 hotplug in処理が起動されるためttyUSB0の処理中に設定しれた値がttyUSB1の処理で上書きされるのを防ぐためのflagです。この値が 1 であると、ttyUSB0のhotplug in 処理が完了したことを示します。

     

    2. /etc/config/ttyusb

    /etc/config/ttyusb - 新規ファイル追加のサンプル。WSIM接続のusername, passwordはdummyの’*’としています。

    config 'ttyusb' '12D11003'
        option 'vendor' 'Huawei'
        option 'driver' 'option'
        option 'modemtype' 'dialup'
        option 'username' 'em'
        option 'password' 'em'
        option 'connectcmd' '/tmp/chat_dialer -s -v -T*99#'
        option 'speed' '921600'
        option 'atinit' 'AT'
        option 'vidpid' '12D11003'
        option 'product' 'D02HW(E220)'

    config 'ttyusb' '12D11008'
        option 'vendor' 'Huawei'
        option 'product' 'H12HW'
        option 'driver' 'option'
        option 'modemtype' 'dialup'
        option 'username' 'em'
        option 'password' 'em'
        option 'connectcmd' '/tmp/chat_dialer -s -v -T*99#'
        option 'speed' '921600'
        option 'atinit' 'AT'
        option 'vidpid' '12D11008'

    config 'ttyusb' '04BB0940'
        option 'product' 'IO Data WSIM'
        option 'driver' 'pl2303'
        option 'modemtype' 'dialup'
        option 'username' '********'
        option 'password' '********'
        option 'connectcmd' '/tmp/chat_dialer -s -v -T0570572744##64'
        option 'speed' '115200'
        option 'atinit' 'AT&D2&C1&K3S0=0'
        option 'vidpid' '04BB0940'
        option 'vendor' 'Willcom INC'

    config ‘ttyusb’ VIDPID: VIDPIDによって識別されるUSB dialup modemの設定情報セクションです。

    vendor: ベンダー名

    product: 製品名

    vidpid: dialup modemのvendor idとproduct idを連結した16進8桁の値となります。dailup modemの識別のためにセクション名とこちらの2重に保持しています。

    driver: device driverの種類を設定します。IO Data WSIMの場合にはpl2303, Huawei (Emobile)についてはoptionです。他にusbserialも選択できます。この項目は、以前のimplementationにおいて利用していました。現在は利用していません。

    modemtype: モデムタイプ。’dialup’ or ‘3gumts’。’dialup’のときには今回のdialup処理とし、3GUMTS処理が起動されないようにします。’3gumts’の場合には、その逆となります。

    username: PPP接続のアカウント名です。USB dialup modemのhotplug in処理中、ttyusbの該当情報が/etc/config/networkの’interface’ ‘ppp’セクションのusernameにコピーされます。

    password: PPP接続のパスワードです。USB dialup modemのhotplug in処理中、ttyusbの該当情報が/etc/config/networkの’interface’ ‘ppp’セクションのpasswordにコピーされます。

    connectcmd: PPP接続のchat script起動用コマンドラインです。-T以降の電話番号のみ変更するようにしてください。Emobileの場合は、-T*99#になります。USB dialup modemのhotplug in処理中、ttyusbの該当情報が/etc/config/networkの’interface’ ‘ppp’セクションのconnectcmdにコピーされます。

    speed: PPP接続のインターフェース速度(bps)です。IO Data WSIMの場合は 115200(bps)が上限のようです。Huawei (Emobile)のH12HWの場合には921600(bps)

    atinit: USB dialup modemの初期化コマンドです。空でも差し支えはないでしょう。/tmp/chat_dialerの中で “ATZ” は発行しています。3GUMTSの場合は、ATZとATHを発行しているようです。(/App/umtsd.lua)

     

    3. /etc/ppp/options

    /etc/ppp/options - パラメーターの修正(bold部分)

    #debug
    #logfile /dev/null
    noaccomp
    nopcomp
    #nocrtscts
    crtscts
    lock
    maxfail 0
    lcp-echo-failure 5
    lcp-echo-interval 3

    Hardware flow controlを有効にするために nocrtsctsをコメントにします。そしてctsctsを追加します。また、lcp-echo-intervalの値を3に変更します。オリジナルの1では、IO Data WSIM接続の場合に LCP Timeoutが発生することがありました。

     

    4. /etc/hotplug.d/ttyusb/10-umts

    /etc/hotplug.d/ttyusb/10-umts - 修正 (ファイルの先頭に追加)

    modemtype=`uci get ttyusb.${VIDPID}.modemtype`
    if [ "${modemtype}" != "3gumts" ] ; then
      exit 1
    fi

    modemtypeが”3gumts”ではないデバイスが装着されたときに3GUMTSが起動されるのを防ぎます。

     

    5. /etc/hotplug.d/ttyusb/11-dialup

    /etc/hotplug.d/ttyusb/11-dialup - 新規ファイルの追加

    DIALER="/tmp/chat_dialer"

    modemtype=`uci get ttyusb.${VIDPID}.modemtype`

    if [ "${modemtype}" != "dialup" ] ; then
      exit 1
    fi

    [ "$ACTION" == "add" -a "$SUBSYSTEM" == "ttyusb" ] && {

    attached=`uci get network.ppp.attached`
    if [ "${attached}" != "1" ] ; then
      speed=`uci get ttyusb.${VIDPID}.speed`
      username=`uci get ttyusb.${VIDPID}.username`
      password=`uci get ttyusb.${VIDPID}.password`
      connectcmd=`uci get ttyusb.${VIDPID}.connectcmd`
      atinit=`uci get ttyusb.${VIDPID}.atinit`

    # Write to /etc/config/network ppp section
      uci set network.ppp.speed="${speed}"
      uci set network.ppp.username="${username}"
      uci set network.ppp.password="${password}"
      uci set network.ppp.connectcmd="${connectcmd}"
      uci set network.ppp.device="/dev/""${NODE}"
      uci commit network

    echo "\
    #!/usr/sbin/chat -f
    TIMEOUT 10
    ABORT   '\nNO ANSWER\r'
    ABORT   '\nNO CARRIER\r'
    ABORT   '\nNO DIALTONE\r'
    ABORT   '\nBUSY\r'
    ''      ATZ
    OK      AT
    OK      ${atinit}
    TIMEOUT 30
    OK      ATDT\T
    CONNECT \d\d" > ${DIALER}

        chmod +x ${DIALER}
    uci set network.ppp.attached=1
    uci commit network

        ifup ppp
    fi
    }

    [ "$ACTION" == "remove" -a "$SUBSYSTEM" == "ttyusb" ] && {
    uci set network.ppp.attached=0
    uci commit network
    }

    modemtypeが”dialup”ではないデバイスが装着されたときにdial up接続が起動されるのを防ぎます。

    Hotplug in 処理(環境変数 ACTIONの値が”add”)のときには、

    • ‘attached’ flagが1でない場合、すなわち WSIM接続時、Huawei (Emobile)接続で /dev/ttyUSB0の処理のときには、処理を進めます。 ‘attached’が1の場合には、Huawei(Emboile)接続で /dev/ttyUSB1(Control port)の処理でのすで、以下の処理はttyUSB0 (Data port)と重複するため行いません。
    • VIDPIDが環境変数として引き渡されるので、対応する設定情報を /etc/config/ttyusbより取得し、/etc/config/networkの’interface’ ‘ppp’セクションにコピーします。そして、最後に ‘attached’ を1にします。

    unplug処理(環境変数 ACTIONの値が”remove”)のときには、’attached’を0として、次回のhotplug in処理用に初期化します。

     

    6. /etc/hotplug.d/usb/10-umts

    /etc/hotplug.d/usb/10-umts - 追加(ファイルの先頭に追加します)

    fillzero() {
      id=$1
      len=`expr 4 - ${#id}`

      while [ ${len} -ge 1 ];
      do
        id="0"$id
        len=`expr $len - 1`
      done

      echo ${id}
    }

    # ${PRODUCT} contains vendor and product information, like 04bb/0940/1.
    VID=`echo ${PRODUCT} | cut -f1 -d'/'`
    PID=`echo ${PRODUCT} | cut -f2 -d'/'`
    VID=`fillzero ${VID} | tr '[a-z]' '[A-Z]'`
    PID=`fillzero ${PID} | tr '[a-z]' '[A-Z]'`
    VIDPID=$VID$PID

    # check the modemtype to prevent this script working on 3G/UMTS.
    modemtype=`uci get ttyusb.${VIDPID}.modemtype`
    if [ "${modemtype}" != "3gumts" ] ; then
      exit 1
    fi

    modemtypeが”3gumts”ではないデバイスが装着されたときに3GUMTSが起動されるのを防ぎます。

     

    7. /etc/hotplug.d/usb/11-dialup

    /etc/hotplug.d/usb/11-dialup - 新規ファイルの追加

    DIALER="/tmp/chat_dialer"

    fillzero() {
      id=$1
      len=`expr 4 - ${#id}`

      while [ ${len} -ge 1 ];
      do
        id="0"$id
        len=`expr $len - 1`
      done

    echo ${id}
    }

    # ${PRODUCT} contains vendor and product information, like 04bb/0940/1.
    VID=`echo ${PRODUCT} | cut -f1 -d'/'`
    PID=`echo ${PRODUCT} | cut -f2 -d'/'`
    VID=`fillzero ${VID} | tr '[a-z]' '[A-Z]'`
    PID=`fillzero ${PID} | tr '[a-z]' '[A-Z]'`
    VIDPID=$VID$PID

    # check the modemtype to prevent this script working on 3G/UMTS.
    modemtype=`uci get ttyusb.${VIDPID}.modemtype`
    if [ "${modemtype}" != "dialup" ] ; then
      exit 1
    fi

    [ "$ACTION" == "add" -a "$HOTPLUG_TYPE" == "usb" ] && {
    :
    }

    [ "$ACTION" == "remove" -a "$HOTPLUG_TYPE" == "usb" ] && {
            ifdown ppp
            # Remote dailup chat script
            rm -f ${DIALER}
            # Reset ppp attached flag
            uci set network.ppp.attached=0
            uci commit network
    }

    modemtypeが”dialup”ではないデバイスが装着されたときにdialup接続が起動されるのを防ぎます。そして、unplug処理(環境変数ACTIONの値が”remove”のときにはppp の接続断、chat script (/tmp/chat_dialer)の削除、’attached’を0にします(重複していますが)。

     

    8. /lib/network/ppp.sh

    /lib/network/ppp.sh - 修正(太字部分)

    start_pppd() {
            local cfg="$1"; shift

            # make sure only one pppd process is started
            lock "/var/lock/ppp-${cfg}"
            local pid="$(head -n1 /var/run/ppp-${cfg}.pid 2>/dev/null)"
            [ -d "/proc/$pid" ] && grep pppd "/proc/$pid/cmdline" 2>/dev/null >/dev/null && {
                    lock -u "/var/lock/ppp-${cfg}"
                    return 0
            }

            # Workaround: sometimes hotplug2 doesn't deliver the hotplug event for creating
            # /dev/ppp fast enough to be used here
            [ -e /dev/ppp ] || mknod /dev/ppp c 108 0

            config_get device "$cfg" device
            config_get unit "$cfg" unit
            config_get username "$cfg" username
            config_get password "$cfg" password
            config_get keepalive "$cfg" keepalive

            config_get connect "$cfg" connect
            config_get disconnect "$cfg" disconnect
            config_get pppd_options "$cfg" pppd_options
            config_get_bool defaultroute "$cfg" defaultroute 1
    # -- Start
    # 2010/06/14
    # Added overwriting "connect" paramter.
    # Added linkname and ipparam
            config_get connect "$cfg" connectcmd
            config_get linkname "$cfg" linkname
            config_get ipparam "$cfg" ipparam
    # – End

            [ "$defaultroute" -eq 1 ] && defaultroute="defaultroute replacedefaultroute" || de

            interval="${keepalive##*[, ]}"
            [ "$interval" != "$keepalive" ] || interval=5

            config_get_bool peerdns "$cfg" peerdns 1
            [ "$peerdns" -eq 1 ] && peerdns="usepeerdns" || peerdns=""

            config_get demand "$cfg" demand
            [ -n "$demand" ] && echo "nameserver 1.1.1.1" > /tmp/resolv.conf.auto

            config_get_bool ipv6 "$cfg" ipv6 0
            [ "$ipv6" -eq 1 ] && ipv6="+ipv6" || ipv6=""

    # 2010/06/14
            /usr/sbin/pppd "$@" \
                    ${keepalive:+lcp-echo-interval $interval lcp-echo-failure ${keepalive%%[,
                    ${demand:+precompiled-active-filter /etc/ppp/filter demand idle }${demand:
                    $peerdns \
                    $defaultroute \
                    ${username:+user "$username" password "$password"} \
                    unit "$unit" \
                    linkname "$linkname" \
                    ipparam "$ipparam" \
                    ${connect:+connect "$connect"} \
                    ${disconnect:+disconnect "$disconnect"} \
                    ${ipv6} \
                    ${pppd_options}

            lock -u "/var/lock/ppp-${cfg}"
    }

    setup_interface_ppp() {
            local iface="$1"
            local config="$2"

            config_get device "$config" device
    # 2010/06/14
            config_get speed "$config" speed

            config_get mtu "$cfg" mtu
            mtu=${mtu:-1492}
            start_pppd "$config" \
                    mtu $mtu mru $mtu \
                    "$device" "$speed"

    • connectcmd, linkname, ipparamの値を /etc/config/networkの’interface’ ‘ppp’より取得します。connectcmdはconnectを上書きします。
    • linknameとipparamをpppdの引数として追加します。
    • speedの値を取り出し、同じく引数として追加します。

     

    9. /lib/uci/schema/defaults/network

    /lib/uci/schema/defaults/network - 追加(ファイルの最後)

    config variable
            option name     'connectcmd'
            option title    'Connect command"
            option section  'network.interface'
            option datatype 'string'
            option minlength 0
            option maxlength 64
            list   depends  'proto=ppp'

    config variable
            option name     'linkname'
            option title    'pppd option linkname"
            option section  'network.interface'
            option datatype 'string'
            option minlength 0
            option maxlength 64
            list   depends  'proto=ppp'

    config variable
            option name     'ipparam'
            option title    'pppd option ipparam"
            option section  'network.interface'
            option datatype 'string'
            option minlength 0
            option maxlength 64
            list   depends  'proto=ppp'

    config variable
            option name 'speed'
            option title 'Connection bit rate'
            option section 'network.interface'
            option datatype uint

    config variable
            option name 'attached'
            opiton title 'Dialup 1st data device attached'
            option datatype 'boolean'

    /etc/config/networkに追加した値の定義をします。

     

    10. /lib/uci/schema/defaults/ttyusb

    /lib/uci/schema/defaults/ttyusb - 新規ファイル

    package ttyusb

    config section
            option name     'ttyusb'
            option package  'ttyusb'
            option unique   true

    config variable
            option name     'driver'
            option section  'ttyusb.ttyusb'
            option datatype 'string'
            option minlength 0
            option maxlength 32

    config variable
            option name     'vendor'
            option section  'ttyusb.ttyusb'
            option datatype 'string'
            option minlength 0
            option maxlength 32

    config variable
            option name     'product'
            option section  'ttyusb.ttyusb'
            option datatype 'string'
            option minlength 0
            option maxlength 32

    config variable
            option name     'modemtype'
            option section  'ttyusb.ttyusb'
            option datatype 'string'
            option minlength 0
            option maxlength 32

    config variable
            option name     'device'
            option section  'ttyusb.ttyusb'
            option datatype 'string'
            option minlength 0
            option maxlength 32

    config variable
            option name     'connectcmd'
            option title    'Connect command'
            option section  'ttyusb.ttyusb'
            option datatype 'string'
            option minlength 0
            option maxlength 64

    config variable
            option name 'speed'
            option title 'Connection bit rate'
            option section 'ttyusb.ttyusb'
            option datatype uint

    config variable
            option name 'atinit'
            option title 'AT INIT command line'
            opiton section 'ttyusb.ttyusb'
            option datatype 'string'
            option minlength 0
            opiton maxlength 64

    /etc/config/ttyusbの値の定義をします。

     

    更新履歴

    • 2010/07/28: Initial release