BBB as modified file system

dear BBB experts: I would like to create a high-level filesystem device on my BBB that my (possibly malicious) linux PC can communicate with over USB in EHCI (USB 2.0 high-speed). I will want to switch off everything else, incl ethernet-over-usb, again because I will guess that my PC is infected.

from the PC perspective, I want the BBB to operate at roughly at the level of a fuse filesystem, albeit with its own processor that can enforce separation.

most importantly, I would like the BBB to hook into the “open file” request call. for example, I want my BBB to log every file open request to its own /tmp/log/file-logged, return an error if I don’t like the filename, mangle the filename (e.g., shorten it of auto-expand it), or disallow opening a file for write when a pin is bridged or when the file resides in the /ro/ part of the file system or the filename contains the string “ro”.

on the PC, I want to do

PC$ mount -t speak2mybbb /dev/usb1 /mnt/usb1 ## say my BBB sits on /dev/usb1
PC$ echo “hi” > /mnt/usb1/rw/file2 ## create a file
PC$ ls /mnt/usb1/rw/ ## note: my BBB has mangled the filename
file2-mangled-file-name

PC$ cat /mnt/usb1/rw/file2-remangleme ## note: my BBB can remangle and figure this out
hi

PC$ echo “hi” > /mnt/usb1/ro/file2 ## note: my BBB knows that /ro/ is read-only and does not allow writing here.
ERROR: no such file or directory
PC$ umount /dev/usb1

at first, I thought I should hook into the USB mass storage driver, because it already does EHCI and reading the USB spec, there is a lot of stuff that can go wrong. but the problem, I believe, is that this layer operates at too low a level. I deduct this because it supports many different higher-level file systems, like FAT or ext4. presumably, the USB-mass storage level is primarily “sector-read” and “sector-write,” which would make it very difficult to hook into a file-open.

the USB serial driver works and would allow me to filter requests, and I could write a fuse driver on the PC (not the BBB), but USB serial is slow.

has anyone created an EHCI fuse-like file-system communication example? any pointers by experts would be highly appreciated.

regards,

/iaw

ok, further research. I discovered that I probably want to write a usb mtp (media transfer protocol) driver for the BBB. if anyone has already written one, please let me know.

Ivo,

Did you ever get an MTP responder working on beagleboard?

Claude

No.

are you still interested? What are your requirements? I have a project that requires MTP to present other file systems to the initiator.

Claude