matoken?

  • Kenichiro MATOHARA ( @matoken )

  • http://matoken.org

  • 興味

    • PC-UNIX/OSS, OpenStreetMap, 電子工作, 自転車……

    • altanativeが好き,多様性は正義!

Map

最近

とくになし(◞‸◟)

  • 鹿児島市オープンデータ航空写真関連差し替え

  • i3 wm入門

  • Go GUI入門

  • ホームアシスタント入門

  • ARM64 SBCをデスクトップ環境に※今日のネタ元

さっきハードオフに

image/hardoff.jpg

先月目をつけていたUSB-モニタ

image/usbmonitor01.jpg
image/usbmonitor02.jpg
  • I-O DATA LCD-USB7XB

  • miniUSBで繋いでバスパワーで動くモニタ

  • 多分DisplayLinkでドライバがないから動いていなくてジャンク扱いなのでは?

  • でもハード的に生きてるんだろうか?

  • 店員さんに「PCに繋いでみてもいいですか?」「いいですよ.電源使いますか?」

dmesg

[ 1222.360090] usb 1-1: new high-speed USB device number 4 using ehci-pci
[ 1222.509140] usb 1-1: New USB device found, idVendor=17e9, idProduct=0153
[ 1222.509143] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1222.509144] usb 1-1: Product: I-O DATA LCD-USB7X
[ 1222.509146] usb 1-1: Manufacturer: DisplayLink
[ 1222.509147] usb 1-1: SerialNumber: 001E01
[ 1222.509308] usb 1-1: Device is not authorized for usage
[ 1225.159128] usb-storage 1-1:2.0: USB Mass Storage device detected
[ 1225.161302] scsi host6: usb-storage 1-1:2.0
[ 1225.161532] usb 1-1: authorized to connect
[ 1226.172977] scsi host6: scsi scan: INQUIRY result too short (5), using 36
[ 1226.172983] scsi 6:0:0:0: CD-ROM                                           PQ: 0 ANSI: 0
[ 1226.175733] sr 6:0:0:0: [sr0] scsi3-mmc drive: 8x/40x writer xa/form2 cdda tray
[ 1226.177517] sr 6:0:0:0: Attached scsi CD-ROM sr0
[ 1226.177893] sr 6:0:0:0: Attached scsi generic sg1 type 5

多分動く

  • モニタ光るしPCからUSBデバイスとして認識する

  • dmesgやlsusbでDisplayLinkに見えるのできっといける

  • でもCD-ROMにも見える?ejectかusb_modeswitchで行けるか?

  • 1080 → 864に値下がりしてるし

  • お買上げ

ジョイフルへ

  • お昼食べなきゃだし

  • 最近のジョイフルは一部店舗を除き電源&Wi-Fiが使えて素晴らしいです

  • モーニング(ドリンクバー付き)24時間食べられるし……

  • ご飯食べてこの文章を作成

image/joyfull.jpg

lsusb

$ lsusb -d 17e9:0153
Bus 002 Device 008: ID 17e9:0153 DisplayLink
$ sudo lsusb -d 17e9:0153 -vvv | gist-paste -f 'sudo lsusb -d 17e9:0153 -vvv.log'
https://gist.github.com/f35c5119fe205fa234345f86d1a436b4

CD-ROMに見える

  • mountしてみるとやっぱりDriverだった

  • eject commandは効かない

  • DisplayLinkのドライバ入れたら動かないかな?

$ ls -l /dev/sr0
brw-rw----+ 1 root cdrom 11, 0  6月 13 02:14 /dev/sr0
$ ls -lA /mnt
合計 14388
-r-xr-xr-x 1 root root   427368  1月  6  2009 AutoRun.exe
-r-xr-xr-x 1 root root     1042  1月  6  2009 DisplayLinkPids.tag
-r-xr-xr-x 1 root root   198591  1月  6  2009 DisplayLinkUsb.inf
-r-xr-xr-x 1 root root   299008  1月  6  2009 DisplayLinkUsbCo2.dll
-r-xr-xr-x 1 root root   385024  1月  6  2009 DisplayLinkUsbCo64.dll
-r-xr-xr-x 1 root root    20992  1月  6  2009 DisplayLinkUsbPort.sys
-r-xr-xr-x 1 root root    16896  1月  6  2009 DisplayLinkUsbPort64.sys
-r-xr-xr-x 1 root root    48104  1月  6  2009 ReleaseNote.txt
-r-xr-xr-x 1 root root 13157736  1月  6  2009 Setup.exe
-r-xr-xr-x 1 root root       59  1月  6  2009 autorun.inf
-r-xr-xr-x 1 root root   129513  1月  6  2009 displaylinkusb.cat
-r-xr-xr-x 1 root root    46258  1月  6  2009 usbdriver_license.txt
-r-xr-xr-x 1 root root       55  1月  6  2009 version.dat
$ sudo eject
eject: unable to eject, last error: Invalid argument

