'잡동사니'에 해당되는 글 12930건

  1. 2009.08.18 ifup/ifdown
  2. 2009.08.18 국가대표 (2009) 4
  3. 2009.08.17 ifup / ifdown + busybox
  4. 2009.08.17 참쉽죠? 2
  5. 2009.08.15 휴가에 남는건 욕과 근육통? 8
  6. 2009.08.14 휴가때 모하시나요? 1
  7. 2009.08.13 피랍당했다가 돌아왔는데..
  8. 2009.08.13 풀업 / 풀다운 저항(Pull up / Pull down register) 4
  9. 2009.08.12 파형 뒤집어 플레이 하기 6
  10. 2009.08.12 WAVE format
Linux API/network2009. 8. 18. 11:16
이 녀석들은 데비안 출신이었나?

5.3.5. The network interface with the static IP

The network interface served by the static IP is configured by creating the configuration entry in the "/etc/network/interfaces" file as the following.

allow-hotplug eth0
iface eth0 inet static
address 192.168.11.100
netmask 255.255.255.0
broadcast 192.168.11.255
gateway 192.168.11.1
dns-domain lan
dns-nameservers 192.168.11.1

When the Linux kernel detects the physical interface eth0, the allow-hotplug stanza will cause ifup to bring up the interface and the iface stanza will cause ifup to use the static IP to configure the interface.


