LoginSignup
0
1

More than 1 year has passed since last update.

LPTポートをVirtualBoxで使用する方法

Last updated at Posted at 2019-12-23

概要

VirtualBoxの現在のバージョン(v6.1.0)には、
VirtualMachineのLPT設定を構成するためのGUIサポートがありません。
代わりにCUIでVBoxManageコマンドを使用する必要があります。

慣れてきたら、VagrantとかDockerとかを使うので、
CUIがメインになってくると思います。
あくまでコンテナ技術中級者向けの記事です。

一般的なWindowsユーザーのための説明

VBoxManageコマンドを使用する前の下準備を説明します。
はじめにコマンドプロンプトを開き、

cd "c:\Program Files\Oracle\VirtualBox"

と入力してVBoxManageフォルダに移動します。
※パス文字列の周りにスペースが含まれているため、二重引用符に注意してください。
この後に、これ以降で説明するコマンドを入力できます。
コマンドを入力した後にはEnterを押しましょう。

コマンド構文

※<>括弧内のフィールドはプレースホルダーであり、括弧はリテラルではありません。

オンにする場合↓
VBoxManage modifyvm <VMname> --lptmode1 <host LPT device name>
VBoxManage modifyvm <VMname> --lpt1 0x378 7

--lptmode1を先に実行して、バーチャルマシン<VMname>のlpt1ではホストの<host LPT device name>を使用することを指定します。
そのあと--lpt1を実行してゲスト側で認識されるときのIOベースアドレスとIRQ番号を指定します。

リファレンスに載っている基本構文

VBoxManage modifyvm [--lptmode<1-N> <host LPT device name>]
VBoxManage modifyvm [--lpt<1-N> off|<I/O base> <IRQ>]

--lptmode<1-N> : Specifies the Device Name of the parallel port that the Parallel Port feature will be using. Use this before --lpt. This feature depends on the host operating system. For Windows hosts, use a device name such as lpt1. On Linux hosts, use a device name such as /dev/lp0.

--lpt<1-N> : Specifies the I/O address of the parallel port and the IRQ number that the Parallel Port feature will be using. Optional. Use this after --lptmod. I/O base address and IRQ are the values that guest sees. For example, the values avalable under guest Device Manager.

<I/O base><IRQ>は、ゲスト側で表示されてほしい値を入力するようです。勘違いしやすいので要チェックです。

IRQ number とはWindowsでいうとデバイスマネージャーの表示をリソース種別に変更すると見やすいようです。
I/O base address についても同様です。
割り込み要求(IRQ)の割り当て状況を一覧表示させるには(Windows 2000編)
ポートの設定で「割り込みを全く使用しない」がデフォルトでオンになっているけれど、関係あるのかよくわかりません。

Windowsホストの例

※ホストが使用するポートが "LPT4"の場合です。

VBoxManage modifyvm "My VM Name" --lptmode1 "LPT4"
VBoxManage modifyvm "My VM Name" --lpt1 0x378 7

Linuxホストの例

※上記と同等でホストが使用するポートが "LPT4"の場合です。

VBoxManage modifyvm "My VM Name" --lptmode1 "/dev/parport3"
VBoxManage modifyvm "My VM Name" --lpt1 0x378 7

元に戻す

VBoxManage modifyvm --lpt1 off

実例

私が実機で試したときのコマンド実例です。

VBoxManage modifyvm "Win7(32bit)" --lptmode1 "LPT1"
VBoxManage modifyvm "Win7(32bit)" --lpt1 0x378 7

注意

コマンド実行時にはVirtualMachineはシャットダウンしている必要があります。
コマンドが正常終了した時にメッセージは帰ってきません。

情報元

パラレル(LPTx)ポートの有効化と構成 | VirtualBoxのエンドユーザーフォーラム

Excelsior!

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1