이런거 가지고 놀기 좋아한다고 뜬금없이 다른 보드와 함께 선물받은 Genuino 101 보드.

좀 시대 지난 보드지만 그래도 다른 보드와 다른점도 있고(Intel® Curie™/x86 (Quark) and a 32-bit ARC architecture core, both clocked at 32MHz.),
나름 BLE도 내장하고 있다.

테스트로 한번 blink 코드를 올려보려 하는데 자꾸 에러가 난다.

# arduino101load -dfu=/Users/heisice/Library/Arduino15/packages/arduino/tools/dfu-util/0.9.0-arduino1 -bin=/var/folders/3v/62sy5_5j1b72zgmg3wrnll6c0000gn/T/arduino_build_60893/Blink.ino.bin -port=/dev/cu.usbmodem14201 -v -ble_fw_str="ATP1BLE00R-1631C4439" -ble_fw_pos=169984 -rtos_fw_str="" -rtos_fw_pos=0 -core=2.0.0
arduino101load 2.0.1 - compiled with go1.7.5
Starting download script...
Serial Port: /dev/cu.usbmodem14201
BIN FILE /var/folders/3v/62sy5_5j1b72zgmg3wrnll6c0000gn/T/arduino_build_60893/Blink.ino.bin
Waiting for device...
Waiting for device...
Device found!
exit status 74

구글링을 열심히 해보다가 뚜렷한 답이 없어서 쳐박아뒀었는데, 다시 꺼내봤다가 답을 찾았다.


결국 또 구글링이긴 한데
바이너리 업로드에 쓰이는 저 arduino101load라는 프로그램이 예전 버전은 되는데 기존 버전은 안된다는 것 같다.

결국 구글링한 페이지에 링크된 버전을 다운받아, 기존 프로그램이 있는곳에 복사해 넣어줬더니 정상 동작한다.

# arduino101load -dfu=/Users/heisice/Library/Arduino15/packages/arduino/tools/dfu-util/0.9.0-arduino1 -bin=/var/folders/3v/62sy5_5j1b72zgmg3wrnll6c0000gn/T/arduino_build_60893/Blink.ino.bin -port=/dev/cu.usbmodem14201 -v -ble_fw_str="ATP1BLE00R-1631C4439" -ble_fw_pos=169984 -rtos_fw_str="" -rtos_fw_pos=0 -core=2.0.0
arduino101load 2.0.2 - compiled with go1.7.5
Starting download script...
Serial Port: /dev/cu.usbmodem14201
BIN FILE /var/folders/3v/62sy5_5j1b72zgmg3wrnll6c0000gn/T/arduino_build_60893/Blink.ino.bin
Waiting for device...
Device found!
Verifying BLE version: ATP1BLE00R-1631C4439
BLE version: verified
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
dfu-util: Invalid DFU suffix signature
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Deducing device DFU version from functional descriptor length
Opening DFU capable USB device...
ID 8087:0aba
Run-time device DFU version 0011
Claiming USB DFU Interface...
Setting Alternate Setting #7 ...
Determining device status: state = dfuDNLOAD-IDLE, status = 0
aborting previous incomplete transfer
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0011
Device returned transfer size 2048
Copying data from PC to DFU device

Download [ ] 0% 0 bytes
Download [= ] 4% 2048 bytes
Download [== ] 8% 4096 bytes
Download [=== ] 12% 6144 bytes
Download [==== ] 16% 8192 bytes
Download [===== ] 20% 10240 bytes
Download [====== ] 24% 12288 bytes
Download [======= ] 28% 14336 bytes
Download [======== ] 32% 16384 bytes
Download [========= ] 36% 18432 bytes
Download [========== ] 40% 20480 bytes
Download [=========== ] 44% 22528 bytes
Download [============ ] 48% 24576 bytes
Download [============= ] 52% 26624 bytes
Download [============== ] 56% 28672 bytes
Download [=============== ] 60% 30720 bytes
Download [================ ] 64% 32768 bytes
Download [================= ] 68% 34816 bytes
Download [================== ] 72% 36864 bytes
Download [=================== ] 76% 38912 bytes
Download [==================== ] 80% 40960 bytes
Download [===================== ] 84% 43008 bytes
Download [====================== ] 88% 45056 bytes
Download [======================= ] 92% 47104 bytes
Download [======================== ] 96% 48732 bytes
Download [=========================] 100% 48732 bytes
Download done.
Sent a total of 48732 bytes
state(2) = dfuIDLE, status(0) = No error condition is present
Done!
dfu-util: can't detach
Resetting USB to switch back to runtime mode
SUCCESS: Sketch will execute in about 5 seconds.


해당 프로그램 바이너리는 나중에 참조를 위해 이 글에 첨부하기로 한다.

arduino101load-2.0.0-darwin-testU.zip


참조: https://forum.arduino.cc/index.php?topic=467201.msg3205748#msg3205748

맥북에서 하드한 윈도우 환경이 필요한데 가상PC환경에서 쓰자니 좀 힘겨워 해서 가상 환경을 실제 환경으로 세팅했다.

근데 드라이버가 제대로 안돼있네?


다시 맥 환경으로 부팅해서 부트캠프지원 켜서 다운로드 기다리고 USB메모리 연결하고..


번거로워 찾아보니 좋은 도구를 만들어놨네?


https://github.com/timsutton/brigadier/releases


맥북용 윈도우 드라이버를 다운받으려면 그냥 exe파일 다운받은 다음에 실행만 하면 딱 맞는 드라이버를 자동으로 다운 받아준다.


