Download dnw:
$ wget https://dnw-linux.googlecode.com/files/dnw-linux-v1.01.tar.gz
Install kernel source:
$ sudo apt-get install linux-source-`uname -r`
Install kernel headers:
$ sudo apt-get install linux-headers-`uname -r`
Install kernel headers for development:
$ sudo apt-get install linux-libc-dev
$ sudo apt-get install kernel-package libncurses5-dev fakeroot
Makefile (in ~/dnw-linux/src/driver)
--------------------
KDIR="/usr/src/linux-headers-3.16.0-30-generic"
PWD=$(shell pwd)
VV=
obj-m := secbulk.o
secbulk-m := secbulk.o
all:
$(MAKE) -C ${KDIR} M=${PWD} V=${VV} modules
clean:
$(MAKE) -C ${KDIR} M=${PWD} clean
--------------------
$ cd ~/
$ mkdir dnw-linux
$ mv dnw-linux-v1.01.tar.gz dnw-linux
$ cd dnw-linux/
$ tar zxvf dnw-linux-v1.01.tar.gz
$ cd ~/dnw-linux/src/driver
$ lsusb
Bus 001 Device 009: ID 04e8:1234 Samsung Electronics Co., Ltd /* <— here */
Bus 001 Device 009: ID 04e8:1234 Samsung Electronics Co., Ltd /* <— here */
Bus 001 Device 003: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 001 Device 002: ID 80ee:0021 VirtualBox USB Tablet
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
$ emacs secbulk.c
…...
static struct usb_device_id secbulk_table[]= {
{ USB_DEVICE(0x5345, 0x1234) }, /* FS2410 */
{ USB_DEVICE(0x04e8, 0x1234) }, /* EZ6410 */
{ USB_DEVICE(0x04e8, 0x1234) }, /* <— here */
};
…...
$ make
make -C "/opt/linux-source-3.13.0" M=/home/moto/dnw-linux/src/driver V= modules
make[1]: Entering directory `/opt/linux-source-3.13.0'
WARNING: Symbol version dump /opt/linux-source-3.13.0/Module.symvers
is missing; modules will have no dependencies and modversions.
CC [M] /home/moto/dnw-linux/src/driver/secbulk.o
In file included from /home/moto/dnw-linux/src/driver/secbulk.c:1:0:
/home/moto/dnw-linux/src/driver/secbulk.c: In function ‘secbulk_write’:
include/linux/kernel.h:672:17: warning: comparison of distinct pointer types lacks a cast [enabled by default]
(void) (&_min1 == &_min2); \
^
/home/moto/dnw-linux/src/driver/secbulk.c:60:14: note: in expansion of macro ‘min’
to_write = min(len, BULKOUT_BUFFER_SIZE);
^
Building modules, stage 2.
MODPOST 1 modules
CC /home/moto/dnw-linux/src/driver/secbulk.mod.o
LD [M] /home/moto/dnw-linux/src/driver/secbulk.ko
make[1]: Leaving directory `/opt/linux-source-3.13.0'
$ sudo cp secbulk.ko /lib/modules/3.16.0-30-generic/kernel
$ sudo depmod -A
Load module
$ sudo modprobe secbulk
Auto loading while booting
$ sudo emacs /etc/modules
Add secbulk
$ cd ~/dnw-linux/src/dnw
$ make
gcc -g -o dnw dnw.c
Client:
SMDK6410 # dnw
OTG cable Connected!
Now, Waiting for DNW to transmit data
HOST:
$ touch 123
$ sudo ./dnw 123
load address: 0x57E00000
Writing data...
100% 0x0000000A bytes (0 K)
speed: 0.001907M/S
Client:
SMDK6410 # dnw
OTG cable Connected!
Now, Waiting for DNW to transmit data
HOST:
$ touch 123
$ sudo ./dnw 123
load address: 0x57E00000
Writing data...
100% 0x0000000A bytes (0 K)
speed: 0.001907M/S
搞定收功~ XD
沒有留言:
張貼留言