[링크 : http://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_the_network_interface_with_the_static_ip]


간단하게 해석하자면, 물리적으로 연결이 되었음을 탐지하게 되면, 자동으로 설정을 실행한다는 의미이다.
(interface-eth0-를 up 시키고 iface구절을 실행함)


Check to see if a Network Link/Interface is up|down

ip link show eth0
//the iproute package is required. If there is no ip package, apt-get install iproute

If eth0 has a Network link, the following will be returned:
2: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:0c:29:26:57:4e brd ff:ff:ff:ff:ff:ff

If eth0 has no Network link, the following will be returned:
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:0c:29:26:57:4e brd ff:ff:ff:ff:ff:ff

The "UP" is the operative word.


[링크 : http://wiki.kartbuilding.net/index.php/Ifup-ifdown]


실제로 ifup, ifdown 시에 제대로 interface가 up / down 되었는지 확인하는 방법이다.
Posted by 구차니
개소리 왈왈/영화2009. 8. 18. 00:43
너 머야!
국가대표
머라고 똑바로 말해봐!!
대한민국 국가대표!



유치뽕짝하면서도 은근히 감동을 주는 대사이고
실화를 바탕으로 해서 감동을 끌어내주면서도
강하시의 그래픽 효과는 상당히 멋져서
정말 내가 타고 내려가는 것 만 같은 느낌이 든다.

그래도 아쉬운 건, 이야기를 풀어가는 긴장감이 없다는 점
개인적으로 킹콩을 들다의 긴장감(뻔한 진행과 진부한 대사임에도 불구하고)에 반에도 못 미치고
도대체 여주인공격인 이은성은 왜 나오는지 (시나리오상에서 코믹 역으로 약간의 존재감이..)
이러한 아쉬움을 남겨둔 채

마지막의 하이라이트 점프 부분은(머. 예고편에 나오지만) 감동 그 자체이다.

'개소리 왈왈 > 영화' 카테고리의 다른 글

불꽃처럼 나비처럼 (2009)  (6) 2009.09.26
[영화] BLACK (2009)  (8) 2009.09.06
영화 - 해운대 (2009)  (6) 2009.07.25
기대하지 않았던 대박 - 킹콩을 들다  (4) 2009.07.05
박물관이 살아있다 2  (2) 2009.06.06
Posted by 구차니
프로그램 사용/u-boot2009. 8. 17. 18:34
busybox에서 라고 해야 하나,
아무튼, busybox의 경우에는 커널에서 부팅시에 ip를 설정한다.

TCP bic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
stmmaceth_open: MAC address 00:fa:e0:fa:e0:59
stmmac_init_phy: phy_id=0:03, phy_addr=0x3
IP-Config: Complete:
      device=eth0, addr=192.168.10.116, mask=255.255.255.0, gw=192.168.10.1,
     host=hmp_7109, domain=, nis-domain=(none),
     bootserver=255.255.255.255, rootserver=192.168.10.10, rootpath=
Looking up port of RPC 100003/2 on 192.168.10.10
PHY: 0:03 - Link is Up - 100/Full
Looking up port of RPC 100005/1 on 192.168.10.10
VFS: Mounted root (nfs filesystem) readonly.
Freeing unused kernel memory: 100k freed
  Vendor: AXXEN     Model: SKYMIRROR         Rev: 1.00
  Type:   Direct-Access                      ANSI SCSI revision: 02
SCSI device sda: 4016128 512-byte hdwr sectors (2056 MB)
sda: assuming Write Enabled
sda: assuming drive cache: write through
SCSI device sda: 4016128 512-byte hdwr sectors (2056 MB)
sda: assuming Write Enabled
sda: assuming drive cache: write through
 sda: sda1
sd 1:0:0:0: Attached scsi removable disk sda
Welcome to STLinux BusyBox system

머.. 이건 중요한게 아니고, 아무튼, ifdown을 통해서 죽이고
ifup을 통해서 올리려고 하는데, ifup시 static ip가 설정이 되지 않고
초기 kernel argument로 넘긴 값으로 부팅이 되는 문제가 있다.

검색을 해보니

Re: ETH0 already configured durring boot
The U-boot uses its own network driver and only the MAC address set up by the U-boot affects the network driver under Linux.

The network is started by the script /etc/init.d/networking in Debian/Emdebian distribution.  The soft links are used in each run level start up directories /etc/rcX.d, where X is run level 0, 1, 2, etc.  The normal run level is 3.  You can remove the link in the directory to disable the network start up.

The text file /etc/network/interfaces configures the network interfaces.  It should be something like,

auto eth0
iface eth0 inet dhcp

You can also just remove everything in this file to disable the automatic start up of the network.

[링크 : http://glomation.net/smf/index.php?topic=111.0]

라고 되어있는데, 일단 커널레벨에서 설정하는 것과는 별개의 문제이다.

# cat /etc/network/interfaces
######################################################################
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
#
# A "#" character in the very first column makes the rest of the line
# be ignored. Blank lines are ignored. Lines may be indented freely.
# A "\" character at the very end of the line indicates the next line
# should be treated as a continuation of the current one.
#
# The "pre-up", "up", "down" and "post-down" options are valid for all
# interfaces, and may be specified multiple times. All other options
# may only be specified once.
#
# See the interfaces(5) manpage for information on what options are
# available.
######################################################################

# We always want the loopback interface.
#
# auto lo
# iface lo inet loopback

# An example ethernet card setup: (broadcast and gateway are optional)
#
# auto eth0
# iface eth0 inet static
#     address 192.168.0.42
#     network 192.168.0.0
#     netmask 255.255.255.0
#     broadcast 192.168.0.255
#     gateway 192.168.0.1

# A more complicated ethernet setup, with a less common netmask, and a downright
# weird broadcast address: (the "up" lines are executed verbatim when the
# interface is brought up, the "down" lines when it's brought down)
#
# auto eth0
# iface eth0 inet static
#     address 192.168.1.42
#     network 192.168.1.0
#     netmask 255.255.255.128
#     broadcast 192.168.1.0
#     up route add -net 192.168.1.128 netmask 255.255.255.128 gw 192.168.1.2
#     up route add default gw 192.168.1.200
#     down route del default gw 192.168.1.200
#     down route del -net 192.168.1.128 netmask 255.255.255.128 gw 192.168.1.2

# A more complicated ethernet setup with a single ethernet card with
# two interfaces.
# Note: This happens to work since ifconfig handles it that way, not because
# ifup/down handles the ':' any differently.
# Warning: There is a known bug if you do this, since the state will not
# be properly defined if you try to 'ifdown eth0' when both interfaces
# are up. The ifconfig program will not remove eth0 but it will be
# removed from the interfaces state so you will see it up until you execute:
# 'ifdown eth0:1 ; ifup eth0; ifdown eth0'
# BTW, this is "bug" #193679 (it's not really a bug, it's more of a
# limitation)
#
# auto eth0 eth0:1
# iface eth0 inet static
#     address 192.168.0.100
#     network 192.168.0.0
#     netmask 255.255.255.0
#     broadcast 192.168.0.255
#     gateway 192.168.0.1
# iface eth0:1 inet static
#     address 192.168.0.200
#     network 192.168.0.0
#     netmask 255.255.255.0

# "pre-up" and "post-down" commands are also available. In addition, the
# exit status of these commands are checked, and if any fail, configuration
# (or deconfiguration) is aborted. So:
#
# auto eth0
# iface eth0 inet dhcp
#     pre-up [ -f /etc/network/local-network-ok ]
#
# will allow you to only have eth0 brought up when the file
# /etc/network/local-network-ok exists.

# Two ethernet interfaces, one connected to a trusted LAN, the other to
# the untrusted Internet. If their MAC addresses get swapped (because an
# updated kernel uses a different order when probing for network cards,
# say), then they don't get brought up at all.
#
# auto eth0 eth1
# iface eth0 inet static
#     address 192.168.42.1
#     netmask 255.255.255.0
#     pre-up /path/to/check-mac-address.sh eth0 11:22:33:44:55:66
#     pre-up /usr/local/sbin/enable-masq
# iface eth1 inet dhcp
#     pre-up /path/to/check-mac-address.sh eth1 AA:BB:CC:DD:EE:FF
#     pre-up /usr/local/sbin/firewall

# Two ethernet interfaces, one connected to a trusted LAN, the other to
# the untrusted Internet, identified by MAC address rather than interface
# name:
#
# auto eth0 eth1
# mapping eth0 eth1
#     script /path/to/get-mac-address.sh
#     map 11:22:33:44:55:66 lan
#     map AA:BB:CC:DD:EE:FF internet
# iface lan inet static
#     address 192.168.42.1
#     netmask 255.255.255.0
#     pre-up /usr/local/sbin/enable-masq $IFACE
# iface internet inet dhcp
#     pre-up /usr/local/sbin/firewall $IFACE

# A PCMCIA interface for a laptop that is used in different locations:
# (note the lack of an "auto" line for any of these)
#
# mapping eth0
#    script /path/to/pcmcia-compat.sh
#    map home,*,*,*                  home
#    map work,*,*,00:11:22:33:44:55  work-wireless
#    map work,*,*,01:12:23:34:45:50  work-static
#
# iface home inet dhcp
# iface work-wireless bootp
# iface work-static static
#     address 10.15.43.23
#     netmask 255.255.255.0
#     gateway 10.15.43.1
#
# Note, this won't work unless you specifically change the file
# /etc/pcmcia/network to look more like:
#
#     if [ -r ./shared ] ; then . ./shared ; else . /etc/pcmcia/shared ; fi
#     get_info $DEVICE
#     case "$ACTION" in
#         'start')
#             /sbin/ifup $DEVICE
#             ;;
#         'stop')
#             /sbin/ifdown $DEVICE
#             ;;
#     esac
#     exit 0

# An alternate way of doing the same thing: (in this case identifying
# where the laptop is is done by configuring the interface as various
# options, and seeing if a computer that is known to be on each particular
# network will respond to pings. The various numbers here need to be chosen
# with a great deal of care.)
#
# mapping eth0
#    script /path/to/ping-places.sh
#    map 192.168.42.254/24 192.168.42.1 home
#    map 10.15.43.254/24 10.15.43.1 work-wireless
#    map 10.15.43.23/24 10.15.43.1 work-static
#
# iface home inet dhcp
# iface work-wireless bootp
# iface work-static static
#     address 10.15.43.23
#     netmask 255.255.255.0
#     gateway 10.15.43.1
#
# Note that the ping-places script requires the iproute package installed,
# and the same changes to /etc/pcmcia/network are required for this as for
# the previous example.


# Set up an interface to read all the traffic on the network. This
# configuration can be useful to setup Network Intrusion Detection
# sensors in 'stealth'-type configuration. This prevents the NIDS
# system to be a direct target in a hostile network since they have
# no IP address on the network. Notice, however, that there have been
# known bugs over time in sensors part of NIDS (for example see
# DSA-297 related to Snort) and remote buffer overflows might even be
# triggered by network packet processing.
#
# auto eth0
# iface eth0 inet manual
#     up ifconfig $IFACE 0.0.0.0 up
#       up ip link set $IFACE promisc on
#       down ip link set $IFACE promisc off
#       down ifconfig $IFACE down

# Set up an interface which will not be allocated an IP address by
# ifupdown but will be configured through external programs. This
# can be useful to setup interfaces configured through other programs,
# like, for example, PPPOE scripts.
#
# auto eth0
# iface eth0 inet manual
#       up ifconfig $IFACE 0.0.0.0 up
#       up /usr/local/bin/myconfigscript
#       down ifconfig $IFACE down

/etc/network/interfaces는 ifup / ifdown 에서 사용하는 내용으로 저러면 된다는데...
결국 미궁이다.. 후우...

[링크 : http://www.annodex.net/cgi-bin/man/man2html?interfaces]
[링크 : http://www.annodex.net/cgi-bin/man/man2html?8+ifup]
[링크 : http://www.annodex.net/cgi-bin/man/man2html?8+ifdown]


Posted by 구차니
개소리 왈왈2009. 8. 17. 09:34

강릉 통일공원의 강릉 무장공비 침투사건 시 인양된 북한 잠수함과 그 옆에 세계 최초 육상 전시한
최역 해군 함정인데

저 사진만 보면 참 쉽죠~ 라는 밥 로스 아저씨의 말이 생각나는건 왜일까?

'개소리 왈왈' 카테고리의 다른 글

허스키 익스프레스  (2) 2009.08.23
난 붕어가 아니에요~  (0) 2009.08.22
휴가에 남는건 욕과 근육통?  (8) 2009.08.15
휴가때 모하시나요?  (1) 2009.08.14
휴가징크스  (6) 2009.08.11
Posted by 구차니
개소리 왈왈2009. 8. 15. 20:30
운전을 했더니 온몸이 찌뿌둥 하다..
아마도 너무 긴장해서라고 하지만..
긴장한거 치고는 속도를 너무 냈다고 욕을 먹어대는 바람에
명박이 보다 더 오래 살지도 모르겠다 -ㅁ-



아무튼 통일공원에서 찍은 갖은 사진들을 정리해서 올려야 할 듯 -ㅁ-!

'개소리 왈왈' 카테고리의 다른 글

난 붕어가 아니에요~  (0) 2009.08.22
참쉽죠?  (2) 2009.08.17
휴가때 모하시나요?  (1) 2009.08.14
휴가징크스  (6) 2009.08.11
프레스~~~~핫!! 2  (4) 2009.08.10
Posted by 구차니
개소리 왈왈2009. 8. 14. 18:18
잠이 보약이라지만..

휴가에 너무 많이 자는건 아닌가? 라는 생각이 들정도로

잠만 자고 사는 구차니군입니다 -ㅁ-!




사족 : 훔쳐쓰는 공짜 인터넷이라 허구한날 끊겨서 메신저질도 못하는 1인 ㅠ.ㅠ

'개소리 왈왈' 카테고리의 다른 글

참쉽죠?  (2) 2009.08.17
휴가에 남는건 욕과 근육통?  (8) 2009.08.15
휴가징크스  (6) 2009.08.11
프레스~~~~핫!! 2  (4) 2009.08.10
지 아이 조 - G.I.JOE (2009)  (4) 2009.08.08
Posted by 구차니
TV에서 나오는 화면은
예전 살인자들 끌고가는 느낌이 드는건.. 나만의 생각일까?

차에 쑤셔넣고, 기자들로 부터 보호하는게 아니라
그냥 범인을 질질 끌고가는 느낌..
Posted by 구차니
하드웨어2009. 8. 13. 11:48

AVR이나 8051 등에서 스위치를 연결하는 방법으로
스위치를 누르지 않은 상태에 어떠한 전압이 인가되는지에 대한 설정을 의미한다.

그런데 단어만 보면, 이게 눌렀을때인지 누르기 전인지 애매하고
개인적인 생각으로는 도면상에
저항이 위에 있는지(VCC 연결)
저항이 아래 있는지(GND 연결)
로 구분을 하는게 아닐까 마저 생각이 든다.

풀업 저항은, 입력이 당겨 올려(Pull up)지도록 설정된 것으로 누르지 않으면 VCC가 포트로 들어간다.
풀다운 저항은, 입력을 끌어 당겨(Pull Down)지도록 설정된 것으로 누르지 않으면 GND가 포트로 들어간다.


    

Pull-up resistor limits the current / The less common pull-down

[링크 : http://www.seattlerobotics.org/encoder/mar97/basics.html]


[링크 : http://pepsiman.tistory.com/65?srchid=BR1http%3A%2F%2Fpepsiman.tistory.com%2F65]

'하드웨어' 카테고리의 다른 글

inductor - 저항이 아니라규!  (2) 2009.09.29
CVBS / RGB - SCART  (2) 2009.09.23
프레스캇!  (10) 2009.08.07
LGA775/Socket478  (4) 2009.08.04
VT-d  (0) 2009.07.30
Posted by 구차니
신기하다고 해야겠지만..
파형을 뒤집는다고 해서 소리가 달라지지 않는다라는 신기한 사실이 발견되었다.

당연히 뒤집으면 값이 달라지니, 주파수 쪽에서도 변동이 생길 것이고,
그러다 보면 당연히 일반적인 사람의 목소리가 아니거나 다른 소리로 변한걸이라고 생각했는데
그대로 나오는 현상이 있었다.

완전히 같은 위치는 아니지만
"in.wav"에서는 2채널에서는 파형이 나오는데 반해

"outout.wav"에서는 파형이 전혀 나오지 않음에도 불구하고 소리는 나온다.

왼쪽 파형을 뒤집어서 오른쪽에 덮어 씌운 결과물이 "output.wav"인데
왜 소리가 나오는지도 애매하다..

void main()
{
	short s16temp;
	FILE *fp;
	FILE *output;
	char filename[] = "in.wav";
	RIFF_HEADER riff;
	FMT_CHUNK fmt;
	DATA_CHUNK data;
	char *wave = NULL;
	unsigned int idx, maxloop;
	unsigned int ch_idx, ch_maxloop;

	fp = fopen(filename, "rb");
	output = fopen("output.wav","wb");
	fread(&riff, 1, sizeof(RIFF_HEADER), fp);
	fwrite(&riff, 1, sizeof(RIFF_HEADER), output);
		printf("riff.file_length[%d] bytes\n",riff.file_length);

	fread(&fmt, 1, sizeof(FMT_CHUNK), fp);
	fwrite(&fmt, 1, sizeof(FMT_CHUNK), output);
		printf("fmt.fmt_length[%d] bytes\n",fmt.fmt_length);
			printf("fmt.format[%d]\n",fmt.format);
			printf("fmt.channels[%d] channels\n",fmt.channels);
			printf("fmt.khz[%d] kHz\n",fmt.khz);
			printf("fmt.bps[%d] Bps\n",fmt.bps);
			printf("fmt.blockalign[%d] bytes/block\n",fmt.blockalign);
			printf("fmt.depth[%d] bits/sample\n",fmt.depth);

	fread(&data, 1, sizeof(DATA_CHUNK) - 4, fp);
	fwrite(&data, 1, sizeof(DATA_CHUNK) - 4, output);
		printf("data.data_length[%d]\n",data.data_length);
		printf("playtime %02d:%02d\n",
			data.data_length/fmt.bps/60,
			data.data_length/fmt.bps);
		printf("samples %02d\n",
			data.data_length/fmt.blockalign);

		wave = malloc(data.data_length);
		fread(wave, 1, data.data_length, fp);
	
		maxloop = data.data_length / 2;
		ch_maxloop = fmt.channels;
#if 1
		for(idx=0; idx < maxloop; idx+=fmt.channels)
		{
			memcpy(&s16temp, (short*)wave + idx + 1, fmt.depth / 8);
			fwrite(&s16temp, 1, fmt.depth / 8, output);

			if(s16temp == -65536)
			{
				s16temp = -65535;
			}
			s16temp = -s16temp;
			fwrite(&s16temp, 1, fmt.depth / 8, output);
		}
#endif
		free(wave);
	fclose(fp);
	fclose(output);
}

'모종의 음모 > noise cancelling' 카테고리의 다른 글

wave multi channel order  (0) 2010.05.01
WAVE format  (0) 2009.08.12
Active Noise Control - ANC  (0) 2009.08.12
WAVEFORMATEX structure  (0) 2009.04.01
음속  (0) 2009.03.30
Posted by 구차니
WAVE 파일은 RIFF / FMT / DATA chunk로 구성된다.
chunk는 데이터 덩어리 혹은 패킷이라고 생각하면 될 듯 하다.

아무튼 각 chunk에는 식별을 위한 MAGIC WORD가 있으나, 몇개의 파일만 확인해서
저 순서가 아닌 다른 순서로도 있는지는 확인하지 못하였다.
그냥 순서대로 읽어오면 된다.

typedef struct _RIFF_HEADER_
{
	unsigned char magic_RIFF[4];
	unsigned int file_length;
	unsigned char magic_WAVE[4];
} RIFF_HEADER;

typedef struct _FMT_CHUNK_
{
	unsigned char magic_FMT[4];
	unsigned int fmt_length;
	unsigned short format;
	unsigned short channels;
	unsigned int khz;	// sample rate
	unsigned int bps;	// bytes per second
	unsigned short blockalign;
	unsigned short depth;	// bits per sample
} FMT_CHUNK;

typedef struct _DATA_CHUNK_
{
	unsigned char magic_DATA[4];
	unsigned int data_length;
	unsigned char *data;
} DATA_CHUNK;

'모종의 음모 > noise cancelling' 카테고리의 다른 글

wave multi channel order  (0) 2010.05.01
파형 뒤집어 플레이 하기  (6) 2009.08.12
Active Noise Control - ANC  (0) 2009.08.12
WAVEFORMATEX structure  (0) 2009.04.01
음속  (0) 2009.03.30
Posted by 구차니