다운로드가 끝나면 BootCamp-xxx-xxxxx 폴더가 생기고 안에 들어가서 BootCamp 폴더에 들어가면 Setup.exe가 있다.

실행하면 모든 드라이버가 자동으로 설치된다.

종종 SFTP를 이용해 서버에 파일을 업로드 하는데 갑자기 클라이언트에서 Connection timeout으로 접속이 되지 않는 문제가 발생.


서버에 로그를 확인해보니, 연결되자 마자 클라이언트에서 연결을 끊는다.

  
    $ tail -f /var/log/secure

    Accepted password for heisice from x.x.x.x port x ssh2
    pam_unix(sshd:session): session opened for user heisice by (uid=0)
    Received disconnect from x.x.x.x port x:11: disconnected by user
    Disconnected from x.x.x.x port x
    pam_unix(sshd:session): session closed for user heisice

그래서 클라이언트에서 command line sftp클라이언트에 -v 옵션을 주어 실행해보니,

  
    $ sftp -i ~/.ssh/key -v heisice@server.com

    ...

    debug2: fd 5 setting TCP_NODELAY
    debug2: client_session2_setup: id 0
    debug1: Sending environment.
    debug1: Sending env LANG = ko_KR.UTF-8
    debug2: channel 0: request env confirm 0
    debug1: Sending subsystem: sftp
    debug2: channel 0: request subsystem confirm 1
    debug2: channel_input_open_confirmation: channel 0: callback done
    debug2: channel 0: open confirm rwindow 0 rmax 32768
    debug2: channel 0: rcvd adjust 2097152
    debug2: channel_input_status_confirm: type 99 id 0
    debug2: subsystem request accepted on channel 0
    Received message too long 1315927840
    debug2: channel 0: read<=0 rfd 6 len 0
    debug2: channel 0: read failed
    debug2: channel 0: close_read
    debug2: channel 0: input open -> drain
    debug2: channel 0: ibuf empty
    debug2: channel 0: send eof
    debug2: channel 0: input drain -> closed
    debug2: channel 0: write failed
    
    ...


Received message too long 이라는 메세지가 보였다.


그래서 구글링 해보니 ssh 접속시 나오는 메세지 때문에 그런경우가 있다고 한다.
얼마전에 ~/.bashrc 파일에 추가해둔 초기화 명령에서 출력되는 메세지 때문에 그런듯 하다.

그래서 그 부분을 출력하지 않게 했더니 문제가 해결되었다.

아직도 제가 만든 라디오 프로그램을 많이 찾으시는 것 같은데 실망하고 돌아가실 것 같아,
각 방송사의 라디오를 PC나 스마트폰으로 듣는 방법을 알려드리려고 합니다.

KBS

KBS 라디오를 많이들으시는 분들은 KBS 라디오 사이트 (http://radio.kbs.co.kr/) 우측 상단 메뉴 중에서 "듣기"를 클릭하시면 이런 화면이 나옵니다.

이 화면에서 콩 다운로드 부분에서 PC및 스마트폰용 프로그램을 다운받으시면 편리하게 들으실 수 있습니다.
팟캐스팅으로 지난 방송을 다시 들으실 수  있고 실시간 듣기를 누르시면 채널별로 브라우저를 통해 바로 들으실 수 있습니다.
(자주 들으시면 프로그램을 설치하시는 것을 추천합니다.)

SBS

SBS 라디오(http://w3.sbs.co.kr/radio/main.do)를 많이 들으시는 분들은 고릴라 라는 프로그램(http://w3.sbs.co.kr/radio/gorealraMain.do)을 다운받으시면 됩니다. PC및 스마튼폰 앱이 준비되어 있습니다.

문자메세지는 유료지만, 앱에서 사연 보내고 참여하는 것은 무료입니다.


MBC

MBC 라디오(http://www.imbc.com/broad/radio/index.html)를 많이 들으시는 분들은 미니 웹(http://mini.imbc.com/v2/index.html)에서 바로 들으실 수도 있구요. PC및 스마트폰 앱으로도 미니라는 청취 앱(http://www.imbc.com/mobileapp/mini/)이 준비되어 있습니다.


들으시는 채널만 들으시는 분들이 많기 때문에 거의 대부분은 해당 방송사의 청취 프로그램이나 앱만 설치하시면 들으시는 데 불편함 없으실거라 생각합니다.


즐거운 라디오 생활 되세요~!


리눅스상에서 웹 호출 문제를 디버깅 하고 싶을 때 mysql 서버 로그를 봐도 부족하고 그럴 때는 패킷을 캡쳐해서 분석할 수 있다.

If you want to debug web call problems on Linux, you may not be able to view the mysql server logs, and you can capture and analyze the packets in such cases.


tpcdump는 기본으로 설치가 안되어 있으니 설치를 해야 한다.

tcpdump can not be installed by default.


그리고 루트 계정으로 실행해야 한다.

and, should run it as root.



tcpdump -i eth0 -s 0 -l -w - dst port 3306 | strings | perl -e '

while(<>) { chomp; next if /^[^ ]+[ ]*$/;

    if(/^(SELECT|UPDATE|DELETE|INSERT|SET|COMMIT|ROLLBACK|CREATE|DROP|ALTER|CALL)/i)

    {

        if (defined $q) { print "$q\n"; }

        $q=$_;

    } else {

        $_ =~ s/^[ \t]+//; $q.=" $_";

    }

}'


+ Recent posts