ドライバの入手

  • 今回のマシンはUbuntu 17.10 artful amd64

  • DisplayLinkの公式サイトにUbuntu用ドライバがあった

ドライバの導入

$ unzip -l DisplayLink\ USB\ Graphics\ Software\ for\ Ubuntu\ 1.3.52.zip
Archive: DisplayLink USB Graphics Software for Ubuntu 1.3.52.zip
Length Date Time Name
--------- ---------- ----- ----
13094220 2017-02-03 04:49 displaylink-driver-1.3.52.run
--------- -------
13094220 1 file
$ unzip DisplayLink\ USB\ Graphics\ Software\ for\ Ubuntu\ 1.3.52.zip
Archive: DisplayLink USB Graphics Software for Ubuntu 1.3.52.zip
inflating: displaylink-driver-1.3.52.run
$ sudo ./displaylink-driver-1.3.52.run
Verifying archive integrity... All good.
Uncompressing DisplayLink Linux Driver 1.3.52 100%
DisplayLink Linux Software 1.3.52 install script called: install
Distribution discovered: Ubuntu Artful Aardvark (development branch)
Installing
Configuring EVDI DKMS module
Registering EVDI kernel module with DKMS
Building EVDI kernel module with DKMS
Installing EVDI kernel module to kernel tree
EVDI kernel module built successfully
Installing x64-ubuntu-1604/DisplayLinkManager
Installing libraries
Installing firmware packages
Installing license file
Adding udev rule for DisplayLink DL-3xxx/5xxx devices

USB MODESWATCH

  • ドライバを入れた後つなぎ直してもやっぱりCD-ROM

  • usb_modeswitchを試す

$ sudo usb_modeswitch -v 17e9 -p 0153
Look for default devices ...
   product ID matched
 Found devices in default mode (1)
Access device 002 on bus 002
Get the current device configuration ...
Current configuration number is 2
Use interface number 0

USB description data (for identification)
\-------------------------
Manufacturer: DisplayLink
     Product: I-O DATA LCD-USB7X
  Serial No.: 001E01
\-------------------------
Warning: no switching method given. See documentation
-> Run lsusb to note any changes. Bye!

$ sudo usb_modeswitch -v 17e9 -p 0153 -u 1
Look for default devices ...
   product ID matched
Get the current device configuration ...
 Found devices in default mode (1)
Access device 004 on bus 001
Get the current device configuration ...
Current configuration number is 2
Use interface number 0

USB description data (for identification)
\-------------------------
Manufacturer: DisplayLink
     Product: I-O DATA LCD-USB7X
  Serial No.: 001E01
\-------------------------
Change configuration to 1 ...
 Device is busy, try to detach kernel driver
Looking for active driver ...
 OK, driver detached
 OK, configuration set
Get the current device configuration ...
The configuration was set successfully
-> Run lsusb to note any changes. Bye!

フレームバッファーデバイスが生えた

$ ls -l /dev/fb*
crw-rw---- 1 root video 29, 0  6月 11 12:58 /dev/fb0
crw-rw---- 1 root video 29, 1  6月 11 13:26 /dev/fb1

xranderでXでも認識させる

$ xrandr --listproviders

Providers: number : 2
Provider 0: id: 0x48 cap: 0x9, Source Output, Sink Offload crtcs: 2 outputs: 7 associated providers: 1 name:modesetting
Provider 1: id: 0x10a cap: 0x2, Sink Output crtcs: 1 outputs: 1 associated providers: 1 name:modesetting
$ xrandr --setprovideroutputsource 1 0

xrandrやarandrで切り替えて普通に利用出来た

image/displaylink01.jpg
image/displaylink02.jpg
image/displaylink-maud01.jpg
image/displaylink-maud02.jpg
image/displaylink-gs01.jpg

刺さる

  • そのままUSBを引っこ抜いたら刺さった

  • Magick SysRqも効かない…….強制電源断orz

  • 据え置きならいいけどNotePCに繋いで付け外しできないのは辛い

繋ぐ時の逆の手順でmoduleをunloadしてみる

  • arandrやxrandrでoffに $ xrandr --output DVI-I-1-1 --off

  • プロバイダから切り離し $ xrandr --setprovideroutputsource 1

  • usb_modeswitchでCD_ROMに戻す $ sudo usb_modeswitch -v 17e9 -p 0153 -u 2

  • moduleのunload $ sudo modprobe -frv udl

  • sync;sync;syncとかして恐る恐るUSB Cableを抜く……行けた!と思ったけどやっぱ駄目 usb_modeswitchの時点で刺さることも