Armadilloフォーラム

USB-OTGでμSDをWindowsとLinuxで共有した際の同期の問題

izawa

2014年2月21日 21時27分

毎度お世話様。
「Howto : Armadillo-410 液晶モデル開発セット で USB デバイス機能を使用する(http://armadillo.atmark-techno.com/howto/a400-use-usb-gadget)」を参考に、
A440でμSDをWindowsとLinuxで共有しています。
Windows側でμSD上にファイルを書いた場合はLinux(A440)側ではmountし直すことで動機が取れていますが、
Linux側でμSD上にファイルを書いてもWindows(USB-HOST)側ではそのファイルが見えません。
そこで質問です。
・Windowsで同期する(ファイルが見えるようにする)にはどうすればいいでしょうか。
・Linuxで同期する為にはmountし直し(umount / mount)しかありませんでしょうか。

実際のターゲットはA410ですが、実験しているのはA440なので「製品」はA440を選択しておきました。
宜しくどうぞ。

コメント

izawa

2014年2月24日 17時55分

追記。
insmod g_mass_storage file=/dev/mmcblk0 stall=0 した後に、正常にrmmodできた試しがありません。
手順は詳しく確認していませんが、Windows側で「取り出し」を行なっても行わなくてもカーネルがエラーを吐くようです。
これも、(今回は運用上余り問題にはなりませんが)解決しておきたい問題です。

at_daisuke.sasaki

2014年2月27日 16時07分

佐々木大輔です。

> A440でμSDをWindowsとLinuxで共有しています。

申し訳ありませんが、Mass Storage gadgetで
Armadillo-440のmicroSDをWindowsとLinuxで共有するといった事はできません。

Mass Storage gadgetが動作し、USB Host(この場合Windows)と接続された場合、
ArmadilloのストレージはUSB Hostのプライベートディスクとしてしか使用できない仕様になっています。

詳細はLinux USB Projectの以下のページに記載されていましたので、参考にしてみてください。
Backing Storage for the Mass Storage Gadget
http://www.linux-usb.org/gadget/file_storage.html

AN IMPORTANT WARNING! While MSG is running and the gadget is connected to a USB host, that USB host will use the backing storage as a private disk drive. It will not expect to see any changes in the backing storage other than the ones it makes. Extraneous changes are liable to corrupt the filesystem and may even crash the host. Only one system (normally, the USB host) may write to the backing storage, and if one system is writing that data, no other should be reading it. The only safe way to share the backing storage between the host and the gadget's operating system at the same time is to make it read-only on both sides.

at_daisuke.sasaki

2014年2月27日 16時47分

佐々木大輔です。

> 申し訳ありませんが、Mass Storage gadgetで
> Armadillo-440のmicroSDをWindowsとLinuxで共有するといった事はできません。

本件について、以下HowToから読み取れませんでしたので、冒頭部に注意書きを追加しておきました。

Howto : Armadillo-410 液晶モデル開発セット で USB デバイス機能を使用する
http://armadillo.atmark-techno.com/howto/a400-use-usb-gadget

izawa

2014年2月27日 16時57分

回答ありがとうございます。
共有は無理がある件、了解しました。
件のページにあるように、A410でマウントしたμSD上のファイルシステムイメージをマウントしてファイルを書き込み、
その後イメージをアンマウントしてからg_mass_storage.koをinsmodする運用で逃げることにしました。
# 尚、現在は製品用に納品いただいたA410にて実験を行っております。

つきましては、もう一つの「一度Windowsが認識するとその後は正常にrmmodできない」問題の方は何か情報がありませんでしょうか。
その度にリブート必須ではそれはそれで運用上巧くありませんので。

> 佐々木大輔です。
>
> > A440でμSDをWindowsとLinuxで共有しています。
>
> 申し訳ありませんが、Mass Storage gadgetで
> Armadillo-440のmicroSDをWindowsとLinuxで共有するといった事はできません。
>
> Mass Storage gadgetが動作し、USB Host(この場合Windows)と接続された場合、
> ArmadilloのストレージはUSB Hostのプライベートディスクとしてしか使用できない仕様になっています。
>
> 詳細はLinux USB Projectの以下のページに記載されていましたので、参考にしてみてください。
> Backing Storage for the Mass Storage Gadget
> http://www.linux-usb.org/gadget/file_storage.html
>
>

> AN IMPORTANT WARNING! While MSG is running and the gadget is connected to a USB host, that USB host will use the backing storage as a private disk drive. It will not expect to see any changes in the backing storage other than the ones it makes. Extraneous changes are liable to corrupt the filesystem and may even crash the host. Only one system (normally, the USB host) may write to the backing storage, and if one system is writing that data, no other should be reading it. The only safe way to share the backing storage between the host and the gadget's operating system at the same time is to make it read-only on both sides.
> 

>

at_daisuke.sasaki

2014年3月13日 21時59分

佐々木大輔です。

> つきましては、もう一つの「一度Windowsが認識するとその後は正常にrmmodできない」問題の方は何か情報がありませんでしょうか。
> その度にリブート必須ではそれはそれで運用上巧くありませんので。

mass storage gadgetがモジュールアンロード時にOopsしてしまう問題について、
IRAMを使用した場合の処理に問題があったようです。

Patchを作成しましたので、添付のPatchを適用し確認していただけますか?

ファイル ファイルの説明
linux-2.6.35-at-alpha4-arcotg-iram-fix.patch

izawa

2014年3月14日 16時55分

毎度お世話様です。
件のパッチを適用したところ、モジュールは無事にアンロードできようになりました。
これで、Linux側から必要に応じてマウント先を切り替えて使うような運用が可能になります。
対処ありがとうございました。

> 佐々木大輔です。
>
> > つきましては、もう一つの「一度Windowsが認識するとその後は正常にrmmodできない」問題の方は何か情報がありませんでしょうか。
> > その度にリブート必須ではそれはそれで運用上巧くありませんので。
>
> mass storage gadgetがモジュールアンロード時にOopsしてしまう問題について、
> IRAMを使用した場合の処理に問題があったようです。
>
> Patchを作成しましたので、添付のPatchを適用し確認していただけますか?
>

at_daisuke.sasaki

2014年3月14日 19時57分

佐々木大輔です。

> 件のパッチを適用したところ、モジュールは無事にアンロードできようになりました。
> これで、Linux側から必要に応じてマウント先を切り替えて使うような運用が可能になります。
> 対処ありがとうございました。

ご確認いただきありがとうございます。
Patchはカーネル linux-2.6.35-atにマージしたいと思います。