Friday, February 27, 2015

raspberry pi에 USB Flash Memory(FAT32) 읽기 쓰기가 가능하도록 마운트 (Mount FAT32 usb stick read,write permission)

USB Flash memory를 FAT32로 포맷하고 이것을 마운트 하려면 다음과 같이 한다.

굵은 글씨는 명령어.

pi@rpi ~ $ lsusb
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 005: ID 0781:5580 SanDisk Corp.
Bus 001 Device 004: ID 0d8c:0105 C-Media Electronics, Inc. CM108 Audio Controller


USB Flash memory가 lsusb에 나타났다.

pi@rpi ~ $ tail -f /var/log/messagesFeb 28 05:09:34 rpi kernel: [58069.795528] usb-storage 1-1.2:1.0: USB Mass Storage device detected
Feb 28 05:09:34 rpi kernel: [58069.796076] scsi host0: usb-storage 1-1.2:1.0
Feb 28 05:09:34 rpi kernel: [58069.820379] usbcore: registered new interface driver uas
Feb 28 05:09:35 rpi kernel: [58070.793472] scsi 0:0:0:0: Direct-Access     SanDisk  Extreme          0001 PQ: 0 ANSI: 6
Feb 28 05:09:35 rpi kernel: [58070.796241] sd 0:0:0:0: [sda] 31277232 512-byte logical blocks: (16.0 GB/14.9 GiB)
Feb 28 05:09:35 rpi kernel: [58070.797056] sd 0:0:0:0: [sda] Write Protect is off
Feb 28 05:09:35 rpi kernel: [58070.797777] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
Feb 28 05:09:35 rpi kernel: [58070.802944]  sda: sda4Feb 28 05:09:35 rpi kernel: [58070.806540] sd 0:0:0:0: [sda] Attached SCSI disk
Feb 28 05:09:35 rpi kernel: [58070.825946] sd 0:0:0:0: Attached scsi generic sg0 type 0

꼽았을때 sda4로 잡혔음을 알 수 있다.

그렇다면 sda4를 마운트 하면됨.
pi@rpi ~ $ sudo mount -t vfat /dev/sda4 /media/usbstick -o rw,umask=111,dmask=000
pi@rpi ~ $ ls /media/usbstick/ -l

total 8
drwxrwxrwx 3 root root 8192 Feb 28 05:28 log


이제 usb flash memory의 내용이 잘 보임. 마운트가 잘되었음.

pi@rpi /media/usbstick/log/201502 $ ls -l
total 8
-rw-rw-rw- 1 root root 15 Feb 28 05:29 20150228142900.txt


중요한것은 umask와 dmask에 따라서 디렉토리와 파일의 권한이 달라진다는점.


Thursday, February 26, 2015

라즈베리파이에서 i2c 핀을 사용하면 복구모드로 부팅될때 해결방법(raspberry pi recovery mode when i2c pin connected)

I2C SDA와 SCL핀은 복구모드 진입용으로 사용되고 있다.

부팅시 복구모드로 빠져버리는 경우는 i2c scl과 sda핀중 하나라도 low가 된것이다.
(i2c 관련 회로를 잘못 만들면 그렇게 되는 경우가 있음)

부팅시 반드시 SDA와 SCL핀은 high가 되거나 high impedence가 되도록 하면된다.


Raspberry pi will boot to recovery mode when  i2c sda pin or scl pin is LOW.

i2c sda and scl pin must HIGH or High impedence( disconnect ) while booting term.

Check your circuit

Raspberry pi에 vsftpd 쉽게 설정하기. (easy configuration for raspberry pi vsftp)

vsftpd 설치( install vsftpd )
명령어(command): sudo apt-get install vsftpd


설정파일 편집 (open configuration file)
명령어(command): sudo nano /etc/vsftpd.conf


모든 내용을 지운다. (erase all content of vsftpd.conf file)

아래 내용을 입력하고 저장. (fill content as bellow text, and write)

anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
xferlog_enable=YES
xferlog_std_format=YES
xferlog_file=/var/log/vsftpd.log
pam_service_name=vsftpd
session_support=YES
chroot_local_user=NO
listen=YES
listen_port=21


vsftpd 재시작. (restart vsftpd service)

명령어(command) : sudo service vsftpd restart


이제 pi 계정으로 로그인(Login ftp as "pi")