diff options
447 files changed, 4092 insertions, 34599 deletions
@@ -32,23 +32,9 @@ config ADK_HOST config ADK_DEVELSYSTEM bool "Compile a ADK development system" default n - select BUSYBOX_CMP - select BUSYBOX_COMM - select BUSYBOX_EXPR - select BUSYBOX_INSTALL - select BUSYBOX_MKTEMP - select BUSYBOX_UNZIP - select BUSYBOX_RMDIR - select BUSYBOX_SPLIT - select BUSYBOX_TAC - select BUSYBOX_TEE - select BUSYBOX_WGET - select BUSYBOX_YES - select BUSYBOX_TRUE select ADK_PACKAGE_BASH select ADK_PACKAGE_BINUTILS select ADK_PACKAGE_BZIP2 - select ADK_PACKAGE_CPIO select ADK_PACKAGE_DIFFUTILS select ADK_PACKAGE_FILE select ADK_PACKAGE_GAWK @@ -82,7 +68,7 @@ config ADK_DEBUG default n help All packages and libc will be compiled and packaged with debug information. - Mostly useful for NFS root or big USB/CF disk setups. + Mostly useful for NFS root or big USB/CF or hard disk setups. config ADK_STATIC bool "Link applications statically by default" @@ -153,6 +139,76 @@ config ADK_HOST_CYGWIN endchoice +choice +prompt "Hardware profile (autodetection on OpenADK systems)" +config ADK_HARDWARE_NOPROFILE + bool "no profile" + +config ADK_HARDWARE_IBMX40 + bool "IBM X40 laptop" + select ADK_TARGET_WITH_USB + select ADK_TARGET_WITH_VGA + select ADK_TARGET_WITH_INPUT + select ADK_TARGET_WITH_RTC + select ADK_TARGET_WITH_HDD + select ADK_KERNEL_NLS + select ADK_KERNEL_EXT2_FS + select ADK_KERNEL_SCSI + select ADK_KERNEL_ATA + select ADK_KERNEL_BLK_DEV_SD + select ADK_KERNEL_INPUT_KEYBOARD + select ADK_KERNEL_NETDEVICES + select ADK_KERNEL_NET_PCI + select ADK_KERNEL_NET_ETHERNET + select ADK_KERNEL_MII + select ADK_KERNEL_SWAP + select ADK_KPACKAGE_KMOD_MAC80211 + select ADK_KPACKAGE_KMOD_ATH5K + select ADK_KERNEL_MAC80211_LEDS + select ADK_KERNEL_ATH_COMMON + select ADK_KPACKAGE_KMOD_SND + select ADK_KPACKAGE_KMOD_SND_OSSEMUL + select ADK_PACKAGE_KMOD_USB_CONTROLLER + select ADK_KPACKAGE_KMOD_USB + select ADK_KPACKAGE_KMOD_USB_EHCI_HCD + select ADK_KPACKAGE_KMOD_USB_OHCI_HCD + help + Hardware profile for IBM X40 laptop's. + +config ADK_HARDWARE_YEELONG + bool "Yeelong laptop" + select ADK_TARGET_WITH_USB + select ADK_TARGET_WITH_VGA + select ADK_TARGET_WITH_INPUT + select ADK_TARGET_WITH_RTC + select ADK_TARGET_WITH_HDD + select ADK_KERNEL_NLS + select ADK_KERNEL_EXT2_FS + select ADK_KERNEL_SCSI + select ADK_KERNEL_ATA + select ADK_KERNEL_BLK_DEV_SD + select ADK_KERNEL_INPUT_KEYBOARD + select ADK_KERNEL_NETDEVICES + select ADK_KERNEL_NET_PCI + select ADK_KERNEL_NET_ETHERNET + select ADK_KERNEL_MII + select ADK_KERNEL_SWAP + select ADK_KPACKAGE_KMOD_MAC80211 + select ADK_KPACKAGE_KMOD_EEPROM_93CX6 + select ADK_KPACKAGE_KMOD_RTL8187 + select ADK_KPACKAGE_KMOD_SND + select ADK_KPACKAGE_KMOD_SND_CS5535AUDIO + select ADK_KPACKAGE_KMOD_SND_OSSEMUL + select ADK_PACKAGE_KMOD_USB_CONTROLLER + select ADK_KPACKAGE_KMOD_USB + select ADK_KPACKAGE_KMOD_USB_EHCI_HCD + select ADK_KPACKAGE_KMOD_USB_OHCI_HCD + help + Hardware profile for Lemotes Yeelong laptop. + Selects drivers for wireless card, usb controller and sound card. + +endchoice + endmenu source "target/Config.in" @@ -61,9 +61,6 @@ pkg-help: @echo 'This does not automatically resolve package dependencies!' dev-help: - @echo 'Regenerate menu information via "make menu"' - @echo 'Regenerate dependency information via "make dep"' - @echo @echo 'Fast way of updating package patches:' @echo ' run "make package=<pkgname> clean" to start with a good base' @echo ' run "make package=<pkgname> patch" to fetch, unpack and patch the source' @@ -180,15 +177,6 @@ NO_ERROR=0 echo "GNU bash needs to be installed."; \ exit 1; \ fi - @if ! mksh -c 'echo $$KSH_VERSION' 2>&1 | grep -F 'MIRBSD' >/dev/null 2>&1; then \ - echo "MirBSD ksh (mksh) needs to be installed."; \ - exit 1; \ - else \ - if [ $$(mksh -c 'echo $$KSH_VERSION' |cut -d ' ' -f 3|sed "s#R##") -le 34 ]; then \ - echo "MirBSD ksh is too old. R35 or higher needed."; \ - exit 1; \ - fi \ - fi @if test x"$$(umask 2>/dev/null | sed 's/00*22/OK/')" != x"OK"; then \ echo >&2 Error: you must build with umask 022, sorry.; \ exit 1; \ @@ -221,6 +209,7 @@ NO_ERROR=0 @echo 'LC_ALL:=C' >>prereq.mk @echo 'MAKE:=$${GMAKE}' >>prereq.mk @echo "OStype:=$$(env uname)" >>prereq.mk + @echo "ADKtype:=$$(cat /etc/adktarget 2>/dev/null)" >>prereq.mk @echo "_PATH:=$$PATH" >>prereq.mk @echo "PATH:=\$${TOPDIR}/scripts:/usr/sbin:$$PATH" >>prereq.mk @echo "SHELL:=$$(which bash)" >>prereq.mk @@ -228,6 +217,7 @@ NO_ERROR=0 CC='${CC}' CPPFLAGS='${CPPFLAGS}' \ bash scripts/scan-tools.sh @echo '===> Prerequisites checked successfully.' + @touch .adkinit @touch $@ .PHONY: prereq prereq-noerror @@ -5,7 +5,6 @@ This is a menu based buildsystem for your home made embedded Linux system. Before you can start you need to install some tools: - bash -- mksh - gcc - binutils - GNU make diff --git a/config/Makefile b/config/Makefile index 86114f55f..cacb2a28c 100644 --- a/config/Makefile +++ b/config/Makefile @@ -53,25 +53,25 @@ GCONF_OBJS=$(patsubst %.c,%.o, $(GCONF_SRC)) SHARED_OBJS=$(patsubst %.c,%.o, $(SHARED_SRC)) conf: $(CONF_OBJS) $(SHARED_OBJS) - $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) $^ -o $@ + @$(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) $^ -o $@ mconf: $(MCONF_OBJS) $(SHARED_OBJS) - $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS) + @$(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS) gconf: $(GCONF_OBJS) $(SHARED_OBJS) - $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) $^ -o $@ $(HOSTGTKLIBS) + @$(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) $^ -o $@ $(HOSTGTKLIBS) $(CONF_OBJS): %.o : %.c $(SHARED_DEPS) - $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@ + @$(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@ $(MCONF_OBJS): %.o : %.c $(SHARED_DEPS) - $(HOSTCC) $(HOSTCFLAGS) $(HOSTNCURSES) -I. -c $< -o $@ + @$(HOSTCC) $(HOSTCFLAGS) $(HOSTNCURSES) -I. -c $< -o $@ $(GCONF_OBJS): %.o : %.c $(SHARED_DEPS) - $(HOSTCC) $(HOSTCFLAGS) $(HOSTGTKCFLAGS) -DLKC_DIRECT_LINK -I. -c $< -o $@ + @$(HOSTCC) $(HOSTCFLAGS) $(HOSTGTKCFLAGS) -DLKC_DIRECT_LINK -I. -c $< -o $@ glob.o: glob.c $(SHARED_DEPS) - $(HOSTCC) $(HOSTCFLAGS) -I. -c glob.c -o $@ + @$(HOSTCC) $(HOSTCFLAGS) -I. -c glob.c -o $@ lkc_defs.h: lkc_proto.h @sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/' @@ -105,19 +105,19 @@ lex.zconf.o: lex.zconf.c $(SHARED_DEPS) $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@ lex.zconf.c: lex.zconf.c_shipped - $(CP) lex.zconf.c_shipped lex.zconf.c + @$(CP) lex.zconf.c_shipped lex.zconf.c zconf.hash.c: zconf.hash.c_shipped - $(CP) zconf.hash.c_shipped zconf.hash.c + @$(CP) zconf.hash.c_shipped zconf.hash.c zconf.tab.o: zconf.tab.c zconf.hash.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(SHARED_DEPS) - $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@ + @$(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@ zconf.tab.c: zconf.tab.c_shipped - $(CP) zconf.tab.c_shipped zconf.tab.c + @$(CP) zconf.tab.c_shipped zconf.tab.c zconf.tab.h: zconf.tab.h_shipped - $(CP) zconf.tab.h_shipped zconf.tab.h + @$(CP) zconf.tab.h_shipped zconf.tab.h endif .PHONY: ncurses diff --git a/mk/build.mk b/mk/build.mk index f71808b3f..71fad8cae 100644 --- a/mk/build.mk +++ b/mk/build.mk @@ -64,8 +64,11 @@ noconfig_targets:= menuconfig \ defconfig \ tags -POSTCONFIG= -@ \ +POSTCONFIG= -@\ + if [ -f .adkinit ];then rm .adkinit;\ + else \ if [ -f .config.old ];then \ + $(TOPDIR)/bin/tools/pkgrebuild;\ rebuild=0; \ if [ "$$(grep ^BUSYBOX .config|md5sum)" != "$$(grep ^BUSYBOX .config.old|md5sum)" ];then \ touch .rebuild.busybox;\ @@ -76,8 +79,9 @@ POSTCONFIG= -@ \ rebuild=1;\ fi; \ if [ $$rebuild -eq 1 ];then \ - cp .config .config.old; \ + cp .config .config.old;\ fi; \ + fi; \ fi # Pull in the user's configuration file @@ -87,17 +91,17 @@ endif ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y) include $(TOPDIR)/rules.mk -include ${TOPDIR}/mk/split-cfg.mk all: world ${TOPDIR}/package/Depends.mk: ${TOPDIR}/.config $(wildcard ${TOPDIR}/package/*/Makefile) - mksh ${TOPDIR}/package/depmaker + $(TOPDIR)/bin/tools/depmaker > ${TOPDIR}/package/Depends.mk + .NOTPARALLEL: .PHONY: all world clean cleantarget cleandir distclean image_clean -world: $(DISTDIR) $(BUILD_DIR) $(TARGET_DIR) $(PACKAGE_DIR) ${TOPDIR}/.ADK_HAVE_DOT_CONFIG +world: $(DISTDIR) $(BUILD_DIR) $(TARGET_DIR) $(PACKAGE_DIR) ${BASH} ${TOPDIR}/scripts/scan-pkgs.sh ifeq ($(ADK_NATIVE),y) $(MAKE) -f mk/build.mk toolchain/kernel-headers-prepare tools/install target/config-prepare target/compile package/compile root_clean package/install package_index target/install @@ -137,10 +141,10 @@ ifeq ($(ADK_TARGET_PACKAGE_IPKG),y) echo "option offline_root ${TARGET_DIR}" >>$(STAGING_DIR)/etc/ipkg.conf endif -package/%: ${TOPDIR}/.ADK_HAVE_DOT_CONFIG ${STAGING_DIR}/etc/ipkg.conf ${TOPDIR}/package/Depends.mk +package/%: ${STAGING_DIR}/etc/ipkg.conf ${TOPDIR}/package/Depends.mk $(MAKE) -C package $(patsubst package/%,%,$@) -target/%: ${TOPDIR}/.ADK_HAVE_DOT_CONFIG +target/%: $(MAKE) -C target $(patsubst target/%,%,$@) toolchain/%: ${STAGING_DIR} @@ -164,9 +168,15 @@ switch: else echo "No old target config found";mv .config .config.bak; make TARGET=${TARGET};fi kernelconfig: +ifeq ($(ADKtype),) cp $(TOPDIR)/target/$(ADK_TARGET)/kernel.config $(BUILD_DIR)/linux/.config $(MAKE) -C $(BUILD_DIR)/linux/ ARCH=$(ARCH) menuconfig cp $(BUILD_DIR)/linux/.config $(TOPDIR)/target/$(ADK_TARGET)/kernel.config +else + cp $(TOPDIR)/target/$(ADKtype)/kernel.config $(BUILD_DIR)/linux/.config + $(MAKE) -C $(BUILD_DIR)/linux/ ARCH=$(ARCH) menuconfig + cp $(BUILD_DIR)/linux/.config $(TOPDIR)/target/$(ADKtype)/kernel.config +endif # create a new package from package/.template newpackage: @@ -177,13 +187,7 @@ newpackage: $(SED) 's#@PKG@#$(PKG)#' $(TOPDIR)/package/$(PKG)/Makefile $(SED) 's#@VER@#$(VER)#' $(TOPDIR)/package/$(PKG)/Makefile @echo "Edit package/$(PKG)/Makefile to complete" - @echo "choose PKG_SECTION to add it to an existent submenu" -############################################################# -# -# Cleanup and misc junk -# -############################################################# root_clean: @$(TRACE) root_clean rm -rf $(TARGET_DIR) @@ -206,9 +210,8 @@ clean: done \ done rm -rf $(BUILD_DIR) $(BIN_DIR) $(TARGET_DIR) \ - ${TOPDIR}/.cfg_${ADK_TARGET}_${ADK_LIBC} \ ${TOPDIR}/package/pkglist.d - rm -f ${TOPDIR}/package/*/info.mk ${TOPDIR}/package/Depends.mk + rm -f ${TOPDIR}/package/Depends.mk cleankernel: @$(TRACE) cleankernel @@ -216,34 +219,28 @@ cleankernel: cleandir: @$(TRACE) cleandir - @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE) + @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE) rm -rf $(BUILD_DIR_PFX) $(BIN_DIR_PFX) $(TARGET_DIR_PFX) \ - ${TOPDIR}/.cfg* ${TOPDIR}/package/pkglist.d - rm -rf $(TOOLCHAIN_BUILD_DIR_PFX) $(STAGING_PARENT_PFX) \ - $(TOOLS_BUILD_DIR) - rm -f .menu .tmpconfig.h ${TOPDIR}/package/*/info.mk \ + ${TOPDIR}/package/pkglist.d ${TOPDIR}/package/pkgconfigs.d + rm -rf $(TOOLCHAIN_BUILD_DIR_PFX) $(STAGING_PARENT_PFX) $(TOOLS_BUILD_DIR) + rm -f .menu .tmpconfig.h .rebuild* \ ${TOPDIR}/package/Depends.mk ${TOPDIR}/prereq.mk \ - .busyboxcfg cleantarget: @$(TRACE) cleantarget @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE) - rm -rf $(BUILD_DIR) $(BIN_DIR) $(TARGET_DIR) \ - ${TOPDIR}/.cfg_${ADK_TARGET}_${ADK_LIBC} + rm -rf $(BUILD_DIR) $(BIN_DIR) $(TARGET_DIR) rm -rf $(TOOLCHAIN_BUILD_DIR) $(STAGING_PARENT) - rm -f .tmpconfig.h ${TOPDIR}/package/*/info.mk \ - .busyboxcfg all.config .defconfig + rm -f .tmpconfig.h all.config .defconfig distclean: @$(TRACE) distclean @$(MAKE) -C $(CONFIG) clean $(MAKE_TRACE) @rm -rf $(BUILD_DIR_PFX) $(BIN_DIR_PFX) $(TARGET_DIR_PFX) $(DISTDIR) \ - ${TOPDIR}/.cfg* ${TOPDIR}/package/pkglist.d - @rm -rf $(TOOLCHAIN_BUILD_DIR_PFX) $(STAGING_PARENT_PFX) \ - $(TOOLS_BUILD_DIR) + ${TOPDIR}/package/pkglist.d ${TOPDIR}/package/pkgconfigs.d + @rm -rf $(TOOLCHAIN_BUILD_DIR_PFX) $(STAGING_PARENT_PFX) $(TOOLS_BUILD_DIR) @rm -f .config* .defconfig .tmpconfig.h all.config ${TOPDIR}/prereq.mk \ - .menu ${TOPDIR}/package/*/info.mk ${TOPDIR}/package/Depends.mk \ - .busyboxcfg .ADK_HAVE_DOT_CONFIG + .menu ${TOPDIR}/package/Depends.mk .ADK_HAVE_DOT_CONFIG .rebuild.* else # ! ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y) @@ -294,6 +291,12 @@ endif ifneq (,$(filter CYGWIN%,${OStype})) @echo ADK_HOST_CYGWIN=y > $(TOPDIR)/.defconfig endif +ifeq ($(ADKtype),ibmx40) + @echo ADK_HARDWARE_IBMX40=y >> $(TOPDIR)/.defconfig +endif +ifeq ($(ADKtype),lemote) + @echo ADK_HARDWARE_YEELONG=y >> $(TOPDIR)/.defconfig +endif @if [ ! -z "$(TARGET)" ];then \ grep "^config" target/Config.in \ |grep -i "$(TARGET)"\$$ \ @@ -365,6 +368,12 @@ endif ifneq (,$(filter CYGWIN%,${OStype})) @echo ADK_HOST_CYGWIN=y > $(TOPDIR)/all.config endif +ifeq ($(ADKtype),ibmx40) + @echo ADK_HARDWARE_IBMX40=y >> $(TOPDIR)/all.config +endif +ifeq ($(ADKtype),lemote) + @echo ADK_HARDWARE_YEELONG=y >> $(TOPDIR)/all.config +endif @if [ ! -z "$(TARGET)" ];then \ grep "^config" target/Config.in \ |grep -i "$(TARGET)"\$$ \ @@ -411,21 +420,21 @@ ifneq (,$(filter wrap%,${TARGET})) @echo ADK_LINUX_ALIX=y >> $(TOPDIR)/all.config endif -menuconfig: $(CONFIG)/mconf defconfig .menu +menuconfig: $(CONFIG)/mconf defconfig .menu package/Config.in.auto @if [ ! -f .config ];then \ $(CONFIG)/conf -D .defconfig $(CONFIG_CONFIG_IN); \ fi @$(CONFIG)/mconf $(CONFIG_CONFIG_IN) ${POSTCONFIG} -guiconfig: $(CONFIG)/gconf defconfig .menu +guiconfig: $(CONFIG)/gconf defconfig .menu package/Config.in.auto @if [ ! -f .config ];then \ $(CONFIG)/conf -D .defconfig $(CONFIG_CONFIG_IN); \ fi @$(CONFIG)/gconf $(CONFIG_CONFIG_IN) ${POSTCONFIG} -_config: $(CONFIG)/conf .menu +_config: $(CONFIG)/conf .menu package/Config.in.auto -@touch .config @$(CONFIG)/conf ${W} $(CONFIG_CONFIG_IN) ${POSTCONFIG} @@ -438,10 +447,10 @@ _mconfig2: ${CONFIG}/conf modconfig .menu distclean: @$(MAKE) -C $(CONFIG) clean @rm -rf $(BUILD_DIR_PFX) $(BIN_DIR_PFX) $(TARGET_DIR_PFX) $(DISTDIR) \ - ${TOPDIR}/.cfg* ${TOPDIR}/package/pkglist.d + ${TOPDIR}/package/pkglist.d ${TOPDIR}/package/pkgconfigs.d @rm -rf $(TOOLCHAIN_BUILD_DIR_PFX) $(STAGING_PARENT_PFX) $(TOOLS_BUILD_DIR) @rm -f .config* .defconfig .tmpconfig.h all.config ${TOPDIR}/prereq.mk \ - .menu ${TOPDIR}/package/*/info.mk ${TOPDIR}/package/Depends.mk .ADK_HAVE_DOT_CONFIG + .menu .rebuild.* ${TOPDIR}/package/Depends.mk .ADK_HAVE_DOT_CONFIG endif # ! ifeq ($(strip $(ADK_HAVE_DOT_CONFIG)),y) @@ -495,14 +504,22 @@ bulkallmod: ) 2>&1 | tee $(TOPDIR)/bin/$${target}_$$libc/$$target-$$libc-$$fs.log; \ done <${TOPDIR}/target/bulk.lst -menu .menu: $(wildcard ${TOPDIR}/package/*/Makefile) +${TOPDIR}/bin/tools/pkgmaker: + @mkdir -p $(TOPDIR)/bin/tools + @$(HOSTCC) -g -o $@ tools/adk/pkgmaker.c tools/adk/sortfile.c tools/adk/strmap.c + +${TOPDIR}/bin/tools/pkgrebuild: + @mkdir -p $(TOPDIR)/bin/tools + @$(HOSTCC) -g -o $@ tools/adk/pkgrebuild.c tools/adk/strmap.c + +package/Config.in.auto menu .menu: $(wildcard ${TOPDIR}/package/*/Makefile) ${TOPDIR}/bin/tools/pkgmaker ${TOPDIR}/bin/tools/pkgrebuild @echo "Generating menu structure ..." - mksh $(TOPDIR)/package/pkgmaker + @$(TOPDIR)/bin/tools/pkgmaker @:>.menu dep: @echo "Generating dependencies ..." - mksh $(TOPDIR)/package/depmaker + $(TOPDIR)/bin/tools/depmaker > ${TOPDIR}/package/Depends.mk .PHONY: menu dep diff --git a/mk/buildhlp.mk b/mk/buildhlp.mk index 4df712fcb..14cee191d 100644 --- a/mk/buildhlp.mk +++ b/mk/buildhlp.mk @@ -29,7 +29,7 @@ post-extract: ifeq ($(strip ${NO_DISTFILES}),1) ${WRKDIST}/.extract_done: rm -rf ${WRKDIST} ${WRKSRC} ${WRKBUILD} - mkdir -p ${WRKDIR} ${WRKDIST} + @mkdir -p ${WRKDIR} ${WRKDIST} ${MAKE} do-extract @${MAKE} post-extract touch $@ @@ -57,9 +57,9 @@ ifeq ($(strip ${__use_generic_patch_target}),42) post-patch: ${WRKDIST}/.prepared: ${WRKDIST}/.extract_done [ ! -d ./patches/${PKG_VERSION} ] || ${PREVENT_PATCH} ${PATCH} ${WRKDIST} ./patches \ - '{patch-!(*.orig),*.patch}' + '{patch-!(*.orig),*.patch}' $(MAKE_TRACE) [ ! -d ./patches ] || ${PREVENT_PATCH} ${PATCH} ${WRKDIST} ./patches \ - '{patch-!(*.orig),*.patch}' + '{patch-!(*.orig),*.patch}' $(MAKE_TRACE) [ ! -d ./src ] || (cd src; $(PREVENT_PATCH) cp -Rp . ${WRKDIST}/) \ $(MAKE_TRACE) @${MAKE} post-patch $(MAKE_TRACE) diff --git a/mk/image.mk b/mk/image.mk index 6c3b1e5f9..5858b9511 100644 --- a/mk/image.mk +++ b/mk/image.mk @@ -22,7 +22,7 @@ image-prepare-post: fi KERNEL_PKGDIR:=$(LINUX_BUILD_DIR)/kernel-pkg -KERNEL_PKG:=$(PACKAGE_DIR)/kernel_$(ADK_TARGET)-$(KERNEL_VERSION)_$(CPU_ARCH).$(PKG_SUFFIX) +KERNEL_PKG:=$(PACKAGE_DIR)/kernel_$(KERNEL_VERSION)_$(CPU_ARCH).$(PKG_SUFFIX) kernel-package: $(LINUX_DIR)/vmlinux $(TRACE) target/$(ADK_TARGET)-create-kernel-package @@ -30,7 +30,7 @@ kernel-package: $(LINUX_DIR)/vmlinux @mkdir -p $(KERNEL_PKGDIR)/boot cp $(KERNEL) $(KERNEL_PKGDIR)/boot/vmlinuz-adk @${BASH} ${SCRIPT_DIR}/make-ipkg-dir.sh ${KERNEL_PKGDIR} \ - ../linux/kernel.control ${ADK_TARGET}-${KERNEL_VERSION} ${CPU_ARCH} + ../linux/kernel.control ${KERNEL_VERSION} ${CPU_ARCH} $(PKG_BUILD) $(KERNEL_PKGDIR) $(PACKAGE_DIR) $(MAKE_TRACE) $(TRACE) target/$(ADK_TARGET)-install-kernel-package $(PKG_INSTALL) $(KERNEL_PKG) $(MAKE_TRACE) @@ -51,7 +51,7 @@ ${BIN_DIR}/${ROOTFSUSERTARBALL}: ${TARGET_DIR} ${BIN_DIR}/${INITRAMFS}: ${TARGET_DIR} cd ${TARGET_DIR}; find . | sed -n '/^\.\//s///p' | \ sed "s#\(.*\)#:0:0::::::\1#" | sort | \ - ${STAGING_TOOLS}/bin/cpio -o -C512 -Hnewc -P | \ + ${TOPDIR}/bin/tools/cpio -o -C512 -Hnewc -P | \ ${ADK_COMPRESSION_TOOL} >$@ 2>/dev/null ${BUILD_DIR}/${INITRAMFS_PIGGYBACK}: ${TARGET_DIR} @@ -59,7 +59,7 @@ ${BUILD_DIR}/${INITRAMFS_PIGGYBACK}: ${TARGET_DIR} $(LINUX_DIR)/.config cd ${TARGET_DIR}; find . | sed -n '/^\.\//s///p' | \ sed "s#\(.*\)#:0:0::::::\1#" | sort | \ - ${STAGING_TOOLS}/bin/cpio -o -C512 -Hnewc -P >$@ 2>/dev/null + ${TOPDIR}/bin/tools/cpio -o -C512 -Hnewc -P >$@ 2>/dev/null ${BIN_DIR}/${ROOTFSSQUASHFS}: ${TARGET_DIR} ${STAGING_TOOLS}/bin/mksquashfs ${TARGET_DIR} \ diff --git a/mk/kernel-build.mk b/mk/kernel-build.mk index ebc58a7d0..2eaf1ada1 100644 --- a/mk/kernel-build.mk +++ b/mk/kernel-build.mk @@ -9,6 +9,12 @@ $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/linux-$(KERNE $(TRACE) target/$(ADK_TARGET)-kernel-patch $(PATCH) $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/linux-$(KERNEL_VERSION) ../linux/patches/$(KERNEL_VERSION) *.patch $(MAKE_TRACE) $(PATCH) $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/linux-$(KERNEL_VERSION) ../$(ADK_TARGET)/patches *.patch $(MAKE_TRACE) +ifeq ($(ADK_NATIVE),y) + if [ -f /etc/adktarget ];then \ + target=$$(cat /etc/adktarget); \ + $(PATCH) $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/linux-$(KERNEL_VERSION) ../$$target/patches *.patch $(MAKE_TRACE); \ + fi +endif touch $@ $(LINUX_DIR)/.prepared: $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/linux-$(KERNEL_VERSION)/.patched @@ -17,7 +23,7 @@ $(LINUX_DIR)/.prepared: $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PK mkdir -p $(LINUX_BUILD_DIR)/kmod-control touch $@ -$(LINUX_DIR)/.config: $(LINUX_DIR)/.prepared $(BUILD_DIR)/.kernelconfig +$(LINUX_DIR)/.config: $(LINUX_DIR)/.prepared $(BUILD_DIR)/.kernelconfig $(TOPDIR)/mk/modules.mk $(TRACE) target/$(ADK_TARGET)-kernel-configure for f in $(TARGETS);do if [ -f $$f ];then rm $$f;fi;done $(MAKE_TRACE) $(CP) $(BUILD_DIR)/.kernelconfig $(LINUX_DIR)/.config diff --git a/mk/kernel.mk b/mk/kernel.mk index a8b3884da..eb4e52a33 100644 --- a/mk/kernel.mk +++ b/mk/kernel.mk @@ -28,9 +28,9 @@ TARGETS:= # define KMOD_template -IDEPENDK_$(1):=kernel ($(ADK_TARGET)-$(KERNEL_VERSION)) $(foreach pkg,$(5),", $(pkg)") +IDEPENDK_$(1):=kernel ($(KERNEL_VERSION)) $(foreach pkg,$(5),", $(pkg)") -PKG_$(1) := $(PACKAGE_DIR)/kmod-$(2)_$(ADK_TARGET)-$(KERNEL_VERSION)-$(KERNEL_RELEASE)_$(CPU_ARCH).$(PKG_SUFFIX) +PKG_$(1) := $(PACKAGE_DIR)/kmod-$(2)_$(KERNEL_VERSION)-$(KERNEL_RELEASE)_$(CPU_ARCH).$(PKG_SUFFIX) I_$(1) := $(KMOD_BUILD_DIR)/ipkg/$(2) ifeq ($$(ADK_KPACKAGE_KMOD_$(1)),m) @@ -50,7 +50,7 @@ $$(PKG_$(1)): echo "Description: kernel module $(2)" >> $(LINUX_BUILD_DIR)/kmod-control/kmod-$(2).control ${BASH} ${SCRIPT_DIR}/make-ipkg-dir.sh $$(I_$(1)) \ $(LINUX_BUILD_DIR)/kmod-control/kmod-$(2).control \ - $(ADK_TARGET)-$(KERNEL_VERSION)-$(KERNEL_RELEASE) $(CPU_ARCH) + $(KERNEL_VERSION)-$(KERNEL_RELEASE) $(CPU_ARCH) echo "Depends: $$(IDEPENDK_$(1))" >> $$(I_$(1))/CONTROL/control ifneq ($(strip $(3)),) mkdir -p $$(I_$(1))/lib/modules/$(KERNEL_VERSION) diff --git a/mk/modules.mk b/mk/modules.mk index 7f4055aed..e88a90783 100644 --- a/mk/modules.mk +++ b/mk/modules.mk @@ -61,7 +61,7 @@ $(eval $(call KMOD_template,SKY2,sky2,\ $(eval $(call KMOD_template,MAC80211,mac80211,\ $(MODULES_DIR)/kernel/net/wireless/cfg80211 \ $(MODULES_DIR)/kernel/net/mac80211/mac80211 \ -,15, kmod-crypto-aes kmod-crypto-arc4 kmod-crypto-ecb kmod-crc32)) +,15, kmod-crypto-aes kmod-crypto-arc4 kmod-crypto-ecb)) $(eval $(call KMOD_template,ATH5K,ath5k,\ $(MODULES_DIR)/kernel/drivers/net/wireless/ath/ath \ @@ -72,8 +72,8 @@ $(eval $(call KMOD_template,P54_COMMON,p54-common,\ $(MODULES_DIR)/kernel/drivers/net/wireless/p54/p54common \ ,68)) -$(eval $(call KMOD_template,RTL8187B,rtl8187b,\ - $(MODULES_DIR)/kernel/drivers/net/wireless/rtl8187b/rtl8187b \ +$(eval $(call KMOD_template,RTL8187,rtl8187,\ + $(MODULES_DIR)/kernel/drivers/net/wireless/rtl818x/rtl8187 \ ,70)) $(eval $(call KMOD_template,B43,b43,\ diff --git a/mk/package.mk b/mk/package.mk index 30965e17b..db3007f71 100644 --- a/mk/package.mk +++ b/mk/package.mk @@ -77,10 +77,11 @@ MAKE_ENV+= WRKDIR='${WRKDIR}' WRKDIST='${WRKDIST}' \ CXXFLAGS='$(strip ${TCXXFLAGS})' \ CPPFLAGS='$(strip ${TCPPFLAGS})' \ LDFLAGS='$(strip ${TLDFLAGS})' +MAKE_ENV+= PATH='${TARGET_PATH}' ifeq ($(ADK_NATIVE),) MAKE_ENV+= PATH='${TARGET_PATH}' \ - ${HOST_CONFIGURE_OPTS} \ PKG_CONFIG_LIBDIR='${STAGING_DIR}/usr/lib/pkgconfig' \ + ${HOST_CONFIGURE_OPTS} \ CC='${TARGET_CC}' \ CXX='${TARGET_CXX}' \ AR='${TARGET_CROSS}ar' \ @@ -108,7 +109,6 @@ _IPKGS_COOKIE= ${PACKAGE_DIR}/.stamps/${PKG_NAME}${PKG_VERSION}-${PKG_RELEASE} _IN_PACKAGE:= 1 include ${TOPDIR}/mk/buildhlp.mk --include info.mk # defined in buildhlp.mk ('extract' can fail, use 'patch' then) extract: ${_EXTRACT_COOKIE} @@ -118,6 +118,11 @@ patch: ${_PATCH_COOKIE} configure: ${_CONFIGURE_COOKIE} build: ${_BUILD_COOKIE} fake: ${_FAKE_COOKIE} +rebuild: + @if [ -f ${TOPDIR}/.rebuild.${PKG_NAME} ];then \ + $(MAKE) clean; \ + rm -f ${TOPDIR}/.rebuild.${PKG_NAME}; \ + fi # our recursive build entry point build-all-pkgs: ${_IPKGS_COOKIE} @@ -208,7 +213,7 @@ ifeq (,$(filter noremove,$(7))) fi endif @rm -f '$${STAGING_PARENT}/pkg/$(1)' - @-cd $${IDIR_$(1)}; \ + -cd $${IDIR_$(1)}; \ x=$$$$(find tmp var -mindepth 1 2>/dev/null); if [[ -n $$$$x ]]; then \ echo 'WARNING: $${IPKG_$(1)} installs files into a' \ 'ramdisk location:' >&2; \ @@ -221,7 +226,7 @@ endif find usr ! -type d 2>/dev/null | \ grep -v -e '^usr/share' -e '^usr/man' -e '^usr/info' -e '^usr/lib/libc.so' | \ tee '$${STAGING_PARENT}/pkg/$(1)' | \ - cpio -padlmu '$${STAGING_DIR}' + $(TOPDIR)/bin/tools/cpio -padlmu '$${STAGING_DIR}' @cd '$${STAGING_DIR}'; grep 'usr/lib/.*\.la$$$$' \ '$${STAGING_PARENT}/pkg/$(1)' | while read fn; do \ chmod u+w $$$$fn; \ diff --git a/mk/pkg-bottom.mk b/mk/pkg-bottom.mk index 101a240a9..e68607f9d 100644 --- a/mk/pkg-bottom.mk +++ b/mk/pkg-bottom.mk @@ -165,7 +165,7 @@ endif find usr ! -type d 2>/dev/null | \ grep -v -e '^usr/share' -e '^usr/man' -e '^usr/info' -e '^usr/lib/libc.so' | \ tee '${STAGING_PARENT}/pkg/${PKG_NAME}' | \ - cpio -padlmu '${STAGING_DIR}' + $(TOPDIR)/bin/tools/cpio -padlmu '${STAGING_DIR}' @cd '${STAGING_DIR}'; grep 'usr/lib/.*\.la$$' \ '${STAGING_PARENT}/pkg/${PKG_NAME}' | while read fn; do \ chmod u+w $$fn; \ diff --git a/mk/split-cfg.mk b/mk/split-cfg.mk deleted file mode 100644 index e9521c259..000000000 --- a/mk/split-cfg.mk +++ /dev/null @@ -1,9 +0,0 @@ -# This file is part of the OpenADK project. OpenADK is copyrighted -# material, please see the LICENCE file in the top-level directory. -# must work with both BSD and GNU make - -${TOPDIR}/.ADK_HAVE_DOT_CONFIG: \ - ${TOPDIR}/.config ${TOPDIR}/mk/split-cfg.mk \ - ${TOPDIR}/scripts/split-cfg.sh - mksh ${TOPDIR}/scripts/split-cfg.sh '${TOPDIR}' '${ADK_TARGET}' '${ADK_LIBC}' - touch ${TOPDIR}/.ADK_HAVE_DOT_CONFIG diff --git a/mk/vars.mk b/mk/vars.mk index 6f38db944..40226b254 100644 --- a/mk/vars.mk +++ b/mk/vars.mk @@ -102,7 +102,7 @@ EXTRACT_CMD= mkdir -p ${WRKDIR}; \ cd ${WRKDIR} && \ for file in ${FULLDISTFILES}; do case $$file in \ *.cpio) \ - cat $$file | $(STAGING_TOOLS)/bin/cpio -i -d ;; \ + cat $$file | $(TOPDIR)/bin/tools/cpio -i -d ;; \ *.tar) \ tar -xf $$file ;; \ *.cpio.Z | *.cpio.gz | *.cgz | *.mcz) \ @@ -114,7 +114,7 @@ EXTRACT_CMD= mkdir -p ${WRKDIR}; \ *.tar.bz2 | *.tbz | *.tbz2) \ bzip2 -dc $$file | tar -xf - ;; \ *.zip) \ - cat $$file | $(STAGING_TOOLS)/bin/cpio -ivd -H zip ;; \ + cat $$file | $(TOPDIR)/bin/tools/cpio -ivd -H zip ;; \ *.arm) \ cp $$file ${WRKDIR} ;; \ *) \ diff --git a/package/.template/Makefile b/package/.template/Makefile index 977e4aede..e5593b3fb 100644 --- a/package/.template/Makefile +++ b/package/.template/Makefile @@ -3,6 +3,7 @@ include $(TOPDIR)/rules.mk +# always use tab spaces as separator, no spaces PKG_NAME:= @PKG@ PKG_VERSION:= @VER@ PKG_RELEASE:= 1 @@ -10,10 +11,45 @@ PKG_MD5SUM:= add md5sum of package here PKG_DESCR:= add short description PKG_SECTION:= add section PKG_DEPENDS:= add dependendant package names -PKG_BUILDDEP+= add packages which need to be compiled +PKG_BUILDDEP:= add packages which need to be compiled PKG_URL:= add project url PKG_SITES:= add download url without package name +# if more than one binary package is created, add symbol names of all here +# leave variable empty, when no binary package is created. You can set it +# to override PKG_NAME for the main binary package +#PKG_SUBPKGS:= PKG SUBPKG1 SUBPKG2 +# you can add separate, build depends, run depends, section and description +# build time dependency for subpackage SUBPKG1, package dir +#PKGSB_SUBPKG1:= +# runtime dependency for subpackage SUBPKG1, package names +#PKGSS_SUBPKG1:= +# section for subpackage SUBPKG1 +#PKGSC_SUBPKG1:= +# description for subpackage SUBPKG1 +#PKGSD_SUBPKG1:= + +# define your flavours for your package here, WITH_SSL f.e. +#PKG_FLAVOURS:= WITH_SSL +# flavour description +#PKGFD_WITH_SSL:= enable SSL support +# flavour runtime dependency, package name +#PKGFS_WITH_SSL:= libopenssl +# flavour build time dependency, package dir +#PKGFB_WITH_SSL:= openssl + +# define your choices for your package here, f.e. different SSL implementations +#PKG_CHOICES:= WITH_OPENSSL WITH_GNUTLS +# package description for each choice +#PKGCD_WITH_OPENSSL:= SSL support via OpenSSL library +#PKGCD_WITH_GNUTLS:= SSL support via GNUTLS library +# package build time dependencies +#PKGCB_WITH_OPENSSL:= openssl +#PKGCB_WITH_GNUTLS:= gnutls +# package runtime dependencies +#PKGCS_WITH_OPENSSL:= libopenssl +#PKGCS_WITH_GNUTLS:= libgnutls + # if downloaded package is not ending with .tar.gz use following #DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 diff --git a/package/DirectFB/Makefile b/package/DirectFB/Makefile index f96d888ec..ba0b69a03 100644 --- a/package/DirectFB/Makefile +++ b/package/DirectFB/Makefile @@ -9,8 +9,8 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 223e036da906ceb4bd44708026839ff1 PKG_DESCR:= Thin library on top of the Linux framebuffer devices PKG_SECTION:= libs -PKG_BUILDDEP:= libpng libX11 libXext PKG_DEPENDS:= libpng +PKG_BUILDDEP:= libpng libX11 libXext PKG_URL:= http://www.directfb.org/ PKG_SITES:= http://directfb.org/downloads/Core/DirectFB-1.4/ diff --git a/package/Makefile b/package/Makefile index d9a015494..12058a8dd 100644 --- a/package/Makefile +++ b/package/Makefile @@ -28,6 +28,7 @@ endif include $(TOPDIR)/package/Depends.mk DOWNLOAD:=$(patsubst %,%-download,$(package-y) $(package-m)) +REBUILD_PACKAGES:=$(patsubst %,%-rebuild,$(package-y) $(package-m)) COMPILE_PACKAGES:=$(patsubst %,%-compile,$(package-y) $(package-m)) INSTALL_PACKAGES:=$(patsubst %,%-install,$(package-y)) @@ -35,10 +36,10 @@ all: compile download: $(DOWNLOAD) clean: $(patsubst %,%-clean,$(package-) $(package-y) $(package-m) base-files) ifeq ($(ADK_TOOLCHAIN_ONLY),y) -compile: $(COMPILE_PACKAGES) +compile: $(REBUILD_PACKAGES) $(COMPILE_PACKAGES) install: $(INSTALL_PACKAGES) else -compile: base-files-compile $(COMPILE_PACKAGES) +compile: $(REBUILD_PACKAGES) base-files-compile $(COMPILE_PACKAGES) install: base-files-install $(INSTALL_PACKAGES) endif @@ -57,6 +58,12 @@ $(TARGET_DIR): $(CMD_TRACE) " done" $(END_TRACE) +%-rebuild: + $(START_TRACE) "package/$(patsubst %-rebuild,%,$@)-rebuild: " + $(MAKE) -C $(patsubst %-rebuild,%,$@) rebuild + $(CMD_TRACE) " done" + $(END_TRACE) + %-install: @$(START_TRACE) "package/$(patsubst %-install,%,$@)-install: " @$(MAKE) -C $(patsubst %-install,%,$@) install diff --git a/package/MesaLib/Makefile b/package/MesaLib/Makefile index 4d82687ee..6d70a1798 100644 --- a/package/MesaLib/Makefile +++ b/package/MesaLib/Makefile @@ -10,26 +10,27 @@ PKG_MD5SUM:= 62e8e47cbd63741b4bbe634dcdc8a56a PKG_DESCR:= MESA library PKG_SECTION:= libs PKG_DEPENDS:= libxdamage libxfixes libdrm -PKG_BUILDDEP+= libXdamage libXfixes libXxf86vm libdrm +PKG_BUILDDEP:= libXdamage libXfixes libXxf86vm libdrm PKG_BUILDDEP+= dri2proto glproto expat PKG_URL:= http://www.mesa3d.org/ PKG_SITES:= ftp://ftp.freedesktop.org/pub/mesa/7.8.1/ -PKG_DESCR_GLXINFO:= Display various GLX information -PKG_SECT_GLXINFO:= x11/apps -PKG_DESCR_GLXGEARS:= Nice little OpenGL demo application -PKG_SECT_GLXGEARS:= x11/apps +PKG_SUBPKGS:= MESALIB GLXINFO GLXGEARS +PKGSD_GLXINFO:= Display various GLX information +PKGSC_GLXINFO:= x11/apps +PKGSD_GLXGEARS:= Nice little OpenGL demo application +PKGSC_GLXGEARS:= x11/apps -WRKDIST= ${WRKDIR}/Mesa-${PKG_VERSION} - -PKG_TARGET_DEPENDS:= ibmx40 lemote PKG_HOST_DEPENDS:= !cygwin +PKG_TARGET_DEPENDS:= ibmx40 lemote + +WRKDIST= ${WRKDIR}/Mesa-${PKG_VERSION} include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,MESALIB,mesalib,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,GLXINFO,glxinfo,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_GLXINFO},${PKG_SECT_GLXINFO})) -$(eval $(call PKG_template,GLXGEARS,glxgears,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_GLXGEARS},${PKG_SECT_GLXGEARS})) +$(eval $(call PKG_template,GLXINFO,glxinfo,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_GLXINFO},${PKGSC_GLXINFO})) +$(eval $(call PKG_template,GLXGEARS,glxgears,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_GLXGEARS},${PKGSC_GLXGEARS})) ifeq (${ADK_LINUX_X86_IBMX40},y) DRI_DRIVERS:=i810 diff --git a/package/adkinstall/Makefile b/package/adkinstall/Makefile index 65745cd08..5a64ae14d 100644 --- a/package/adkinstall/Makefile +++ b/package/adkinstall/Makefile @@ -9,6 +9,7 @@ PKG_RELEASE:= 5 PKG_DESCR:= openadk installer PKG_SECTION:= base PKG_DEPENDS:= parted sfdisk e2fsprogs +PKG_URL:= http://www.openadk.org/ PKG_TARGET_DEPENDS:= alix wrap routerboard foxg20 diff --git a/package/aiccu/Makefile b/package/aiccu/Makefile index 0a6d706ed..5eeeac943 100644 --- a/package/aiccu/Makefile +++ b/package/aiccu/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= c9bcc83644ed788e22a7c3f3d4021350 PKG_DESCR:= SixXS Automatic IPv6 Connectivity Client Utility PKG_SECTION:= ipv6 PKG_DEPENDS:= kmod-ipv6 libpthread -PKG_URL:= http://www.sixxs.net +PKG_URL:= http://www.sixxs.net/ PKG_SITES:= http://www.sixxs.net/archive/sixxs/aiccu/unix/ DISTFILES:= $(PKG_NAME)_$(PKG_VERSION).tar.gz diff --git a/package/aircrack-ng/Makefile b/package/aircrack-ng/Makefile index b9c9470bf..7bc5ec29e 100644 --- a/package/aircrack-ng/Makefile +++ b/package/aircrack-ng/Makefile @@ -10,8 +10,8 @@ PKG_MD5SUM:= f7a24ed8fad122c4187d06bfd6f998b4 PKG_DESCR:= set of tools for auditing wireless networks PKG_SECTION:= wifi PKG_DEPENDS:= libpthread libopenssl libpcap -PKG_BUILDDEP+= openssl libpcap -PKG_URL:= http://www.aircrack-ng.org +PKG_BUILDDEP:= openssl libpcap +PKG_URL:= http://www.aircrack-ng.org/ PKG_SITES:= http://download.aircrack-ng.org/ include $(TOPDIR)/mk/package.mk diff --git a/package/alix-switch/Makefile b/package/alix-switch/Makefile index 493a73053..79b72b1e1 100644 --- a/package/alix-switch/Makefile +++ b/package/alix-switch/Makefile @@ -8,8 +8,10 @@ PKG_VERSION:= 1.0 PKG_RELEASE:= 1 PKG_DESCR:= daemon listening on button events PKG_SECTION:= base +PKG_URL:= http://www.openadk.org/ PKG_TARGET_DEPENDS:= alix +PKG_DFLT_ALIX_SWITCH:= y NO_DISTFILES:= 1 @@ -17,8 +19,6 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,ALIX_SWITCH,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -PKGDFLT_ALIX_SWITCH= y - CONFIG_STYLE:= manual BUILD_STYLE:= manual INSTALL_STYLE:= manual diff --git a/package/alsa-utils/Makefile b/package/alsa-utils/Makefile index e1668520c..288faafdf 100644 --- a/package/alsa-utils/Makefile +++ b/package/alsa-utils/Makefile @@ -10,17 +10,14 @@ PKG_MD5SUM:= f7180316188552ee1e6759a03f1fe98d PKG_DESCR:= ALSA mixer utility PKG_SECTION:= multimedia PKG_DEPENDS:= alsa-lib libpthread -PKG_BUILDDEP+= alsa-lib -ifeq (${ADK_PACKAGE_ALSA_UTILS_WITH_ALSAMIXER},y) -PKG_BUILDDEP+= ncurses -endif -PKG_URL:= http://www.alsa-project.org -PKG_SITES:= ftp://ftp.task.gda.pl/pub/linux/misc/alsa/utils/ \ - ftp://ftp.alsa-project.org/pub/utils/ +PKG_BUILDDEP:= alsa-lib +PKG_URL:= http://www.alsa-project.org/ +PKG_SITES:= ftp://ftp.alsa-project.org/pub/utils/ PKG_FLAVOURS:= WITH_ALSAMIXER PKGFS_WITH_ALSAMIXER:= libncurses PKGFD_WITH_ALSAMIXER:= include alsamixer ncurses applet +PKGFB_WITH_ALSAMIXER:= ncurses DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 diff --git a/package/apr-util/Makefile b/package/apr-util/Makefile index 2c0afd8bf..86ddd34ca 100644 --- a/package/apr-util/Makefile +++ b/package/apr-util/Makefile @@ -3,15 +3,15 @@ include ${TOPDIR}/rules.mk -PKG_NAME:= apr-util -PKG_VERSION:= 1.3.9 -PKG_RELEASE:= 1 -PKG_MD5SUM:= cc2ec0ba4f01d88375f1170f762518fa +PKG_NAME:= apr-util +PKG_VERSION:= 1.3.9 +PKG_RELEASE:= 1 +PKG_MD5SUM:= cc2ec0ba4f01d88375f1170f762518fa PKG_DESCR:= Apache Portable Runtime utility library PKG_SECTION:= libs PKG_DEPENDS:= libexpat apr -PKG_BUILDDEP+= expat apr -PKG_URL:= http://apr.apache.org +PKG_BUILDDEP:= expat apr +PKG_URL:= http://apr.apache.org/ PKG_SITES:= http://apache.mirror.clusters.cc/apr/ include ${TOPDIR}/mk/package.mk diff --git a/package/apr/Makefile b/package/apr/Makefile index 7da0bf8b5..08faf55d9 100644 --- a/package/apr/Makefile +++ b/package/apr/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= fc80cb54f158c2674f9eeb47a1f672cd PKG_DESCR:= Apache Portable Runtime library PKG_SECTION:= libs PKG_DEPENDS:= libpthread -PKG_URL:= http://apr.apache.org +PKG_URL:= http://apr.apache.org/ PKG_SITES:= http://gd.tuwien.ac.at/infosys/servers/http/apache/dist/${PKG_NAME}/ PKG_FLAVOURS:= WITH_IPV6 diff --git a/package/arpd/Makefile b/package/arpd/Makefile index 249f4b8eb..071e4eb7d 100644 --- a/package/arpd/Makefile +++ b/package/arpd/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= e2911fa9de1b92ef50deda1489ae944d PKG_DESCR:= Generates ARP responses for IP address ranges PKG_SECTION:= route PKG_DEPENDS:= libpcap libdnet libevent -PKG_BUILDDEP+= libpcap libdnet libevent +PKG_BUILDDEP:= libpcap libdnet libevent PKG_URL:= http://niels.xtdnet.nl/honeyd/ PKG_SITES:= http://niels.xtdnet.nl/honeyd/ diff --git a/package/arpwatch/Makefile b/package/arpwatch/Makefile index 83584fb1e..a3e437f64 100644 --- a/package/arpwatch/Makefile +++ b/package/arpwatch/Makefile @@ -10,8 +10,8 @@ PKG_MD5SUM:= cebfeb99c4a7c2a6cee2564770415fe7 PKG_DESCR:= Ethernet monitor program PKG_SECTION:= net/security PKG_DEPENDS:= libpcap -PKG_BUILDDEP+= libpcap -PKG_URL:= http://www-nrg.ee.lbl.gov +PKG_BUILDDEP:= libpcap +PKG_URL:= http://www-nrg.ee.lbl.gov/ PKG_SITES:= ftp://ftp.ee.lbl.gov/ include $(TOPDIR)/mk/package.mk diff --git a/package/asterisk/Makefile b/package/asterisk/Makefile index a6025ce43..3083656f4 100644 --- a/package/asterisk/Makefile +++ b/package/asterisk/Makefile @@ -9,38 +9,37 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 50412a90942ae7306fb8dcc31a05c2ce PKG_DESCR:= Open Source PBX PKG_SECTION:= phone -PKG_MULTI:= 1 -PKG_NOPARALLEL:= 1 PKG_DEPENDS:= libncurses libpthread libopenssl libcurl -PKG_BUILDDEP+= ncurses openssl zlib curl popt -ifneq ($(ADK_PACKAGE_ASTERISK_CODEC_SPEEX),) -PKG_BUILDDEP+= speex -endif -ifneq ($(ADK_PACKAGE_ASTERISK_PGSQL),) -PKG_BUILDDEP+= postgresql -endif +PKG_BUILDDEP:= ncurses openssl zlib curl popt PKG_URL:= http://www.asterisk.org/ PKG_SITES:= http://downloads.asterisk.org/pub/telephony/asterisk/releases/ +PKG_MULTI:= 1 +PKG_NOPARALLEL:= 1 PKG_TARGET_DEPENDS:= !foxboard -PKG_DESCR_CHAN_MGCP:= Media Gateway Control Protocol implementation -PKG_DESCR_CHAN_SKINNY:= Skinny Client Control Protocol implementation -PKG_DESCR_CHAN_IAX2:= Support for the Inter Asterisk Protocol -PKG_DESCR_CODEC_SPEEX:= Speex/PCM16 Codec Translator -PKG_DESCR_SOUNDS:= Various soundfiles in GSM format -PKG_DEPENDS_SOUNDS:= ${PKG_DEPENDS} asterisk-codec-gsm +PKG_SUBPKGS:= ASTERISK ASTERISK_PGSQL ASTERISK_VOICEMAIL ASTERISK_SOUNDS ASTERISK_CHAN_MGCP +PKG_SUBPKGS+= ASTERISK_CHAN_SKINNY ASTERISK_CHAN_IAX2 ASTERISK_CODEC_SPEEX ASTERISK_CODEC_GSM +PKG_SUBPKGS+= ASTERISK_PBX_DUNDI ASTERISK_RES_AGI +PKGSB_ASTERISK_CODEC_SPEEX:= speex +PKGSB_ASTERISK_PQSQL:= postgresql +PKGSD_ASTERISK_CHAN_MGCP:= Media Gateway Control Protocol implementation +PKGSD_ASTERISK_CHAN_SKINNY:= Skinny Client Control Protocol implementation +PKGSD_ASTERISK_CHAN_IAX2:= Support for the Inter Asterisk Protocol +PKGSD_ASTERISK_CODEC_SPEEX:= Speex/PCM16 Codec Translator +PKGSD_ASTERISK_SOUNDS:= Various soundfiles in GSM format +PKGSS_ASTERISK_SOUNDS:= asterisk-codec-gsm include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,ASTERISK,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) $(eval $(call PKG_template,ASTERISK_PGSQL,asterisk-pgsql,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) $(eval $(call PKG_template,ASTERISK_VOICEMAIL,asterisk-voicemail,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,ASTERISK_SOUNDS,asterisk-sounds,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS_SOUNDS},${PKG_DESCR_SOUNDS},${PKG_SECTION})) -$(eval $(call PKG_template,ASTERISK_CHAN_MGCP,asterisk-chan-mgcp,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS_MAIN},${PKG_DESCR_CHAN_MGCP},${PKG_SECTION})) -$(eval $(call PKG_template,ASTERISK_CHAN_SKINNY,asterisk-chan-skinny,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS_MAIN},${PKG_DESCR_CHAN_SKINNY},${PKG_SECTION})) -$(eval $(call PKG_template,ASTERISK_CHAN_IAX2,asterisk-chan-iax2,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS_MAIN},${PKG_DESCR_CHAN_IAX2},${PKG_SECTION})) -$(eval $(call PKG_template,ASTERISK_CODEC_SPEEX,asterisk-codec-speex,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS_MAIN},${PKG_DESCR_CODEC_SPEEX},${PKG_SECTION})) +$(eval $(call PKG_template,ASTERISK_SOUNDS,asterisk-sounds,$(PKG_VERSION)-${PKG_RELEASE},${PKGSS_ASTERISK_SOUNDS},${PKGSD_ASTERISK_SOUNDS},${PKG_SECTION})) +$(eval $(call PKG_template,ASTERISK_CHAN_MGCP,asterisk-chan-mgcp,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_ASTERISK_CHAN_MGCP},${PKG_SECTION})) +$(eval $(call PKG_template,ASTERISK_CHAN_SKINNY,asterisk-chan-skinny,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_ASTERISK_CHAN_SKINNY},${PKG_SECTION})) +$(eval $(call PKG_template,ASTERISK_CHAN_IAX2,asterisk-chan-iax2,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_ASTERISK_CHAN_IAX2},${PKG_SECTION})) +$(eval $(call PKG_template,ASTERISK_CODEC_SPEEX,asterisk-codec-speex,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_ASTERISK_CODEC_SPEEX},${PKG_SECTION})) $(eval $(call PKG_template,ASTERISK_CODEC_GSM,asterisk-codec-gsm,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) $(eval $(call PKG_template,ASTERISK_PBX_DUNDI,asterisk-pbx-dundi,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) $(eval $(call PKG_template,ASTERISK_RES_AGI,asterisk-res-agi,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/atftp/Makefile b/package/atftp/Makefile index e009111fa..601e9aba3 100644 --- a/package/atftp/Makefile +++ b/package/atftp/Makefile @@ -10,16 +10,17 @@ PKG_MD5SUM:= 3b27365772d918050b2251d98a9c7c82 PKG_DESCR:= TFTP client PKG_SECTION:= dhcp PKG_DEPENDS:= libreadline libncurses -PKG_BUILDDEP+= readline ncurses -PKG_URL:= http://freshmeat.net/projects/atftp +PKG_BUILDDEP:= readline ncurses +PKG_URL:= http://freshmeat.net/projects/atftp/ PKG_SITES:= ftp://ftp.mamalinux.com/pub/atftp/ -PKG_DESCR_TFTP_SERVER:= TFTP server +PKG_SUBPKGS:= ATFTP ATFTPD +PKGSD_ATFTPD:= TFTP server include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,ATFTP,atftp,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,ATFTPD,atftpd,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_TFTP_SERVER},${PKG_SECTION})) +$(eval $(call PKG_template,ATFTPD,atftpd,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_ATFTPD},${PKG_SECTION})) MAKE_FLAGS+= CFLAGS="${TCFLAGS} -Wall -D_REENTRANT -fno-inline" diff --git a/package/atk/Makefile b/package/atk/Makefile index 2b3437450..cb33d1f30 100644 --- a/package/atk/Makefile +++ b/package/atk/Makefile @@ -9,8 +9,8 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= f587d9285b2d0ac35ea95acef673517c PKG_DESCR:= atk library PKG_SECTION:= libs -PKG_BUILDDEP+= glib -PKG_URL:= http://www.gnome.org +PKG_BUILDDEP:= glib +PKG_URL:= http://www.gnome.org/ PKG_SITES:= ${MASTER_SITE_GNOME:=/atk/1.29/} ifeq ($(ADK_STATIC),y) diff --git a/package/aufs2-util/Makefile b/package/aufs2-util/Makefile index d757e9c98..4078fa8e1 100644 --- a/package/aufs2-util/Makefile +++ b/package/aufs2-util/Makefile @@ -9,6 +9,7 @@ PKG_RELEASE:= 1 PKG_DESCR:= aufs2 utilities PKG_SECTION:= fs PKG_URL:= http://aufs.sf.net/ + PKG_HOST_DEPENDS:= !cygwin !freebsd !openbsd !netbsd NO_DISTFILES:= 1 diff --git a/package/autossh/Makefile b/package/autossh/Makefile index 8f7a776b2..19fc3216d 100644 --- a/package/autossh/Makefile +++ b/package/autossh/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 8f9aa006f6f69e912d3c2f504622d6f7 PKG_DESCR:= Automatically restart SSH sessions and tunnels PKG_SECTION:= net/security PKG_DEPENDS:= openssh-client -PKG_URL:= http://www.harding.motd.ca/autossh +PKG_URL:= http://www.harding.motd.ca/autossh/ PKG_SITES:= http://www.harding.motd.ca/autossh/ DISTFILES:= $(PKG_NAME)-$(PKG_VERSION).tgz diff --git a/package/avahi/Makefile b/package/avahi/Makefile index ba55ad05a..ebd811ca9 100644 --- a/package/avahi/Makefile +++ b/package/avahi/Makefile @@ -10,19 +10,21 @@ PKG_MD5SUM:= a83155a6e29e3988f07e5eea3287b21e PKG_DESCR:= mDNS daemon PKG_SECTION:= dhcp PKG_DEPENDS:= libavahi libdaemon libexpat gettext -PKG_BUILDDEP+= libdaemon expat gdbm glib gettext -PKG_URL:= http://avahi.org +PKG_BUILDDEP:= libdaemon expat gdbm glib gettext +PKG_URL:= http://avahi.org/ PKG_SITES:= http://avahi.org/download/ -PKG_DEPENDS_DNSCONFD:= libavahi libdaemon avahi-daemon -PKG_DESCR_DNSCONFD:= DNS server from mDNS configuration daemon -PKG_DESCR_LIB:= DNS-SD over mDNS library +PKG_SUBPKGS:= AVAHI_DAEMON AVAHI_DNSCONFD LIBAVAHI +PKGSS_AVAHI_DNSCONFD:= libavahi libdaemon avahi-daemon +PKGSD_AVAHI_DNSCONFD:= DNS server from mDNS configuration daemon +PKGSD_LIBAVAHI:= DNS-SD over mDNS library +PKGSC_LIBAVAHI:= libs include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,AVAHI_DAEMON,avahi-daemon,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,AVAHI_DNSCONFD,avahi-dnsconfd,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_DNSCONFD},${PKG_DESCR_DNSCONFD},${PKG_SECTION})) -$(eval $(call PKG_template,LIBAVAHI,libavahi,${PKG_VERSION}-${PKG_RELEASE},,${PKG_DESCR_LIB},libs)) +$(eval $(call PKG_template,AVAHI_DNSCONFD,avahi-dnsconfd,${PKG_VERSION}-${PKG_RELEASE},${PKGSS_AVAHI_DNSCONFD},${PKGSD_AVAHI_DNSCONFD},${PKG_SECTION})) +$(eval $(call PKG_template,LIBAVAHI,libavahi,${PKG_VERSION}-${PKG_RELEASE},,${PKGSD_LIBAVAHI},${PKGSC_LIBAVAHI})) TLDFLAGS+= -lintl CONFIGURE_ARGS+= --enable-glib \ diff --git a/package/axtls/Makefile b/package/axtls/Makefile index 0b2e60d97..c3c659666 100644 --- a/package/axtls/Makefile +++ b/package/axtls/Makefile @@ -10,11 +10,12 @@ PKG_MD5SUM:= 03471b5a5874e2ce86025f24b3fa0958 PKG_DESCR:= small embedded webserver PKG_SECTION:= net/security PKG_DEPENDS:= libaxtls -PKG_URL:= http://axtls.sourceforge.net +PKG_URL:= http://axtls.sourceforge.net/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=axtls/} -PKG_DESCR_LIB:= small tls library -PKG_SECTION_LIB:= libs +PKG_SUBPKGS:= AXHTTPD LIBAXTLS +PKGSD_LIBAXTLS:= small tls library +PKGSC_LIBAXTLS:= libs DISTFILES:= axTLS-${PKG_VERSION}.tar.gz WRKDIST= ${WRKDIR}/axTLS @@ -22,7 +23,7 @@ WRKDIST= ${WRKDIR}/axTLS include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,AXHTTPD,axhttpd,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,LIBAXTLS,libaxtls,${PKG_VERSION}-${PKG_RELEASE},,${PKG_DESCR_LIB},${PKG_SECTION_LIB})) +$(eval $(call PKG_template,LIBAXTLS,libaxtls,${PKG_VERSION}-${PKG_RELEASE},,${PKGSD_LIBAXTLS},${PKGSC_LIBAXTLS})) CONFIG_STYLE:= manual INSTALL_STYLE:= manual diff --git a/package/base-files/Makefile b/package/base-files/Makefile index db1162946..c0d7a0724 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -66,7 +66,7 @@ endif echo $(ADK_RUNTIME_HOSTNAME) > \ $(IDIR_BASE_FILES)/etc/hostname test -z $(ADK_RUNTIME_PASSWORD) || \ - $(SED) 's,\*NP\*,'"$$(${STAGING_TOOLS}/bin/mkcrypt \ + $(SED) 's,\*NP\*,'"$$(${TOPDIR}/bin/tools/mkcrypt \ ${ADK_RUNTIME_PASSWORD}),g" $(IDIR_BASE_FILES)/etc/shadow git log -1|head -1|sed -e 's#commit ##' \ > $(IDIR_BASE_FILES)/etc/adkversion @@ -77,12 +77,4 @@ ifneq (${ADK_PACKAGE_CONFIG_IN_ETC},) chmod 600 $(IDIR_BASE_FILES)/etc/adkconfig.gz endif -rebuild: - @if [ -f ${TOPDIR}/.rebuild.${PKG_NAME} ];then \ - rm ${WRKBUILD}/.build_done; \ - rm ${TOPDIR}/.rebuild.${PKG_NAME}; \ - fi - -fake: rebuild - include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/bc/Makefile b/package/bc/Makefile index 8912693c0..3ee37411b 100644 --- a/package/bc/Makefile +++ b/package/bc/Makefile @@ -9,9 +9,11 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= d44b5dddebd8a7a7309aea6c36fda117 PKG_DESCR:= An arbitrary precision calculator language PKG_SECTION:= utils -PKG_URL:= http://www.gnu.org/software/bc +PKG_URL:= http://www.gnu.org/software/bc/ PKG_SITES:= http://ftp.gnu.org/pub/gnu/bc/ +PKG_SUBPKGS:= BC DC + include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,BC,bc,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/bigreqsproto/Makefile b/package/bigreqsproto/Makefile index 52b61b367..05488be69 100644 --- a/package/bigreqsproto/Makefile +++ b/package/bigreqsproto/Makefile @@ -8,6 +8,7 @@ PKG_VERSION:= 1.1.0 PKG_RELEASE:= 1 PKG_MD5SUM:= 882d49cc3bb591dbdccdf9e680bd2e4b PKG_SITES:= ${MASTER_SITE_XORG} +PKG_SUBPKGS:= include $(TOPDIR)/mk/package.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/bind/Makefile b/package/bind/Makefile index 2ad76e560..9adff33fd 100644 --- a/package/bind/Makefile +++ b/package/bind/Makefile @@ -10,17 +10,19 @@ PKG_MD5SUM:= c245b5d1aa0a4f53d9538faa1efe2c3f PKG_DESCR:= popular DNS server PKG_SECTION:= dns PKG_DEPENDS:= libopenssl libbind libxml2 -PKG_BUILDDEP+= openssl libxml2 -PKG_URL:= https://www.isc.org/software/bind +PKG_BUILDDEP:= openssl libxml2 +PKG_URL:= https://www.isc.org/software/bind/ PKG_SITES:= ftp://ftp.isc.org/isc/bind9/${PKG_VERSION}/ -PKG_DESCR_1:= dynamic dns client (nsupdate utility) -PKG_DESCR_2:= library for the bind software suite -PKG_DESCR_3:= rndc & rndc-confgen utilities -PKG_DESCR_4:= check utilities -PKG_DESCR_5:= dnssec utilities -PKG_DESCR_6:= host utility -PKG_DESCR_7:= dig utility +PKG_SUBPKGS:= BIND_SERVER BIND_CLIENT LIBBIND BIND_RNDC BIND_CHECK BIND_DNSSEC BIND_HOST BIND_DIG +PKGSD_LIBBIND:= library for the bind software suite +PKGSC_LIBBIND:= libs +PKGSD_BIND_CLIENT:= dynamic dns client (nsupdate utility) +PKGSD_BIND_RNDC:= rndc & rndc-confgen utilities +PKGSD_BIND_CHECK:= check utilities +PKGSD_BIND_DNSSEC:= dnssec utilities +PKGSD_BIND_HOST:= host utility +PKGSD_BIND_DIG:= dig utility PKG_FLAVOURS:= WITH_IPV6 PKGFD_WITH_IPV6:= enable IPv6 support @@ -28,13 +30,13 @@ PKGFD_WITH_IPV6:= enable IPv6 support include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,BIND_SERVER,bind-server,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,BIND_CLIENT,bind-client,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_1},${PKG_SECTION})) -$(eval $(call PKG_template,LIBBIND,libbind,${PKG_VERSION}-${PKG_RELEASE},,${PKG_DESCR_2},libs)) -$(eval $(call PKG_template,BIND_RNDC,bind-rndc,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_3},${PKG_SECTION})) -$(eval $(call PKG_template,BIND_CHECK,bind-check,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_4},${PKG_SECTION})) -$(eval $(call PKG_template,BIND_DNSSEC,bind-dnssec,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_5},${PKG_SECTION})) -$(eval $(call PKG_template,BIND_HOST,bind-host,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_6},${PKG_SECTION})) -$(eval $(call PKG_template,BIND_DIG,bind-dig,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_7},${PKG_SECTION})) +$(eval $(call PKG_template,BIND_CLIENT,bind-client,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_BIND_CLIENT},${PKG_SECTION})) +$(eval $(call PKG_template,LIBBIND,libbind,${PKG_VERSION}-${PKG_RELEASE},,${PKGSD_LIBBIND},${PKGSC_LIBBIND})) +$(eval $(call PKG_template,BIND_RNDC,bind-rndc,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_BIND_RNDC},${PKG_SECTION})) +$(eval $(call PKG_template,BIND_CHECK,bind-check,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_BIND_CHECK},${PKG_SECTION})) +$(eval $(call PKG_template,BIND_DNSSEC,bind-dnssec,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_BIND_DNSSEC},${PKG_SECTION})) +$(eval $(call PKG_template,BIND_HOST,bind-host,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_BIND_HOST},${PKG_SECTION})) +$(eval $(call PKG_template,BIND_DIG,bind-dig,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_BIND_DIG},${PKG_SECTION})) CONFIGURE_ARGS+= --with-randomdev=/dev/urandom \ --disable-threads \ diff --git a/package/binutils/Makefile b/package/binutils/Makefile index 478a135c1..b076323d5 100644 --- a/package/binutils/Makefile +++ b/package/binutils/Makefile @@ -8,16 +8,16 @@ PKG_DESCR:= binary utilities (nm, objdump, as, ..) PKG_SECTION:= lang PKG_DEPENDS:= libbfd -PKG_NAME_LIBBFD:= libbfd -PKG_DESCR_LIBBFD:= bfd library -PKG_SECTION_LIBBFD:= libs +PKG_SUBPKGS:= BINUTILS LIBBFD +PKGSD_LIBBFD:= Binary File Descriptor library +PKGSC_LIBBFD:= libs PKG_HOST_DEPENDS:= !cygwin include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,BINUTILS,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,LIBBFD,${PKG_NAME_LIBBFD},${PKG_VERSION}-${PKG_RELEASE},,${PKG_DESCR_LIBBFD},${PKG_SECTION_LIBBFD})) +$(eval $(call PKG_template,LIBBFD,libbfd,${PKG_VERSION}-${PKG_RELEASE},,${PKGSD_LIBBFD},${PKGSC_LIBBFD})) TCFLAGS+= -fPIC CONFIGURE_ARGS+= --disable-werror \ diff --git a/package/bitlbee/Makefile b/package/bitlbee/Makefile index 223fdd654..41319a738 100644 --- a/package/bitlbee/Makefile +++ b/package/bitlbee/Makefile @@ -10,8 +10,8 @@ PKG_MD5SUM:= 26b9bfc5446bdf0e932e8074d117be67 PKG_DESCR:= IRC gateway to IM chat networks PKG_SECTION:= chat PKG_DEPENDS:= glib libiconv libopenssl -PKG_BUILDDEP+= glib libiconv openssl -PKG_URL:= http://www.bitlbee.org +PKG_BUILDDEP:= glib libiconv openssl +PKG_URL:= http://www.bitlbee.org/ PKG_SITES:= http://get.bitlbee.org/src/ include ${TOPDIR}/mk/package.mk diff --git a/package/bluez-firmware/Makefile b/package/bluez-firmware/Makefile index 50961a2d7..56ce5d5ed 100644 --- a/package/bluez-firmware/Makefile +++ b/package/bluez-firmware/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 1cc3cefad872e937e05de5a0a2b390dd PKG_DESCR:= Bluez firmware for BCM2033 PKG_SECTION:= bluetooth PKG_DEPENDS:= kmod-bt bluez -PKG_URL:= http://www.bluez.org +PKG_URL:= http://www.bluez.org/ PKG_SITES:= http://bluez.sourceforge.net/download/ include ${TOPDIR}/mk/package.mk diff --git a/package/bluez/Makefile b/package/bluez/Makefile index 34c8e7b7c..eb72b47f7 100644 --- a/package/bluez/Makefile +++ b/package/bluez/Makefile @@ -10,8 +10,8 @@ PKG_MD5SUM:= 1c7cee215bc84656b1edee019cee78f5 PKG_DESCR:= bluetooth libraries and applications PKG_SECTION:= bluetooth PKG_DEPENDS:= kmod-bt libusb glib dbus -PKG_BUILDDEP+= libusb dbus glib -PKG_URL:= http://www.bluez.org +PKG_BUILDDEP:= libusb dbus glib +PKG_URL:= http://www.bluez.org/ PKG_SITES:= ${MASTER_SITE_KERNEL:=bluetooth/} include ${TOPDIR}/mk/package.mk diff --git a/package/bogofilter/Makefile b/package/bogofilter/Makefile index c923305b2..103f95c68 100644 --- a/package/bogofilter/Makefile +++ b/package/bogofilter/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= a12a16d88d6d565dacf2a5e6259a3337 PKG_DESCR:= mail filter PKG_SECTION:= mail PKG_DEPENDS:= libiconv libdb -PKG_BUILDDEP+= libiconv libdb +PKG_BUILDDEP:= libiconv libdb PKG_URL:= http://bogofilter.sourceforge.net/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=bogofilter/} diff --git a/package/busybox/Makefile b/package/busybox/Makefile index cdd0d8538..efae99f2a 100644 --- a/package/busybox/Makefile +++ b/package/busybox/Makefile @@ -14,13 +14,14 @@ PKG_SITES:= http://www.busybox.net/downloads/ DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 -PKG_DESCR_UDHCPD:= uDHCPD meta package -PKG_SECTION_UDHCPD:= net +PKG_SUBPKGS:= BUSYBOX UDHCPD +PKGSD_UDHCPD:= uDHCPD meta package +PKGSC_UDHCPD:= net include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,BUSYBOX,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,UDHCPD,udhcpd,${PKG_VERSION}-${PKG_RELEASE},busybox,${PKG_DESCR_UDHCPD},${PKG_SECTION_UDHCPD})) +$(eval $(call PKG_template,UDHCPD,udhcpd,${PKG_VERSION}-${PKG_RELEASE},busybox,${PKGSD_UDHCPD},${PKGSC_UDHCPD})) SUB_INSTALLS-y:= SUB_INSTALLS-m:= @@ -30,15 +31,10 @@ CONFIG_STYLE:= manual BUILD_STYLE:= manual INSTALL_STYLE:= manual -${TOPDIR}/.busyboxcfg: ${TOPDIR}/.config +do-configure: grep BUSYBOX_ $(TOPDIR)/.config|sed -e 's/BUSYBOX_/CONFIG_/' > \ - ${TOPDIR}/.busyboxcfg - -${WRKBUILD}/.config: ${TOPDIR}/.busyboxcfg - cp $(TOPDIR)/.busyboxcfg ${WRKBUILD}/.config + ${WRKBUILD}/.config $(SED) 's;@IDIR@;${WRKINST};' ${WRKBUILD}/.config - -do-configure: ${WRKBUILD}/.config ifeq ($(ADK_NATIVE),y) yes '' | \ $(MAKE) V=1 \ @@ -51,7 +47,7 @@ else ARCH="$(ARCH)" HOSTCC="$(HOSTCC)" -C $(WRKBUILD) oldconfig $(MAKE_TRACE) endif -do-build: do-configure +do-build: ifeq ($(ADK_NATIVE),y) $(MAKE) V=1 \ IPKG_ARCH="$(CPU_ARCH)" ARCH="$(ARCH)" HOSTCC="$(HOSTCC)" -C $(WRKBUILD) busybox @@ -60,7 +56,7 @@ else IPKG_ARCH="$(CPU_ARCH)" ARCH="$(ARCH)" HOSTCC="$(HOSTCC)" -C $(WRKBUILD) busybox endif -do-install: ${WRKBUILD}/.config ${SUB_INSTALLS-m} ${SUB_INSTALLS-y} +do-install: ${SUB_INSTALLS-m} ${SUB_INSTALLS-y} ifeq ($(ADK_NATIVE),y) $(MAKE) V=1 \ IPKG_ARCH="$(CPU_ARCH)" ARCH="$(ARCH)" HOSTCC="$(HOSTCC)" -C $(WRKBUILD) install $(MAKE_TRACE) @@ -81,12 +77,4 @@ udhcpd-install: ${INSTALL_DIR} ${IDIR_UDHCPD}/etc/ ${INSTALL_DATA} ./files/udhcpd.conf ${IDIR_UDHCPD}/etc/ -rebuild: - @if [ -f ${TOPDIR}/.rebuild.${PKG_NAME} ];then \ - rm ${WRKBUILD}/.build_done; \ - rm ${TOPDIR}/.rebuild.${PKG_NAME}; \ - fi - -fake: rebuild - include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/busybox/config/Config.in b/package/busybox/config/Config.in index 2aaf7ee9f..bf0d9d8c0 100644 --- a/package/busybox/config/Config.in +++ b/package/busybox/config/Config.in @@ -369,7 +369,7 @@ config BUSYBOX_BUILD_LIBBUSYBOX config BUSYBOX_FEATURE_INDIVIDUAL bool "Produce a binary for each applet, linked against libbusybox" - default y + default n depends on BUSYBOX_BUILD_LIBBUSYBOX help If your CPU architecture doesn't allow for sharing text/rodata @@ -387,7 +387,7 @@ config BUSYBOX_FEATURE_INDIVIDUAL config BUSYBOX_FEATURE_SHARED_BUSYBOX bool "Produce additional busybox binary linked against libbusybox" - default y + default n depends on BUSYBOX_BUILD_LIBBUSYBOX help Build busybox, dynamically linked against libbusybox.so.N.N.N. diff --git a/package/busybox/config/coreutils/Config.in b/package/busybox/config/coreutils/Config.in index 85d4342e5..75130fcad 100644 --- a/package/busybox/config/coreutils/Config.in +++ b/package/busybox/config/coreutils/Config.in @@ -74,7 +74,7 @@ config BUSYBOX_CKSUM config BUSYBOX_COMM bool "comm" - default n + default y help comm is used to compare two files line by line and return a three-column output. @@ -263,7 +263,7 @@ config BUSYBOX_FEATURE_EXPAND_LONG_OPTIONS config BUSYBOX_EXPR bool "expr" - default n + default y help expr is used to calculate numbers and print the result to standard output. @@ -324,7 +324,7 @@ config BUSYBOX_ID config BUSYBOX_INSTALL bool "install" - default n + default y help Copy files and set attributes. @@ -479,7 +479,7 @@ config BUSYBOX_NOHUP config BUSYBOX_OD bool "od" - default n + default y help od is used to dump binary files in octal and other formats. @@ -531,7 +531,7 @@ config BUSYBOX_RM config BUSYBOX_RMDIR bool "rmdir" - default n + default y help rmdir is used to remove empty directories. @@ -615,7 +615,7 @@ config BUSYBOX_FEATURE_SORT_BIG config BUSYBOX_SPLIT bool "split" - default n + default y help split a file into pieces. @@ -663,7 +663,7 @@ config BUSYBOX_SYNC config BUSYBOX_TAC bool "tac" - default n + default y help tac is used to concatenate and print files in reverse. @@ -684,7 +684,7 @@ config BUSYBOX_FEATURE_FANCY_TAIL config BUSYBOX_TEE bool "tee" - default n + default y help tee is used to read from standard input and write to standard output and files. @@ -746,7 +746,7 @@ config BUSYBOX_FEATURE_TR_EQUIV config BUSYBOX_TRUE bool "true" - default n + default y help true returns an exit code of TRUE (0). @@ -830,7 +830,7 @@ config BUSYBOX_WHOAMI config BUSYBOX_YES bool "yes" - default n + default y help yes is used to repeatedly output a specific string, or the default string `y'. diff --git a/package/busybox/config/debianutils/Config.in b/package/busybox/config/debianutils/Config.in index 9246370ca..891d194e0 100644 --- a/package/busybox/config/debianutils/Config.in +++ b/package/busybox/config/debianutils/Config.in @@ -7,7 +7,7 @@ menu "Debian Utilities" config BUSYBOX_MKTEMP bool "mktemp" - default n + default y help mktemp is used to create unique temporary files diff --git a/package/busybox/config/editors/Config.in b/package/busybox/config/editors/Config.in index 598514d95..52594b0ef 100644 --- a/package/busybox/config/editors/Config.in +++ b/package/busybox/config/editors/Config.in @@ -22,7 +22,7 @@ config BUSYBOX_FEATURE_AWK_LIBM config BUSYBOX_CMP bool "cmp" - default n + default y help cmp is used to compare two files and returns the result to standard output. diff --git a/package/busybox/patches/006-od-bloat.patch b/package/busybox/patches/006-od-bloat.patch new file mode 100644 index 000000000..8c608ca87 --- /dev/null +++ b/package/busybox/patches/006-od-bloat.patch @@ -0,0 +1,214 @@ +diff -Nur busybox-1.17.1.orig/coreutils/od.c busybox-1.17.1/coreutils/od.c +--- busybox-1.17.1.orig/coreutils/od.c 2010-07-06 04:25:53.000000000 +0200 ++++ busybox-1.17.1/coreutils/od.c 2010-08-15 12:50:31.000000000 +0200 +@@ -13,210 +13,5 @@ + + + #include "libbb.h" +-#if ENABLE_DESKTOP + /* This one provides -t (busybox's own build script needs it) */ + #include "od_bloaty.c" +-#else +- +-#include "dump.h" +- +-static void +-odoffset(dumper_t *dumper, int argc, char ***argvp) +-{ +- char *num, *p; +- int base; +- char *end; +- +- /* +- * The offset syntax of od(1) was genuinely bizarre. First, if +- * it started with a plus it had to be an offset. Otherwise, if +- * there were at least two arguments, a number or lower-case 'x' +- * followed by a number makes it an offset. By default it was +- * octal; if it started with 'x' or '0x' it was hex. If it ended +- * in a '.', it was decimal. If a 'b' or 'B' was appended, it +- * multiplied the number by 512 or 1024 byte units. There was +- * no way to assign a block count to a hex offset. +- * +- * We assumes it's a file if the offset is bad. +- */ +- p = **argvp; +- +- if (!p) { +- /* hey someone is probably piping to us ... */ +- return; +- } +- +- if ((*p != '+') +- && (argc < 2 +- || (!isdigit(p[0]) +- && ((p[0] != 'x') || !isxdigit(p[1]))))) +- return; +- +- base = 0; +- /* +- * skip over leading '+', 'x[0-9a-fA-f]' or '0x', and +- * set base. +- */ +- if (p[0] == '+') +- ++p; +- if (p[0] == 'x' && isxdigit(p[1])) { +- ++p; +- base = 16; +- } else if (p[0] == '0' && p[1] == 'x') { +- p += 2; +- base = 16; +- } +- +- /* skip over the number */ +- if (base == 16) +- for (num = p; isxdigit(*p); ++p) +- continue; +- else +- for (num = p; isdigit(*p); ++p) +- continue; +- +- /* check for no number */ +- if (num == p) +- return; +- +- /* if terminates with a '.', base is decimal */ +- if (*p == '.') { +- if (base) +- return; +- base = 10; +- } +- +- dumper->dump_skip = strtol(num, &end, base ? base : 8); +- +- /* if end isn't the same as p, we got a non-octal digit */ +- if (end != p) +- dumper->dump_skip = 0; +- else { +- if (*p) { +- if (*p == 'b') { +- dumper->dump_skip *= 512; +- ++p; +- } else if (*p == 'B') { +- dumper->dump_skip *= 1024; +- ++p; +- } +- } +- if (*p) +- dumper->dump_skip = 0; +- else { +- ++*argvp; +- /* +- * If the offset uses a non-octal base, the base of +- * the offset is changed as well. This isn't pretty, +- * but it's easy. +- */ +-#define TYPE_OFFSET 7 +- { +- char x_or_d; +- if (base == 16) { +- x_or_d = 'x'; +- goto DO_X_OR_D; +- } +- if (base == 10) { +- x_or_d = 'd'; +- DO_X_OR_D: +- dumper->fshead->nextfu->fmt[TYPE_OFFSET] +- = dumper->fshead->nextfs->nextfu->fmt[TYPE_OFFSET] +- = x_or_d; +- } +- } +- } +- } +-} +- +-static const char *const add_strings[] = { +- "16/1 \"%3_u \" \"\\n\"", /* a */ +- "8/2 \" %06o \" \"\\n\"", /* B, o */ +- "16/1 \"%03o \" \"\\n\"", /* b */ +- "16/1 \"%3_c \" \"\\n\"", /* c */ +- "8/2 \" %05u \" \"\\n\"", /* d */ +- "4/4 \" %010u \" \"\\n\"", /* D */ +- "2/8 \" %21.14e \" \"\\n\"", /* e (undocumented in od), F */ +- "4/4 \" %14.7e \" \"\\n\"", /* f */ +- "4/4 \" %08x \" \"\\n\"", /* H, X */ +- "8/2 \" %04x \" \"\\n\"", /* h, x */ +- "4/4 \" %11d \" \"\\n\"", /* I, L, l */ +- "8/2 \" %6d \" \"\\n\"", /* i */ +- "4/4 \" %011o \" \"\\n\"", /* O */ +-}; +- +-static const char od_opts[] ALIGN1 = "aBbcDdeFfHhIiLlOoXxv"; +- +-static const char od_o2si[] ALIGN1 = { +- 0, 1, 2, 3, 5, +- 4, 6, 6, 7, 8, +- 9, 0xa, 0xb, 0xa, 0xa, +- 0xb, 1, 8, 9, +-}; +- +-int od_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; +-int od_main(int argc, char **argv) +-{ +- int ch; +- int first = 1; +- char *p; +- dumper_t *dumper = alloc_dumper(); +- +- while ((ch = getopt(argc, argv, od_opts)) > 0) { +- if (ch == 'v') { +- dumper->dump_vflag = ALL; +- } else if (((p = strchr(od_opts, ch)) != NULL) && (*p != '\0')) { +- if (first) { +- first = 0; +- bb_dump_add(dumper, "\"%07.7_Ao\n\""); +- bb_dump_add(dumper, "\"%07.7_ao \""); +- } else { +- bb_dump_add(dumper, "\" \""); +- } +- bb_dump_add(dumper, add_strings[(int)od_o2si[(p - od_opts)]]); +- } else { /* P, p, s, w, or other unhandled */ +- bb_show_usage(); +- } +- } +- if (!dumper->fshead) { +- bb_dump_add(dumper, "\"%07.7_Ao\n\""); +- bb_dump_add(dumper, "\"%07.7_ao \" 8/2 \"%06o \" \"\\n\""); +- } +- +- argc -= optind; +- argv += optind; +- +- odoffset(dumper, argc, &argv); +- +- return bb_dump_dump(dumper, argv); +-} +-#endif /* ENABLE_DESKTOP */ +- +-/*- +- * Copyright (c) 1990 The Regents of the University of California. +- * All rights reserved. +- * +- * Redistribution and use in source and binary forms, with or without +- * modification, are permitted provided that the following conditions +- * are met: +- * 1. Redistributions of source code must retain the above copyright +- * notice, this list of conditions and the following disclaimer. +- * 2. Redistributions in binary form must reproduce the above copyright +- * notice, this list of conditions and the following disclaimer in the +- * documentation and/or other materials provided with the distribution. +- * 3. Neither the name of the University nor the names of its contributors +- * may be used to endorse or promote products derived from this software +- * without specific prior written permission. +- * +- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +- * SUCH DAMAGE. +- */ diff --git a/package/bwm/Makefile b/package/bwm/Makefile index c26ae51ec..119f23c11 100644 --- a/package/bwm/Makefile +++ b/package/bwm/Makefile @@ -18,9 +18,9 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,BWM,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -CONFIG_STYLE:= manual -BUILD_STYLE:= manual -INSTALL_STYLE:= manual +CONFIG_STYLE:= manual +BUILD_STYLE:= manual +INSTALL_STYLE:= manual do-build: ${TARGET_CC} ${TARGET_CFLAGS} ${WRKBUILD}/bwm.c -o ${WRKBUILD}/bwm diff --git a/package/bzip2/Makefile b/package/bzip2/Makefile index fc15ee0ab..b94a29059 100644 --- a/package/bzip2/Makefile +++ b/package/bzip2/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 3c15a0c8d1d3ee1c46a1634d00617b1a PKG_DESCR:= bzip2 compression utility PKG_SECTION:= archive -PKG_URL:= http://www.bzip.org +PKG_URL:= http://www.bzip.org/ PKG_SITES:= http://www.bzip.org/1.0.5/ include ${TOPDIR}/mk/package.mk diff --git a/package/bzr/Makefile b/package/bzr/Makefile index d67497c22..7b6836cae 100644 --- a/package/bzr/Makefile +++ b/package/bzr/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 0b253f59601ebc9ee5975c612fc65f43 PKG_DESCR:= bazaar PKG_SECTION:= scm PKG_DEPENDS:= python2 -PKG_BUILDDEP+= python2 +PKG_BUILDDEP:= python2 PKG_URL:= http://bazaar.canonical.com/en/ PKG_SITES:= http://launchpad.net/bzr/2.0/${PKG_VERSION}/+download/ diff --git a/package/cairo/Makefile b/package/cairo/Makefile index 4b6f40c7b..5c2a6f96c 100644 --- a/package/cairo/Makefile +++ b/package/cairo/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= b60a82f405f9400bbfdcf850b1728d25 PKG_DESCR:= cairo graphics library PKG_SECTION:= libs PKG_DEPENDS:= fontconfig libfreetype libpng libx11 pixman -PKG_BUILDDEP+= libpng pixman freetype fontconfig libX11 +PKG_BUILDDEP:= libpng pixman freetype fontconfig libX11 PKG_URL:= http://cairographics.org/ PKG_SITES:= http://cairographics.org/releases/ diff --git a/package/ccid/Makefile b/package/ccid/Makefile index bd3223d77..87f48c483 100644 --- a/package/ccid/Makefile +++ b/package/ccid/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 7fcdbacacd955659286f988fa9b6e0be PKG_DESCR:= a generic USB CCID and ICCD driver PKG_SECTION:= crypto -PKG_BUILDDEP+= pcsc-lite +PKG_BUILDDEP:= pcsc-lite PKG_URL:= http://pcsclite.alioth.debian.org/ccid.html PKG_SITES:= https://alioth.debian.org/frs/download.php/3281/ diff --git a/package/cfgfs/Makefile b/package/cfgfs/Makefile index a67ad4329..77ec839e3 100644 --- a/package/cfgfs/Makefile +++ b/package/cfgfs/Makefile @@ -8,20 +8,25 @@ PKG_VERSION:= 1.0.7 PKG_RELEASE:= 3 PKG_DESCR:= compressed config filesystem PKG_SECTION:= base +PKG_URL:= http://www.openadk.org/ PKG_TARGET_DEPENDS:= alix wrap foxboard ag241 foxg20 routerboard +PKG_CFLINE_CFGFS:= select BUSYBOX_COMM@ +PKG_CFLINE_CFGFS+= select BUSYBOX_MD5SUM@ +PKG_CFLINE_CFGFS+= select BUSYBOX_XARGS@ +PKG_CFLINE_CFGFS+= select BUSYBOX_FEATURE_SORT_BIG@ +PKG_CFLINE_CFGFS+= select BUSYBOX_DIFF@ +PKG_CFLINE_CFGFS+= depends on !ADK_TARGET_ROOTFS_NFSROOT && !ADK_TARGET_ROOTFS_INITRAMFS_PIGGYBACK && !ADK_TARGET_ROOTFS_INITRAMFS +PKG_DFLT_CFGFS:= y + WRKDIST= ${WRKDIR}/${PKG_NAME}-${PKG_VERSION} NO_DISTFILES:= 1 -CFLINE_CFGFS:= select BUSYBOX_COMM\n\tselect BUSYBOX_MD5SUM\n\tselect BUSYBOX_XARGS\n\tselect BUSYBOX_FEATURE_SORT_BIG\n\tselect BUSYBOX_DIFF\n\tdepends on !ADK_TARGET_ROOTFS_NFSROOT && !ADK_TARGET_ROOTFS_INITRAMFS_PIGGYBACK && !ADK_TARGET_ROOTFS_INITRAMFS - include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,CFGFS,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -PKGDFLT_CFGFS= y - CONFIG_STYLE:= manual INSTALL_STYLE:= manual diff --git a/package/cgilib/Makefile b/package/cgilib/Makefile index 316b5e143..7fd1dc97a 100644 --- a/package/cgilib/Makefile +++ b/package/cgilib/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 2c7053f58dfb06f7a80a112797ed7e86 PKG_DESCR:= Simple CGI Library PKG_SECTION:= libs -PKG_URL:= http://www.infodrom.org/projects/cgilib +PKG_URL:= http://www.infodrom.org/projects/cgilib/ PKG_SITES:= http://www.infodrom.org/projects/cgilib/download/ include ${TOPDIR}/mk/package.mk diff --git a/package/chillispot/Makefile b/package/chillispot/Makefile index d7bbad374..2b5e15872 100644 --- a/package/chillispot/Makefile +++ b/package/chillispot/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 9d2597756af3fa14d7331b4a3651fc9b PKG_DESCR:= Wireless LAN Access Point Controller PKG_SECTION:= wifi PKG_DEPENDS:= kmod-tun -PKG_URL:= http://www.chillispot.info +PKG_URL:= http://www.chillispot.info/ PKG_SITES= http://www.chillispot.info/download/ include ${TOPDIR}/mk/package.mk diff --git a/package/collectd/Makefile b/package/collectd/Makefile index 07f54226e..52e6e6ab5 100644 --- a/package/collectd/Makefile +++ b/package/collectd/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= c473cf8e9f22f5a9f7ef4c5be1b0c436 PKG_DESCR:= System statistics collection daemon PKG_SECTION:= misc PKG_DEPENDS:= libpthread -PKG_URL:= http://collectd.org +PKG_URL:= http://collectd.org/ PKG_SITES:= http://collectd.org/files/ PKG_FLAVOURS:= CPU LOAD MEMORY PING diff --git a/package/compositeproto/Makefile b/package/compositeproto/Makefile index 6f7572f55..3b5abb435 100644 --- a/package/compositeproto/Makefile +++ b/package/compositeproto/Makefile @@ -8,6 +8,7 @@ PKG_VERSION:= 0.4.1 PKG_RELEASE:= 1 PKG_MD5SUM:= 6994a209774fe7877fd8e0c9fafe2466 PKG_SITES:= ${MASTER_SITE_XORG} +PKG_SUBPKGS:= include $(TOPDIR)/mk/package.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/conntrack-tools/Makefile b/package/conntrack-tools/Makefile index 3e22262f7..1e8971ecd 100644 --- a/package/conntrack-tools/Makefile +++ b/package/conntrack-tools/Makefile @@ -10,9 +10,10 @@ PKG_MD5SUM:= 35b0ab9cde069b4ec8a493daae82d67b PKG_DESCR:= Connection tracking userspace tools PKG_SECTION:= firewall PKG_DEPENDS:= libnetfilter-conntrack -PKG_BUILDDEP+= libnetfilter_conntrack -PKG_URL:= http://conntrack-tools.netfilter.org +PKG_BUILDDEP:= libnetfilter_conntrack +PKG_URL:= http://conntrack-tools.netfilter.org/ PKG_SITES:= http://www.netfilter.org/projects/conntrack-tools/files/ + DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 include $(TOPDIR)/mk/package.mk diff --git a/package/coreutils/Makefile b/package/coreutils/Makefile index bd7a621af..39ab9fddf 100644 --- a/package/coreutils/Makefile +++ b/package/coreutils/Makefile @@ -12,13 +12,14 @@ PKG_SECTION:= base PKG_URL:= http://www.gnu.org/software/coreutils/ PKG_SITES:= http://ftp.gnu.org/gnu/coreutils/ -PKG_DESCR_TSORT:= topological sort utility -PKG_SECTION_TSORT:= misc +PKG_SUBPKGS:= TSORT +PKGSD_TSORT:= topological sort utility +PKGSC_TSORT:= misc include $(TOPDIR)/mk/package.mk #$(eval $(call PKG_template,COREUTILS,$(PKG_NAME),$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,TSORT,tsort,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_TSORT},${PKG_SECTION_TSORT})) +$(eval $(call PKG_template,TSORT,tsort,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_TSORT},${PKGSC_TSORT})) post-install: $(INSTALL_DIR) $(IDIR_TSORT)/usr/bin diff --git a/package/cpufrequtils/Makefile b/package/cpufrequtils/Makefile index 1962dd729..19ceff96a 100644 --- a/package/cpufrequtils/Makefile +++ b/package/cpufrequtils/Makefile @@ -11,7 +11,8 @@ PKG_DESCR:= utilities for the Linux kernel cpufreq subsystem PKG_SECTION:= utils PKG_URL:= http://www.kernel.org/pub/linux/utils/kernel/cpufreq/cpufrequtils.html PKG_SITES:= http://www.kernel.org/pub/linux/utils/kernel/cpufreq/ -PKG_TARGET_DEPENDS:= !foxboard !foxg20 !ag241 + +PKG_TARGET_DEPENDS:= !ag241 !foxboard !foxg20 include $(TOPDIR)/mk/package.mk diff --git a/package/cryptinit/Makefile b/package/cryptinit/Makefile index b82e67e51..e3204b615 100644 --- a/package/cryptinit/Makefile +++ b/package/cryptinit/Makefile @@ -6,15 +6,15 @@ include ${TOPDIR}/rules.mk PKG_NAME:= cryptinit PKG_VERSION:= 1.0.2 PKG_RELEASE:= 1 -PKG_BUILDDEP+= cryptsetup lvm PKG_DESCR:= init for encrypted rootfilesystem PKG_SECTION:= base +PKG_BUILDDEP:= cryptsetup lvm + +PKG_CFLINE_CRYPTINIT:= depends on ADK_TARGET_ROOTFS_ENCRYPTED WRKDIST= ${WRKDIR}/${PKG_NAME}-${PKG_VERSION} NO_DISTFILES:= 1 -CFLINE_CRYPTINIT:= depends on ADK_TARGET_ROOTFS_ENCRYPTED - include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,CRYPTINIT,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/cryptsetup/Makefile b/package/cryptsetup/Makefile index 3daa946da..893f431b9 100644 --- a/package/cryptsetup/Makefile +++ b/package/cryptsetup/Makefile @@ -9,10 +9,10 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 318a64470861ea5b92a52f2014f1e7c1 PKG_DESCR:= LUKS cryptsetup tools PKG_SECTION:= crypto -PKG_DEPENDS:= libgcrypt device-mapper libuuid libpopt \ - kmod-dm-crypt kmod-crypto-aes kmod-crypto-cbc \ - kmod-crypto-sha256 kmod-blk-dev-dm -PKG_BUILDDEP+= libgcrypt popt e2fsprogs lvm +PKG_DEPENDS:= libgcrypt device-mapper libuuid libpopt +PKG_DEPENDS+= kmod-dm-crypt kmod-crypto-aes kmod-crypto-cbc +PKG_DEPENDS+= kmod-crypto-sha256 kmod-blk-dev-dm +PKG_BUILDDEP:= libgcrypt popt e2fsprogs lvm PKG_URL:= http://cryptsetup.googlecode.com/ PKG_SITES:= http://cryptsetup.googlecode.com/files/ diff --git a/package/ctorrent/Makefile b/package/ctorrent/Makefile index c21c89d66..ea39d0d64 100755 --- a/package/ctorrent/Makefile +++ b/package/ctorrent/Makefile @@ -6,10 +6,10 @@ include ${TOPDIR}/rules.mk PKG_NAME:= ctorrent PKG_VERSION:= dnh3.3.2 PKG_RELEASE:= 1 -PKG_BUILDDEP+= openssl PKG_MD5SUM:= 59b23dd05ff70791cd6449effa7fc3b6 PKG_DESCR:= console-based BitTorrent client PKG_SECTION:= p2p +PKG_BUILDDEP:= openssl PKG_URL:= http://www.rahul.net/dholmes/ctorrent PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=dtorrent/} diff --git a/package/cups/Makefile b/package/cups/Makefile index 24fcfa408..635638767 100644 --- a/package/cups/Makefile +++ b/package/cups/Makefile @@ -6,13 +6,12 @@ include ${TOPDIR}/rules.mk PKG_NAME:= cups PKG_VERSION:= 1.4.2 PKG_RELEASE:= 1 -PKG_BUILDDEP+= zlib PKG_MD5SUM:= d95e2d588e3d36e563027a963b117b1b PKG_DESCR:= Common Unix Printing System PKG_SECTION:= net/misc PKG_DEPENDS:= zlib libpthread -PKG_BUILDDEP+= zlib -PKG_URL:= http://www.cups.org +PKG_BUILDDEP:= zlib +PKG_URL:= http://www.cups.org/ PKG_SITES:= ftp://ftp.easysw.com/pub/cups/${PKG_VERSION}/ DISTFILES:= ${PKG_NAME}-${PKG_VERSION}-source.tar.bz2 diff --git a/package/curl/Makefile b/package/curl/Makefile index 41c271e22..781adb27e 100644 --- a/package/curl/Makefile +++ b/package/curl/Makefile @@ -10,15 +10,16 @@ PKG_MD5SUM:= 6dfb911a254a1b5ca8b534b98f2196aa PKG_DESCR:= a client-side URL transfer tool PKG_SECTION:= www PKG_DEPENDS:= libcurl -PKG_BUILDDEP+= openssl zlib +PKG_BUILDDEP:= openssl zlib PKG_URL:= http://curl.haxx.se/ PKG_SITES:= http://curl.haxx.se/download/ -PKG_DESCR_LIB:= a client-side URL transfer library -PKG_SECTION_LIB:= libs -PKG_DEPENDS_LIB:= libopenssl zlib -PKG_DESCR_LIB_DEV:= development files for libcurl -PKG_SECTION_LIB_DEV:= devel +PKG_SUBPKGS:= CURL LIBCURL LIBCURL_DEV +PKGSD_LIBCURL:= a client-side URL transfer library +PKGSC_LIBCURL:= libs +PKGSS_LIBCURL:= libopenssl zlib +PKGSD_LIBCURL_DEV:= development files for libcurl +PKGSC_LIBCURL_DEV:= devel PKG_FLAVOURS:= WITH_IPV6 PKGFD_WITH_IPV6:= enable IPv6 support @@ -26,8 +27,8 @@ PKGFD_WITH_IPV6:= enable IPv6 support include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,CURL,curl,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,LIBCURL,libcurl,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_LIB},${PKG_DESCR_LIB},${PKG_SECTION_LIB})) -$(eval $(call PKG_template,LIBCURL_DEV,libcurl-dev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_LIB_DEV},${PKG_SECTION_LIB_DEV})) +$(eval $(call PKG_template,LIBCURL,libcurl,${PKG_VERSION}-${PKG_RELEASE},${PKGSS_LIBCURL},${PKGSD_LIBCURL},${PKGSC_LIBCURL})) +$(eval $(call PKG_template,LIBCURL_DEV,libcurl-dev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_LIBCURL_DEV},${PKGSC_LIBCURL_DEV})) SUB_INSTALLS-y:= SUB_INSTALLS-m:= diff --git a/package/cvs/Makefile b/package/cvs/Makefile index c35193271..13e750f6d 100644 --- a/package/cvs/Makefile +++ b/package/cvs/Makefile @@ -16,14 +16,6 @@ include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,CVS,$(PKG_NAME),$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -#CONFIG_STYLE:= manual -# use following to add ./configure options -#CONFIGURE_ARGS+= --disable-foo -# overwrite any configure variables -#CONFIGURE_ENV+= ac_cv_func_setpgrp_void=yes -#BUILD_STYLE:= manual -#INSTALL_STYLE:= manual - post-install: $(INSTALL_DIR) $(IDIR_CVS)/usr/bin $(INSTALL_BIN) $(WRKINST)/usr/bin/cvs \ diff --git a/package/cxxtools/Makefile b/package/cxxtools/Makefile index a21312e41..b01fc0618 100644 --- a/package/cxxtools/Makefile +++ b/package/cxxtools/Makefile @@ -10,8 +10,8 @@ PKG_MD5SUM:= 16ce92a83beb925fa5138fc9a52d55af PKG_DESCR:= a collection of general-purpose C++ classes PKG_SECTION:= libs PKG_DEPENDS:= libiconv -PKG_BUILDDEP+= libiconv -PKG_URL:= http://www.tntnet.org +PKG_BUILDDEP:= libiconv +PKG_URL:= http://www.tntnet.org/ PKG_SITES:= http://www.tntnet.org/download/ include ${TOPDIR}/mk/package.mk diff --git a/package/cyrus-sasl/Makefile b/package/cyrus-sasl/Makefile index d9724f2fc..b5640cb66 100644 --- a/package/cyrus-sasl/Makefile +++ b/package/cyrus-sasl/Makefile @@ -10,12 +10,13 @@ PKG_MD5SUM:= 45dde9d19193ae9dd388eb68b2027bc9 PKG_DESCR:= a general purpose authentication library PKG_SECTION:= libs PKG_DEPENDS:= libopenssl -PKG_BUILDDEP+= openssl -PKG_URL:= http://asg.web.cmu.edu/sasl +PKG_BUILDDEP:= openssl +PKG_URL:= http://asg.web.cmu.edu/sasl/ PKG_SITES:= http://ftp.andrew.cmu.edu/pub/cyrus-mail/ - PKG_NOPARALLEL:= 1 +PKG_SUBPKGS:= LIBSASL2 + include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBSASL2,libsasl2,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/damageproto/Makefile b/package/damageproto/Makefile index 129f2837d..e3883040e 100644 --- a/package/damageproto/Makefile +++ b/package/damageproto/Makefile @@ -8,6 +8,7 @@ PKG_VERSION:= 1.2.0 PKG_RELEASE:= 1 PKG_MD5SUM:= 423516fd64e43e8671120056b0d9f597 PKG_SITES:= ${MASTER_SITE_XORG} +PKG_SUBPKGS:= include $(TOPDIR)/mk/package.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/dansguardian/Makefile b/package/dansguardian/Makefile index 4d69720f9..215ff8c08 100644 --- a/package/dansguardian/Makefile +++ b/package/dansguardian/Makefile @@ -9,11 +9,11 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 0987a1c9bfbdf398118386f10279611a PKG_DESCR:= web content filter proxy PKG_SECTION:= proxy -PKG_CXX:= DANSGUARDIAN PKG_DEPENDS:= libpcre zlib -PKG_BUILDDEP+= pcre zlib -PKG_URL:= http://dansguardian.org +PKG_BUILDDEP:= pcre zlib +PKG_URL:= http://dansguardian.org/ PKG_SITES:= http://dansguardian.org/downloads/2/Stable/ +PKG_CXX:= DANSGUARDIAN include ${TOPDIR}/mk/package.mk diff --git a/package/davfs2/Makefile b/package/davfs2/Makefile index b21ad8fca..b3a1dbcda 100644 --- a/package/davfs2/Makefile +++ b/package/davfs2/Makefile @@ -5,24 +5,14 @@ include ${TOPDIR}/rules.mk PKG_NAME:= davfs2 PKG_VERSION:= 1.4.6 -PKG_RELEASE:= 1 +PKG_RELEASE:= 2 PKG_MD5SUM:= c9e8aeb15daeba4b6283b40bb640e908 PKG_DESCR:= WebDAV filesystem PKG_SECTION:= net/fs -PKG_BUILDDEP+= libiconv neon -ifneq (${ADK_PACKAGE_DAVFS2_FUSE}${ADK_PACKAGE_DAVFS2_BOTH},) -PKG_BUILDDEP+= fuse -endif -PKG_URL:= http://savannah.nongnu.org/projects/davfs2 -PKG_SITES:= http://www.very-clever.com/download/nongnu/davfs2/ - -ifeq (${ADK_PACKAGE_DAVFS2_FUSE},y) PKG_DEPENDS:= fuse-utils kmod-fuse-fs libiconv neon -else ifeq (${ADK_PACKAGE_DAVFS2_CODA},y) -PKG_DEPENDS:= kmod-coda-fs libiconv neon -else -PKG_DEPENDS:= kmod-coda-fs fuse-utils kmod-fuse-fs libiconv neon -endif +PKG_BUILDDEP:= libiconv neon fuse +PKG_URL:= http://savannah.nongnu.org/projects/davfs2/ +PKG_SITES:= http://www.very-clever.com/download/nongnu/davfs2/ include ${TOPDIR}/mk/package.mk diff --git a/package/dbus-glib/Makefile b/package/dbus-glib/Makefile index 33461c7c4..0db8b64bc 100644 --- a/package/dbus-glib/Makefile +++ b/package/dbus-glib/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= cd0ab148fb0c786fc88be49d19971f50 PKG_DESCR:= DBUS glib bindings PKG_SECTION:= libs PKG_DEPENDS:= dbus -PKG_BUILDDEP+= dbus +PKG_BUILDDEP:= dbus PKG_URL:= http://www.freedesktop.org/wiki/Software/DBusBindings PKG_SITES:= http://dbus.freedesktop.org/releases/dbus-glib/ diff --git a/package/dbus/Makefile b/package/dbus/Makefile index 0dc44e852..931ac4373 100644 --- a/package/dbus/Makefile +++ b/package/dbus/Makefile @@ -10,8 +10,8 @@ PKG_MD5SUM:= 565346cecd9cfecf1463540c6086cc2c PKG_DESCR:= DBUS library PKG_SECTION:= libs PKG_DEPENDS:= libexpat -PKG_BUILDDEP+= expat -PKG_URL:= http://dbus.freedesktop.org +PKG_BUILDDEP:= expat +PKG_URL:= http://dbus.freedesktop.org/ PKG_SITES:= http://dbus.freedesktop.org/releases/dbus/ ifeq ($(ADK_STATIC),y) diff --git a/package/deco/Makefile b/package/deco/Makefile index 9cabc38ae..a8c3086dd 100644 --- a/package/deco/Makefile +++ b/package/deco/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= f77f60e8be0cae1f814cba1ef61bf4d0 PKG_DESCR:= Text-based, full featured file manager PKG_SECTION:= misc PKG_DEPENDS:= libncurses -PKG_BUILDDEP+= ncurses +PKG_BUILDDEP:= ncurses PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=deco/} DISTFILES:= ${PKG_NAME}${PKG_VERSION}.tgz diff --git a/package/depmaker b/package/depmaker deleted file mode 100644 index da3923554..000000000 --- a/package/depmaker +++ /dev/null @@ -1,38 +0,0 @@ -unset MAKEFLAGS -export MAKEFLAGS=s -cd "$(dirname "$0")" -export TOPDIR=$(realpath ..) -if gmake --help >/dev/null 2>&1; then - export GMAKE=gmake -else - export GMAKE=make -fi -GMAKE="$GMAKE --no-print-directory" -(( x_cols = (COLUMNS > 10) ? COLUMNS - 2 : 80 )) -typeset -L$x_cols pbar - -for dn in */Makefile; do - dn=${dn%/*} - pbar="$dn ..." - print -nu2 "$pbar\r" - case $dn { - (@(?(e)g|uc|)libc|libpthread|uclibc++) ;; - (*) - # dnu: directory name, uppercase, y/-+/_X/ - typeset -u dnu=${dn//-/_} - dnu=${dnu//+/X} - print "package-\$(ADK_COMPILE_${dnu}) += $dn" - ;; - } - cd $dn - deps=$($GMAKE show=PKG_BUILDDEP) - cd .. - [[ -n $deps ]] || continue - x="${dn}-compile:" - for dep in $deps; do - x="$x ${dep}-compile" - done - print -r -- $x -done >Depends.mk -pbar=done -print -u2 "$pbar" diff --git a/package/dhcp-forwarder/Makefile b/package/dhcp-forwarder/Makefile index c95d620f6..ff483b392 100644 --- a/package/dhcp-forwarder/Makefile +++ b/package/dhcp-forwarder/Makefile @@ -9,9 +9,8 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= fb3670dee9f71af1e55ac5dcd64e213e PKG_DESCR:= DHCP relay agent PKG_SECTION:= dhcp -PKG_URL:= http://www.nongnu.org/dhcp-fwd -PKG_SITES:= http://savannah.nongnu.org/download/dhcp-fwd/ \ - http://ftp.cc.uoc.gr/mirrors/nongnu.org/dhcp-fwd/ +PKG_URL:= http://www.nongnu.org/dhcp-fwd/ +PKG_SITES:= http://savannah.nongnu.org/download/dhcp-fwd/ DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 diff --git a/package/dhcp/Makefile b/package/dhcp/Makefile index d3769845e..ea3af6439 100644 --- a/package/dhcp/Makefile +++ b/package/dhcp/Makefile @@ -9,17 +9,17 @@ PKG_RELEASE:= 2 PKG_MD5SUM:= 38a74c89d8913b9b5f33737047623c18 PKG_DESCR:= ISC DHCP server PKG_SECTION:= dhcp -PKG_URL:= https://www.isc.org/software/dhcp +PKG_URL:= https://www.isc.org/software/dhcp/ PKG_SITES:= ftp://ftp.isc.org/isc/dhcp/ -PKG_DESCR_RELAY:= ISC DHCP relay server +PKG_SUBPKGS:= DHCP_SERVER DHCP_RELAY +PKGSD_DHCP_RELAY:= ISC DHCP relay server include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,DHCP_SERVER,dhcp-server,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,DHCP_RELAY,dhcp-relay,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_RELAY},${PKG_SECTION})) +$(eval $(call PKG_template,DHCP_RELAY,dhcp-relay,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_DHCP_RELAY},${PKG_SECTION})) -#TCFLAGS+= -D_GNU_SOURCE CONFIGURE_ENV+= ac_cv_file__dev_random=yes post-install: diff --git a/package/dialog/Makefile b/package/dialog/Makefile index cefcfaa32..774af32ad 100644 --- a/package/dialog/Makefile +++ b/package/dialog/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 3caebd641a9f337b980becb4444336c5 PKG_DESCR:= A text gui interface PKG_SECTION:= misc PKG_DEPENDS:= libncurses -PKG_BUILDDEP+= ncurses +PKG_BUILDDEP:= ncurses PKG_SITES:= ftp://ftp.us.debian.org/debian/pool/main/d/dialog/ DISTFILES:= ${PKG_NAME}_${PKG_VERSION}.orig.tar.gz diff --git a/package/digitemp/Makefile b/package/digitemp/Makefile index fc7a2bcc3..390ac22a0 100644 --- a/package/digitemp/Makefile +++ b/package/digitemp/Makefile @@ -10,8 +10,8 @@ PKG_MD5SUM:= 9be2e48db37920f21925ae6e88f83b84 PKG_DESCR:= program for reading values from 1-wire devices PKG_SECTION:= misc PKG_DEPENDS:= libusb -PKG_BUILDDEP+= libusb libusb-compat -PKG_URL:= http://www.digitemp.com/software/linux +PKG_BUILDDEP:= libusb libusb-compat +PKG_URL:= http://www.digitemp.com/software/linux/ PKG_SITES:= http://www.digitemp.com/software/linux/ include ${TOPDIR}/mk/package.mk diff --git a/package/dillo/Makefile b/package/dillo/Makefile index 5f39f9c79..853f3e4ce 100644 --- a/package/dillo/Makefile +++ b/package/dillo/Makefile @@ -11,14 +11,14 @@ PKG_DESCR:= small graphical web browser PKG_SECTION:= x11/apps PKG_DEPENDS:= libfltk libxi libiconv libpng zlib libjpeg PKG_DEPENDS+= libstdcxx -PKG_BUILDDEP+= fltk libXi libiconv jpeg libpng zlib +PKG_BUILDDEP:= fltk libXi libiconv jpeg libpng zlib PKG_URL:= http://www.dillo.org/ PKG_SITES:= http://www.dillo.org/download/ -DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 - -PKG_TARGET_DEPENDS:= ibmx40 lemote PKG_HOST_DEPENDS:= !cygwin +PKG_TARGET_DEPENDS:= ibmx40 lemote + +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 include $(TOPDIR)/mk/package.mk diff --git a/package/dnsmasq/Makefile b/package/dnsmasq/Makefile index 57cc71bab..3586fe165 100644 --- a/package/dnsmasq/Makefile +++ b/package/dnsmasq/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= b093d7c6bc7f97ae6fd35d048529232a PKG_DESCR:= A lightweight DNS and DHCP server PKG_SECTION:= dns -PKG_URL:= http://thekelleys.org.uk/dnsmasq +PKG_URL:= http://thekelleys.org.uk/dnsmasq/ PKG_SITES:= http://thekelleys.org.uk/dnsmasq/ include ${TOPDIR}/mk/package.mk diff --git a/package/dosfstools/Makefile b/package/dosfstools/Makefile index 269f26cc4..89a3cb861 100644 --- a/package/dosfstools/Makefile +++ b/package/dosfstools/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= bd273cf8aa6341c0b52cbac72050bcf4 PKG_DESCR:= Utilities to create and check MS-DOS FAT filesystems PKG_SECTION:= fs -PKG_URL:= http://www.daniel-baumann.ch/software/dosfstools +PKG_URL:= http://www.daniel-baumann.ch/software/dosfstools/ PKG_SITES:= http://www.daniel-baumann.ch/software/dosfstools/ include ${TOPDIR}/mk/package.mk diff --git a/package/dovecot/Makefile b/package/dovecot/Makefile index 9bab810f5..124b1c393 100644 --- a/package/dovecot/Makefile +++ b/package/dovecot/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= b7d0081b17ff6afae85e8dc14157fa57 PKG_DESCR:= A minimal and secure imap server PKG_SECTION:= mail -PKG_URL:= http://www.dovecot.org +PKG_URL:= http://www.dovecot.org/ PKG_SITES:= http://www.dovecot.org/releases/1.2/ include ${TOPDIR}/mk/package.mk diff --git a/package/dri2proto/Makefile b/package/dri2proto/Makefile index 8d1241c55..a4d11920f 100644 --- a/package/dri2proto/Makefile +++ b/package/dri2proto/Makefile @@ -8,6 +8,7 @@ PKG_VERSION:= 2.3 PKG_RELEASE:= 1 PKG_MD5SUM:= 2087269416782cff56f9b22d1449c192 PKG_SITES:= http://xorg.freedesktop.org/releases/individual/proto/ +PKG_SUBPKGS:= include $(TOPDIR)/mk/package.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/dropbear/Makefile b/package/dropbear/Makefile index 8d720680a..c80be266a 100644 --- a/package/dropbear/Makefile +++ b/package/dropbear/Makefile @@ -9,21 +9,20 @@ PKG_RELEASE:= 3 PKG_MD5SUM:= 1c69ec674481d7745452f68f2ea5597e PKG_DESCR:= SSH 2 server/client designed for embedded systems PKG_SECTION:= net/security -PKG_URL:= http://matt.ucc.asn.au/dropbear +PKG_URL:= http://matt.ucc.asn.au/dropbear/ PKG_SITES:= http://matt.ucc.asn.au/dropbear/releases/ -PKG_DESCR_UTIL:= Utility for converting SSH private keys +PKG_DFLT_DROPBEAR:= y if !ADK_TOOLCHAIN_ONLY +PKG_SUBPKGS:= DROPBEAR DBCONVERT +PKGSD_DBCONVERT:= Utility for converting SSH private keys include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,DROPBEAR,$(PKG_NAME),$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,DBCONVERT,dropbearconvert,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_UTIL},${PKG_SECTION})) - -PKGDFLT_DROPBEAR:= y if !ADK_TOOLCHAIN_ONLY +$(eval $(call PKG_template,DBCONVERT,dropbearconvert,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_DBCONVERT},${PKG_SECTION})) BUILD_STYLE:= manual INSTALL_STYLE:= manual - CONFIGURE_ARGS+= --disable-pam \ --enable-openpty \ --enable-syslog \ diff --git a/package/dsniff/Makefile b/package/dsniff/Makefile index edc333b66..b943675e7 100644 --- a/package/dsniff/Makefile +++ b/package/dsniff/Makefile @@ -10,8 +10,8 @@ PKG_MD5SUM:= 2f761fa3475682a7512b0b43568ee7d6 PKG_DESCR:= tools for network auditing and penetration testing PKG_SECTION:= net PKG_DEPENDS:= libnet libpcap libnids libopenssl libgdbm -PKG_BUILDDEP+= libnids openssl gdbm libpcap libnet -PKG_URL:= http://www.monkey.org/~dugsong/dsniff +PKG_BUILDDEP:= libnids openssl gdbm libpcap libnet +PKG_URL:= http://www.monkey.org/~dugsong/dsniff/ PKG_SITES:= http://www.monkey.org/~dugsong/dsniff/beta/ WRKDIST= ${WRKDIR}/${PKG_NAME}-2.4 diff --git a/package/e2fsprogs/Makefile b/package/e2fsprogs/Makefile index 34c2cdab8..471f0fa04 100644 --- a/package/e2fsprogs/Makefile +++ b/package/e2fsprogs/Makefile @@ -13,25 +13,25 @@ PKG_DEPENDS:= libcom-err libuuid libblkid libpthread PKG_URL:= http://e2fsprogs.sourceforge.net/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=e2fsprogs/} -PKG_DESCR_UUID:= UUID library -PKG_SECTION_UUID:= libs -PKG_DESCR_COM_ERR:= Common error library -PKG_SECTION_COM_ERR:= libs -PKG_DESCR_BLKID:= Libblkid -PKG_SECTION_BLKID:= libs -PKG_DESCR_SS:= Subsystem command parsing library -PKG_SECTION_SS:= libs +PKG_SUBPKGS:= E2FSPROGS LIBUUID LIBCOM_ERR LIBSS LIBBLKID +PKGSD_LIBUUID:= UUID library +PKGSC_LIBUUID:= libs +PKGSD_LIBCOM_ERR:= Common error library +PKGSC_LIBCOM_ERR:= libs +PKGSD_LIBSS:= Subsystem command parsing library +PKGSC_LIBSS:= libs +PKGSD_LIBBLKID:= Libblkid +PKGSC_LIBBLKID:= libs include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,E2FSPROGS,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,LIBUUID,libuuid,${PKG_VERSION}-${PKG_RELEASE},,${PKG_DESCR_UUID},${PKG_SECTION_UUID})) -$(eval $(call PKG_template,LIBCOM_ERR,libcom-err,${PKG_VERSION}-${PKG_RELEASE},,${PKG_DESCR_COM_ERR},${PKG_SECTION_COM_ERR})) -$(eval $(call PKG_template,LIBSS,libss,${PKG_VERSION}-${PKG_RELEASE},,${PKG_DESCR_SS},${PKG_SECTION_SS})) -$(eval $(call PKG_template,LIBBLKID,libblkid,${PKG_VERSION}-${PKG_RELEASE},,${PKG_DESCR_BLKID},${PKG_SECTION_BLKID})) +$(eval $(call PKG_template,LIBUUID,libuuid,${PKG_VERSION}-${PKG_RELEASE},,${PKGSD_LIBUUID},${PKGSC_LIBUUID})) +$(eval $(call PKG_template,LIBCOM_ERR,libcom-err,${PKG_VERSION}-${PKG_RELEASE},,${PKGSD_LIBCOM_ERR},${PKGSC_LIBCOM_ERR})) +$(eval $(call PKG_template,LIBSS,libss,${PKG_VERSION}-${PKG_RELEASE},,${PKGSD_LIBSS},${PKGSC_LIBSS})) +$(eval $(call PKG_template,LIBBLKID,libblkid,${PKG_VERSION}-${PKG_RELEASE},,${PKGSD_LIBBLKID},${PKGSC_LIBBLKID})) -CONFIGURE_ARGS+= --enable-elf-shlibs \ - --disable-tls +CONFIGURE_ARGS+= --enable-elf-shlibs --disable-tls INSTALL_TARGET+= install-libs pre-build: diff --git a/package/eglibc/Makefile b/package/eglibc/Makefile index e70d9a790..911aa45f8 100644 --- a/package/eglibc/Makefile +++ b/package/eglibc/Makefile @@ -6,9 +6,12 @@ include $(TOPDIR)/toolchain/eglibc/Makefile.inc PKG_DESCR:= embedded GNU C library PKG_SECTION:= base -NO_DISTFILES:= 1 PKG_OPTS:= noremove +PKG_SUBPKGS:= EGLIBC EGLIBC_DEV + +NO_DISTFILES:= 1 + include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,EGLIBC,$(PKG_NAME),$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) diff --git a/package/elinks/Makefile b/package/elinks/Makefile index 4a11809df..6101f0abc 100644 --- a/package/elinks/Makefile +++ b/package/elinks/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 145c510cae41c204d0f23dce4bdd23ab PKG_DESCR:= advanced text web browser PKG_SECTION:= browser PKG_DEPENDS:= libopenssl -PKG_BUILDDEP+= openssl +PKG_BUILDDEP:= openssl PKG_URL:= http://elinks.or.cz/ PKG_SITES:= http://elinks.or.cz/download/ diff --git a/package/esound/Makefile b/package/esound/Makefile index c0d31c270..8923d7b7d 100644 --- a/package/esound/Makefile +++ b/package/esound/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 3d8973ed87053d7acc1f4d44af2c4688 PKG_DESCR:= Enlightened Sound Daemon PKG_SECTION:= multimedia PKG_DEPENDS:= libaudiofile -PKG_BUILDDEP+= libaudiofile +PKG_BUILDDEP:= libaudiofile PKG_URL:= http://www.tux.org/~ricdude/EsounD.html PKG_SITES:= ftp://ftp.gnome.org/pub/gnome/sources/esound/0.2/ diff --git a/package/ethtool/Makefile b/package/ethtool/Makefile index 76b3b16c9..dd9aafb7d 100644 --- a/package/ethtool/Makefile +++ b/package/ethtool/Makefile @@ -13,7 +13,7 @@ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=gkernel/} include ${TOPDIR}/mk/package.mk -$(eval $(call PKG_template,ETHTOOL,ethtool,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +$(eval $(call PKG_template,ETHTOOL,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) post-install: ${INSTALL_DIR} ${IDIR_ETHTOOL}/usr/sbin diff --git a/package/evieext/Makefile b/package/evieext/Makefile index b1765b721..238d50aff 100644 --- a/package/evieext/Makefile +++ b/package/evieext/Makefile @@ -8,6 +8,7 @@ PKG_VERSION:= 1.1.0 PKG_RELEASE:= 1 PKG_MD5SUM:= 68e61ce53caa495a3ad4085f66010eb8 PKG_SITES:= ftp://ftp.x.org/pub/individual/proto/ +PKG_SUBPKGS:= include $(TOPDIR)/mk/package.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/evilwm/Makefile b/package/evilwm/Makefile index f98696aef..d88504298 100644 --- a/package/evilwm/Makefile +++ b/package/evilwm/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 8fd9256c635cce2289b648a01d54202c PKG_DESCR:= A minimalist window manager for the X Window System PKG_SECTION:= x11/apps PKG_DEPENDS:= libx11 libxext -PKG_BUILDDEP+= libX11 libXext +PKG_BUILDDEP:= libX11 libXext PKG_URL:= http://www.6809.org.uk/evilwm/ PKG_SITES:= http://www.6809.org.uk/evilwm/ diff --git a/package/exmap/Makefile b/package/exmap/Makefile index acb6feb88..536249af9 100644 --- a/package/exmap/Makefile +++ b/package/exmap/Makefile @@ -10,23 +10,24 @@ PKG_MD5SUM:= 55aec784e214037e61400287a55b5426 PKG_DESCR:= memory analysing client tool PKG_SECTION:= debug PKG_DEPENDS:= exmap-kmod libreadline glib -PKG_BUILDDEP+= glib readline +PKG_BUILDDEP:= glib readline PKG_SITES:= http://labs.o-hand.com/sources/exmap-console/ +PKG_SUBPKGS:= EXMAP EXMAPD EXMAPSERVER EXMAP_KMOD +PKGSD_EXMAPD:= memory analysing daemon +PKGSD_EXMAPSERVER:= memory analysing server +PKGSD_EXMAP_KMOD:= memory analysing kernel module +PKGSC_EXMAP_KMOD:= kernel + DISTFILES:= ${PKG_NAME}-console-${PKG_VERSION}.tgz WRKDIST= ${WRKDIR}/${PKG_NAME}-console-${PKG_VERSION} -PKG_DESCR_EXMAPD:= memory analysing daemon -PKG_DESCR_EXMAPSERVER:= memory analysing server -PKG_DESCR_EXMAP_KMOD:= memory analysing kernel module -PKG_SECTION_EXMAP_KMOD:=kernel - include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,EXMAP,exmap,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,EXMAPD,exmapd,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_EXMAPD},${PKG_SECTION})) -$(eval $(call PKG_template,EXMAPSERVER,exmapserver,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_EXMAPSERVER},${PKG_SECTION})) -$(eval $(call PKG_template,EXMAP_KMOD,exmap-kmod,${KERNEL_VERSION}+${PKG_VERSION}-${ADK_TARGET}-${PKG_RELEASE},,${PKG_DESCR_EXMAP_KMOD},${PKG_SECTION_EXMAP_KMOD})) +$(eval $(call PKG_template,EXMAPD,exmapd,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_EXMAPD},${PKG_SECTION})) +$(eval $(call PKG_template,EXMAPSERVER,exmapserver,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_EXMAPSERVER},${PKG_SECTION})) +$(eval $(call PKG_template,EXMAP_KMOD,exmap-kmod,${KERNEL_VERSION}+${PKG_VERSION}-${ADK_TARGET}-${PKG_RELEASE},,${PKGSD_EXMAP_KMOD},${PKGSC_EXMAP_KMOD})) CONFIGURE_ARGS+= --disable-doc CONFIGURE_ENV+= LIBS="-lncurses" diff --git a/package/expat/Makefile b/package/expat/Makefile index 6d267e53e..28fde3a50 100644 --- a/package/expat/Makefile +++ b/package/expat/Makefile @@ -12,6 +12,10 @@ PKG_SECTION:= libs PKG_URL:= http://expat.sourceforge.net PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=expat/} +PKG_SUBPKGS:= LIBEXPAT LIBEXPAT_DEV +PKGSD_LIBEXPAT_DEV:= development files for expat +PKGSC_LIBEXPAT_DEV:= devel + ifeq ($(ADK_STATIC),y) PKG_OPTS:= libonly endif @@ -19,9 +23,18 @@ endif include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBEXPAT,libexpat,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) +$(eval $(call PKG_template,LIBEXPAT_DEV,libexpat-dev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_LIBEXPAT_DEV},${PKGSC_LIBEXPAT_DEV})) + +SUB_INSTALLS-y:= +SUB_INSTALLS-m:= +SUB_INSTALLS-${ADK_PACKAGE_LIBEXPAT_DEV}+= libexpat-dev-install -post-install: +post-install: ${SUB_INSTALLS-m} ${SUB_INSTALLS-y} ${INSTALL_DIR} ${IDIR_LIBEXPAT}/usr/lib ${CP} ${WRKINST}/usr/lib/libexpat.so* ${IDIR_LIBEXPAT}/usr/lib/ +libexpat-dev-install: + ${INSTALL_DIR} ${IDIR_LIBEXPAT_DEV}/usr/include + ${CP} ${WRKINST}/usr/include/*.h ${IDIR_LIBEXPAT_DEV}/usr/include + include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/ez-ipupdate/Makefile b/package/ez-ipupdate/Makefile index 3bf09fc18..bb2fd7bfe 100644 --- a/package/ez-ipupdate/Makefile +++ b/package/ez-ipupdate/Makefile @@ -9,9 +9,10 @@ PKG_RELEASE:= 10 PKG_MD5SUM:= 000211add4c4845ffa4211841bff4fb0 PKG_DESCR:= a client for dynamic DNS services PKG_SECTION:= dns -PKG_URL:= http://ez-ipupdate.com -PKG_SITES:= http://ftp.debian.org/debian/pool/main/e/ez-ipupdate/ \ - http://ftp.de.debian.org/debian/pool/main/e/ez-ipupdate/ +PKG_URL:= http://ez-ipupdate.com/ +PKG_SITES:= http://ftp.debian.org/debian/pool/main/e/ez-ipupdate/ + +PKG_SUBPKGS:= EZIPUPDATE DISTFILES:= ${PKG_NAME}_${PKG_VERSION}.orig.tar.gz diff --git a/package/faad2/Makefile b/package/faad2/Makefile index ab794dab2..53ef6196a 100644 --- a/package/faad2/Makefile +++ b/package/faad2/Makefile @@ -12,6 +12,8 @@ PKG_SECTION:= libs PKG_URL:= http://sourceforge.net/projects/faac/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=faac/} +PKG_SUBPKGS:= LIBFAAD2 + include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBFAAD2,libfaad2,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/fetchmail/Makefile b/package/fetchmail/Makefile index 3d06db9cb..8dd02942e 100644 --- a/package/fetchmail/Makefile +++ b/package/fetchmail/Makefile @@ -9,9 +9,6 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 72c20ad2b9629f1a109668b05a84d823 PKG_DESCR:= fetch mail from a POP or IMAP server PKG_SECTION:= mail -ifeq (${ADK_PACKAGE_FETCHMAIL_SSL},y) -PKG_BUILDDEP+= openssl -endif PKG_URL:= http://fetchmail.berlios.de/ PKG_SITES:= http://download.berlios.de/fetchmail/ @@ -20,6 +17,7 @@ DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 PKG_FLAVOURS:= SSL PKGFD_SSL:= enable SSL support PKGFS_SSL:= libopenssl +PKGFB_SSL:= openssl include ${TOPDIR}/mk/package.mk diff --git a/package/ffmpeg/Makefile b/package/ffmpeg/Makefile index 142c6fa07..5d4306cbc 100644 --- a/package/ffmpeg/Makefile +++ b/package/ffmpeg/Makefile @@ -10,20 +10,22 @@ PKG_MD5SUM:= d6142a9a5821d6a6262a6edb903faa24 PKG_DESCR:= record, convert and stream audio & video PKG_SECTION:= libs PKG_DEPENDS:= libfaad2 -PKG_BUILDDEP+= faad2 sdl +PKG_BUILDDEP:= faad2 PKG_URL:= http://www.ffmpeg.org/ PKG_SITES:= http://www.ffmpeg.org/releases/ -DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 +PKG_SUBPKGS:= FFMPEG FFPLAY +PKGSD_FFPLAY:= ffmpeg based video player +PKGSC_FFPLAY:= multimedia +PKGSS_FFPLAY:= libsdl libpthread ffmpeg +PKGSB_FFPLAY:= sdl -PKG_SECTION_FFPLAY:= multimedia -PKG_DESCR_FFPLAY:= ffmpeg based video player -PKG_DEPENDS_FFPLAY:= libsdl libpthread ffmpeg +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,FFMPEG,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,FFPLAY,ffplay,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_FFPLAY},${PKG_DESCR_FFPLAY},${PKG_SECTION_FFPLAY})) +$(eval $(call PKG_template,FFPLAY,ffplay,${PKG_VERSION}-${PKG_RELEASE},${PKGSS_FFPLAY},${PKGSD_FFPLAY},${PKGSC_FFPLAY})) SUB_INSTALLS-y:= SUB_INSTALLS-m:= diff --git a/package/firefox/Makefile b/package/firefox/Makefile index 54e62d6b1..e807fda8f 100644 --- a/package/firefox/Makefile +++ b/package/firefox/Makefile @@ -12,17 +12,17 @@ PKG_SECTION:= x11/apps PKG_DEPENDS:= libpthread alsa-lib dbus-glib glib libgtk+ libnotify PKG_DEPENDS+= nspr nss libjpeg atk pango cairo libxt libx11 libstdcxx PKG_DEPENDS+= libxdamage libxfixes libidl -PKG_BUILDDEP+= alsa-lib dbus-glib glib gtk+ libnotify libIDL libX11 +PKG_BUILDDEP:= alsa-lib dbus-glib glib gtk+ libnotify libIDL libX11 PKG_BUILDDEP+= nspr nss jpeg libXt PKG_URL:= http://www.mozilla.org/ PKG_SITES:= http://releases.mozilla.org/pub/mozilla.org/firefox/releases/${PKG_VERSION}/source/ -DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.source.tar.bz2 - -WRKDIST= ${WRKDIR}/mozilla-1.9.2 PKG_TARGET_DEPENDS:= alix1c x86_qemu x86_64_qemu shuttle ibmx40 lemote PKG_HOST_DEPENDS:= !netbsd !freebsd !openbsd !cygwin +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.source.tar.bz2 +WRKDIST= ${WRKDIR}/mozilla-1.9.2 + include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,FIREFOX,$(PKG_NAME),$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/fixesproto/Makefile b/package/fixesproto/Makefile index 07cf45150..aeca1101e 100644 --- a/package/fixesproto/Makefile +++ b/package/fixesproto/Makefile @@ -8,6 +8,7 @@ PKG_VERSION:= 4.1.1 PKG_RELEASE:= 1 PKG_MD5SUM:= 95806b9b648639d4c3e5b226d10927c0 PKG_SITES:= ${MASTER_SITE_XORG} +PKG_SUBPKGS:= include $(TOPDIR)/mk/package.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/flac/Makefile b/package/flac/Makefile index fa7ccb9f8..274a74714 100644 --- a/package/flac/Makefile +++ b/package/flac/Makefile @@ -12,6 +12,8 @@ PKG_SECTION:= libs PKG_URL:= http://flac.sourceforge.net PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=flac/} +PKG_SUBPKGS:= LIBFLAC + include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBFLAC,libflac,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/fltk/Makefile b/package/fltk/Makefile index c08d8d21a..6757c1bf8 100644 --- a/package/fltk/Makefile +++ b/package/fltk/Makefile @@ -9,16 +9,17 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 557544badbacca4ee1ebb2448f6e1f8a PKG_DESCR:= fast light toolkit PKG_SECTION:= libs -PKG_BUILDDEP+= libX11 libXi MesaLib freeglut +PKG_BUILDDEP:= libX11 libXi MesaLib freeglut PKG_URL:= http://www.fltk.org/ PKG_SITES:= http://ftp.funet.fi/pub/mirrors/ftp.easysw.com/pub/fltk/snapshots/ +PKG_SUBPKGS:= LIBFLTK +PKG_TARGET_DEPENDS:= ibmx40 lemote +PKG_HOST_DEPENDS:= !cygwin + DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.x-r7513.tar.bz2 WRKDIST= ${WRKDIR}/${PKG_NAME}-2.0.x-r7513 -PKG_TARGET_DEPENDS:= ibmx40 lemote -PKG_HOST_DEPENDS:= !cygwin - include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,LIBFLTK,libfltk,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/fluxbox/Makefile b/package/fluxbox/Makefile index 7ad664321..885972f1a 100644 --- a/package/fluxbox/Makefile +++ b/package/fluxbox/Makefile @@ -11,15 +11,13 @@ PKG_DESCR:= Fluxbox is an X11 window manager featuring tabs and an iconbar PKG_SECTION:= x11/apps PKG_DEPENDS:= libstdcxx PKG_BUILDDEP:= libXpm -ifeq (${ADK_PACKAGE_FLUXBOX_WITH_IMLIB2},y) -PKG_BUILDDEP+= imlib2 -endif -PKG_URL:= http://www.fluxbox.org +PKG_URL:= http://www.fluxbox.org/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=fluxbox/} PKG_FLAVOURS:= WITH_IMLIB2 PKGFD_WITH_IMLIB2:= enable imlib2 support PKGFS_WITH_IMLIB2:= imlib2 +PKGFB_WITH_IMLIB2:= imlib2 include $(TOPDIR)/mk/package.mk diff --git a/package/font-adobe-100dpi/Makefile b/package/font-adobe-100dpi/Makefile index 47ce19f35..35e10ec85 100644 --- a/package/font-adobe-100dpi/Makefile +++ b/package/font-adobe-100dpi/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 93bd04e2fb348a0c48e13ab3933f2381 PKG_DESCR:= X fonts PKG_SECTION:= x11/fonts PKG_DEPENDS:= font-util -PKG_BUILDDEP+= font-util +PKG_BUILDDEP:= font-util PKG_URL:= http://www.x.org/ PKG_SITES:= ${MASTER_SITE_XORG} diff --git a/package/font-adobe-75dpi/Makefile b/package/font-adobe-75dpi/Makefile index 3e12e5fd2..6f0da9876 100644 --- a/package/font-adobe-75dpi/Makefile +++ b/package/font-adobe-75dpi/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= d22283daba10129643800d73f5496aab PKG_DESCR:= X fonts PKG_SECTION:= x11/fonts PKG_DEPENDS:= font-util -PKG_BUILDDEP+= font-util +PKG_BUILDDEP:= font-util PKG_URL:= http://www.x.org/ PKG_SITES:= ${MASTER_SITE_XORG} diff --git a/package/font-misc-misc/Makefile b/package/font-misc-misc/Makefile index 3baa548a4..4e1015900 100644 --- a/package/font-misc-misc/Makefile +++ b/package/font-misc-misc/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 047eae4d061f17d96213c4e78f7abccb PKG_DESCR:= X fonts PKG_SECTION:= x11/fonts -PKG_BUILDDEP+= font-util +PKG_BUILDDEP:= font-util PKG_URL:= http://www.x.org/ PKG_SITES:= ${MASTER_SITE_XORG} diff --git a/package/fontcacheproto/Makefile b/package/fontcacheproto/Makefile index ce103cade..dec821d49 100644 --- a/package/fontcacheproto/Makefile +++ b/package/fontcacheproto/Makefile @@ -8,6 +8,7 @@ PKG_VERSION:= 0.1.2 PKG_RELEASE:= 1 PKG_MD5SUM:= dc8c34a8c3559bf3b008bcdf7ba5a743 PKG_SITES:= ${MASTER_SITE_XORG} +PKG_SUBPKGS:= include $(TOPDIR)/mk/package.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/fontconfig/Makefile b/package/fontconfig/Makefile index 0a1bee2dd..119c09e9a 100644 --- a/package/fontconfig/Makefile +++ b/package/fontconfig/Makefile @@ -10,8 +10,8 @@ PKG_MD5SUM:= 77e15a92006ddc2adbb06f840d591c0e PKG_DESCR:= fontconfig PKG_SECTION:= libs PKG_DEPENDS:= libxml2 -PKG_BUILDDEP+= freetype libxml2 -PKG_URL:= http://fontconfig.org +PKG_BUILDDEP:= freetype libxml2 +PKG_URL:= http://fontconfig.org/ PKG_SITES:= http://fontconfig.org/release/ ifeq ($(ADK_STATIC),y) diff --git a/package/fontsproto/Makefile b/package/fontsproto/Makefile index 718d10a53..dd62362e2 100644 --- a/package/fontsproto/Makefile +++ b/package/fontsproto/Makefile @@ -8,6 +8,7 @@ PKG_VERSION:= 2.1.0 PKG_RELEASE:= 1 PKG_MD5SUM:= 6819fc82585daac68cec17938b659bf0 PKG_SITES:= ${MASTER_SITE_XORG} +PKG_SUBPKGS:= include $(TOPDIR)/mk/package.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/fping/Makefile b/package/fping/Makefile index 002639da2..3f0fec5e3 100644 --- a/package/fping/Makefile +++ b/package/fping/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= d5e8be59e307cef76bc479e1684df705 PKG_DESCR:= A program to ping hosts in parallel PKG_SECTION:= net -PKG_URL:= http://fping.sourceforge.net +PKG_URL:= http://fping.sourceforge.net/ PKG_SITES:= http://fping.sourceforge.net/download/ DISTFILES:= ${PKG_NAME}.tar.gz diff --git a/package/fprobe/Makefile b/package/fprobe/Makefile index 510dd466f..67353121a 100644 --- a/package/fprobe/Makefile +++ b/package/fprobe/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 65850d0470078269b33eee58cba77ac2 PKG_DESCR:= NetFlow probe PKG_SECTION:= net PKG_DEPENDS:= libpcap libpthread -PKG_BUILDDEP+= libpcap +PKG_BUILDDEP:= libpcap PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=fprobe/} DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 diff --git a/package/freeglut/Makefile b/package/freeglut/Makefile index a3585b620..5f94775b5 100644 --- a/package/freeglut/Makefile +++ b/package/freeglut/Makefile @@ -9,12 +9,12 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 39f0f2de89f399529d2b981188082218 PKG_DESCR:= OpenGL Utility Toolkit PKG_SECTION:= libs -PKG_BUILDDEP+= MesaLib +PKG_BUILDDEP:= MesaLib PKG_URL:= http://freeglut.sourceforge.net/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=freeglut/} -PKG_TARGET_DEPENDS:= ibmx40 lemote PKG_HOST_DEPENDS:= !cygwin +PKG_TARGET_DEPENDS:= ibmx40 lemote include $(TOPDIR)/mk/package.mk diff --git a/package/freeradius-client/Makefile b/package/freeradius-client/Makefile index d40360831..eecc9f3ee 100644 --- a/package/freeradius-client/Makefile +++ b/package/freeradius-client/Makefile @@ -10,12 +10,11 @@ PKG_MD5SUM:= edd4d904e802ff66d35532be1475cfa7 PKG_DESCR:= RADIUS client PKG_SECTION:= ppp PKG_DEPENDS:= libopenssl -PKG_BUILDDEP+= openssl -PKG_URL:= http://www.freeradius.org -PKG_SITES:= ftp://ftp.freeradius.org/pub/radius/ \ - http://freeradius.portal-to-web.de/ \ - ftp://ftp.uk.freeradius.org/pub/radius/ +PKG_BUILDDEP:= openssl +PKG_URL:= http://www.freeradius.org/ +PKG_SITES:= ftp://ftp.freeradius.org/pub/radius/ +PKG_SUBPKGS:= FREERADIUS_CLIENT LIBFREERADIUS_CLIENT PKG_SECTION_LIB:= libs include ${TOPDIR}/mk/package.mk diff --git a/package/freeradius-server/Makefile b/package/freeradius-server/Makefile index 92313ca39..8ccd93613 100644 --- a/package/freeradius-server/Makefile +++ b/package/freeradius-server/Makefile @@ -9,40 +9,41 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= aa2ae711387af144df7c351b28b8789c PKG_DESCR:= a flexible RADIUS server PKG_SECTION:= ppp -PKG_MULTI:= 1 PKG_DEPENDS:= libltdl libopenssl libpthread -PKG_BUILDDEP+= libtool openssl -ifneq ($(ADK_PACKAGE_FREERADIUS_MOD_LDAP),) -PKG_BUILDDEP+= openldap -PKG_DEPENDS_LDAP:= libopenldap -endif -ifneq ($(ADK_PACKAGE_FREERADIUS_MOD_SQL_MYSQL),) -PKG_BUILDDEP+= mysql -PKG_DEPENDS_MYSQL:= libmysqlclient -endif -ifneq ($(ADK_PACKAGE_FREERADIUS_MOD_SQL_PGSQL),) -PKG_BUILDDEP+= postgresql -PKG_DEPENDS_PGSQL:= libpq -endif -PKG_URL:= http://www.freeradius.org +PKG_BUILDDEP:= libtool openssl +PKG_URL:= http://www.freeradius.org/ PKG_SITES:= ftp://ftp.freeradius.org/pub/radius/ +PKG_MULTI:= 1 + +PKG_SUBPKGS:= FREERADIUS_SERVER FREERADIUS_DEMOCERTS FREERADIUS_MOD_CHAP FREERADIUS_MOD_DETAIL +PKG_SUBPKGS+= FREERADIUS_MOD_DIGEST FREERADIUS_MOD_FILES FREERADIUS_MOD_LDAP FREERADIUS_MOD_MSCHAP +PKG_SUBPKGS+= FREERADIUS_MOD_PAP FREERADIUS_MOD_PREPROCESS FREERADIUS_MOD_REALM FREERADIUS_MOD_SQL +PKG_SUBPKGS+= FREERADIUS_MOD_SQL_MYSQL FREERADIUS_MOD_SQL_PGSQL FREERADIUS_UTILS PKG_HOST_DEPENDS:= !cygwin -PKG_DESCR_DEMOCERTS:= Demo certificates to test the server -PKG_DESCR_CHAP:= CHAP authentication module -PKG_DESCR_DETAIL:= Detailed accounting module -PKG_DESCR_DIGEST:= Digest authentication module -PKG_DESCR_FILES:= Module using local files for authorization -PKG_DESCR_LDAP:= LDAP module -PKG_DESCR_MSCHAP:= MS-CHAP and MS-CHAPv2 module -PKG_DESCR_PAP:= PAP authentication module -PKG_DESCR_PREPROCESS:= Request pre-processing module -PKG_DESCR_REALM:= Realms handling module -PKG_DESCR_SQL:= Base SQL module -PKG_DESCR_MYSQL:= MySQL module -PKG_DESCR_PGSQL:= PostgreSQL module -PKG_DESCR_UTILS:= Misc. client utilities +# sub package build dependencies +PKGSB_FREERADIUS_MOD_LDAP:= openldap +PKGSB_FREERADIUS_MOD_SQL_MYSQL:= mysql +PKGSB_FREERADIUS_MOD_SQL_PGSQL:= postgresql +PKGSS_FREERADIUS_MOD_LDAP:= libopenldap +PKGSS_FREERADIUS_MOD_SQL_MYSQL:= libmysqlclient +PKGSS_FREERADIUS_MOD_SQL_PGSQL:= libpq + +PKGSD_FREERADIUS_DEMOCERTS:= Demo certificates to test the server +PKGSD_FREERADIUS_MOD_CHAP:= CHAP authentication module +PKGSD_FREERADIUS_MOD_DETAIL:= Detailed accounting module +PKGSD_FREERADIUS_MOD_DIGEST:= Digest authentication module +PKGSD_FREERADIUS_MOD_FILES:= Module using local files for authorization +PKGSD_FREERADIUS_MOD_LDAP:= LDAP module +PKGSD_FREERADIUS_MOD_MSCHAP:= MS-CHAP and MS-CHAPv2 module +PKGSD_FREERADIUS_MOD_PAP:= PAP authentication module +PKGSD_FREERADIUS_MOD_PREPROCESS:= Request pre-processing module +PKGSD_FREERADIUS_MOD_REALM:= Realms handling module +PKGSD_FREERADIUS_MOD_SQL:= Base SQL module +PKGSD_FREERADIUS_MOD_SQL_MYSQL:= MySQL module +PKGSD_FREERADIUS_MOD_SQL_PGSQL:= PostgreSQL module +PKGSD_FREERADIUS_UTILS:= Misc. client utilities PKG_CONFIGURE_OPTS:= @@ -91,20 +92,19 @@ ${2}-install: endef $(eval $(call PKG_template,FREERADIUS_SERVER,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,FREERADIUS_DEMOCERTS,freeradius-democerts,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_DEMOCERTS},${PKG_SECTION})) -$(eval $(call PKG_template,FREERADIUS_MOD_CHAP,freeradius-mod-chap,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_CHAP},${PKG_SECTION})) -$(eval $(call PKG_template,FREERADIUS_MOD_DETAIL,freeradius-mod-detail,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_DETAIL},${PKG_SECTION})) -$(eval $(call PKG_template,FREERADIUS_MOD_DIGEST,freeradius-mod-digest,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_DIGEST},${PKG_SECTION})) -$(eval $(call PKG_template,FREERADIUS_MOD_FILES,freeradius-mod-files,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_FILES},${PKG_SECTION})) -$(eval $(call PKG_template,FREERADIUS_MOD_LDAP,freeradius-mod-ldap,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_LDAP},${PKG_DESCR_LDAP},${PKG_SECTION})) -$(eval $(call PKG_template,FREERADIUS_MOD_MSCHAP,freeradius-mod-mschap,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_MSCHAP},${PKG_SECTION})) -$(eval $(call PKG_template,FREERADIUS_MOD_PAP,freeradius-mod-pap,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_PAP},${PKG_SECTION})) -$(eval $(call PKG_template,FREERADIUS_MOD_PREPROCESS,freeradius-mod-preprocess,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_PREPROCESS},${PKG_SECTION})) -$(eval $(call PKG_template,FREERADIUS_MOD_REALM,freeradius-mod-realm,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_REALM},${PKG_SECTION})) -$(eval $(call PKG_template,FREERADIUS_MOD_SQL,freeradius-mod-sql,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_SQL},${PKG_SECTION})) -$(eval $(call PKG_template,FREERADIUS_MOD_SQL_MYSQL,freeradius-mod-sql-mysql,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_MYSQL},${PKG_DESCR_MYSQL},${PKG_SECTION})) -$(eval $(call PKG_template,FREERADIUS_MOD_SQL_PGSQL,freeradius-mod-sql-pgsql,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_PGSQL},${PKG_DESCR_PGSQL},${PKG_SECTION})) -$(eval $(call PKG_template,FREERADIUS_UTILS,freeradius-utils,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_UTILS},${PKG_SECTION})) +$(eval $(call PKG_template,FREERADIUS_DEMOCERTS,freeradius-democerts,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_FREERADIUS_DEMOCERTS},${PKG_SECTION})) +$(eval $(call PKG_template,FREERADIUS_MOD_CHAP,freeradius-mod-chap,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_FREERADIUS_MOD_CHAP},${PKG_SECTION})) +$(eval $(call PKG_template,FREERADIUS_MOD_DETAIL,freeradius-mod-detail,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_FREERADIUS_MOD_DETAIL},${PKG_SECTION})) +$(eval $(call PKG_template,FREERADIUS_MOD_DIGEST,freeradius-mod-digest,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_FREERADIUS_MOD_DIGEST},${PKG_SECTION})) +$(eval $(call PKG_template,FREERADIUS_MOD_FILES,freeradius-mod-files,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_FREERADIUS_MOD_FILES},${PKG_SECTION})) +$(eval $(call PKG_template,FREERADIUS_MOD_LDAP,freeradius-mod-ldap,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_LDAP},${PKGSD_FREERADIUS_MOD_LDAP},${PKG_SECTION})) +$(eval $(call PKG_template,FREERADIUS_MOD_MSCHAP,freeradius-mod-mschap,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_FREERADIUS_MOD_MSCHAP},${PKG_SECTION})) +$(eval $(call PKG_template,FREERADIUS_MOD_PAP,freeradius-mod-pap,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_FREERADIUS_MOD_PAP},${PKG_SECTION})) +$(eval $(call PKG_template,FREERADIUS_MOD_PREPROCESS,freeradius-mod-preprocess,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_FREERADIUS_MOD_PREPROCESS},${PKG_SECTION})) +$(eval $(call PKG_template,FREERADIUS_MOD_REALM,freeradius-mod-realm,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_FREERADIUS_MOD_REALM},${PKG_SECTION})) +$(eval $(call PKG_template,FREERADIUS_MOD_SQL_MYSQL,freeradius-mod-sql-mysql,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_MYSQL},${PKGSD_FREERADIUS_MOD_SQL_MYSQL},${PKG_SECTION})) +$(eval $(call PKG_template,FREERADIUS_MOD_SQL_PGSQL,freeradius-mod-sql-pgsql,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_PGSQL},${PKGSD_FREERADIUS_MOD_SQL_PGSQL},${PKG_SECTION})) +$(eval $(call PKG_template,FREERADIUS_UTILS,freeradius-utils,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_FREERADIUS_UTILS},${PKG_SECTION})) $(eval $(call PKG_mod_template,FREERADIUS_MOD_CHAP,rlm_chap,)) $(eval $(call PKG_mod_template,FREERADIUS_MOD_DETAIL,rlm_detail,)) diff --git a/package/freetype/Makefile b/package/freetype/Makefile index eab453ba6..469859884 100644 --- a/package/freetype/Makefile +++ b/package/freetype/Makefile @@ -10,10 +10,12 @@ PKG_MD5SUM:= a693c9a4b0121890ca71e39364ffea4a PKG_DESCR:= A free, high-quality and portable font engine PKG_SECTION:= libs PKG_DEPENDS:= zlib -PKG_BUILDDEP+= zlib -PKG_URL:= http://www.freetype.org +PKG_BUILDDEP:= zlib +PKG_URL:= http://www.freetype.org/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=freetype/} +PKG_SUBPKGS:= LIBFREETYPE + ifeq ($(ADK_STATIC),y) PKG_OPTS:= libonly endif diff --git a/package/fuse/Makefile b/package/fuse/Makefile index 06d20ec6d..c861a06d0 100644 --- a/package/fuse/Makefile +++ b/package/fuse/Makefile @@ -10,9 +10,11 @@ PKG_MD5SUM:= 4879f06570d2225667534c37fea04213 PKG_DESCR:= Filesystem in Userspace (utilities) PKG_SECTION:= fs PKG_DEPENDS:= kmod-fuse-fs -PKG_URL:= http://fuse.sourceforge.net +PKG_URL:= http://fuse.sourceforge.net/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=${PKG_NAME}/} +PKG_SUBPKGS:= FUSE_UTILS + include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,FUSE_UTILS,fuse-utils,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/gatling/Makefile b/package/gatling/Makefile index cae136e1b..850ef17be 100644 --- a/package/gatling/Makefile +++ b/package/gatling/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= a0fb49ccb6b910bdbd7e76a9960394e3 PKG_DESCR:= small non-forking webserver PKG_SECTION:= www PKG_DEPENDS:= libiconv -PKG_BUILDDEP+= libowfat libiconv +PKG_BUILDDEP:= libowfat libiconv PKG_URL:= http://www.fefe.de/gatling/ PKG_SITES:= http://dl.fefe.de/ diff --git a/package/gcc/Makefile b/package/gcc/Makefile index b12f2a3ec..000b9d98c 100644 --- a/package/gcc/Makefile +++ b/package/gcc/Makefile @@ -7,8 +7,8 @@ include ${TOPDIR}/toolchain/gcc/Makefile.inc PKG_DESCR:= GNU compiler collection PKG_SECTION:= lang PKG_OPTS:= noremove -PKG_DEPENDS:= libgmp mpfr -PKG_BUILDDEP+= gmp mpfr +PKG_DEPENDS:= libmpc libgmp mpfr +PKG_BUILDDEP:= mpc gmp mpfr ifeq ($(ADK_TARGET_LIB_UCLIBC),y) PKG_DEPENDS+= uclibc-dev diff --git a/package/gdb/Makefile b/package/gdb/Makefile index 07371ea3e..7c1261135 100644 --- a/package/gdb/Makefile +++ b/package/gdb/Makefile @@ -7,11 +7,11 @@ include ${TOPDIR}/toolchain/gdb/Makefile.inc PKG_DESCR:= GNU debugger PKG_SECTION:= debug PKG_DEPENDS:= libthread-db libncurses libiconv libexpat -PKG_BUILDDEP+= ncurses readline libiconv expat -PKG_TARGET_DEPENDS:= !foxboard !ag241 - +PKG_BUILDDEP:= ncurses readline libiconv expat PKG_NOPARALLEL:= 1 +PKG_TARGET_DEPENDS:= !foxboard !ag241 + include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,GDB,gdb,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/gdbm/Makefile b/package/gdbm/Makefile index fcef44550..42dfeacfd 100644 --- a/package/gdbm/Makefile +++ b/package/gdbm/Makefile @@ -9,9 +9,11 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 1d1b1d5c0245b1c00aff92da751e9aa1 PKG_DESCR:= disk file format database PKG_SECTION:= libs -PKG_URL:= http://www.gnu.org/software/gdbm +PKG_URL:= http://www.gnu.org/software/gdbm/ PKG_SITES:= ${MASTER_SITE_GNU:=gdbm/} +PKG_SUBPKGS:= LIBGDBM + include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBGDBM,libgdbm,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/gdbserver/Makefile b/package/gdbserver/Makefile index a11971547..56ead34a6 100644 --- a/package/gdbserver/Makefile +++ b/package/gdbserver/Makefile @@ -7,13 +7,14 @@ include ${TOPDIR}/toolchain/gdb/Makefile.inc PKG_DESCR:= GNU debugger (small server) PKG_SECTION:= debug PKG_DEPENDS:= libthread-db +PKG_SUBPKGS:= GDBSERVER -PKG_TARGET_DEPENDS:= !foxboard - -include ${TOPDIR}/mk/package.mk +PKG_TARGET_DEPENDS:= !foxboard WRKSRC= ${WRKDIST}/gdb/gdbserver +include ${TOPDIR}/mk/package.mk + $(eval $(call PKG_template,GDBSERVER,gdbserver,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) post-install: diff --git a/package/gettext/Makefile b/package/gettext/Makefile index 4ef29852e..a0b0a7b65 100644 --- a/package/gettext/Makefile +++ b/package/gettext/Makefile @@ -4,13 +4,13 @@ include ${TOPDIR}/rules.mk PKG_NAME= gettext -PKG_VERSION= 0.16.1 +PKG_VERSION= 0.18.1.1 PKG_RELEASE= 1 -PKG_MD5SUM= 3d9ad24301c6d6b17ec30704a13fe127 +PKG_MD5SUM:= 3dd55b952826d2b32f51308f2f91aa89 PKG_DESCR:= internationalisation library PKG_SECTION:= libs PKG_DEPENDS:= libiconv libpthread -PKG_BUILDDEP+= libiconv libpthread +PKG_BUILDDEP:= libiconv libpthread PKG_URL:= http://www.gnu.org/software/gettext/ PKG_SITES:= ${MASTER_SITE_GNU:=gettext/} @@ -39,7 +39,9 @@ CONFIGURE_ENV+= nls_cv_use_gnu_gettext=yes \ gt_use_preinstalled_gnugettext=no post-install: - ${INSTALL_DIR} ${IDIR_GETTEXT}/usr/lib + ${INSTALL_DIR} ${IDIR_GETTEXT}/usr/lib ${IDIR_GETTEXT}/usr/bin ${CP} ${WRKINST}/usr/lib/*.so* ${IDIR_GETTEXT}/usr/lib + $(INSTALL_BIN) $(WRKINST)/usr/bin/gettext \ + $(IDIR_GETTEXT)/usr/bin include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/git/Makefile b/package/git/Makefile index 162cc13ab..068ba07b2 100644 --- a/package/git/Makefile +++ b/package/git/Makefile @@ -10,8 +10,8 @@ PKG_MD5SUM:= 13fc44363df744a401552e73e5476351 PKG_DESCR:= fast version control system PKG_SECTION:= scm PKG_DEPENDS:= libopenssl libcurl libexpat libpthread -PKG_BUILDDEP+= openssl curl expat -PKG_URL:= http://git-scm.com +PKG_BUILDDEP:= openssl curl expat +PKG_URL:= http://git-scm.com/ PKG_SITES:= http://kernel.org/pub/software/scm/git/ include $(TOPDIR)/mk/package.mk diff --git a/package/gkrellmd/Makefile b/package/gkrellmd/Makefile index 5ef0ed431..2f2548ca6 100644 --- a/package/gkrellmd/Makefile +++ b/package/gkrellmd/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 600f4daa395112ed19a3633deb0829ff PKG_DESCR:= The GNU Krell Monitors Server PKG_SECTION:= net/misc PKG_DEPENDS:= glib libpthread -PKG_BUILDDEP+= glib +PKG_BUILDDEP:= glib PKG_URL:= http://members.dslextreme.com/users/billw/gkrellm/gkrellm.html PKG_SITES:= http://members.dslextreme.com/users/billw/gkrellm/ diff --git a/package/glib/Makefile b/package/glib/Makefile index 4db94344a..9abe5a292 100644 --- a/package/glib/Makefile +++ b/package/glib/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= e699a93d62c01e0ee07caef3e11eddd8 PKG_DESCR:= low-level core library that forms the basis of GTK+ PKG_SECTION:= libs PKG_DEPENDS:= gettext libiconv libpthread -PKG_BUILDDEP+= gettext libiconv +PKG_BUILDDEP:= gettext libiconv PKG_URL:= http://www.gtk.org/ PKG_SITES:= ftp://ftp.gtk.org/pub/glib/2.22/ diff --git a/package/glibc/Makefile b/package/glibc/Makefile index 483c5244d..497fecd7c 100644 --- a/package/glibc/Makefile +++ b/package/glibc/Makefile @@ -6,9 +6,12 @@ include $(TOPDIR)/toolchain/glibc/Makefile.inc PKG_DESCR:= GNU C library PKG_SECTION:= base -NO_DISTFILES:= 1 PKG_OPTS:= noremove +PKG_SUBPKGS:= GLIBC GLIBC_DEV + +NO_DISTFILES:= 1 + include $(TOPDIR)/mk/package.mk GLIBC_CONFOPTS:= \ diff --git a/package/glproto/Makefile b/package/glproto/Makefile index b9b5ce58d..d85612a22 100644 --- a/package/glproto/Makefile +++ b/package/glproto/Makefile @@ -8,6 +8,8 @@ PKG_VERSION:= 1.4.11 PKG_RELEASE:= 1 PKG_MD5SUM:= 78e7c4dc7dcb74b1869fee7897e00f59 PKG_SITES:= http://xorg.freedesktop.org/releases/individual/proto/ +PKG_SUBPKGS:= + DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 include $(TOPDIR)/mk/package.mk diff --git a/package/gmediaserver/Makefile b/package/gmediaserver/Makefile index 53ae8367f..568bc424c 100644 --- a/package/gmediaserver/Makefile +++ b/package/gmediaserver/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= c422de386331e2a1a859d45f6fa270a3 PKG_DESCR:= An UPnP music media server PKG_SECTION:= multimedia PKG_DEPENDS:= id3lib libupnp -PKG_BUILDDEP+= id3lib libupnp +PKG_BUILDDEP:= id3lib libupnp PKG_URL:= http://www.gnu.org/software/gmediaserver PKG_SITES:= http://savannah.nongnu.org/download/gmediaserver/ diff --git a/package/gmp/Makefile b/package/gmp/Makefile index b7e6c2e82..721f16573 100644 --- a/package/gmp/Makefile +++ b/package/gmp/Makefile @@ -6,7 +6,9 @@ include ${TOPDIR}/toolchain/gmp/Makefile.inc PKG_DESCR:= GNU multiprecision arithmetic library PKG_SECTION:= libs -PKG_URL:= http://gmplib.org +PKG_URL:= http://gmplib.org/ + +PKG_SUBPKGS:= LIBGMP include ${TOPDIR}/mk/package.mk diff --git a/package/gnupg/Makefile b/package/gnupg/Makefile index 3f30ef3c2..ff3739775 100644 --- a/package/gnupg/Makefile +++ b/package/gnupg/Makefile @@ -10,8 +10,8 @@ PKG_MD5SUM:= 991faf66d3352ac1452acc393c430b23 PKG_DESCR:= Gnu Privacy Guard PKG_SECTION:= crypto PKG_DEPENDS:= libreadline libiconv -PKG_BUILDDEP+= readline libiconv -PKG_URL:= http://www.gnupg.org +PKG_BUILDDEP:= readline libiconv +PKG_URL:= http://www.gnupg.org/ PKG_SITES:= ftp://ftp.gnupg.org/gcrypt/gnupg/ include ${TOPDIR}/mk/package.mk diff --git a/package/gnutls/Makefile b/package/gnutls/Makefile index aaabead17..c6967f497 100644 --- a/package/gnutls/Makefile +++ b/package/gnutls/Makefile @@ -10,22 +10,25 @@ PKG_MD5SUM:= eb0a6d7d3cb9ac684d971c14f9f6d3ba PKG_DESCR:= GNU TLS library PKG_SECTION:= crypto PKG_DEPENDS:= libgcrypt libtasn1 zlib -PKG_BUILDDEP+= libgcrypt liblzo libtasn1 opencdk zlib ncurses +PKG_BUILDDEP:= libgcrypt liblzo libtasn1 opencdk zlib ncurses PKG_URL:= http://www.gnu.org/software/gnutls/ PKG_SITES:= ${MASTER_SITE_GNU:=gnutls/} -DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 +PKG_SUBPKGS:= LIBGNUTLS GNUTLS_UTILS LIBGNUTLS_EXTRA LIBGNUTLS_OPENSSL +PKGSD_GNUTLS_UTILS:= GNU TLS utilities +PKGSS_GNUTLS_UTILS:= libgnutls libgnutls-extra +PKGSC_LIBGNUTLS:= libs +PKGSC_LIBGNUTLS_EXTRA:= libs +PKGSC_LIBGNUTLS_OPENSSL:= libs -PKG_DESCR_GNUTLS_UTILS:= GNU TLS utilities -PKG_DEPENDS_GNUTLS_UTILS:= libgnutls libgnutls-extra -PKG_SECTION_LIB:= libs +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 include ${TOPDIR}/mk/package.mk -$(eval $(call PKG_template,LIBGNUTLS,libgnutls,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION_LIB})) -$(eval $(call PKG_template,GNUTLS_UTILS,gnutls-utils,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_GNUTLS_UTILS},${PKG_DESCR_GNUTLS_UTILS},${PKG_SECTION})) -$(eval $(call PKG_template,LIBGNUTLS_EXTRA,libgnutls-extra,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION_LIB})) -$(eval $(call PKG_template,LIBGNUTLS_OPENSSL,libgnutls-openssl,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION_LIB})) +$(eval $(call PKG_template,LIBGNUTLS,libgnutls,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKGSC_LIBGNUTLS})) +$(eval $(call PKG_template,GNUTLS_UTILS,gnutls-utils,${PKG_VERSION}-${PKG_RELEASE},${PKGSS_GNUTLS_UTILS},${PKGSD_GNUTLS_UTILS},${PKG_SECTION})) +$(eval $(call PKG_template,LIBGNUTLS_EXTRA,libgnutls-extra,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKGSC_LIBGNUTLS_EXTRA})) +$(eval $(call PKG_template,LIBGNUTLS_OPENSSL,libgnutls-openssl,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKGSC_LIBGNUTLS_OPENSSL})) CONFIGURE_ARGS+= --without-libopencdk-prefix \ --disable-camellia \ diff --git a/package/gpsd/Makefile b/package/gpsd/Makefile index 167af550a..275613e3d 100644 --- a/package/gpsd/Makefile +++ b/package/gpsd/Makefile @@ -10,17 +10,18 @@ PKG_MD5SUM:= 12535a9ed9fecf9ea2c5bdc9840da5ae PKG_DESCR:= An interface daemon for GPS receivers PKG_SECTION:= misc PKG_DEPENDS:= libpthread -PKG_BUILDDEP+= ncurses -PKG_CXX:= GPSD +PKG_BUILDDEP:= ncurses PKG_SITES:= http://download.berlios.de/gpsd/ PKG_URL:= http://gpsd.berlios.de/ +PKG_CXX:= GPSD -PKG_DESCR_CLIENTS:= GPS client utilities +PKG_SUBPKGS:= GPSD GPSD_CLIENTS +PKGSD_GPSD_CLIENTS:= GPS client utilities include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,GPSD,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,GPSD_CLIENTS,gpsd-clients,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_CLIENTS},${PKG_SECTION})) +$(eval $(call PKG_template,GPSD_CLIENTS,gpsd-clients,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_GPSD_CLIENTS},${PKG_SECTION})) CONFIGURE_ENV+= EGREP="grep -E" \ CPP="$(TARGET_CC) -E" \ diff --git a/package/grub-bin/Makefile b/package/grub-bin/Makefile index c1d412b32..d39c1bb21 100644 --- a/package/grub-bin/Makefile +++ b/package/grub-bin/Makefile @@ -12,16 +12,17 @@ PKG_MD5SUM:= 958f9fd415a0bd52fe115176afbf19d9 PKG_DESCR:= GRUB2 bootloader (binary package) PKG_SECTION:= base PKG_SITES:= http://openadk.org/distfiles/ +PKG_URL:= http://www.gnu.org/software/grub PKG_TARGET_DEPENDS:= x86 x86_64 -CFLINE_GRUB_BIN:= select BUSYBOX_FEATURE_STAT_FORMAT\n\tdepends on !ADK_TARGET_ROOTFS_INITRAMFS_PIGGYBACK && !ADK_TARGET_ROOTFS_INITRAMFS +PKG_CFLINE_GRUB_BIN:= select BUSYBOX_FEATURE_STAT_FORMAT@ +PKG_CFLINE_GRUB_BIN+= depends on !ADK_TARGET_ROOTFS_INITRAMFS_PIGGYBACK && !ADK_TARGET_ROOTFS_INITRAMFS +PKG_DFLT_GRUB_BIN:= y include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,GRUB_BIN,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -PKGDFLT_GRUB_BIN= y - CONFIG_STYLE:= manual BUILD_STYLE:= manual INSTALL_STYLE:= manual diff --git a/package/grub/Makefile b/package/grub/Makefile index b594a5632..404332590 100644 --- a/package/grub/Makefile +++ b/package/grub/Makefile @@ -13,7 +13,7 @@ PKG_URL:= http://www.gnu.org/software/grub PKG_SITES:= ftp://alpha.gnu.org/gnu/grub/ PKG_HOST_DEPENDS:= linux -PKG_TARGET_DEPENDS:= x86 x86_64 +PKG_TARGET_DEPENDS:= x86 x86_64 include $(TOPDIR)/mk/package.mk diff --git a/package/gsm/Makefile b/package/gsm/Makefile index ef5beb10b..cac1448ae 100644 --- a/package/gsm/Makefile +++ b/package/gsm/Makefile @@ -11,17 +11,19 @@ PKG_DESCR:= A GSM 06.10 full-rate speech transcoding implementation (library) PKG_SECTION:= libs PKG_URL:= http://www-rn.informatik.uni-bremen.de/software/gsm/ PKG_SITES:= http://www-rn.informatik.uni-bremen.de/software/gsm/ - PKG_NOPARALLEL:= 1 -PKG_DESCR_1:= A GSM 06.10 full-rate speech transcoding implementation (utilities) -PKG_DEPENDS_1:= libgsm + +PKG_SUBPKGS:= LIBGSM GSM_UTILS +PKGSD_GSM_UTILS:= A GSM 06.10 full-rate speech transcoding implementation (utilities) +PKGSS_GSM_UTILS:= libgsm +PKGSC_GSM_UTILS:= misc WRKDIST= ${WRKDIR}/${PKG_NAME}-1.0-pl10 include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBGSM,libgsm,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,GSM_UTILS,gsm-utils,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_1},${PKG_DESCR_1},${PKG_SECTION})) +$(eval $(call PKG_template,GSM_UTILS,gsm-utils,${PKG_VERSION}-${PKG_RELEASE},${PKGSS_GSM_UTILS},${PKGSD_GSM_UTILS},${PKGSC_GSM_UTILS})) CONFIG_STYLE:= manual diff --git a/package/gtk+/Makefile b/package/gtk+/Makefile index c67a7c101..163aeed97 100644 --- a/package/gtk+/Makefile +++ b/package/gtk+/Makefile @@ -10,10 +10,12 @@ PKG_MD5SUM:= f98617af9f6be3065f64248f78dae2b7 PKG_DESCR:= GTK+ library PKG_SECTION:= libs PKG_DEPENDS:= glib -PKG_BUILDDEP+= cairo atk pango libXext renderproto libXrender +PKG_BUILDDEP:= cairo atk pango libXext renderproto libXrender PKG_URL:= http://www.gtk.org/ PKG_SITES:= http://ftp.gnome.org/pub/gnome/sources/gtk+/2.18/ +PKG_SUBPKGS:= GTK + ifeq ($(ADK_STATIC),y) PKG_OPTS:= libonly endif diff --git a/package/haserl/Makefile b/package/haserl/Makefile index b40ffdc9c..25b8bff76 100644 --- a/package/haserl/Makefile +++ b/package/haserl/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 8cd64e591209751a062ad4e08f1d10dd PKG_DESCR:= a CGI wrapper to embed shell scripts in HTML documents PKG_SECTION:= lang -PKG_URL:= http://haserl.sourceforge.net +PKG_URL:= http://haserl.sourceforge.net/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=haserl/} include ${TOPDIR}/mk/package.mk diff --git a/package/heimdal/Makefile b/package/heimdal/Makefile index 6065af49f..41cb87bd1 100644 --- a/package/heimdal/Makefile +++ b/package/heimdal/Makefile @@ -5,44 +5,38 @@ include $(TOPDIR)/rules.mk PKG_NAME:= heimdal PKG_VERSION:= 1.2.1 -PKG_RELEASE:= 1 +PKG_RELEASE:= 2 PKG_MD5SUM:= 6e5028077e2a6b101a4a72801ba71b9e PKG_DESCR:= Kerberos 5 server PKG_SECTION:= crypto -PKG_NOPARALLEL:= 1 PKG_DEPENDS:= libheimdal libheimdal-client libncurses libcom-err -PKG_BUILDDEP+= openssl ncurses e2fsprogs -ifeq (${ADK_COMPILE_HEIMDAL_WITH_DB_BDB},y) -PKG_BUILDDEP+= libdb -endif -ifeq (${ADK_COMPILE_HEIMDAL_WITH_DB_LDAP},y) -PKG_BUILDDEP+= openldap -endif -PKG_URL:= http://www.h5l.org +PKG_BUILDDEP:= openssl ncurses e2fsprogs +PKG_URL:= http://www.h5l.org/ PKG_SITES:= http://www.h5l.org/dist/src/ +PKG_NOPARALLEL:= 1 -PKG_DESCR_1:= Kerberos 5 server libraries -PKG_SECTION_1:= libs - -PKG_DESCR_2:= Kerberos 5 client libraries -PKG_SECTION_2:= libs +PKG_SUBPKGS:= HEIMDAL LIBHEIMDAL LIBHEIMDAL_CLIENT +PKGSD_LIBHEIMDAL:= Kerberos 5 server libraries +PKGSC_LIBHEIMDAL:= libs +PKGSD_LIBHEIMDAL_CLIENT:= Kerberos 5 client libraries +PKGSC_LIBHEIMDAL_CLIENT:= libs PKG_FLAVOURS:= PKINIT PKGFD_PKINIT:= Enable PK-INIT -include $(TOPDIR)/mk/package.mk - -ifeq ($(ADK_COMPILE_HEIMDAL_WITH_DB_BDB),y) -PKG_DEPENDS+= libdb -endif +PKG_CHOICES:= WITH_LDAP WITH_BDB +PKGCD_WITH_LDAP:= use OpenLDAP as database backend +PKGCS_WITH_LDAP:= libopenldap +PKGCB_WITH_LDAP:= openldap +PKGCD_WITH_BDB:= use Berkeley DB as database backend +PKGCS_WITH_BDB:= libdb +PKGCB_WITH_BDB:= libdb -ifeq ($(ADK_COMPILE_HEIMDAL_WITH_DB_LDAP),y) -PKG_DEPENDS+= libopenldap -endif +include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,HEIMDAL_SERVER,heimdal-server,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,LIBHEIMDAL,libheimdal,$(PKG_VERSION)-${PKG_RELEASE},,${PKG_DESCR_1},${PKG_SECTION_1})) -$(eval $(call PKG_template,LIBHEIMDAL_CLIENT,libheimdal-client,$(PKG_VERSION)-${PKG_RELEASE},,${PKG_DESCR_2},${PKG_SECTION_2})) +$(eval $(call PKG_template,LIBHEIMDAL,libheimdal,$(PKG_VERSION)-${PKG_RELEASE},,${PKGSD_LIBHEIMDAL},${PKGSC_LIBHEIMDAL})) +$(eval $(call PKG_template,LIBHEIMDAL_CLIENT,libheimdal-client,$(PKG_VERSION)-${PKG_RELEASE},,${PKGSD_LIBHEIMDAL_CLIENT},${PKGSC_LIBHEIMDAL_CLIENT})) CONFIGURE_OPTS:= --with-hdbdir=/etc/heimdal \ --disable-otp \ @@ -52,13 +46,13 @@ CONFIGURE_OPTS:= --with-hdbdir=/etc/heimdal \ --with-ipv6 \ --sysconfdir=/etc/heimdal -ifeq ($(ADK_COMPILE_HEIMDAL_WITH_DB_BDB),y) +ifeq ($(ADK_COMPILE_HEIMDAL_WITH_BDB),y) CONFIGURE_ARGS+= --enable-berkeley-db else CONFIGURE_ARGS+= --disable-berkeley-db endif -ifeq ($(ADK_COMPILE_HEIMDAL_WITH_DB_LDAP),y) +ifeq ($(ADK_COMPILE_HEIMDAL_WITH_LDAP),y) CONFIGURE_ARGS+= --with-openldap=yes CONFIGURE_ARGS+= --with-openldap-include=${STAGING_DIR}/usr CONFIGURE_ARGS+= --with-openldap-lib=${STAGING_DIR}/usr diff --git a/package/heyu/Makefile b/package/heyu/Makefile index d52aa0a22..f94c27072 100644 --- a/package/heyu/Makefile +++ b/package/heyu/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 9c7624b61ea39bbfa70336dc703cd5f1 PKG_DESCR:= X10 home automation control using the CM11A PKG_SECTION:= serial PKG_DEPENDS:= setserial -PKG_URL:= http://heyu.tanj.com +PKG_URL:= http://heyu.tanj.com/ PKG_SITES:= http://heyu.tanj.com/download/ DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tgz diff --git a/package/hostapd/Makefile b/package/hostapd/Makefile index d547c9c94..0aa427d55 100644 --- a/package/hostapd/Makefile +++ b/package/hostapd/Makefile @@ -9,25 +9,22 @@ PKG_RELEASE:= 2 PKG_MD5SUM:= f47689c62ee8c1c59989b402d4f130c3 PKG_DESCR:= an IEEE 802.11 AP, IEEE 802.1x/WPA/WPA2/EAP/RADIUS Authenticator PKG_SECTION:= wifi -PKG_MULTI:= 1 -PKG_DEPENDS:= libnl libopenssl -PKG_BUILDDEP+= libnl openssl -PKG_URL:= http://hostap.epitest.fi -ifeq (${ADK_PACKAGE_HOSTAPD_WITH_OPENSSL},y) -PKG_BUILDDEP+= openssl -endif -ifeq (${ADK_PACKAGE_HOSTAPD_WITH_GNUTLS},y) -PKG_BUILDDEP+= gnutls -endif +PKG_DEPENDS:= libnl +PKG_BUILDDEP:= libnl +PKG_URL:= http://hostap.epitest.fi/ PKG_SITES:= http://hostap.epitest.fi/releases/ +PKG_MULTI:= 1 -WRKSRC= ${WRKDIST}/${PKG_NAME} - +PKG_SUBPKGS:= HOSTAPD HOSTAPD_UTILS PKG_CHOICES:= WITH_OPENSSL WITH_GNUTLS PKGCD_WITH_OPENSSL:= use OpenSSL for crypto PKGCS_WITH_OPENSSL:= libopenssl +PKGCB_WITH_OPENSSL:= openssl PKGCD_WITH_GNUTLS:= use GnuTLS for crypto PKGCS_WITH_GNUTLS:= libgnutls +PKGCB_WITH_GNUTLS:= gnutls + +WRKSRC= ${WRKDIST}/${PKG_NAME} include ${TOPDIR}/mk/package.mk diff --git a/package/httping/Makefile b/package/httping/Makefile index ca536190f..2abf4d187 100644 --- a/package/httping/Makefile +++ b/package/httping/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= bde1ff3c01343d2371d8f34fbf8a1d9a PKG_DESCR:= Httping is like 'ping' but for http-requests PKG_SECTION:= net PKG_DEPENDS:= libopenssl -PKG_BUILDDEP+= openssl +PKG_BUILDDEP:= openssl PKG_SITES:= http://www.vanheusden.com/httping/ DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tgz diff --git a/package/httptunnel/Makefile b/package/httptunnel/Makefile index 134a207a1..31ddcda22 100644 --- a/package/httptunnel/Makefile +++ b/package/httptunnel/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 2a710f377c82ab4eb201458f7b9f99c5 PKG_DESCR:= http tunneling software PKG_SECTION:= net/security -PKG_URL:= http://www.nocrew.org/software/httptunnel +PKG_URL:= http://www.nocrew.org/software/httptunnel/ PKG_SITES:= http://www.nocrew.org/software/httptunnel/ include ${TOPDIR}/mk/package.mk diff --git a/package/icecast/Makefile b/package/icecast/Makefile index 24e5c6633..295c45844 100644 --- a/package/icecast/Makefile +++ b/package/icecast/Makefile @@ -6,11 +6,11 @@ include ${TOPDIR}/rules.mk PKG_NAME:= icecast PKG_VERSION:= 2.3.2 PKG_RELEASE:= 2 -PKG_BUILDDEP+= curl libvorbis libxml2 libxslt PKG_MD5SUM:= ff516b3ccd2bcc31e68f460cd316093f PKG_DESCR:= A streaming media server PKG_SECTION:= multimedia PKG_DEPENDS:= libcurl libvorbis libpthread libxml2 libxslt +PKG_BUILDDEP:= curl libvorbis libxml2 libxslt PKG_URL:= http://www.icecast.org/ PKG_SITES:= http://downloads.us.xiph.org/releases/icecast/ diff --git a/package/id3lib/Makefile b/package/id3lib/Makefile index 983ac7a1d..a35c76f0e 100644 --- a/package/id3lib/Makefile +++ b/package/id3lib/Makefile @@ -9,11 +9,11 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 19f27ddd2dda4b2d26a559a4f0f402a7 PKG_DESCR:= An ID3v1/ID3v2 tagging library PKG_SECTION:= libs -PKG_CXX:= ID3LIB PKG_DEPENDS:= zlib libiconv -PKG_BUILDDEP+= zlib libiconv -PKG_URL:= http://id3lib.sourceforge.net +PKG_BUILDDEP:= zlib libiconv +PKG_URL:= http://id3lib.sourceforge.net/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=id3lib/} +PKG_CXX:= ID3LIB include ${TOPDIR}/mk/package.mk diff --git a/package/iftop/Makefile b/package/iftop/Makefile index 374cf5410..fdee53037 100644 --- a/package/iftop/Makefile +++ b/package/iftop/Makefile @@ -10,8 +10,8 @@ PKG_MD5SUM:= 062bc8fb3856580319857326e0b8752d PKG_DESCR:= display bandwith usage on an interface PKG_SECTION:= net PKG_DEPENDS:= libncurses libpcap libpthread -PKG_BUILDDEP+= libpcap libpthread ncurses -PKG_URL:= http://www.ex-parrot.com/~pdw/iftop +PKG_BUILDDEP:= libpcap libpthread ncurses +PKG_URL:= http://www.ex-parrot.com/~pdw/iftop/ PKG_SITES:= http://www.ex-parrot.com/~pdw/iftop/download/ include ${TOPDIR}/mk/package.mk diff --git a/package/igmpproxy/Makefile b/package/igmpproxy/Makefile index 32797780f..d255fd1f2 100644 --- a/package/igmpproxy/Makefile +++ b/package/igmpproxy/Makefile @@ -12,7 +12,8 @@ PKG_SECTION:= proxy PKG_URL:= http://sourceforge.net/projects/igmpproxy/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=igmpproxy/} -CFLINE_IGMPPROXY= select ADK_KERNEL_IP_MULTICAST\n\tselect ADK_KERNEL_IP_MROUTE +PKG_CFLINE_IGMPPROXY:= select ADK_KERNEL_IP_MULTICAST@ +PKG_CFLINE_IGMPPROXY+= select ADK_KERNEL_IP_MROUTE include ${TOPDIR}/mk/package.mk diff --git a/package/inputproto/Makefile b/package/inputproto/Makefile index e9243c8cf..bf22d9d9a 100644 --- a/package/inputproto/Makefile +++ b/package/inputproto/Makefile @@ -8,6 +8,7 @@ PKG_VERSION:= 2.0 PKG_RELEASE:= 1 PKG_MD5SUM:= 13d91739cf70a781f1db24d8d3677574 PKG_SITES:= ${MASTER_SITE_XORG} +PKG_SUBPKGS:= include $(TOPDIR)/mk/package.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/ipcad/Makefile b/package/ipcad/Makefile index 342822d26..769b3898b 100644 --- a/package/ipcad/Makefile +++ b/package/ipcad/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 125605249958894148ec26d3c88189f5 PKG_DESCR:= IP Cisco Accounting Daemon PKG_SECTION:= net PKG_DEPENDS:= libpcap -PKG_BUILDDEP+= libpcap +PKG_BUILDDEP:= libpcap PKG_URL:= http://lionet.info/ipcad PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=ipcad/} diff --git a/package/iperf/Makefile b/package/iperf/Makefile index 2876f1464..7a4f70994 100644 --- a/package/iperf/Makefile +++ b/package/iperf/Makefile @@ -9,10 +9,10 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 8c5bc14cc2ea55f18f22afe3c23e3dcb PKG_DESCR:= Internet Protocol bandwidth measuring tool PKG_SECTION:= net -PKG_CXX:= IPERF PKG_DEPENDS:= libpthread PKG_URL:= http://sourceforge.net/projects/iperf PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=iperf/} +PKG_CXX:= IPERF include ${TOPDIR}/mk/package.mk diff --git a/package/iproute2/Makefile b/package/iproute2/Makefile index aaf17a1a5..8ffc0ddb0 100644 --- a/package/iproute2/Makefile +++ b/package/iproute2/Makefile @@ -9,34 +9,33 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 5c5742bdac05a1688f266512e685b83c PKG_DESCR:= iproute2 routing control utility PKG_SECTION:= route -ifneq ($(strip ${ADK_PACKAGE_TC_ATM}),) -PKG_BUILDDEP+= linux-atm -endif PKG_URL:= http://www.linuxfoundation.org/en/Net:Iproute2 PKG_SITES:= http://devresources.linuxfoundation.org/dev/iproute2/download/ -PKG_DESCR_TC:= iproute2 traffic control utility -PKG_DEPENDS_TC:= kmod-sched -PKG_DESCR_TC_ATM:= iproute2 traffic control ATM support library -PKG_DEPENDS_TC_ATM:= tc libatm -PKG_DESCR_IFSTAT:= iproute2 interface statistics utility -PKG_DESCR_LNSTAT:= iproute2 network statistics utilities -PKG_DESCR_ROUTEL:= iproute2 route list and flush utilities -PKG_DESCR_RTMON:= iproute2 RTnetlink monitor -PKG_DESCR_SS:= iproute2 socket statistics utility +PKG_SUBPKGS:= IP TC TC_ATM IFSTAT LNSTAT ROUTEL RTMON SS +PKGSD_TC:= iproute2 traffic control utility +PKGSS_TC:= kmod-sched +PKGSD_TC_ATM:= iproute2 traffic control ATM support library +PKGSS_TC_ATM:= tc libatm +PKGSB_TC_ATM:= linux-atm +PKGSD_IFSTAT:= iproute2 interface statistics utility +PKGSD_LNSTAT:= iproute2 network statistics utilities +PKGSD_ROUTEL:= iproute2 route list and flush utilities +PKGSD_RTMON:= iproute2 RTnetlink monitor +PKGSD_SS:= iproute2 socket statistics utility DISTFILES:= $(PKG_NAME)-$(PKG_VERSION).tar.bz2 include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,IP,ip,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,TC,tc,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_TC},${PKG_DESCR_TC},${PKG_SECTION})) -$(eval $(call PKG_template,TC_ATM,tc-atm,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_TC_ATM},${PKG_DESCR_TC_ATM},${PKG_SECTION})) -$(eval $(call PKG_template,IFSTAT,ifstat,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_IFSTAT},${PKG_DESCR_IFSTAT},${PKG_SECTION})) -$(eval $(call PKG_template,LNSTAT,lnstat,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_LNSTAT},${PKG_DESCR_LNSTAT},${PKG_SECTION})) -$(eval $(call PKG_template,ROUTEL,routel,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_ROUTEL},${PKG_DESCR_ROUTEL},${PKG_SECTION})) -$(eval $(call PKG_template,RTMON,rtmon,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_RTMON},${PKG_DESCR_RTMON},${PKG_SECTION})) -$(eval $(call PKG_template,SS,ss,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_SS},${PKG_DESCR_SS},${PKG_SECTION})) +$(eval $(call PKG_template,TC,tc,${PKG_VERSION}-${PKG_RELEASE},${PKGSS_TC},${PKGSD_TC},${PKG_SECTION})) +$(eval $(call PKG_template,TC_ATM,tc-atm,${PKG_VERSION}-${PKG_RELEASE},${PKGSS_TC_ATM},${PKGSD_TC_ATM},${PKG_SECTION})) +$(eval $(call PKG_template,IFSTAT,ifstat,${PKG_VERSION}-${PKG_RELEASE},,${PKGSD_IFSTAT},${PKG_SECTION})) +$(eval $(call PKG_template,LNSTAT,lnstat,${PKG_VERSION}-${PKG_RELEASE},,${PKGSD_LNSTAT},${PKG_SECTION})) +$(eval $(call PKG_template,ROUTEL,routel,${PKG_VERSION}-${PKG_RELEASE},,${PKGSD_ROUTEL},${PKG_SECTION})) +$(eval $(call PKG_template,RTMON,rtmon,${PKG_VERSION}-${PKG_RELEASE},,${PKGSD_RTMON},${PKG_SECTION})) +$(eval $(call PKG_template,SS,ss,${PKG_VERSION}-${PKG_RELEASE},,${PKGSD_SS},${PKG_SECTION})) TCFLAGS+= -D_GNU_SOURCE XAKE_FLAGS+= CCOPTS="${TCFLAGS}" MFLAGS="CC=${TARGET_CC}" \ diff --git a/package/ipsec-tools/Makefile b/package/ipsec-tools/Makefile index 322d8328a..d3efd7f5d 100644 --- a/package/ipsec-tools/Makefile +++ b/package/ipsec-tools/Makefile @@ -10,8 +10,8 @@ PKG_MD5SUM:= 72861f005746ee27984b2ee715ecc629 PKG_DESCR:= IPsec management tools PKG_SECTION:= net/security PKG_DEPENDS:= libopenssl -PKG_BUILDDEP+= openssl -PKG_URL:= http://ipsec-tools.sourceforge.net +PKG_BUILDDEP:= openssl +PKG_URL:= http://ipsec-tools.sourceforge.net/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=ipsec-tools/} DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 diff --git a/package/ipset/Makefile b/package/ipset/Makefile index a5b9c00c0..ff8a0399b 100644 --- a/package/ipset/Makefile +++ b/package/ipset/Makefile @@ -9,21 +9,21 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= d104007fdf5ea64fef774c22b1c0a97b PKG_DESCR:= ip sets administration utility PKG_SECTION:= firewall -PKG_URL:= http://ipset.netfilter.org +PKG_URL:= http://ipset.netfilter.org/ PKG_SITES:= http://ipset.netfilter.org/ -PKG_SECTION_KMOD_IPSET:=kernel -DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 +PKG_SUBPKGS:= IPSET KMOD_IPSET +PKGSD_KMOD_IPSET:= ipset kernel module +PKGSC_KMOD_IPSET:= kernel -PKG_DESCR_KMOD:= ipset kernel module +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,IPSET,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,KMOD_IPSET,kmod-ipset,${KERNEL_VERSION}+${PKG_VERSION}-${ADK_TARGET}-${PKG_RELEASE},,${PKG_DESCR_KMOD},${PKG_SECTION_KMOD_IPSET})) +$(eval $(call PKG_template,KMOD_IPSET,kmod-ipset,${KERNEL_VERSION}+${PKG_VERSION}-${ADK_TARGET}-${PKG_RELEASE},,${PKGSD_KMOD_IPSET},${PKGSC_KMOD_IPSET})) CONFIG_STYLE:= manual - XAKE_FLAGS+= PREFIX=/usr ALL_TARGET:= binaries INSTALL_TARGET:= binaries_install diff --git a/package/iptables-snmp/Makefile b/package/iptables-snmp/Makefile index eb5d1bc8c..b6ce0993d 100644 --- a/package/iptables-snmp/Makefile +++ b/package/iptables-snmp/Makefile @@ -6,10 +6,10 @@ include $(TOPDIR)/rules.mk PKG_NAME:= iptables-snmp PKG_VERSION:= 0.1 PKG_RELEASE:= 1 -PKG_BUILDDEP+= net-snmp PKG_MD5SUM:= 8370d2f0c899461a053da491400119d1 PKG_DESCR:= iptables support for net-snmp PKG_SECTION:= net/misc +PKG_BUILDDEP:= net-snmp PKG_URL:= http://www.nobiscuit.com/iptables-snmp/ PKG_SITES:= http://www.nobiscuit.com/iptables-snmp/ diff --git a/package/iptables/Makefile b/package/iptables/Makefile index d22f847a5..aac6179a0 100644 --- a/package/iptables/Makefile +++ b/package/iptables/Makefile @@ -22,6 +22,8 @@ PKG_SITES:= http://www.netfilter.org/projects/iptables/files/ \ ftp://ftp.de.netfilter.org/pub/netfilter/iptables/ \ ftp://ftp.no.netfilter.org/pub/netfilter/iptables/ +PKG_SUBPKGS:= IPTABLES IP6TABLES + DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 include ${TOPDIR}/mk/package.mk diff --git a/package/iptraf/Makefile b/package/iptraf/Makefile index e45ec244e..6c3bc7907 100644 --- a/package/iptraf/Makefile +++ b/package/iptraf/Makefile @@ -10,10 +10,9 @@ PKG_MD5SUM:= 377371c28ee3c21a76f7024920649ea8 PKG_DESCR:= A console-based network monitoring program. PKG_SECTION:= net PKG_DEPENDS:= libncurses -PKG_BUILDDEP+= ncurses -PKG_URL:= http://iptraf.seul.org -PKG_SITES:= ftp://iptraf.seul.org/pub/iptraf/ \ - ftp://the.wiretapped.net/pub/security/network-monitoring/iptraf/ +PKG_BUILDDEP:= ncurses +PKG_URL:= http://iptraf.seul.org/ +PKG_SITES:= ftp://iptraf.seul.org/pub/iptraf/ include ${TOPDIR}/mk/package.mk diff --git a/package/irssi/Makefile b/package/irssi/Makefile index 70b0e256a..55894fd7c 100644 --- a/package/irssi/Makefile +++ b/package/irssi/Makefile @@ -10,17 +10,15 @@ PKG_MD5SUM:= 870db8e319f640c2bf446c30d0c24ef6 PKG_DESCR:= IRC text client PKG_SECTION:= chat PKG_DEPENDS:= glib libncurses -PKG_BUILDDEP+= glib ncurses -ifeq (${ADK_PACKAGE_IRSSI_WITH_SSL},y) -PKG_BUILDDEP+= openssl -endif +PKG_BUILDDEP:= glib ncurses PKG_URL:= http://www.irssi.org/ PKG_SITES:= http://www.irssi.org/files/ PKG_FLAVOURS:= WITH_SSL WITH_IPV6 -PKGFD_SSL:= SSL/TLS support -PKGFS_SSL:= libopenssl -PKGFD_IPV6:= IPv6 support +PKGFD_WITH_SSL:= enable SSL/TLS support +PKGFS_WITH_SSL:= libopenssl +PKGFB_WITH_SSL:= openssl +PKGFD_WITH_IPV6:= enable IPv6 support include ${TOPDIR}/mk/package.mk diff --git a/package/iw/Makefile b/package/iw/Makefile index 69b8a2852..cfd27d041 100644 --- a/package/iw/Makefile +++ b/package/iw/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 3b88743f9c6ce8a7e2f5fd7d18fdea42 PKG_DESCR:= Tools for setting up WiFi cards via netlink (nl80211) PKG_SECTION:= wifi PKG_DEPENDS:= libnl -PKG_BUILDDEP+= libnl +PKG_BUILDDEP:= libnl PKG_URL:= http://wireless.kernel.org/en/users/Documentation/iw PKG_SITES:= http://wireless.kernel.org/download/iw/ @@ -21,6 +21,7 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,IW,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) CONFIG_STYLE:= manual +TCFLAGS+= $(TCPPFLAGS) post-install: ${INSTALL_DIR} ${IDIR_IW}/usr/sbin diff --git a/package/jamvm/Makefile b/package/jamvm/Makefile index a459673eb..06c6d8040 100644 --- a/package/jamvm/Makefile +++ b/package/jamvm/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 7654e9657691f5f09c4f481ed4686176 PKG_DESCR:= A Java Virtual Machine (JVM) implementation PKG_SECTION:= lang PKG_DEPENDS:= libffi zlib -PKG_BUILDDEP+= libffi zlib +PKG_BUILDDEP:= libffi zlib PKG_URL:= http://jamvm.sourceforge.net PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=jamvm/} diff --git a/package/jpeg/Makefile b/package/jpeg/Makefile index 34d1c72ea..4b91d88b3 100644 --- a/package/jpeg/Makefile +++ b/package/jpeg/Makefile @@ -10,8 +10,9 @@ PKG_MD5SUM:= 382ef33b339c299b56baf1296cda9785 PKG_DESCR:= The Independent JPEG Groups JPEG runtime library PKG_SECTION:= libs PKG_URL:= http://www.ijg.org/ -PKG_SITES:= http://www.ijg.org/files/ \ - ftp://ftp.uu.net/graphics/jpeg/ +PKG_SITES:= http://www.ijg.org/files/ + +PKG_SUBPKGS:= LIBJPEG DISTFILES:= ${PKG_NAME}src.v${PKG_VERSION}.tar.gz diff --git a/package/kbproto/Makefile b/package/kbproto/Makefile index f84afa463..f8b7bd0d6 100644 --- a/package/kbproto/Makefile +++ b/package/kbproto/Makefile @@ -8,6 +8,7 @@ PKG_VERSION:= 1.0.4 PKG_RELEASE:= 1 PKG_MD5SUM:= 4deef518a03bc94a7a25902bb7c98dd6 PKG_SITES:= ${MASTER_SITE_XORG} +PKG_SUBPKGS:= include $(TOPDIR)/mk/package.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/kismet/Makefile b/package/kismet/Makefile index bca614414..cfcf5d908 100644 --- a/package/kismet/Makefile +++ b/package/kismet/Makefile @@ -6,24 +6,25 @@ include ${TOPDIR}/rules.mk PKG_NAME:= kismet PKG_VERSION:= 2010-01-R1 PKG_RELEASE:= 1 +PKG_MD5SUM:= a6d6edcf65d5bb2cb5de6472bcc16f19 PKG_DESCR:= Kismet PKG_SECTION:= wifi -PKG_BUILDDEP+= libpcap ncurses PKG_DEPENDS:= libpcap libncurses -PKG_MD5SUM:= a6d6edcf65d5bb2cb5de6472bcc16f19 +PKG_BUILDDEP:= libpcap ncurses PKG_URL:= http://www.kismetwireless.net/ PKG_SITES:= http://www.kismetwireless.net/code/ -PKG_DESCR_CLIENT:= Kismet client -PKG_DESCR_SERVER:= Kismet server -PKG_DESCR_DRONE:= Kismet drone +PKG_SUBPKGS:= KISMET KISMET_CLIENT KISMET_DRONE KISMET_SERVER +PKGSD_KISMET_CLIENT:= Kismet client +PKGSD_KISMET_SERVER:= Kismet server +PKGSD_KISMET_DRONE:= Kismet drone include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,KISMET,kismet,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,KISMET_CLIENT,kismet-client,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_CLIENT},${PKG_SECTION})) -$(eval $(call PKG_template,KISMET_DRONE,kismet-drone,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_DRONE},${PKG_SECTION})) -$(eval $(call PKG_template,KISMET_SERVER,kismet-server,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_SERVER},${PKG_SECTION})) +$(eval $(call PKG_template,KISMET_CLIENT,kismet-client,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_KISMET_CLIENT},${PKG_SECTION})) +$(eval $(call PKG_template,KISMET_DRONE,kismet-drone,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_KISMET_DRONE},${PKG_SECTION})) +$(eval $(call PKG_template,KISMET_SERVER,kismet-server,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_KISMET_SERVER},${PKG_SECTION})) CONFIGURE_ARGS+= --sysconfdir=/etc/kismet \ --disable-linuxwext diff --git a/package/knock/Makefile b/package/knock/Makefile index 75c8055b5..c7978ece1 100644 --- a/package/knock/Makefile +++ b/package/knock/Makefile @@ -9,17 +9,18 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= ca09d61458974cff90a700aba6120891 PKG_DESCR:= A port-knocking client PKG_SECTION:= firewall +PKG_BUILDDEP:= libpcap PKG_URL:= http://www.zeroflux.org/projects/knock -PKG_BUILDDEP+= libpcap PKG_SITES:= http://www.zeroflux.org/proj/knock/files/ -PKG_DESCR_1:= A port-knocking server -PKG_DEPENDS_1:= libpcap +PKG_SUBPKGS:= KNOCK KNOCKD +PKGSD_KNOCKD:= A port-knocking server +PKGSS_KNOCKD:= libpcap include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,KNOCK,knock,${PKG_VERSION}-${PKG_RELEASE},,${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,KNOCKD,knockd,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_1},${PKG_DESCR_1},${PKG_SECTION})) +$(eval $(call PKG_template,KNOCKD,knockd,${PKG_VERSION}-${PKG_RELEASE},${PKGSS_KNOCKD},${PKGSD_KNOCKD},${PKG_SECTION})) TCXXFLAGS+= ${TCPPFLAGS} ${TCFLAGS} CONFIGURE_ENV+= ac_cv_lib_pcap_pcap_open_live=yes diff --git a/package/krb5/Makefile b/package/krb5/Makefile index bb4e809c1..1cbaae817 100644 --- a/package/krb5/Makefile +++ b/package/krb5/Makefile @@ -10,14 +10,14 @@ PKG_MD5SUM:= e29a78b108c4687f7e7937110d1d0415 PKG_DESCR:= MIT kerberos server PKG_SECTION:= crypto PKG_DEPENDS:= libkrb5 libncurses libss libcom-err -PKG_BUILDDEP+= ncurses e2fsprogs -PKG_URL:= http://web.mit.edu/kerberos +PKG_BUILDDEP:= ncurses e2fsprogs +PKG_URL:= http://web.mit.edu/kerberos/ PKG_SITES:= http://web.mit.edu/kerberos/dist/krb5/1.8/ - PKG_NOPARALLEL:= 1 -PKG_DESCR_LIB:= MIT kerberos libraries -PKG_SECTION_LIB:= libs +PKG_SUBPKGS:= KRB5_SERVER LIBKRB5 +PKGSD_LIBKRB5:= MIT kerberos libraries +PKGSC_LIBKRB5:= libs DISTFILES:= ${PKG_NAME}-${PKG_VERSION}-signed.tar WRKSRC= ${WRKDIST}/src @@ -25,7 +25,7 @@ WRKSRC= ${WRKDIST}/src include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,KRB5_SERVER,krb5-server,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,LIBKRB5,libkrb5,$(PKG_VERSION)-${PKG_RELEASE},,${PKG_DESCR_LIB},${PKG_SECTION_LIB})) +$(eval $(call PKG_template,LIBKRB5,libkrb5,$(PKG_VERSION)-${PKG_RELEASE},,${PKGSD_LIBKRB5},${PKGSC_LIBKRB5})) SUB_INSTALLS-y:= SUB_INSTALLS-m:= diff --git a/package/l2tpns/Makefile b/package/l2tpns/Makefile index caae33207..852d40856 100644 --- a/package/l2tpns/Makefile +++ b/package/l2tpns/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 385c58055723ebc6c38062acd2db9c2c PKG_DESCR:= A layer 2 tunneling protocol network server (LNS) PKG_SECTION:= net/security PKG_DEPENDS:= libcli -PKG_BUILDDEP+= libcli +PKG_BUILDDEP:= libcli PKG_URL:= http://l2tpns.sourceforge.net/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=l2tpns/} diff --git a/package/lame/Makefile b/package/lame/Makefile index baaa3b966..4f18aa165 100644 --- a/package/lame/Makefile +++ b/package/lame/Makefile @@ -10,16 +10,17 @@ PKG_MD5SUM:= 719dae0ee675d0c16e0e89952930ed35 PKG_DESCR:= LAME MP3 encoder PKG_SECTION:= multimedia PKG_DEPENDS:= libncurses -PKG_URL:= http://lame.sourceforge.net +PKG_URL:= http://lame.sourceforge.net/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=lame/} -PKG_DESCR_1:= LAME MP3 encoding library -PKG_SECTION_1:= libs +PKG_SUBPKGS:= LAME LIBLAME +PKGSD_LIBLAME:= LAME MP3 encoding library +PKGSC_LIBLAME:= libs include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,LAME,${PKG_NAME},$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,LIBLAME,liblame,$(PKG_VERSION)-${PKG_RELEASE},,${PKG_DESCR_1},${PKG_SECTION_1})) +$(eval $(call PKG_template,LIBLAME,liblame,$(PKG_VERSION)-${PKG_RELEASE},,${PKGSD_LIBLAME},${PKGSC_LIBLAME})) post-install: $(INSTALL_DIR) $(IDIR_LAME)/usr/bin diff --git a/package/less/Makefile b/package/less/Makefile index bf3976e3f..13784b8ff 100644 --- a/package/less/Makefile +++ b/package/less/Makefile @@ -10,13 +10,13 @@ PKG_MD5SUM:= 206f2f13b9b0a35e45df660fcb6af31d PKG_DESCR:= A text mode pager PKG_SECTION:= pager PKG_DEPENDS:= libncurses -PKG_BUILDDEP+= ncurses -PKG_URL:= http://www.greenwoodsoftware.com/less +PKG_BUILDDEP:= ncurses +PKG_URL:= http://www.greenwoodsoftware.com/less/ PKG_SITES:= http://www.greenwoodsoftware.com/less/ include ${TOPDIR}/mk/package.mk -$(eval $(call PKG_template,LESS,less,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +$(eval $(call PKG_template,LESS,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) post-install: ${INSTALL_DIR} ${IDIR_LESS}/usr/bin diff --git a/package/libICE/Makefile b/package/libICE/Makefile index 2f15c75be..79ab03131 100644 --- a/package/libICE/Makefile +++ b/package/libICE/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 4a8f09f15fc92196b91d61e2dc9afcea PKG_DESCR:= Inter-Client Exchange library PKG_SECTION:= x11/libs -PKG_BUILDDEP+= xtrans xproto +PKG_BUILDDEP:= xtrans xproto PKG_SITES:= ${MASTER_SITE_XORG} include $(TOPDIR)/mk/package.mk diff --git a/package/libIDL/Makefile b/package/libIDL/Makefile index d303d2b4a..749782019 100644 --- a/package/libIDL/Makefile +++ b/package/libIDL/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 531fbc1b40b80dd1d6f3b5e76b99067c PKG_DESCR:= libraries for Interface Definition Language files PKG_SECTION:= libs -PKG_URL:= http://www.gnome.org +PKG_URL:= http://www.gnome.org/ PKG_SITES:= http://ftp.gnome.org/pub/GNOME/sources/libIDL/0.8/ include $(TOPDIR)/mk/package.mk diff --git a/package/libSM/Makefile b/package/libSM/Makefile index 26dc4559a..7256e80c8 100644 --- a/package/libSM/Makefile +++ b/package/libSM/Makefile @@ -6,11 +6,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:= libSM PKG_VERSION:= 1.1.1 PKG_RELEASE:= 1 -PKG_BUILDDEP+= libICE PKG_MD5SUM:= 1ee90d479298e48df7bb86a7ccbe00c9 PKG_DESCR:= X11 Session Management library PKG_SECTION:= x11/libs PKG_DEPENDS:= libuuid +PKG_BUILDDEP:= libICE PKG_SITES:= ${MASTER_SITE_XORG} include $(TOPDIR)/mk/package.mk diff --git a/package/libX11/Makefile b/package/libX11/Makefile index aba32b12a..4d7e7794e 100644 --- a/package/libX11/Makefile +++ b/package/libX11/Makefile @@ -9,9 +9,11 @@ PKG_RELEASE:= 2 PKG_MD5SUM:= b68aebbfcac1174c4c95d260e9369766 PKG_DESCR:= X11 client-side library PKG_SECTION:= x11/libs -PKG_BUILDDEP+= xproto xextproto xtrans libXdmcp libXau xcmiscproto bigreqsproto kbproto inputproto +PKG_BUILDDEP:= xproto xextproto xtrans libXdmcp libXau xcmiscproto bigreqsproto kbproto inputproto PKG_SITES:= ${MASTER_SITE_XORG} +PKG_SUBPKGS:= LIBX11 LIBX11_DEV + ifeq ($(ADK_STATIC),y) PKG_OPTS:= libonly endif diff --git a/package/libXaw/Makefile b/package/libXaw/Makefile index 3e05c8868..3eed56635 100644 --- a/package/libXaw/Makefile +++ b/package/libXaw/Makefile @@ -6,10 +6,10 @@ include $(TOPDIR)/rules.mk PKG_NAME:= libXaw PKG_VERSION:= 1.0.7 PKG_RELEASE:= 1 -PKG_BUILDDEP+= libXext libXmu libXpm PKG_MD5SUM:= 67662e6b2dceb2907159215c83364c5a PKG_DESCR:= X11 Athena Widget library PKG_SECTION:= x11/libs +PKG_BUILDDEP:= libXext libXmu libXpm PKG_SITES:= ${MASTER_SITE_XORG} include $(TOPDIR)/mk/package.mk diff --git a/package/libXdamage/Makefile b/package/libXdamage/Makefile index 4481cb3ce..d81ed113f 100644 --- a/package/libXdamage/Makefile +++ b/package/libXdamage/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= f8f19f747c8445213d5409ae8b8b2f0a PKG_DESCR:= X Window System client interface to the DAMAGE extension to the X protocol PKG_SECTION:= libs -PKG_BUILDDEP+= libXfixes damageproto +PKG_BUILDDEP:= libXfixes damageproto PKG_URL:= add project url PKG_SITES:= http://xorg.freedesktop.org/archive/individual/lib/ diff --git a/package/libXext/Makefile b/package/libXext/Makefile index 0352e419f..f7011ddad 100644 --- a/package/libXext/Makefile +++ b/package/libXext/Makefile @@ -6,10 +6,10 @@ include $(TOPDIR)/rules.mk PKG_NAME:= libXext PKG_VERSION:= 1.1.1 PKG_RELEASE:= 1 -PKG_BUILDDEP+= libX11 PKG_MD5SUM:= 6b61b3f657befded8ae66e04085c413e PKG_DESCR:= X client interface to extensions of the X protocol PKG_SECTION:= x11/libs +PKG_BUILDDEP:= libX11 PKG_SITES:= ${MASTER_SITE_XORG} ifeq ($(ADK_STATIC),y) diff --git a/package/libXfixes/Makefile b/package/libXfixes/Makefile index 283a043ce..27ad3da19 100644 --- a/package/libXfixes/Makefile +++ b/package/libXfixes/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 86eb4b916cd5948c0e20d279107b3331 PKG_DESCR:= X Fixes Library PKG_SECTION:= libs -PKG_BUILDDEP+= fixesproto xextproto xproto libX11 +PKG_BUILDDEP:= fixesproto xextproto xproto libX11 PKG_URL:= http://xorg.freedesktop.org PKG_SITES:= http://xorg.freedesktop.org/archive/individual/lib/ diff --git a/package/libXfont/Makefile b/package/libXfont/Makefile index 5f31218e2..cc9241f67 100644 --- a/package/libXfont/Makefile +++ b/package/libXfont/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= bf134b9f79a7fc6507577bf5b6d4f412 PKG_DESCR:= X font Library PKG_SECTION:= x11/libs PKG_DEPENDS:= libfreetype -PKG_BUILDDEP+= freetype fontcacheproto fontsproto libfontenc xtrans +PKG_BUILDDEP:= freetype fontcacheproto fontsproto libfontenc xtrans PKG_SITES:= ${MASTER_SITE_XORG} include $(TOPDIR)/mk/package.mk diff --git a/package/libXft/Makefile b/package/libXft/Makefile index 637ba46b1..ea477afaa 100644 --- a/package/libXft/Makefile +++ b/package/libXft/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 0a1e129b1d8b2d3905dc02a64255b781 PKG_DESCR:= X FreeType library PKG_SECTION:= x11/libs -PKG_BUILDDEP+= libXrender +PKG_BUILDDEP:= libXrender PKG_SITES:= ${MASTER_SITE_XORG} include $(TOPDIR)/mk/package.mk diff --git a/package/libXi/Makefile b/package/libXi/Makefile index 3e4d50f51..de1a11f1a 100644 --- a/package/libXi/Makefile +++ b/package/libXi/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 1c038312e4f9b61fe72e52d0f59a01d5 PKG_DESCR:= X Window System client interface to the XINPUT extension to the X protocol. PKG_SECTION:= x11/libs -PKG_BUILDDEP+= xproto xextproto libXext +PKG_BUILDDEP:= xproto xextproto libXext PKG_URL:= http://xorg.freedesktop.org/ PKG_SITES:= ${MASTER_SITE_XORG} diff --git a/package/libXmu/Makefile b/package/libXmu/Makefile index 0a776b0ef..017065a19 100644 --- a/package/libXmu/Makefile +++ b/package/libXmu/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= f49e3587cdc299707da0786a681f9c05 PKG_DESCR:= miscellaneous utility functions for X libraries PKG_SECTION:= x11/libs -PKG_BUILDDEP+= libXt +PKG_BUILDDEP:= libXt PKG_SITES:= ${MASTER_SITE_XORG} include $(TOPDIR)/mk/package.mk diff --git a/package/libXrender/Makefile b/package/libXrender/Makefile index 4d7ea648a..a2fa2663d 100644 --- a/package/libXrender/Makefile +++ b/package/libXrender/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 1791473c18a83a333a048b72d719fc55 PKG_DESCR:= X11 rendering library PKG_SECTION:= x11/libs -PKG_BUILDDEP+= renderproto +PKG_BUILDDEP:= renderproto PKG_SITES:= ${MASTER_SITE_XORG} ifeq ($(ADK_STATIC),y) diff --git a/package/libXt/Makefile b/package/libXt/Makefile index b60390b9b..e8048e1d6 100644 --- a/package/libXt/Makefile +++ b/package/libXt/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 28f627c7a5ca08c2413ce91d21c177d8 PKG_DESCR:= X Toolkit Intrinsics PKG_SECTION:= x11/libs -PKG_BUILDDEP+= libSM +PKG_BUILDDEP:= libSM PKG_SITES:= ${MASTER_SITE_XORG} include $(TOPDIR)/mk/package.mk diff --git a/package/libXv/Makefile b/package/libXv/Makefile index 24cf35b75..1440bf47f 100644 --- a/package/libXv/Makefile +++ b/package/libXv/Makefile @@ -6,10 +6,10 @@ include $(TOPDIR)/rules.mk PKG_NAME:= libXv PKG_VERSION:= 1.0.5 PKG_RELEASE:= 1 -PKG_BUILDDEP+= libX11 videoproto libXext PKG_MD5SUM:= 6ee98790de6b3cd470074e60057d5c5c PKG_DESCR:= X11 Xvideo extensions PKG_SECTION:= x11/libs +PKG_BUILDDEP:= libX11 videoproto libXext PKG_SITES:= ${MASTER_SITE_XORG} include $(TOPDIR)/mk/package.mk diff --git a/package/libXxf86dga/Makefile b/package/libXxf86dga/Makefile index 959635986..c5a3dae8b 100644 --- a/package/libXxf86dga/Makefile +++ b/package/libXxf86dga/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= ecb81708157e1a1eeaba0e124f0ade08 PKG_DESCR:= client library for the XFree86-DGA extension PKG_SECTION:= x11/libs -PKG_BUILDDEP+= xf86dgaproto libXext libXaw +PKG_BUILDDEP:= xf86dgaproto libXext libXaw PKG_SITES:= ${MASTER_SITE_XORG} include $(TOPDIR)/mk/package.mk diff --git a/package/libXxf86vm/Makefile b/package/libXxf86vm/Makefile index 1465ee1ac..4e2f8ea0e 100644 --- a/package/libXxf86vm/Makefile +++ b/package/libXxf86vm/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 52b49483eccbdd1566b8c560fe7f76e8 PKG_DESCR:= add short description PKG_SECTION:= libs -PKG_BUILDDEP+= xf86vidmodeproto libXext +PKG_BUILDDEP:= xf86vidmodeproto libXext PKG_SITES:= http://xorg.freedesktop.org/archive/individual/lib/ include $(TOPDIR)/mk/package.mk diff --git a/package/libao/Makefile b/package/libao/Makefile index 02c411a0e..effc7d5e4 100644 --- a/package/libao/Makefile +++ b/package/libao/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= b92cba3cbcf1ee9bc221118a85d23dcd PKG_DESCR:= A cross platform audio library PKG_SECTION:= libs PKG_DEPENDS:= esound -PKG_BUILDDEP+= esound +PKG_BUILDDEP:= esound PKG_URL:= http://www.xiph.org/ao PKG_SITES:= http://downloads.xiph.org/releases/ao/ diff --git a/package/libc/Makefile b/package/libc/Makefile index 29b30d546..9b85b82bc 100644 --- a/package/libc/Makefile +++ b/package/libc/Makefile @@ -8,6 +8,7 @@ PKG_VERSION:= 1.0 PKG_RELEASE:= 2 PKG_SECTION:= base PKG_DESCR:= native C library + NO_DISTFILES:= 1 include $(TOPDIR)/mk/package.mk diff --git a/package/libdrm/Makefile b/package/libdrm/Makefile index 780164b03..a55e6468e 100644 --- a/package/libdrm/Makefile +++ b/package/libdrm/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= dcbf9aa0497c84c7e4af15adb0021955 PKG_DESCR:= DRM library PKG_SECTION:= libs -PKG_BUILDDEP+= libpthread-stubs +PKG_BUILDDEP:= libpthread-stubs PKG_URL:= http://dri.freedesktop.org/wiki/ PKG_SITES:= http://dri.freedesktop.org/libdrm/ diff --git a/package/libfontenc/Makefile b/package/libfontenc/Makefile index c9d2a5505..5f038aee5 100644 --- a/package/libfontenc/Makefile +++ b/package/libfontenc/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 0fa1988d08021225d18ced519a30d2b1 PKG_DESCR:= helps to deal with different encodings of fonts PKG_SECTION:= x11/libs PKG_DEPENDS:= zlib -PKG_BUILDDEP+= xproto zlib +PKG_BUILDDEP:= xproto zlib PKG_SITES:= ${MASTER_SITE_XORG} include $(TOPDIR)/mk/package.mk diff --git a/package/libgcrypt/Makefile b/package/libgcrypt/Makefile index 20b5da9c8..f134ceb06 100644 --- a/package/libgcrypt/Makefile +++ b/package/libgcrypt/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 325294c12e7b99d82dee3a8bf8c2c28e PKG_DESCR:= GNU crypto library PKG_SECTION:= libs PKG_DEPENDS:= libgpg-error -PKG_BUILDDEP+= libgpg-error +PKG_BUILDDEP:= libgpg-error PKG_URL:= http://directory.fsf.org/project/libgcrypt PKG_SITES:= ftp://ftp.gnupg.org/gcrypt/libgcrypt/ diff --git a/package/libgd/Makefile b/package/libgd/Makefile index 7b9d7c046..b49270804 100644 --- a/package/libgd/Makefile +++ b/package/libgd/Makefile @@ -6,14 +6,16 @@ include ${TOPDIR}/rules.mk PKG_NAME:= gd PKG_VERSION:= 2.0.35 PKG_RELEASE:= 2 -PKG_BUILDDEP+= libpng jpeg PKG_MD5SUM:= 982963448dc36f20cb79b6e9ba6fdede PKG_DESCR:= A library for the dynamic creation of images PKG_SECTION:= libs PKG_DEPENDS:= libjpeg libpng -PKG_URL:= http://www.libgd.org +PKG_BUILDDEP:= libpng jpeg +PKG_URL:= http://www.libgd.org/ PKG_SITES:= http://www.libgd.org/releases/ +PKG_SUBPKGS:= LIBGD + include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBGD,libgd,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/libgpg-error/Makefile b/package/libgpg-error/Makefile index 73b37eb9b..d653ae8a5 100644 --- a/package/libgpg-error/Makefile +++ b/package/libgpg-error/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 1d2005268a2f096db28cf9cf77b3229a PKG_DESCR:= a helper library for common error codes and descriptions PKG_SECTION:= libs -PKG_URL:= http://www.gnupg.org +PKG_URL:= http://www.gnupg.org/ PKG_SITES:= ftp://ftp.gnupg.org/gcrypt/libgpg-error/ DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 diff --git a/package/libiconv/Makefile b/package/libiconv/Makefile index 1fbb35271..c180fed62 100644 --- a/package/libiconv/Makefile +++ b/package/libiconv/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 7ab33ebd26687c744a37264a330bbe9a PKG_DESCR:= character set conversion library PKG_SECTION:= libs -PKG_URL:= http://www.gnu.org/software/libiconv +PKG_URL:= http://www.gnu.org/software/libiconv/ PKG_SITES:= ${MASTER_SITE_GNU:=libiconv/} ifeq ($(ADK_STATIC),y) diff --git a/package/libid3tag/Makefile b/package/libid3tag/Makefile index 0a0f1cf68..1b1d376ea 100644 --- a/package/libid3tag/Makefile +++ b/package/libid3tag/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= e5808ad997ba32c498803822078748c3 PKG_DESCR:= an ID3 tag manipulation library PKG_SECTION:= libs PKG_DEPENDS:= zlib -PKG_BUILDDEP+= zlib +PKG_BUILDDEP:= zlib PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=mad/} include ${TOPDIR}/mk/package.mk diff --git a/package/liblzo/Makefile b/package/liblzo/Makefile index f15759356..736e1d2fd 100644 --- a/package/liblzo/Makefile +++ b/package/liblzo/Makefile @@ -12,6 +12,8 @@ PKG_SECTION:= libs PKG_URL:= http://www.oberhumer.com/opensource/lzo PKG_SITES:= http://www.oberhumer.com/opensource/lzo/download/ +PKG_SUBPKGS:= LIBLZO + include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBLZO,liblzo,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/libmpc/Makefile b/package/libmpc/Makefile index 5343ae4a4..1d976b17e 100644 --- a/package/libmpc/Makefile +++ b/package/libmpc/Makefile @@ -6,8 +6,10 @@ include ${TOPDIR}/toolchain/mpc/Makefile.inc PKG_DESCR:= GNU multiprecision arithmetic library PKG_SECTION:= libs +PKG_BUILDDEP:= gmp mpfr PKG_URL:= http://www.multiprecision.org/ -PKG_BUILDDEP+= gmp mpfr + +PKG_SUBPKGS:= LIBMPC include ${TOPDIR}/mk/package.mk diff --git a/package/libnet/Makefile b/package/libnet/Makefile index 679da1c05..12a168824 100644 --- a/package/libnet/Makefile +++ b/package/libnet/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= c5e06418a89cc4209f677a776a798fd9 PKG_DESCR:= a low-level packet creation library PKG_SECTION:= libs PKG_DEPENDS:= libpcap -PKG_BUILDDEP+= libpcap +PKG_BUILDDEP:= libpcap PKG_URL:= http://sourceforge.net/projects/libnet-dev/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=libnet-dev/libnet-${PKG_VERSION}/} diff --git a/package/libnetfilter_conntrack/Makefile b/package/libnetfilter_conntrack/Makefile index 517d7d7b2..e0718b49f 100644 --- a/package/libnetfilter_conntrack/Makefile +++ b/package/libnetfilter_conntrack/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 3c4b4048c914f2694c3ca6de2bb457dc PKG_DESCR:= API to connection tracking state table PKG_SECTION:= libs PKG_DEPENDS:= libnfnetlink -PKG_BUILDDEP+= libnfnetlink +PKG_BUILDDEP:= libnfnetlink PKG_URL:= http://www.netfilter.org/projects/libnetfilter_conntrack/ PKG_SITES:= http://www.netfilter.org/projects/libnetfilter_conntrack/files/ diff --git a/package/libnetfilter_log/Makefile b/package/libnetfilter_log/Makefile index 5232b612b..8fb6c91df 100644 --- a/package/libnetfilter_log/Makefile +++ b/package/libnetfilter_log/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= acdb188a1e7504e95636d0770ade393c PKG_DESCR:= API to packets that have been logged PKG_SECTION:= libs PKG_DEPENDS:= libnfnetlink -PKG_BUILDDEP+= libnfnetlink +PKG_BUILDDEP:= libnfnetlink PKG_URL:= http://www.netfilter.org/projects/libnetfilter_log/ PKG_SITES:= http://www.netfilter.org/projects/libnetfilter_log/files/ diff --git a/package/libnetfilter_queue/Makefile b/package/libnetfilter_queue/Makefile index d10464e00..00cc05462 100644 --- a/package/libnetfilter_queue/Makefile +++ b/package/libnetfilter_queue/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 2cde35e678ead3a8f9eb896bf807a159 PKG_DESCR:= API to packets that have been queued by the kernel packet filter PKG_SECTION:= libs PKG_DEPENDS:= libnfnetlink -PKG_BUILDDEP+= libnfnetlink +PKG_BUILDDEP:= libnfnetlink PKG_URL:= http://www.netfilter.org/projects/libnetfilter_queue/ PKG_SITES:= http://www.netfilter.org/projects/libnetfilter_queue/files/ diff --git a/package/libnids/Makefile b/package/libnids/Makefile index 6b25cea6b..123314e44 100644 --- a/package/libnids/Makefile +++ b/package/libnids/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= af35e8ef403a0ca95df2da94db856428 PKG_DESCR:= Network Intrusion Detection System library PKG_SECTION:= libs PKG_DEPENDS:= libnet libpcap glib -PKG_BUILDDEP+= libnet libpcap glib +PKG_BUILDDEP:= libnet libpcap glib PKG_URL:= http://libnids.sourceforge.net/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=libnids/} diff --git a/package/libnl/Makefile b/package/libnl/Makefile index 1cbe9f093..d7021a844 100644 --- a/package/libnl/Makefile +++ b/package/libnl/Makefile @@ -11,12 +11,25 @@ PKG_DESCR:= Netlink library PKG_SECTION:= libs PKG_SITES:= http://downloads.openwrt.org/sources/ +PKG_SUBPKGS:= LIBNL LIBNL_DEV +PKGSD_LIBNL_DEV:= header files for netlink library +PKGSC_LIBNL_DEV:= devel + include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBNL,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +$(eval $(call PKG_template,LIBNL_DEV,${PKG_NAME}-dev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_LIBNL_DEV},${PKGSC_LIBNL_DEV})) + +SUB_INSTALLS-y:= +SUB_INSTALLS-m:= +SUB_INSTALLS-${ADK_PACKAGE_LIBNL_DEV}+= libnl-dev-install -post-install: +post-install: ${SUB_INSTALLS-m} ${SUB_INSTALLS-y} ${INSTALL_DIR} ${IDIR_LIBNL}/usr/lib ${CP} ${WRKINST}/usr/lib/libnl.so* ${IDIR_LIBNL}/usr/lib +libnl-dev-install: + ${INSTALL_DIR} ${IDIR_LIBNL_DEV}/usr/include + ${CP} ${WRKINST}/usr/include/* ${IDIR_LIBNL_DEV}/usr/include + include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/libowfat/Makefile b/package/libowfat/Makefile index 02cd4f89a..c6e21ae01 100644 --- a/package/libowfat/Makefile +++ b/package/libowfat/Makefile @@ -9,6 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 6bbee9a86506419657d87123b7a6f2c1 PKG_URL:= http://www.fefe.de/libowfat PKG_SITES:= http://dl.fefe.de/ +PKG_SUBPKGS:= DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 diff --git a/package/libp11/Makefile b/package/libp11/Makefile index 34ea80d0d..34ac1a204 100644 --- a/package/libp11/Makefile +++ b/package/libp11/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 9e2c5cbececde245e2d2f535bd49ce35 PKG_DESCR:= library implementing a small layer on top of PKCS11 API PKG_SECTION:= libs PKG_DEPENDS:= libopenssl libltdl -PKG_BUILDDEP+= openssl libtool +PKG_BUILDDEP:= openssl libtool PKG_URL:= http://www.opensc-project.org/libp11 PKG_SITES:= http://www.opensc-project.org/files/libp11/ diff --git a/package/libpng/Makefile b/package/libpng/Makefile index 5970d0d9e..62eac961e 100644 --- a/package/libpng/Makefile +++ b/package/libpng/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 89b62f8daaeeab1342e307d6d1411ff1 PKG_DESCR:= A library for reading/writing PNG images PKG_SECTION:= libs PKG_DEPENDS:= zlib -PKG_BUILDDEP+= zlib +PKG_BUILDDEP:= zlib PKG_URL:= http://www.libpng.org/pub/png/libpng.html PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=libpng/} diff --git a/package/libpri/Makefile b/package/libpri/Makefile index 4a1e80329..101f82c98 100644 --- a/package/libpri/Makefile +++ b/package/libpri/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= dc1523d8ee027cd62f20fc6cc9727489 PKG_DESCR:= C implementation of the Primary Rate ISDN specification PKG_SECTION:= libs -PKG_URL:= http://www.asterisk.org +PKG_URL:= http://www.asterisk.org/ PKG_SITES:= http://downloads.asterisk.org/pub/telephony/libpri/releases/ include ${TOPDIR}/mk/package.mk diff --git a/package/libpthread-stubs/Makefile b/package/libpthread-stubs/Makefile index 028d40d3f..58c70f5dc 100644 --- a/package/libpthread-stubs/Makefile +++ b/package/libpthread-stubs/Makefile @@ -9,6 +9,8 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 774eabaf33440d534efe108ef9130a7d PKG_URL:= http://xcb.freedesktop.org/ PKG_SITES:= http://xcb.freedesktop.org/dist/ +PKG_SUBPKGS:= + DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 include $(TOPDIR)/mk/package.mk diff --git a/package/libpthread/Makefile b/package/libpthread/Makefile index 883c04a87..c2f3f7a3c 100644 --- a/package/libpthread/Makefile +++ b/package/libpthread/Makefile @@ -16,6 +16,7 @@ endif PKG_NAME:= libpthread PKG_DESCR:= POSIX threading library PKG_SECTION:= libs + NO_DISTFILES:= 1 ifeq ($(ADK_STATIC),y) @@ -31,8 +32,10 @@ BUILD_STYLE:= manual INSTALL_STYLE:= manual do-install: +ifeq ($(ADK_NATIVE),) ${INSTALL_DIR} ${IDIR_LIBPTHREAD}/lib ${CP} ${STAGING_DIR}/lib/libpthread*.so* ${IDIR_LIBPTHREAD}/lib cd $(IDIR_LIBPTHREAD)/lib && ln -sf libpthread.so.0 libpthread.so +endif include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/librpcsecgss/Makefile b/package/librpcsecgss/Makefile index 69bd9f6db..6c32cb10c 100644 --- a/package/librpcsecgss/Makefile +++ b/package/librpcsecgss/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= b45ed565bdc3099023aa35830ec92997 PKG_DESCR:= Secure RPC library for NFSv4 PKG_SECTION:= libs PKG_DEPENDS:= libgssglue -PKG_BUILDDEP+= libgssglue +PKG_BUILDDEP:= libgssglue PKG_SITES:= http://www.citi.umich.edu/projects/nfsv4/linux/librpcsecgss/ include $(TOPDIR)/mk/package.mk diff --git a/package/libshout/Makefile b/package/libshout/Makefile index 479c8c57c..335147acb 100644 --- a/package/libshout/Makefile +++ b/package/libshout/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 4f75fc9901c724b712c371c9a1e782d3 PKG_DESCR:= Library which can be used to write a source client for streaming PKG_SECTION:= libs PKG_DEPENDS:= libvorbis libogg -PKG_BUILDDEP+= libvorbis +PKG_BUILDDEP:= libvorbis PKG_URL:= http://directory.fsf.org/project/libshout PKG_SITES:= http://downloads.us.xiph.org/releases/libshout/ diff --git a/package/libstdcxx/Makefile b/package/libstdcxx/Makefile index 180a93715..beaea330e 100644 --- a/package/libstdcxx/Makefile +++ b/package/libstdcxx/Makefile @@ -15,6 +15,7 @@ endif PKG_NAME:= libstdcxx PKG_DESCR:= C++ support library PKG_SECTION:= libs + NO_DISTFILES:= 1 include ${TOPDIR}/mk/package.mk diff --git a/package/libtasn1/Makefile b/package/libtasn1/Makefile index 2593708f7..d48c4bc38 100644 --- a/package/libtasn1/Makefile +++ b/package/libtasn1/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 14cc361500d2e768a8a6ec538ce3fecb PKG_DESCR:= an ASN.1 and DER structures manipulation library PKG_SECTION:= libs -PKG_URL:= http://www.gnupg.org +PKG_URL:= http://www.gnupg.org/ PKG_SITES:= ftp://ftp.gnutls.org/pub/gnutls/libtasn1/ include ${TOPDIR}/mk/package.mk diff --git a/package/libthread_db/Makefile b/package/libthread_db/Makefile index 6566b0f9d..ff31c858c 100644 --- a/package/libthread_db/Makefile +++ b/package/libthread_db/Makefile @@ -16,6 +16,7 @@ endif PKG_NAME:= libthread-db PKG_DESCR:= POSIX threads library for gdb/gdbserver PKG_SECTION:= libs + NO_DISTFILES:= 1 include ${TOPDIR}/mk/package.mk diff --git a/package/libtiff/Makefile b/package/libtiff/Makefile index 645b8dae7..b06ba0058 100644 --- a/package/libtiff/Makefile +++ b/package/libtiff/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 2006c1bdd12644dbf02956955175afd6 PKG_DESCR:= A library for reading/writing TIFF images PKG_SECTION:= libs -PKG_URL:= http://www.libtiff.org +PKG_URL:= http://www.libtiff.org/ PKG_SITES:= ftp://ftp.remotesensing.org/pub/libtiff/ DISTFILES:= tiff-${PKG_VERSION}.tar.gz diff --git a/package/libtirpc/Makefile b/package/libtirpc/Makefile index 1702106c4..4d8e4689e 100644 --- a/package/libtirpc/Makefile +++ b/package/libtirpc/Makefile @@ -10,8 +10,8 @@ PKG_MD5SUM:= d77eb15f464bf9d6e66259eaf78b2a4e PKG_DESCR:= a transport independent RPC library PKG_SECTION:= libs PKG_DEPENDS:= libgssglue -PKG_BUILDDEP+= libgssglue -PKG_URL:= http://sourceforge.net/projects/libtirpc +PKG_BUILDDEP:= libgssglue +PKG_URL:= http://sourceforge.net/projects/libtirpc/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=libtirpc/} DISTFILES:= $(PKG_NAME)-$(PKG_VERSION).tar.bz2 diff --git a/package/libtool/Makefile b/package/libtool/Makefile index 1adc4881b..d23aa0a39 100644 --- a/package/libtool/Makefile +++ b/package/libtool/Makefile @@ -9,13 +9,16 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= b745d220e88163fcd9eea0a90ccf21b0 PKG_DESCR:= a generic dynamic object loading library PKG_SECTION:= lang -PKG_URL:= http://www.gnu.org/software/libtool +PKG_URL:= http://www.gnu.org/software/libtool/ PKG_SITES:= ${MASTER_SITE_GNU:=libtool/} +PKG_SUBPKGS:= LIBTOOL LIBLTDL +PKGSC_LIBLTDL:= libs + include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBTOOL,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,LIBLTDL,libltdl,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +$(eval $(call PKG_template,LIBLTDL,libltdl,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKGSC_LIBLTDL})) ifeq (${ADK_HOST_OPENBSD},y) XAKE_FLAGS+= AUTOCONF_VERSION=2.62 diff --git a/package/libtorrent/Makefile b/package/libtorrent/Makefile index ea0de0c28..419654fc9 100644 --- a/package/libtorrent/Makefile +++ b/package/libtorrent/Makefile @@ -6,12 +6,12 @@ include ${TOPDIR}/rules.mk PKG_NAME:= libtorrent PKG_VERSION:= 0.12.5 PKG_RELEASE:= 1 -PKG_BUILDDEP+= openssl libsigc++ PKG_MD5SUM:= fe8155d364b220713074423100d4bf29 PKG_DESCR:= A bittorrent library PKG_SECTION:= libs PKG_DEPENDS:= libopenssl libsigc++ -PKG_URL:= http://libtorrent.rakshasa.no +PKG_BUILDDEP:= openssl libsigc++ +PKG_URL:= http://libtorrent.rakshasa.no/ PKG_SITES:= http://libtorrent.rakshasa.no/downloads/ include ${TOPDIR}/mk/package.mk diff --git a/package/libupnp/Makefile b/package/libupnp/Makefile index 5f6c09ea3..25cbd8566 100644 --- a/package/libupnp/Makefile +++ b/package/libupnp/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 8918dcf7428cd119d0c8275765ff2833 PKG_DESCR:= The Universal Plug and Play (UPnP) SDK library PKG_SECTION:= libs PKG_DEPENDS:= libpthread -PKG_URL:= http://pupnp.sourceforge.net +PKG_URL:= http://pupnp.sourceforge.net/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=pupnp/} DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 diff --git a/package/libusb-compat/Makefile b/package/libusb-compat/Makefile index ce41c1d1d..fd651a5b9 100644 --- a/package/libusb-compat/Makefile +++ b/package/libusb-compat/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 570ac2ea085b80d1f74ddc7c6a93c0eb PKG_DESCR:= a library for accessing Linux USB devices PKG_SECTION:= libs -PKG_BUILDDEP+= libusb +PKG_BUILDDEP:= libusb PKG_URL:= http://libusb.wiki.sourceforge.net PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=libusb/} diff --git a/package/libusb/Makefile b/package/libusb/Makefile index 63e9f21be..795d2ee1a 100644 --- a/package/libusb/Makefile +++ b/package/libusb/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 37d34e6eaa69a4b645a19ff4ca63ceef PKG_DESCR:= a library for accessing Linux USB devices PKG_SECTION:= libs -PKG_URL:= http://libusb.wiki.sourceforge.net +PKG_URL:= http://libusb.wiki.sourceforge.net/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=libusb/} ifeq ($(ADK_STATIC),y) diff --git a/package/libvirt/Makefile b/package/libvirt/Makefile index d28f0cd5c..32682603f 100644 --- a/package/libvirt/Makefile +++ b/package/libvirt/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 1645975662a326969d2f42d5c04574aa PKG_DESCR:= virtualization API PKG_SECTION:= libs PKG_DEPENDS:= libxml2 libgnutls python -PKG_BUILDDEP+= libxml2 gnutls python +PKG_BUILDDEP:= libxml2 gnutls python PKG_URL:= http://www.libvirt.org/ PKG_SITES:= ftp://libvirt.org/libvirt/ diff --git a/package/libvorbis/Makefile b/package/libvorbis/Makefile index 76e156ae4..c5ec6bdee 100644 --- a/package/libvorbis/Makefile +++ b/package/libvorbis/Makefile @@ -9,10 +9,12 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 478646358c49f34aedcce58948793619 PKG_DESCR:= The Vorbis General Audio Compression Codec library PKG_SECTION:= libs -PKG_BUILDDEP+= libogg +PKG_BUILDDEP:= libogg PKG_URL:= http://www.xiph.org/vorbis/ PKG_SITES:= http://downloads.xiph.org/releases/vorbis/ +PKG_SUBPKGS:= LIBVORBIS LIBVORBISENC + include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBVORBIS,libvorbis,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/libxkbfile/Makefile b/package/libxkbfile/Makefile index 87e792291..2dc277b09 100644 --- a/package/libxkbfile/Makefile +++ b/package/libxkbfile/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= a1384a9a48430397aff236f97e26ed05 PKG_DESCR:= X11 keyboard configuration extension library PKG_SECTION:= x11/libs -PKG_BUILDDEP+= kbproto libX11 +PKG_BUILDDEP:= kbproto libX11 PKG_SITES:= ${MASTER_SITE_XORG} include $(TOPDIR)/mk/package.mk diff --git a/package/libxml2/Makefile b/package/libxml2/Makefile index 511663c2b..f518d4cf5 100644 --- a/package/libxml2/Makefile +++ b/package/libxml2/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 7740a8ec23878a2f50120e1faa2730f2 PKG_DESCR:= XML C parser and toolkit PKG_SECTION:= libs PKG_DEPENDS:= zlib -PKG_BUILDDEP+= zlib +PKG_BUILDDEP:= zlib PKG_URL:= http://www.xmlsoft.org/ PKG_SITES:= http://xmlsoft.org/sources/ diff --git a/package/libxslt/Makefile b/package/libxslt/Makefile index 3f18857f4..9f3b1faef 100644 --- a/package/libxslt/Makefile +++ b/package/libxslt/Makefile @@ -10,10 +10,9 @@ PKG_MD5SUM:= e83ec5d27fc4c10c6f612879bea9a153 PKG_DESCR:= XSLT Library PKG_SECTION:= libs PKG_DEPENDS:= libxml2 -PKG_BUILDDEP+= libxml2 +PKG_BUILDDEP:= libxml2 PKG_URL:= http://xmlsoft.org/XSLT -PKG_SITES:= http://xmlsoft.org/sources/ \ - ftp://fr.rpmfind.net/pub/libxml/ +PKG_SITES:= http://xmlsoft.org/sources/ include ${TOPDIR}/mk/package.mk diff --git a/package/lighttpd/Makefile b/package/lighttpd/Makefile index a6f75ac63..780b9b5b5 100644 --- a/package/lighttpd/Makefile +++ b/package/lighttpd/Makefile @@ -9,16 +9,18 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 87e936ec272ddaba8a2fdfecd8c6b704 PKG_DESCR:= a lightweight web server PKG_SECTION:= www -PKG_DEPENDS:= libxml2 libsqlite libpcre -PKG_BUILDDEP+= pcre libxml2 sqlite -ifeq (${ADK_COMPILE_LIGHTTPD_WITH_OPENSSL},y) -PKG_DEPENDS+= libopenssl -PKG_BUILDDEP+= openssl -endif -PKG_URL:= http://www.lighttpd.net +PKG_DEPENDS:= libxml2 libsqlite libpcre libopenssl +PKG_BUILDDEP:= pcre libxml2 sqlite openssl +PKG_URL:= http://www.lighttpd.net/ PKG_SITES:= http://download.lighttpd.net/lighttpd/releases-1.4.x/ PKG_MULTI:= 1 +PKG_SUBPKGS:= LIGHTTPD LIGHTTPD_MOD_ACCESSLOG LIGHTTPD_MOD_ALIAS LIGHTTPD_MOD_AUTH +PKG_SUBPKGS+= LIGHTTPD_MOD_CGI LIGHTTPD_MOD_EVASIVE LIGHTTPD_MOD_EXPIRE LIGHTTPD_MOD_FASTCGI +PKG_SUBPKGS+= LIGHTTPD_MOD_PROXY LIGHTTPD_MOD_REDIRECT LIGHTTPD_MOD_REWRITE LIGHTTPD_MOD_SETENV +PKG_SUBPKGS+= LIGHTTPD_MOD_SIMPLE_VHOST LIGHTTPD_MOD_SSI LIGHTTPD_MOD_STATUS LIGHTTPD_MOD_USERTRACK +PKG_SUBPKGS+= LIGHTTPD_MOD_WEBDAV + include $(TOPDIR)/mk/package.mk define PKG_mod_template @@ -81,12 +83,8 @@ CONFIGURE_ARGS+= \ --without-mysql \ --with-pcre \ --without-valgrind \ - --with-webdav-props -ifeq (${ADK_COMPILE_LIGHTTPD_WITH_OPENSSL},y) -CONFIGURE_ARGS+= --with-openssl='${STAGING_DIR}/usr' -else -CONFIGURE_ARGS+= --without-openssl -endif + --with-webdav-props \ + --with-openssl='${STAGING_DIR}/usr' post-install: ${INSTALL_MODS_y} ${INSTALL_MODS_m} install -m0755 -d $(IDIR_LIGHTTPD)/etc diff --git a/package/links/Makefile b/package/links/Makefile index bae20042c..dae75bd35 100644 --- a/package/links/Makefile +++ b/package/links/Makefile @@ -6,12 +6,12 @@ include ${TOPDIR}/rules.mk PKG_NAME:= links PKG_VERSION:= 2.2 PKG_RELEASE:= 1 -PKG_BUILDDEP+= openssl libpng jpeg gpm PKG_MD5SUM:= c9937f9ed0061f264973182f871fb667 PKG_DESCR:= web browser with graphic support PKG_SECTION:= browser PKG_DEPENDS:= libpng libjpeg libtiff gpm libopenssl -PKG_URL:= http://links.twibright.com +PKG_BUILDDEP:= openssl libpng jpeg gpm +PKG_URL:= http://links.twibright.com/ PKG_SITES:= http://links.twibright.com/download/ include ${TOPDIR}/mk/package.mk diff --git a/package/linux-atm/Makefile b/package/linux-atm/Makefile index 6bee2916a..6ad57ae1a 100644 --- a/package/linux-atm/Makefile +++ b/package/linux-atm/Makefile @@ -8,23 +8,24 @@ PKG_VERSION:= 2.5.1 PKG_RELEASE:= 2 PKG_MD5SUM:= 9560b0e1f410a05b849dfdab465dd758 PKG_DESCR:= ATM library and tools for Linux -PKG_SECTION:= route -PKG_URL:= http://linux-atm.sourceforge.net +PKG_SECTION:= libs +PKG_URL:= http://linux-atm.sourceforge.net/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=linux-atm/} PKG_NOPARALLEL:= 1 PKG_HOST_DEPENDS:= !freebsd -DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tgz +PKG_SUBPKGS:= LIBATM BR2684CTL +PKGSD_BR2684CTL:= br2684ctl ATM utility +PKGSS_BR2684CTL:= libatm +PKGSC_BR2684CTL:= route -PKG_DESCR_1:= br2684ctl -PKG_DEPENDS_1:= libatm -PKG_SECTION_1:= net +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tgz include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBATM,libatm,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,BR2684CTL,br2684ctl,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_1},${PKG_DESCR_1},${PKG_SECTION})) +$(eval $(call PKG_template,BR2684CTL,br2684ctl,${PKG_VERSION}-${PKG_RELEASE},${PKGSS_BR2684CTL},${PKGSD_BR2684CTL},${PKGSC_BR2684CTL})) post-install: ${INSTALL_DIR} ${IDIR_LIBATM}/usr/lib diff --git a/package/logrotate/Makefile b/package/logrotate/Makefile index a49e1fe34..1c7577ac2 100644 --- a/package/logrotate/Makefile +++ b/package/logrotate/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= b3589bea6d8d5afc8a84134fddaae973 PKG_DESCR:= logfile rotation utility PKG_SECTION:= misc PKG_DEPENDS:= libpopt -PKG_BUILDDEP+= popt +PKG_BUILDDEP:= popt PKG_SITES:= https://fedorahosted.org/releases/l/o/logrotate/ include ${TOPDIR}/mk/package.mk diff --git a/package/lua/Makefile b/package/lua/Makefile index 59e50bbd8..59cb96791 100644 --- a/package/lua/Makefile +++ b/package/lua/Makefile @@ -9,20 +9,21 @@ PKG_RELEASE:= 2 PKG_MD5SUM:= d0870f2de55d59c1c8419f36e8fac150 PKG_DESCR:= LUA programming language interpreter PKG_SECTION:= lang -PKG_BUILDDEP:= readline PKG_DEPENDS:= libreadline -PKG_MULTI:= 1 +PKG_BUILDDEP:= readline PKG_URL:= http://www.lua.org/ PKG_SITES:= http://www.lua.org/ftp/ +PKG_MULTI:= 1 -PKG_DESCR_LUAC:= LUA bytecode compiler -PKG_DESCR_LUAEX:= LUA script examples +PKG_SUBPKGS:= LUA LUAC LUA_EXAMPLES +PKGSD_LUAC:= LUA bytecode compiler +PKGSD_LUAEXAMPLES:= LUA script examples include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LUA,lua,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,LUAC,luac,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_LUAC},${PKG_SECTION})) -$(eval $(call PKG_template,LUA_EXAMPLES,lua-examples,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_LUAEX},${PKG_SECTION})) +$(eval $(call PKG_template,LUAC,luac,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_LUAC},${PKG_SECTION})) +$(eval $(call PKG_template,LUA_EXAMPLES,lua-examples,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_LUAEXAMPLES},${PKG_SECTION})) CONFIG_STYLE:= manual MAKE_FLAGS+= CFLAGS="${TCFLAGS} ${TCPPFLAGS} -DLUA_USE_LINUX -fPIC" \ diff --git a/package/lvm/Makefile b/package/lvm/Makefile index adbf96aba..3ebf13f4c 100644 --- a/package/lvm/Makefile +++ b/package/lvm/Makefile @@ -13,17 +13,19 @@ PKG_DEPENDS:= libdevmapper libncurses PKG_URL:= http://sourceware.org/lvm2/ PKG_SITES:= ftp://sources.redhat.com/pub/lvm2/ -PKG_DESCR_DM:= device-mapper utility -PKG_DESCR_LIBDM:= device-mapper library -PKG_SECTION_LIBDM:= libs +PKG_SUBPKGS:= LVM DEVICE_MAPPER LIBDEVMAPPER +PKGSD_DEVICE_MAPPER:= device-mapper utility +PKGSD_LIBDEVMAPPER:= device-mapper library +PKGSC_LIBDEVMAPPER:= libs + DISTFILES:= LVM2.${PKG_VERSION}.tgz WRKDIST= ${WRKDIR}/LVM2.${PKG_VERSION} include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LVM,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,DEVICE_MAPPER,device-mapper,${PKG_VERSION}-${PKG_RELEASE},,${PKG_DESCR_DM},${PKG_SECTION})) -$(eval $(call PKG_template,LIBDEVMAPPER,libdevmapper,${PKG_VERSION}-${PKG_RELEASE},,${PKG_DESCR_LIBDM},${PKG_SECTION_LIBDM})) +$(eval $(call PKG_template,DEVICE_MAPPER,device-mapper,${PKG_VERSION}-${PKG_RELEASE},,${PKGSD_DEVICE_MAPPER},${PKG_SECTION})) +$(eval $(call PKG_template,LIBDEVMAPPER,libdevmapper,${PKG_VERSION}-${PKG_RELEASE},,${PKGSD_LIBDEVMAPPER},${PKGSC_LIBDEVMAPPER})) CONFIGURE_ARGS+= --with-user="" --with-group="" \ --with-optimisation="" \ diff --git a/package/lynx/Makefile b/package/lynx/Makefile index 410c4e1e4..dd67a6dde 100644 --- a/package/lynx/Makefile +++ b/package/lynx/Makefile @@ -3,16 +3,16 @@ include ${TOPDIR}/rules.mk -PKG_NAME= lynx -PKG_VERSION= 2.8.7 -PKG_RELEASE= 1 -PKG_MD5SUM= e36d70f3f09b2d502055ca67f09e363c +PKG_NAME:= lynx +PKG_VERSION:= 2.8.7 +PKG_RELEASE:= 1 +PKG_MD5SUM:= e36d70f3f09b2d502055ca67f09e363c PKG_DESCR:= Standard text browser PKG_SECTION:= browser PKG_DEPENDS:= libncurses libopenssl zlib -PKG_BUILDDEP+= ncurses openssl zlib +PKG_BUILDDEP:= ncurses openssl zlib PKG_URL:= http://lynx.isc.org/ -PKG_SITES= http://lynx.isc.org/${PKG_NAME}${PKG_VERSION}/ +PKG_SITES:= http://lynx.isc.org/${PKG_NAME}${PKG_VERSION}/ DISTFILES= ${PKG_NAME}${PKG_VERSION}.tar.gz WRKDIST= ${WRKDIR}/lynx2-8-7 diff --git a/package/madplay/Makefile b/package/madplay/Makefile index 852865e20..01372dce8 100644 --- a/package/madplay/Makefile +++ b/package/madplay/Makefile @@ -6,11 +6,11 @@ include ${TOPDIR}/rules.mk PKG_NAME:= madplay PKG_VERSION:= 0.15.2b PKG_RELEASE:= 1 -PKG_BUILDDEP+= libid3tag libmad PKG_MD5SUM:= 6814b47ceaa99880c754c5195aa1aac1 PKG_DESCR:= MPEG audio player in fixed point PKG_SECTION:= multimedia PKG_DEPENDS:= libid3tag libmad +PKG_BUILDDEP:= libid3tag libmad PKG_URL:= http://www.underbit.com/products/mad PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=mad/} \ ftp://ftp.mars.org/pub/mpeg/ diff --git a/package/mc/Makefile b/package/mc/Makefile index 1b89c5b09..4185af106 100644 --- a/package/mc/Makefile +++ b/package/mc/Makefile @@ -3,17 +3,17 @@ include ${TOPDIR}/rules.mk -PKG_NAME= mc -PKG_VERSION= 4.7.0.2 -PKG_RELEASE= 1 -PKG_MD5SUM= f48b2c8dd140aeb36f59d16a662f0779 +PKG_NAME:= mc +PKG_VERSION:= 4.7.0.2 +PKG_RELEASE:= 1 +PKG_MD5SUM:= f48b2c8dd140aeb36f59d16a662f0779 PKG_DESCR:= norton commander clone PKG_SECTION:= misc -PKG_NOPARALLEL:= 1 PKG_DEPENDS:= glib libncurses -PKG_BUILDDEP+= glib ncurses +PKG_BUILDDEP:= glib ncurses PKG_URL:= http://www.midnight-commander.org/ -PKG_SITES= http://openadk.org/distfiles/ +PKG_SITES:= http://openadk.org/distfiles/ +PKG_NOPARALLEL:= 1 include ${TOPDIR}/mk/package.mk diff --git a/package/miau/Makefile b/package/miau/Makefile index ef7f42d66..b63ac5d34 100644 --- a/package/miau/Makefile +++ b/package/miau/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 76f794889d47ad277c25e9c5bbddefa4 PKG_DESCR:= miau is an IRC-bouncer/proxy PKG_SECTION:= chat -PKG_URL:= http://miau.sourceforge.net +PKG_URL:= http://miau.sourceforge.net/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=miau/} include ${TOPDIR}/mk/package.mk diff --git a/package/miax/Makefile b/package/miax/Makefile index 9117a4c86..276b202b3 100644 --- a/package/miax/Makefile +++ b/package/miax/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 44f0d2ef46ee2697d890b7b96846adc7 PKG_DESCR:= A console iax (asterisk) client PKG_SECTION:= bluetooth PKG_DEPENDS:= kmod-bt bluez libpthread -PKG_BUILDDEP+= bluez +PKG_BUILDDEP:= bluez PKG_URL:= http://sourceforge.net/projects/miax PKG_SITES:= http://mesh.dl.sourceforge.net/sourceforge/miax/ diff --git a/package/microperl/Makefile b/package/microperl/Makefile index 03626aef2..7e02b75df 100644 --- a/package/microperl/Makefile +++ b/package/microperl/Makefile @@ -9,11 +9,8 @@ PKG_RELEASE:= 3 PKG_MD5SUM:= d2c39b002ebfd2c3c5dba589365c5a71 PKG_DESCR:= Perl without operating-specific functions PKG_SECTION:= lang -PKG_URL:= www.perl.org -PKG_SITES:= ftp://ftp.cpan.org/pub/CPAN/src/5.0/ \ - ftp://ftp.mpi-sb.mpg.de/pub/perl/CPAN/src/5.0/ \ - ftp://ftp.gmd.de/mirrors/CPAN/src/5.0/ \ - ftp://ftp.funet.fi/pub/languages/perl/CPAN/src/5.0/ +PKG_URL:= http://www.perl.org/ +PKG_SITES:= ftp://ftp.cpan.org/pub/CPAN/src/5.0/ DISTFILES:= perl-${PKG_VERSION}.tar.gz WRKDIST= ${WRKDIR}/perl-${PKG_VERSION} diff --git a/package/mini_httpd/Makefile b/package/mini_httpd/Makefile index 2065a9698..0c2ccc13b 100644 --- a/package/mini_httpd/Makefile +++ b/package/mini_httpd/Makefile @@ -7,18 +7,16 @@ PKG_NAME:= mini-httpd PKG_VERSION:= 1.19 PKG_RELEASE:= 10 PKG_MD5SUM:= 7c68293ad265ecfe2edea917912f6f1f -PKG_DESCR:= A small HTTP server +PKG_DESCR:= A small HTTP server with SSL PKG_MULTI:= 1 PKG_SECTION:= www -ifneq ($(ADK_PACKAGE_MINI_HTTPD_OPENSSL),) PKG_DEPENDS:= libopenssl -PKG_BUILDDEP+= openssl -endif -PKG_URL:= http://www.acme.com/software/mini_httpd +PKG_BUILDDEP:= openssl +PKG_URL:= http://www.acme.com/software/mini_httpd/ PKG_SITES:= http://www.acme.com/software/mini_httpd/ -PKG_DESCR_1:= htpasswd utility -PKG_DESCR_2:= A small HTTP server with SSL support +PKG_SUBPKGS:= MINI_HTTPD MINI_HTTPD_HTPASSWD +PKGSD_HTPASSWD:= htpasswd utility DISTFILES:= mini_httpd-${PKG_VERSION}.tar.gz WRKDIST= ${WRKDIR}/mini_httpd-${PKG_VERSION} @@ -26,16 +24,13 @@ WRKDIST= ${WRKDIR}/mini_httpd-${PKG_VERSION} include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,MINI_HTTPD,mini-httpd,${PKG_VERSION}-${PKG_RELEASE},,${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,MINI_HTTPD_HTPASSWD,mini-httpd-htpasswd,${PKG_VERSION}-${PKG_RELEASE},,${PKG_DESCR_1},${PKG_SECTION})) -$(eval $(call PKG_template,MINI_HTTPD_OPENSSL,mini-httpd-openssl,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_2},${PKG_SECTION})) +$(eval $(call PKG_template,MINI_HTTPD_HTPASSWD,mini-httpd-htpasswd,${PKG_VERSION}-${PKG_RELEASE},,${PKGSD_HTPASSWD},${PKG_SECTION})) CONFIG_STYLE:= manual BUILD_STYLE:= manual INSTALL_STYLE:= manual do-build: - # with OpenSSL -ifneq (${ADK_PACKAGE_MINI_HTTPD_OPENSSL},) ${MAKE} -C ${WRKBUILD} \ CC="${TARGET_CC}" \ SSL_DEFS="-DUSE_SSL -DHAVE_OPENSSL" \ @@ -43,29 +38,8 @@ ifneq (${ADK_PACKAGE_MINI_HTTPD_OPENSSL},) SSL_LIBS="-L${STAGING_DIR}/usr/lib -lssl -lcrypto" \ all (cd ${WRKBUILD}; mv mini_httpd mini_httpd-openssl; ) - ${MAKE} -C ${WRKBUILD} clean -endif - # without SSL -ifneq (${ADK_PACKAGE_MINI_HTTPD},) - ${MAKE} -C ${WRKBUILD} \ - CC="${TARGET_CC}" \ - all -endif do-install: - # without SSL -ifneq (${ADK_PACKAGE_MINI_HTTPD},) - ${INSTALL_DIR} ${IDIR_MINI_HTTPD}/etc - ${INSTALL_DATA} ./files/mini_httpd.conf \ - ${IDIR_MINI_HTTPD}/etc/mini_httpd.conf - ${INSTALL_DIR} ${IDIR_MINI_HTTPD}/usr/sbin - ${INSTALL_BIN} ${WRKBUILD}/mini_httpd ${IDIR_MINI_HTTPD}/usr/sbin/ - ${INSTALL_DIR} ${IDIR_MINI_HTTPD_HTPASSWD}/usr/sbin - ${INSTALL_BIN} ${WRKBUILD}/htpasswd \ - ${IDIR_MINI_HTTPD_HTPASSWD}/usr/sbin/ -endif - # with OpenSSL -ifneq (${ADK_PACKAGE_MINI_HTTPD_OPENSSL},) ${INSTALL_DIR} ${IDIR_MINI_HTTPD_OPENSSL}/etc ${INSTALL_DATA} ./files/mini_httpd-ssl.conf \ ${IDIR_MINI_HTTPD_OPENSSL}/etc/mini_httpd.conf @@ -73,6 +47,5 @@ ifneq (${ADK_PACKAGE_MINI_HTTPD_OPENSSL},) ${INSTALL_DIR} ${IDIR_MINI_HTTPD_OPENSSL}/usr/sbin ${INSTALL_BIN} ${WRKBUILD}/mini_httpd-openssl \ ${IDIR_MINI_HTTPD_OPENSSL}/usr/sbin/mini_httpd -endif include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/mini_sendmail/Makefile b/package/mini_sendmail/Makefile index d52b4f45b..a9ad77793 100644 --- a/package/mini_sendmail/Makefile +++ b/package/mini_sendmail/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= fb1585d2ad81c519a26d83bfd783dee8 PKG_DESCR:= A small sendmail-compatible mail forwarder PKG_SECTION:= mail -PKG_URL:= http://www.acme.com/software/mini_sendmail +PKG_URL:= http://www.acme.com/software/mini_sendmail/ PKG_SITES:= http://www.acme.com/software/mini_sendmail/ DISTFILES:= mini_sendmail-${PKG_VERSION}.tar.gz diff --git a/package/miredo/Makefile b/package/miredo/Makefile index fafce8646..a9ced541a 100644 --- a/package/miredo/Makefile +++ b/package/miredo/Makefile @@ -9,12 +9,11 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= bf49c1ddc068746760787d0cf76e40de PKG_DESCR:= A Teredo client and relay daemon PKG_SECTION:= ipv6 -ifeq (${ADK_COMPILE_MIREDO_WITH_UCLIBCXX},y) -PKG_BUILDDEP+= uclibc++ -endif -PKG_URL:= http://www.remlab.net +PKG_URL:= http://www.remlab.net/ PKG_SITES:= http://www.remlab.net/files/miredo/ +PKG_SUBPKGS:= MIREDO MIREDO_SERVER + DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 include ${TOPDIR}/mk/package.mk @@ -33,12 +32,6 @@ CONFIGURE_ARGS+= --disable-chroot \ XAKE_FLAGS+= CXXLINK="\$${LINK}" \ -ifeq ($(ADK_TARGET_LIB_UCLIBCXX),y) -TCXXFLAGS+= -fno-builtin -fno-rtti -nostdinc++ -TLDFLAGS+= -nodefaultlibs -CONFIGURE_ENV+= LIBS="-luClibc++ -lc -lm" -endif - post-install: ${INSTALL_DIR} ${IDIR_MIREDO}/etc/miredo ${IDIR_MIREDO}/usr/sbin ${INSTALL_DIR} ${IDIR_MIREDO}/usr/lib diff --git a/package/mksh/Makefile b/package/mksh/Makefile index fe0288232..7ace9de29 100644 --- a/package/mksh/Makefile +++ b/package/mksh/Makefile @@ -9,15 +9,15 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 0c3cd172b47eefcdf9a302baa42f5092 PKG_DESCR:= MirBSD Korn Shell PKG_SECTION:= shells -PKG_URL:= http://www.mirbsd.org +PKG_URL:= http://www.mirbsd.org/ PKG_SITES:= ${MASTER_SITE_MIRBSD:distfiles/=dist/mir/mksh/} -DISTFILES= ${PKG_NAME}-R${PKG_VERSION}.cpio.gz -WRKDIST= ${WRKDIR}/${PKG_NAME} - PKG_FLAVOURS:= FULL PKGFD_FULL:= Include all features +DISTFILES= ${PKG_NAME}-R${PKG_VERSION}.cpio.gz +WRKDIST= ${WRKDIR}/${PKG_NAME} + include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,MKSH,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/moc/Makefile b/package/moc/Makefile index ed7579e52..7e45410ce 100644 --- a/package/moc/Makefile +++ b/package/moc/Makefile @@ -11,9 +11,9 @@ PKG_DESCR:= console music player PKG_SECTION:= multimedia PKG_DEPENDS:= libmad libvorbis libcurl libflac ffmpeg libiconv PKG_DEPENDS+= libncurses libid3tag -PKG_BUILDDEP+= ncurses libvorbis curl libmad flac ffmpeg libiconv +PKG_BUILDDEP:= ncurses libvorbis curl libmad flac ffmpeg libiconv PKG_BUILDDEP+= libid3tag -PKG_URL:= http://moc.daper.net +PKG_URL:= http://moc.daper.net/ PKG_SITES:= ftp://ftp.daper.net/pub/soft/moc/unstable/ DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 diff --git a/package/monit/Makefile b/package/monit/Makefile index f5d334734..49f37c898 100644 --- a/package/monit/Makefile +++ b/package/monit/Makefile @@ -4,28 +4,21 @@ include ${TOPDIR}/rules.mk PKG_NAME:= monit -PKG_VERSION:= 5.0.3 +PKG_VERSION:= 5.1.1 PKG_RELEASE:= 1 -PKG_MD5SUM:= dae7859ec10551fc941daeae60dee9d3 +PKG_MD5SUM:= 4bbd3845ae1cbab13ec211824e0486dc PKG_DESCR:= An utility for system services monitoring PKG_SECTION:= admin -PKG_DEPENDS:= libpthread -ifeq ($(ADK_COMPILE_MONIT_WITH_SSL),y) -PKG_DEPENDS:= libopenssl -PKG_BUILDDEP+= openssl -endif -PKG_URL:= http://mmonit.com/monit +PKG_DEPENDS:= libpthread libopenssl +PKG_BUILDDEP:= openssl +PKG_URL:= http://mmonit.com/monit/ PKG_SITES:= http://www.tildeslash.com/monit/dist/ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,MONIT,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -ifeq ($(ADK_COMPILE_MONIT_WITH_SSL),y) CONFIGURE_ARGS+= --with-ssl --with-ssl-dir="${STAGING_DIR}/usr" -else -CONFIGURE_ARGS+= --without-ssl -endif post-install: ${INSTALL_DIR} ${IDIR_MONIT}/etc diff --git a/package/monit/patches/patch-configure b/package/monit/patches/patch-configure deleted file mode 100644 index 8f94b6a48..000000000 --- a/package/monit/patches/patch-configure +++ /dev/null @@ -1,86 +0,0 @@ ---- monit-5.0.3.orig/configure 2009-05-28 23:48:01.000000000 +0200 -+++ monit-5.0.3/configure 2009-06-13 12:57:55.000000000 +0200 -@@ -10206,81 +10206,13 @@ fi - # Architecture/OS detection - # ------------------------------------------------------------------------ - --# Backward compatibility until we get ride of arch settings --if test `uname` = "SunOS" --then -- ARCH="SOLARIS" -- CFLAGS="$CFLAGS -D _REENTRANT -D_POSIX_PTHREAD_SEMANTICS" -- test_kstat="true" -- --cat >>confdefs.h <<\_ACEOF --#define HAVE_CPU_WAIT 1 --_ACEOF -- --elif test `uname` = "Linux" --then -- ARCH="LINUX" -- CFLAGS="$CFLAGS -D _REENTRANT" -- if test `uname -r | awk -F '.' '{print$1$2}'` -ge "26" -- then -- --cat >>confdefs.h <<\_ACEOF --#define HAVE_CPU_WAIT 1 --_ACEOF -- -- fi --elif test `uname` = "HP-UX" --then -- ARCH="HPUX" -- CFLAGS="$CFLAGS -D _REENTRANT" -- --cat >>confdefs.h <<\_ACEOF --#define HAVE_CPU_WAIT 1 --_ACEOF -- --elif test `uname` = "OpenBSD" --then -- ARCH="OPENBSD" -- CFLAGS="$CFLAGS -D _REENTRANT" -- test_kvm="true" --elif test `uname` = "FreeBSD" --then -- ARCH="FREEBSD" -- CFLAGS="$CFLAGS -D _REENTRANT" -- test_kvm="true" --elif test `uname` = "NetBSD" --then -- ARCH="NETBSD" -- CFLAGS="$CFLAGS -D _REENTRANT" -- test_kvm="true" --elif test `uname` = "Darwin" --then -- ARCH="DARWIN" -- CFLAGS="$CFLAGS -DREENTRANT -no-cpp-precomp -DNEED_SOCKLEN_T_DEFINED" -- test_kvm="true" -- LIBS="$LIBS -framework System -multiply_defined suppress" --elif test `uname` = "AIX" --then -- ARCH="AIX" -- CFLAGS="$CFLAGS -D _REENTRANT" -- LIBS="$LIBS -lodm" -- # AIX v. 5.2 -- LIBS="$LIBS -lcfg" -- # AIX v. 5.3 -- LIBS="$LIBS -lperfstat" -+ARCH="LINUX" -+CFLAGS="$CFLAGS -D _REENTRANT" - - cat >>confdefs.h <<\_ACEOF - #define HAVE_CPU_WAIT 1 - _ACEOF - --else -- { echo "$as_me:$LINENO: WARNING: Architecture not supported: \`uname\`." >&5 --echo "$as_me: WARNING: Architecture not supported: \`uname\`." >&2;} -- CFLAGS="$CFLAGS -D _REENTRANT" -- ARCH="UNKNOWN" --fi -- -- - # ------------------------------------------------------------------------ - # Resource code - # ------------------------------------------------------------------------ diff --git a/package/motion/Makefile b/package/motion/Makefile index a7a9f1bb5..27b097942 100644 --- a/package/motion/Makefile +++ b/package/motion/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 3a26c00f3250eacf6fa93c7a7e0249d9 PKG_DESCR:= Webcam motion sensing and logging PKG_SECTION:= multimedia PKG_DEPENDS:= libjpeg libpthread -PKG_BUILDDEP+= jpeg +PKG_BUILDDEP:= jpeg PKG_URL:= http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=motion/} diff --git a/package/mpc/Makefile b/package/mpc/Makefile index 14e153491..ed59ee973 100644 --- a/package/mpc/Makefile +++ b/package/mpc/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 08af459a18388c35dd81de8f9f1534c9 PKG_DESCR:= music player client PKG_SECTION:= multimedia PKG_DEPENDS:= libmpdclient -PKG_BUILDDEP+= libmpdclient +PKG_BUILDDEP:= libmpdclient PKG_URL:= http://mpd.wikia.com/wiki/Client:Mpc PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=musicpd/} diff --git a/package/mpd/Makefile b/package/mpd/Makefile index 16de1b05f..db11c4b98 100644 --- a/package/mpd/Makefile +++ b/package/mpd/Makefile @@ -10,73 +10,50 @@ PKG_MD5SUM:= 3ee746cb9193acfd0e1bd7a8c54af1a6 PKG_DESCR:= A music player daemon PKG_SECTION:= multimedia PKG_DEPENDS:= glib libstdcxx -PKG_BUILDDEP+= glib -ifneq ($(ADK_PACKAGE_MPD_WITH_ALSA),) -PKG_BUILDDEP+= alsa-lib -endif -ifneq ($(ADK_PACKAGE_MPD_WITH_AO),) -PKG_BUILDDEP+= libao -endif -ifneq ($(ADK_PACKAGE_MPD_WITH_MP3),) -PKG_BUILDDEP+= libid3tag libmad -endif -ifneq ($(ADK_PACKAGE_MPD_WITH_MP4),) -PKG_BUILDDEP+= faad2 -endif -ifneq ($(ADK_PACKAGE_MPD_WITH_OGG),) -PKG_BUILDDEP+= libvorbis libogg -endif -ifneq ($(ADK_PACKAGE_MPD_WITH_TREMOR),) -PKG_BUILDDEP+= libvorbisidec -endif -ifneq ($(ADK_PACKAGE_MPD_WITH_FLAC),) -PKG_BUILDDEP+= flac -endif -ifneq ($(ADK_PACKAGE_MPD_WITH_WAV),) -PKG_BUILDDEP+= libaudiofile -endif -ifneq ($(ADK_PACKAGE_MPD_WITH_SHOUT),) -PKG_BUILDDEP+= lame libvorbis libshout -endif -ifneq ($(ADK_PACKAGE_MPD_WITH_CURL),) -PKG_BUILDDEP+= curl -endif -ifneq ($(ADK_PACKAGE_MPD_WITH_MMS),) -PKG_BUILDDEP+= libmms -endif -ifneq ($(ADK_PACKAGE_MPD_WITH_FFMPEG),) -PKG_BUILDDEP+= ffmpeg -endif +PKG_BUILDDEP:= glib PKG_URL:= http://mpd.wikia.com/wiki/Music_Player_Daemon_Wiki PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=musicpd/} -PKG_FLAVOURS:= WITH_ALSA WITH_AO WITH_MP3 WITH_MP4 WITH_TREMOR \ - WITH_OGG WITH_FLAC WITH_WAV WITH_MMS WITH_FFMPEG \ - WITH_SHOUT WITH_CURL +PKG_FLAVOURS:= WITH_ALSA WITH_AO WITH_MP3 WITH_MP4 WITH_TREMOR +PKG_FLAVOURS+= WITH_OGG WITH_FLAC WITH_WAV WITH_MMS WITH_FFMPEG +PKG_FLAVOURS+= WITH_SHOUT WITH_CURL + PKGFD_WITH_ALSA:= enable ALSA output PKGFS_WITH_ALSA:= alsa-lib +PKGFB_WITH_ALSA:= alsa-lib PKGFD_WITH_AO:= enable Libao/ESD output PKGFS_WITH_AO:= libao +PKGFB_WITH_AO:= libao PKGFD_WITH_MP3:= enable MP3 support PKGFS_WITH_MP3:= libid3tag libmad +PKGFB_WITH_MP3:= libid3tag libmad PKGFD_WITH_MP4:= enable MP4 support PKGFS_WITH_MP4:= libfaad2 +PKGFB_WITH_MP4:= faad2 PKGFD_WITH_OGG:= enable OGG support PKGFS_WITH_OGG:= libvorbis libogg +PKGFB_WITH_OGG:= libvorbis libogg PKGFD_WITH_TREMOR:= enable fixpoint Vorbis/OGG support PKGFS_WITH_TREMOR:= libvorbisidec +PKGFB_WITH_TREMOR:= libvorbisidec PKGFD_WITH_FLAC:= enable FLAC support PKGFS_WITH_FLAC:= libflac +PKGFB_WITH_FLAC:= flac PKGFD_WITH_WAV:= enable WAVE support PKGFS_WITH_WAV:= libaudiofile +PKGFB_WITH_WAV:= libaudiofile PKGFD_WITH_MMS:= enable MMS support PKGFS_WITH_MMS:= libmms +PKGFB_WITH_MMS:= libmms PKGFD_WITH_FFMPEG:= enable FFMPEG support PKGFS_WITH_FFMPEG:= ffmpeg +PKGFB_WITH_FFMPEG:= ffmpeg PKGFD_WITH_SHOUT:= enable Shoutcast output support PKGFS_WITH_SHOUT:= libshout liblame libvorbis +PKGFB_WITH_SHOUT:= lame libvorbis libshout PKGFD_WITH_CURL:= enable CURL support PKGFS_WITH_CURL:= libcurl +PKGFB_WITH_CURL:= curl include ${TOPDIR}/mk/package.mk diff --git a/package/mpg123/Makefile b/package/mpg123/Makefile index 2f6facdc3..5f7960371 100644 --- a/package/mpg123/Makefile +++ b/package/mpg123/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= e7d810a75d22954169f1530a436aca4c PKG_DESCR:= mp3 console player PKG_SECTION:= multimedia PKG_DEPENDS:= libpthread alsa-lib libltdl -PKG_BUILDDEP+= alsa-lib +PKG_BUILDDEP:= alsa-lib PKG_URL:= http://www.mpg123.de/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=mpg123/} diff --git a/package/mplayer/Makefile b/package/mplayer/Makefile index 7b516a989..f4ea0a183 100644 --- a/package/mplayer/Makefile +++ b/package/mplayer/Makefile @@ -12,17 +12,15 @@ PKG_SECTION:= multimedia PKG_DEPENDS:= alsa-lib libjpeg libfaad2 libmad libncurses PKG_DEPENDS+= libogg libpng libpthread libvorbis PKG_DEPENDS+= libx11 libxau libxdmcp libxext libxv zlib -PKG_BUILDDEP+= alsa-lib libmad libvorbis faad2 ncurses zlib +PKG_BUILDDEP:= alsa-lib libmad libvorbis faad2 ncurses zlib PKG_BUILDDEP+= libX11 libXv libpng libXext -ifeq (${ADK_PACKAGE_MPLAYER_WITH_DIRECTFB},y) -PKG_BUILDDEP+= DirectFB -endif -PKG_URL:= http://www.mplayerhq.hu +PKG_URL:= http://www.mplayerhq.hu/ PKG_SITES:= http://openadk.org/distfiles/ PKG_FLAVOURS:= WITH_DIRECTFB -PKGFS_WITH_DIRECTFB:= directfb PKGFD_WITH_DIRECTFB:= enable DirectFB video output support +PKGFS_WITH_DIRECTFB:= directfb +PKGFB_WITH_DIRECTFB:= DirectFB PKG_TARGET_DEPENDS:= alix1c x86_qemu x86_64_qemu shuttle lemote diff --git a/package/mrd6/Makefile b/package/mrd6/Makefile index 14f8bef91..94a9b01ab 100644 --- a/package/mrd6/Makefile +++ b/package/mrd6/Makefile @@ -9,9 +9,9 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 93ada53bb414b9d622f80a717bc2694b PKG_DESCR:= IPv6 multicast routing daemon PKG_SECTION:= ipv6 -PKG_CXX:= MRD6 PKG_DEPENDS:= kmod-ipv6 PKG_SITES:= http://www.openadk.org/distfiles/ +PKG_CXX:= MRD6 WRKBUILD= ${WRKSRC}/src diff --git a/package/mt-daapd/Makefile b/package/mt-daapd/Makefile index 6f0e22f08..3acf1b8fb 100644 --- a/package/mt-daapd/Makefile +++ b/package/mt-daapd/Makefile @@ -4,14 +4,14 @@ include ${TOPDIR}/rules.mk PKG_NAME:= mt-daapd -PKG_VERSION:= 0.2.4.1 +PKG_VERSION:= 0.2.4.2 PKG_RELEASE:= 1 -PKG_MD5SUM:= 8117141e8a88bfab54fe98b6bbd5cb3a +PKG_MD5SUM:= 67bef9fb14d487693b0dfb792c3f1b05 PKG_DESCR:= a multi-threaded DAAP daemon PKG_SECTION:= multimedia PKG_DEPENDS:= libgdbm libid3tag libpthread -PKG_BUILDDEP+= gdbm libid3tag -PKG_URL:= http://www.fireflymediaserver.org +PKG_BUILDDEP:= gdbm libid3tag +PKG_URL:= http://www.fireflymediaserver.org/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=mt-daapd/} include ${TOPDIR}/mk/package.mk diff --git a/package/mtd/Makefile b/package/mtd/Makefile index 7a186a35e..3b17ce96b 100644 --- a/package/mtd/Makefile +++ b/package/mtd/Makefile @@ -10,6 +10,7 @@ PKG_DESCR:= MTD utility PKG_SECTION:= fs PKG_TARGET_DEPENDS:= ag241 foxboard +PKG_DFLT_MTD:= y NO_DISTFILES:= 1 @@ -17,8 +18,6 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,MTD,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -PKGDFLT_MTD= y - CONFIG_STYLE:= manual BUILD_STYLE:= manual INSTALL_STYLE:= manual diff --git a/package/mtr/Makefile b/package/mtr/Makefile index 4c901d8e7..26803c386 100644 --- a/package/mtr/Makefile +++ b/package/mtr/Makefile @@ -10,8 +10,8 @@ PKG_MD5SUM:= 23baca52d0922c2ecba7eba05317868c PKG_DESCR:= ncurses traceroute/ping tool PKG_SECTION:= net PKG_DEPENDS:= libncurses -PKG_BUILDDEP+= ncurses -PKG_URL:= http://www.bitwizard.nl/mtr +PKG_BUILDDEP:= ncurses +PKG_URL:= http://www.bitwizard.nl/mtr/ PKG_SITES:= ftp://ftp.bitwizard.nl/mtr/ include ${TOPDIR}/mk/package.mk diff --git a/package/mutt/Makefile b/package/mutt/Makefile index 110db512c..ec0a84175 100644 --- a/package/mutt/Makefile +++ b/package/mutt/Makefile @@ -10,8 +10,8 @@ PKG_MD5SUM:= 027cdd9959203de0c3c64149a7ee351c PKG_DESCR:= Mail text client PKG_SECTION:= mail PKG_DEPENDS:= libncurses libopenssl -PKG_BUILDDEP+= ncurses openssl -PKG_URL:= http://www.mutt.org +PKG_BUILDDEP:= ncurses openssl +PKG_URL:= http://www.mutt.org/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=mutt/} include ${TOPDIR}/mk/package.mk diff --git a/package/mysql/Makefile b/package/mysql/Makefile index 033ffebb7..fb3d1404c 100644 --- a/package/mysql/Makefile +++ b/package/mysql/Makefile @@ -10,10 +10,11 @@ PKG_MD5SUM:= d04c54d1cfbd8c6c8650c8d078f885b2 PKG_DESCR:= MySQL client library PKG_SECTION:= db PKG_DEPENDS:= libncurses zlib -PKG_BUILDDEP+= ncurses zlib readline +PKG_BUILDDEP:= ncurses zlib readline PKG_URL:= http://www.mysql.com/ PKG_SITES= ${MASTER_SITE_MYSQL:=Downloads/MySQL-5.1/} +PKG_SUBPKGS:= LIBMYSQLCLIENT PKG_HOST_DEPENDS:= !cygwin include ${TOPDIR}/mk/package.mk diff --git a/package/nand/Makefile b/package/nand/Makefile index 33f9ddcf0..ec5984f6f 100644 --- a/package/nand/Makefile +++ b/package/nand/Makefile @@ -10,6 +10,7 @@ PKG_DESCR:= NAND utility PKG_SECTION:= fs PKG_TARGET_DEPENDS:= routerboard +PKG_DFLT_NAND:= y NO_DISTFILES:= 1 @@ -17,8 +18,6 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,NAND,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -PKGDFLT_NAND= y - CONFIG_STYLE:= manual BUILD_STYLE:= manual INSTALL_STYLE:= manual diff --git a/package/nano/Makefile b/package/nano/Makefile index afab4ffff..df45c05d4 100644 --- a/package/nano/Makefile +++ b/package/nano/Makefile @@ -10,11 +10,12 @@ PKG_MD5SUM:= 6304308afb1f7ef4a5e93eb99206632a PKG_DESCR:= An enhanced clone of the Pico editor PKG_SECTION:= editor PKG_DEPENDS:= libncurses -PKG_BUILDDEP+= ncurses -PKG_URL:= http://www.nano-editor.org +PKG_BUILDDEP:= ncurses +PKG_URL:= http://www.nano-editor.org/ PKG_SITES:= http://www.nano-editor.org/dist/v2.2/ PKG_FLAVOURS:= TINY +PKGFD_TINY:= tiny nano include ${TOPDIR}/mk/package.mk diff --git a/package/ncurses/Makefile b/package/ncurses/Makefile index 053d06fe2..f2659bfa7 100644 --- a/package/ncurses/Makefile +++ b/package/ncurses/Makefile @@ -12,13 +12,14 @@ PKG_SECTION:= libs PKG_URL:= http://www.gnu.org/software/ncurses/ PKG_SITES:= ${MASTER_SITE_GNU:=ncurses/} -PKG_DESCR_LIB_DEV:= development files for libncurses -PKG_SECTION_LIB_DEV:= devel +PKG_SUBPKGS:= LIBNCURSES LIBNCURSES_DEV +PKGSD_LIBNCURSES_DEV:= development files for libncurses +PKGSC_LIBNCURSES_DEV:= devel include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBNCURSES,libncurses,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,LIBNCURSES_DEV,libncurses-dev,${PKG_VERSION}-${PKG_RELEASE},libncurses,${PKG_DESCR_LIB_DEV},${PKG_SECTION_LIB_DEV})) +$(eval $(call PKG_template,LIBNCURSES_DEV,libncurses-dev,${PKG_VERSION}-${PKG_RELEASE},libncurses,${PKGSD_LIBNCURSES_DEV},${PKGSC_LIBNCURSES_DEV})) SUB_INSTALLS-y:= SUB_INSTALLS-m:= diff --git a/package/ndisc/Makefile b/package/ndisc/Makefile index bf60a60cc..20000673b 100644 --- a/package/ndisc/Makefile +++ b/package/ndisc/Makefile @@ -9,9 +9,11 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= cb8d70564b8d40aae95e19592c6be183 PKG_DESCR:= ICMPv6 Neighbour Discovery tools PKG_SECTION:= ipv6 -PKG_URL:= http://www.remlab.net +PKG_URL:= http://www.remlab.net/ PKG_SITES:= http://www.remlab.net/files/ndisc6/ +PKG_SUBPKGS:= NDISC6 RDISC6 TCPTRACEROUTE6 + DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 include ${TOPDIR}/mk/package.mk diff --git a/package/neon/Makefile b/package/neon/Makefile index ddb417224..3d14d58fd 100644 --- a/package/neon/Makefile +++ b/package/neon/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= ba1015b59c112d44d7797b62fe7bee51 PKG_DESCR:= HTTP and WebDAV library PKG_SECTION:= libs PKG_DEPENDS:= libpthread libxml2 libopenssl zlib -PKG_BUILDDEP+= libpthread libxml2 openssl zlib +PKG_BUILDDEP:= libpthread libxml2 openssl zlib PKG_URL:= http://webdav.org/neon/ PKG_SITES:= http://webdav.org/neon/ diff --git a/package/net-snmp/Makefile b/package/net-snmp/Makefile index ddb103bbe..7352a3d07 100644 --- a/package/net-snmp/Makefile +++ b/package/net-snmp/Makefile @@ -10,16 +10,17 @@ PKG_MD5SUM:= 5b2551e7bd024fbbee84dca22a5f13a1 PKG_DESCR:= SNMP Agent PKG_SECTION:= net/misc PKG_DEPENDS:= libnetsnmp libelf -PKG_BUILDDEP+= libelf -PKG_NOPARALLEL:= 1 +PKG_BUILDDEP:= libelf PKG_URL:= http://www.net-snmp.org/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=net-snmp/} +PKG_NOPARALLEL:= 1 -PKG_DESCR_UTILS:= SNMP utilities -PKG_DEPENDS_UTILS:= libnetsnmp libelf -PKG_DESCR_LIBS:= SNMP library -PKG_DEPENDS_LIBS:= libelf -PKG_SECTION_LIBS:= libs +PKG_SUBPKGS:= SNMPD SNMP_UTILS LIBNETSNMP +PKGSD_SNMP_UTILS:= SNMP utilities +PKGSS_SNMP_UTILS:= libnetsnmp libelf +PKGSD_LIBNETSNMP:= SNMP library +PKGSS_LIBNETSNMP:= libelf +PKGSC_LIBNETSNMP:= libs PKG_FLAVOURS:= WITH_IPV6 PKGFD_WITH_IPV6:= enable IPv6 support @@ -27,8 +28,8 @@ PKGFD_WITH_IPV6:= enable IPv6 support include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,SNMPD,snmpd,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,SNMP_UTILS,snmp-utils,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_UTILS},${PKG_DESCR_UTILS},${PKG_SECTION})) -$(eval $(call PKG_template,LIBNETSNMP,libnetsnmp,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_LIBS},${PKG_DESCR_LIBS},${PKG_SECTION_LIBS})) +$(eval $(call PKG_template,SNMP_UTILS,snmp-utils,${PKG_VERSION}-${PKG_RELEASE},${PKGSS_SNMP_UTILS},${PKGSD_SNMP_UTILS},${PKG_SECTION})) +$(eval $(call PKG_template,LIBNETSNMP,libnetsnmp,${PKG_VERSION}-${PKG_RELEASE},${PKGSS_LIBNETSNMP},${PKGSD_LIBNETSNMP},${PKGSC_LIBNETSNMP})) SNMP_TRANSPORTS_INCLUDED:= UDP TCP Callback Unix SNMP_TRANSPORTS_EXCLUDED:= Alias diff --git a/package/netperf/Makefile b/package/netperf/Makefile index a4fa41a90..6ee21da1d 100644 --- a/package/netperf/Makefile +++ b/package/netperf/Makefile @@ -10,8 +10,7 @@ PKG_MD5SUM:= 391a0d98954c72a6ad7f08b8a115e1ce PKG_DESCR:= Program and service to do network performance measurement. PKG_SECTION:= net PKG_URL:= http://www.netperf.org/netperf/ -PKG_SITES:= ftp://ftp.netperf.org/netperf/archive/ \ - ftp://ftp.cup.hp.com/dist/networking/benchmarks/netperf/ +PKG_SITES:= ftp://ftp.netperf.org/netperf/archive/ include ${TOPDIR}/mk/package.mk diff --git a/package/nfs-utils/Makefile b/package/nfs-utils/Makefile index 941d3ac9f..b57a70b95 100644 --- a/package/nfs-utils/Makefile +++ b/package/nfs-utils/Makefile @@ -4,29 +4,24 @@ include ${TOPDIR}/rules.mk PKG_NAME:= nfs-utils -PKG_VERSION:= 1.2.1 -PKG_RELEASE:= 2 +PKG_VERSION:= 1.2.2 +PKG_RELEASE:= 1 PKG_MD5SUM:= c3ccd16c147befd49fe4541a506dd177 PKG_DESCR:= Utilities for NFS kernel server implementation PKG_SECTION:= net/fs PKG_DEPENDS:= kmod-nfsd portmap - -ifeq (${ADK_PACKAGE_NFS_UTILS_WITH_KERBEROS},y) -PKG_BUILDDEP+= libnfsidmap krb5 libevent libgssglue librpcsecgss -endif -ifeq ($(ADK_PACKAGE_NFS_UTILS_WITH_TIRPC),y) -PKG_BUILDDEP+= libtirpc rpcbind -endif PKG_URL:= http://sourceforge.net/projects/nfs PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=nfs/} -DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 - PKG_FLAVOURS:= WITH_KERBEROS WITH_TIRPC PKGFD_WITH_KERBEROS:= enable Kerberos support (MIT) PKGFS_WITH_KERBEROS:= libkrb5 libevent libnfsidmap librpcsecgss libcom-err libgssglue +PKGFB_WITH_KERBEROS:= libnfsidmap krb5 libevent libgssglue librpcsecgss PKGFD_WITH_TIRPC:= enable Transport Independent RPC PKGFS_WITH_TIRPC:= libtirpc rpcbind +PKGFB_WITH_TIRPC:= libtirpc rpcbind + +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 include ${TOPDIR}/mk/package.mk diff --git a/package/nmap/Makefile b/package/nmap/Makefile index 22e84125b..35a043604 100644 --- a/package/nmap/Makefile +++ b/package/nmap/Makefile @@ -9,11 +9,11 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 32d27de32166c02d670bb4a086185886 PKG_DESCR:= utility for network exploration or security auditing PKG_SECTION:= net -PKG_CXX:= NMAP PKG_DEPENDS:= libdnet libpcap libpcre -PKG_BUILDDEP+= libdnet libpcap pcre -PKG_URL:= http://nmap.org +PKG_BUILDDEP:= libdnet libpcap pcre +PKG_URL:= http://nmap.org/ PKG_SITES:= http://download.insecure.org/nmap/dist/ +PKG_CXX:= NMAP DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 diff --git a/package/nss/Makefile b/package/nss/Makefile index e4795f261..a8b80def9 100644 --- a/package/nss/Makefile +++ b/package/nss/Makefile @@ -9,13 +9,13 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= da42596665f226de5eb3ecfc1ec57cd1 PKG_DESCR:= Network Security Services (NSS) library PKG_SECTION:= libs -PKG_BUILDDEP+= nspr zlib -PKG_NOPARALLEL:= 1 +PKG_BUILDDEP:= nspr zlib PKG_URL:= http://www.mozilla.org/projects/security/pki/nss/ PKG_SITES:= https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_12_6_RTM/src/ +PKG_NOPARALLEL:= 1 -PKG_TARGET_DEPENDS:= !foxboard PKG_HOST_DEPENDS:= !cygwin +PKG_TARGET_DEPENDS:= !foxboard WRKSRC= ${WRKDIST}/mozilla/security/nss diff --git a/package/ntfs-3g/Makefile b/package/ntfs-3g/Makefile index 41d01c3f0..13a6b9370 100644 --- a/package/ntfs-3g/Makefile +++ b/package/ntfs-3g/Makefile @@ -3,15 +3,15 @@ include ${TOPDIR}/rules.mk -PKG_NAME= ntfs-3g -PKG_VERSION= 2010.1.16 -PKG_RELEASE= 1 -PKG_MD5SUM= e104c914e8d7d29ee83e63d46afbba25 +PKG_NAME:= ntfs-3g +PKG_VERSION:= 2010.1.16 +PKG_RELEASE:= 1 +PKG_MD5SUM:= e104c914e8d7d29ee83e63d46afbba25 PKG_DESCR:= ntfs filesystem driver PKG_SECTION:= kernel PKG_DEPENDS:= kmod-fuse-fs PKG_URL:= http://tuxera.com -PKG_SITES= http://tuxera.com/opensource/ +PKG_SITES:= http://tuxera.com/opensource/ DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tgz diff --git a/package/ntpclient/Makefile b/package/ntpclient/Makefile index e52c40bb4..1a7f5e69c 100644 --- a/package/ntpclient/Makefile +++ b/package/ntpclient/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= cb98711f11769cdd22fc592844cef414 PKG_DESCR:= NTP client for setting system time from NTP servers PKG_SECTION:= ntp PKG_DEPENDS:= libpthread -PKG_URL:= http://doolittle.icarus.com/ntpclient +PKG_URL:= http://doolittle.icarus.com/ntpclient/ PKG_SITES:= http://doolittle.icarus.com/ntpclient/ DISTFILES:= ${PKG_NAME}_${PKG_VERSION}.tar.gz diff --git a/package/nut/Makefile b/package/nut/Makefile index a239af2cc..833f271e7 100644 --- a/package/nut/Makefile +++ b/package/nut/Makefile @@ -9,25 +9,19 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 609ebaf2123fc7171d25a6c742dd7d66 PKG_DESCR:= Network UPS Tools PKG_SECTION:= net/misc -ifneq (${ADK_PACKAGE_NUT_SSL},) -PKG_BUILDDEP+= openssl -endif -ifneq (${ADK_PACKAGE_NUT_USB},) -PKG_BUILDDEP+= libusb -endif -ifneq (${ADK_PACKAGE_NUT_SNMP},) -PKG_BUILDDEP+= net-snmp -endif -PKG_URL:= http://www.networkupstools.org +PKG_URL:= http://www.networkupstools.org/ PKG_SITES:= http://www.networkupstools.org/source/2.4/ PKG_FLAVOURS:= SSL SNMP USB -PKGFD_SSL:= enable SSL support -PKGFS_SSL:= libopenssl PKGFD_SNMP:= enable SNMP support PKGFS_SNMP:= libnetsnmp +PKGFB_SNMP:= net-snmp PKGFD_USB:= enable USB support PKGFS_USB:= libusb +PKGFB_USB:= libusb +PKGFD_SSL:= enable SSL support +PKGFS_SSL:= libopenssl +PKGFB_SSL:= openssl include ${TOPDIR}/mk/package.mk diff --git a/package/obexftp/Makefile b/package/obexftp/Makefile index 67399ba12..acc8b5b38 100644 --- a/package/obexftp/Makefile +++ b/package/obexftp/Makefile @@ -10,14 +10,15 @@ PKG_MD5SUM:= f20762061b68bc921e80be4aebc349eb PKG_DESCR:= bluetooth ftp application PKG_SECTION:= bluetooth PKG_DEPENDS:= openobex libiconv -PKG_BUILDDEP+= openobex libiconv +PKG_BUILDDEP:= openobex libiconv PKG_URL:= http://dev.zuckschwerdt.org/openobex/wiki/ObexFtp PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=openobex/} -DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 +PKG_SUBPKGS:= OBEXFTP LIBOBEXFTP +PKGSD_LIBOBEXFTP:= obexftp library +PKGSC_LIBOBEXFTP:= libs -PKG_DESCR_LIB:= obexftp library -PKG_SECTION_LIB:= libs +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 ifeq ($(ADK_STATIC),y) PKG_OPTS:= libmix @@ -26,7 +27,7 @@ endif include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,OBEXFTP,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,LIBOBEXFTP,libobexftp,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_LIB},${PKG_SECTION_LIB},${PKG_OPTS})) +$(eval $(call PKG_template,LIBOBEXFTP,libobexftp,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_LIBOBEXFTP},${PKGSC_LIBOBEXFTP},${PKG_OPTS})) ifeq ($(ADK_STATIC),y) XAKE_FLAGS+= STATIC_CFLAGS=-all-static diff --git a/package/olsrd/Makefile b/package/olsrd/Makefile index 566a30f19..19a999d76 100644 --- a/package/olsrd/Makefile +++ b/package/olsrd/Makefile @@ -9,9 +9,12 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= acf15dbd0af521a6826541b567c6473a PKG_DESCR:= Optimized Link State Routing protocol PKG_SECTION:= wifi -PKG_MULTI:= 1 -PKG_URL:= http://www.olsr.org +PKG_URL:= http://www.olsr.org/ PKG_SITES:= http://www.olsr.org/releases/0.5/ +PKG_MULTI:= 1 + +PKG_SUBPKGS:= OLSRD OLSRD_MOD_DYN_GW OLSRD_MOD_HTTPINFO OLSRD_MOD_NAMESERVICE +PKG_SUBPKGS+= OLSRD_MOD_TAS include ${TOPDIR}/mk/package.mk @@ -40,10 +43,9 @@ CONFIG_STYLE:= manual BUILD_STYLE:= manual INSTALL_STYLE:= manual -TCFLAGS+= -fPIC +TCFLAGS+= -fPIC do-build: - rm -rf ${WRKINST} mkdir -p ${WRKINST} ${MAKE} -C "${WRKBUILD}" \ ${TARGET_CONFIGURE_OPTS} \ diff --git a/package/opencdk/Makefile b/package/opencdk/Makefile index 8c2ef472e..0caddd110 100644 --- a/package/opencdk/Makefile +++ b/package/opencdk/Makefile @@ -10,10 +10,12 @@ PKG_MD5SUM:= 813d62d7afe7b2c2d8f3df0a6c9d9331 PKG_DESCR:= Open Crypto Development Kit library PKG_SECTION:= libs PKG_DEPENDS:= libgcrypt libgpg-error zlib -PKG_BUILDDEP+= libgcrypt libgpg-error zlib +PKG_BUILDDEP:= libgcrypt libgpg-error zlib PKG_URL:= http://www.gnu.org/software/gnutls/download.html PKG_SITES:= ftp://ftp.gnutls.org/pub/gnutls/opencdk/ +PKG_SUBPKGS:= LIBOPENCDK + DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 include ${TOPDIR}/mk/package.mk diff --git a/package/openct/Makefile b/package/openct/Makefile index eb4b841d1..fb5cf15b5 100644 --- a/package/openct/Makefile +++ b/package/openct/Makefile @@ -6,12 +6,12 @@ include ${TOPDIR}/rules.mk PKG_NAME:= openct PKG_VERSION:= 0.6.16 PKG_RELEASE:= 1 -PKG_BUILDDEP+= libtool libusb PKG_MD5SUM:= d8d8c63269985303a303a218c4b953d7 PKG_DESCR:= drivers for smart card readers PKG_SECTION:= crypto PKG_DEPENDS:= libltdl libusb -PKG_URL:= http://www.opensc-project.org/openct +PKG_BUILDDEP:= libtool libusb +PKG_URL:= http://www.opensc-project.org/openct/ PKG_SITES:= http://www.opensc-project.org/files/openct/ include ${TOPDIR}/mk/package.mk diff --git a/package/openldap/Makefile b/package/openldap/Makefile index 5404170ee..f9a34f891 100644 --- a/package/openldap/Makefile +++ b/package/openldap/Makefile @@ -10,16 +10,17 @@ PKG_MD5SUM:= 90150b8c0d0192e10b30157e68844ddf PKG_DESCR:= OpenLDAP client libraries PKG_SECTION:= libs PKG_DEPENDS:= libopenssl libsasl2 -PKG_BUILDDEP+= cyrus-sasl openssl libdb +PKG_BUILDDEP:= cyrus-sasl openssl libdb PKG_URL:= http://www.openldap.org/ PKG_SITES:= ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/ -PKG_DESCR_LDAP_UTILS:= OpenLDAP utilities -PKG_DEPENDS_LDAP_UTILS:=libopenldap -PKG_SECTION_LDAP_UTILS:=net/misc -PKG_DESCR_SLAPD:= OpenLDAP server daemon -PKG_DEPENDS_SLAPD:= libopenldap -PKG_SECTION_SLAPD:= net/misc +PKG_SUBPKGS:= LIBOPENLDAP OPENLDAP_UTILS OPENLDAP_SLAPD +PKGSD_OPENLDAP_UTILS:= OpenLDAP utilities +PKGSS_OPENLDAP_UTILS:= libopenldap +PKGSC_OPENLDAP_UTILS:= net/misc +PKGSD_OPENLDAP_SLAPD:= OpenLDAP server daemon +PKGSS_OPENLDAP_SLAPD:= libopenldap +PKGSC_OPENLDAP_SLAPD:= net/misc DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tgz @@ -29,8 +30,8 @@ PKGFD_WITH_IPV6:= enable IPv6 support include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBOPENLDAP,libopenldap,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,OPENLDAP_UTILS,openldap-utils,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_LDAP_UTILS},${PKG_DESCR_LDAP_UTILS},${PKG_SECTION_LDAP_UTILS})) -$(eval $(call PKG_template,OPENLDAP_SLAPD,openldap-slapd,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_SLAPD},${PKG_DESCR_SLAPD},${PKG_SECTION_SLAPD})) +$(eval $(call PKG_template,OPENLDAP_UTILS,openldap-utils,${PKG_VERSION}-${PKG_RELEASE},${PKGSS_OPENLDAP_UTILS},${PKGSD_OPENLDAP_UTILS},${PKGSC_OPENLDAP_UTILS})) +$(eval $(call PKG_template,OPENLDAP_SLAPD,openldap-slapd,${PKG_VERSION}-${PKG_RELEASE},${PKGSS_OPENLDAP_SLAPD},${PKGSD_OPENLDAP_SLAPD},${PKGSC_OPENLDAP_SLAPD})) PKG_CONFIGURE_OPTIONS+= \ --enable-slapd \ diff --git a/package/openntpd/Makefile b/package/openntpd/Makefile index c2ddc7bac..0ed6754c9 100644 --- a/package/openntpd/Makefile +++ b/package/openntpd/Makefile @@ -9,11 +9,8 @@ PKG_RELEASE:= 18 PKG_MD5SUM:= afc34175f38d08867c1403d9008600b3 PKG_DESCR:= NTP server daemon PKG_SECTION:= ntp -PKG_URL:= http://www.openntpd.org -PKG_SITES:= ftp://ftp.openbsd.org/pub/OpenBSD/OpenNTPD/ \ - ftp://ftp.de.openbsd.org/pub/unix/OpenBSD/OpenNTPD/ \ - ftp://ftp.fr.openbsd.org/pub/OpenBSD/OpenNTPD/ \ - ftp://ftp.sunet.se/pub/OpenBSD/OpenNTPD/ +PKG_URL:= http://www.openntpd.org/ +PKG_SITES:= ftp://ftp.openbsd.org/pub/OpenBSD/OpenNTPD/ include ${TOPDIR}/mk/package.mk diff --git a/package/openobex/Makefile b/package/openobex/Makefile index 19a2cf399..84cc3df8f 100644 --- a/package/openobex/Makefile +++ b/package/openobex/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 0d83dc86445a46a1b9750107ba7ab65c PKG_DESCR:= implementation of the Object Exchange (OBEX) protocol PKG_SECTION:= bluetooth -PKG_BUILDDEP+= bluez +PKG_BUILDDEP:= bluez PKG_URL:= http://dev.zuckschwerdt.org/openobex/wiki/WikiStart PKG_SITES:= ${MASTER_SITE_KERNEL:=bluetooth/} diff --git a/package/opensc/Makefile b/package/opensc/Makefile index 89a32d2fe..9218a8c5e 100644 --- a/package/opensc/Makefile +++ b/package/opensc/Makefile @@ -9,8 +9,8 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 98fa151e947941f9c3f27420fdf47c11 PKG_DESCR:= utilities to access smart cards PKG_SECTION:= crypto -PKG_BUILDDEP+= libtool -PKG_URL:= http://www.opensc-project.org/opensc +PKG_BUILDDEP:= libtool +PKG_URL:= http://www.opensc-project.org/opensc/ PKG_SITES:= http://www.opensc-project.org/files/opensc/ include ${TOPDIR}/mk/package.mk diff --git a/package/opensips/Makefile b/package/opensips/Makefile index a1cd0089e..e83add75f 100644 --- a/package/opensips/Makefile +++ b/package/opensips/Makefile @@ -6,15 +6,24 @@ include $(TOPDIR)/rules.mk PKG_NAME:= opensips PKG_VERSION:= 1.6.1 PKG_RELEASE:= 1 +PKG_VARIANT:= tls PKG_MD5SUM:= e7e59910183ca8a213c76a7a80789ea1 PKG_DESCR:= a high-performance, configurable, free SIP server PKG_SECTION:= phone -PKG_MULTI:= 1 -PKG_VARIANT:= tls PKG_DEPENDS:= libopenssl -PKG_BUILDDEP+= openssl -PKG_URL:= http://opensips.org +PKG_BUILDDEP:= openssl +PKG_URL:= http://opensips.org/ PKG_SITES:= http://opensips.org/pub/opensips/$(PKG_VERSION)/src/ +PKG_MULTI:= 1 + +PKG_SUBPKGS:= OPENSIPS OPENSIPS_MOD_ACCOUNTING OPENSIPS_MOD_AUTH +PKG_SUBPKGS+= OPENSIPS_MOD_AUTH_DB OPENSIPS_MOD_AVPOPS OPENSIPS_MOD_DISPATCHER +PKG_SUBPKGS+= OPENSIPS_MOD_DIVERSION OPENSIPS_MOD_FLATSTORE OPENSIPS_MOD_GFLAGS +PKG_SUBPKGS+= OPENSIPS_MOD_GROUP OPENSIPS_MOD_MEDIAPROXY OPENSIPS_MOD_MSILO +PKG_SUBPKGS+= OPENSIPS_MOD_NATHELPER OPENSIPS_MOD_OPTIONS OPENSIPS_MOD_PDT +PKG_SUBPKGS+= OPENSIPS_MOD_PERMISSIONS OPENSIPS_MOD_PIKE OPENSIPS_MOD_SMS +PKG_SUBPKGS+= OPENSIPS_MOD_UAC OPENSIPS_MOD_UAC_REDIRECT OPENSIPS_MOD_URI +PKG_SUBPKGS+= OPENSIPS_MOD_XLOG DISTFILES:= $(PKG_NAME)-$(PKG_VERSION)-$(PKG_VARIANT)_src.tar.gz WRKDIST= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-$(PKG_VARIANT) diff --git a/package/openssh/Makefile b/package/openssh/Makefile index 4e30924c3..1b89b4ae0 100644 --- a/package/openssh/Makefile +++ b/package/openssh/Makefile @@ -5,41 +5,46 @@ include ${TOPDIR}/rules.mk PKG_NAME:= openssh PKG_VERSION:= 5.5p1 -PKG_RELEASE:= 2 +PKG_RELEASE:= 3 PKG_MD5SUM:= 88633408f4cb1eb11ec7e2ec58b519eb PKG_DESCR:= OpenSSH server PKG_SECTION:= net/security PKG_DEPENDS:= zlib libopenssl libpthread -PKG_BUILDDEP+= zlib openssl -ifeq (${ADK_COMPILE_OPENSSH_WITH_KRB5},y) -PKG_DEPENDS+= libkrb5 libcom-err -PKG_BUILDDEP+= krb5 -endif -ifeq (${ADK_COMPILE_OPENSSH_WITH_HEIMDAL},y) -PKG_DEPENDS+= libheimdal libcom-err -PKG_BUILDDEP+= heimdal -endif -PKG_URL:= http://www.openssh.com +PKG_BUILDDEP:= zlib openssl +PKG_URL:= http://www.openssh.com/ PKG_SITES:= ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/ -PKG_DESCR_CLIENT:= OpenSSH client -PKG_DESCR_CLIENT_UTILS:=OpenSSH client utilities -PKG_DESCR_SFTP_CLIENT:= OpenSSH sftp client -PKG_DESCR_SFTP_SERVER:= OpenSSH sftp server +PKG_SUBPKGS:= OPENSSH_SERVER OPENSSH_CLIENT OPENSSH_CLIENT_UTILS +PKG_SUBPKGS+= OPENSSH_SFTP_CLIENT OPENSSH_SFTP_SERVER +PKGSD_OPENSSH_CLIENT:= OpenSSH client +PKGSD_OPENSSH_CLIENT_UTILS:= OpenSSH client utilities +PKGSD_OPENSSH_SFTP_CLIENT:= OpenSSH sftp client +PKGSD_OPENSSH_SFTP_SERVER:= OpenSSH sftp server + +PKG_CHOICES:= NOKRB WITH_KRB5 WITH_HEIMDAL +PKGCD_NOKRB:= no Kerberos support +PKGCD_WITH_KRB5:= with MIT Kerberos +PKGCS_WITH_KRB5:= libkrb5 libcom-err +PKGCB_WITH_KRB5:= krb5 +PKGCD_WITH_HEIMDAL:= with Heimdal Kerberos +PKGCS_WITH_HEIMDAL:= libheimdal libcom-err +PKGCB_WITH_HEIMDAL:= heimdal include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,OPENSSH_SERVER,openssh-server,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,OPENSSH_CLIENT,openssh-client,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_CLIENT},${PKG_SECTION})) -$(eval $(call PKG_template,OPENSSH_CLIENT_UTILS,openssh-client-utils,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_CLIENT_UTILS},${PKG_SECTION})) -$(eval $(call PKG_template,OPENSSH_SFTP_CLIENT,openssh-sftp-client,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_SFTP_CLIENT},${PKG_SECTION})) -$(eval $(call PKG_template,OPENSSH_SFTP_SERVER,openssh-sftp-server,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_SFTP_SERVER},${PKG_SECTION})) +$(eval $(call PKG_template,OPENSSH_CLIENT,openssh-client,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_OPENSSH_CLIENT},${PKG_SECTION})) +$(eval $(call PKG_template,OPENSSH_CLIENT_UTILS,openssh-client-utils,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_OPENSSH_CLIENT_UTILS},${PKG_SECTION})) +$(eval $(call PKG_template,OPENSSH_SFTP_CLIENT,openssh-sftp-client,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_OPENSSH_SFTP_CLIENT},${PKG_SECTION})) +$(eval $(call PKG_template,OPENSSH_SFTP_SERVER,openssh-sftp-server,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_OPENSSH_SFTP_SERVER},${PKG_SECTION})) -ifeq ($(ADK_COMPILE_OPENSSH_WITH_KERBEROS),y) +ifeq ($(ADK_PACKAGE_OPENSSH_WITH_KRB5),y) CONFIGURE_ARGS+= --with-kerberos5="${STAGING_DIR}/usr" -else -CONFIGURE_ARGS+= --without-kerberos5 endif +ifeq ($(ADK_PACKAGE_OPENSSH_WITH_HEIMDAL),y) +CONFIGURE_ARGS+= --with-kerberos5="${STAGING_DIR}/usr" +endif + CONFIGURE_ENV+= LD='${TARGET_CC}' \ ac_cv_func_setlogin=no \ ac_cv_lib_nsl_yp_match=no diff --git a/package/openssl-pkcs11/Makefile b/package/openssl-pkcs11/Makefile index ce523c517..06199ed39 100644 --- a/package/openssl-pkcs11/Makefile +++ b/package/openssl-pkcs11/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 840af6e54dc21445c54f74e15005ba4d PKG_DESCR:= pkcs11 engine for openssl PKG_SECTION:= crypto -PKG_BUILDDEP+= libp11 +PKG_BUILDDEP:= libp11 PKG_URL:= http://www.opensc-project.org/engine_pkcs11 PKG_SITES:= http://www.opensc-project.org/files/engine_pkcs11/ diff --git a/package/openssl/Makefile b/package/openssl/Makefile index 0ab3c2e7f..fcae8c659 100644 --- a/package/openssl/Makefile +++ b/package/openssl/Makefile @@ -10,16 +10,17 @@ PKG_MD5SUM:= e3873edfffc783624cfbdb65e2249cbd PKG_DESCR:= OpenSSL (Secure Socket Layer) libraries PKG_SECTION:= libs PKG_DEPENDS:= zlib -PKG_BUILDDEP+= zlib +PKG_BUILDDEP:= zlib PKG_URL:= http://www.openssl.org/ PKG_SITES:= http://www.openssl.org/source/ -PKG_DESCR_UTIL:= OpenSSL command line tool -PKG_SECTION_UTIL:= crypto -PKG_DEPENDS_UTIL:= libopenssl -PKG_DESCR_DEV:= development files for openssl -PKG_SECTION_DEV:= devel -PKG_DEPENDS_DEV:= libopenssl +PKG_SUBPKGS:= LIBOPENSSL LIBOPENSSL_DEV OPENSSL_UTIL +PKGSD_OPENSSL_UTIL:= OpenSSL command line tool +PKGSC_OPENSSL_UTIL:= crypto +PKGSS_OPENSSL_UTIL:= libopenssl +PKGSD_LIBOPENSSL_DEV:= development files for openssl +PKGSC_LIBOPENSSL_DEV:= devel +PKGSS_LIBOPENSSL_DEV:= libopenssl PKG_FLAVOURS:= WITH_EC PKGFD_WITH_EC:= enable Elliptic Curve crypto @@ -28,8 +29,8 @@ PKGSUB_WITH_EC:= libopenssl include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBOPENSSL,libopenssl,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,LIBOPENSSL_DEV,libopenssl-dev,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_DEV},${PKG_DESCR_DEV},${PKG_SECTION_DEV})) -$(eval $(call PKG_template,OPENSSL_UTIL,openssl-util,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_UTIL},${PKG_DESCR_UTIL},${PKG_SECTION_UTIL})) +$(eval $(call PKG_template,LIBOPENSSL_DEV,libopenssl-dev,${PKG_VERSION}-${PKG_RELEASE},${PKGSS_LIBOPENSSL_DEV},${PKGSD_LIBOPENSSL_DEV},${PKGSC_LIBOPENSSL_DEV})) +$(eval $(call PKG_template,OPENSSL_UTIL,openssl-util,${PKG_VERSION}-${PKG_RELEASE},${PKGSS_OPENSSL_UTIL},${PKGSD_OPENSSL_UTIL},${PKGSC_OPENSSL_UTIL})) SUB_INSTALLS-y:= SUB_INSTALLS-m:= diff --git a/package/openswan/Makefile b/package/openswan/Makefile index 3e261e521..967a951d4 100644 --- a/package/openswan/Makefile +++ b/package/openswan/Makefile @@ -15,10 +15,9 @@ PKG_DEPENDS+= kmod-inet-xfrm-mode-tunnel kmod-inet-xfrm-mode-transport PKG_DEPENDS+= kmod-crypto-sha1 kmod-crypto-md5 PKG_DEPENDS+= kmod-crypto-null kmod-crypto-des kmod-crypto-aes PKG_DEPENDS+= kmod-crypto-hmac kmod-crypto-cbc kmod-crypto-authenc -PKG_BUILDDEP+= gmp +PKG_BUILDDEP:= gmp PKG_URL:= http://www.openswan.org/ PKG_SITES:= http://www.openswan.org/download/ - PKG_NOPARALLEL:= 1 include ${TOPDIR}/mk/package.mk diff --git a/package/openvpn/Makefile b/package/openvpn/Makefile index bc98c1089..f28543afe 100644 --- a/package/openvpn/Makefile +++ b/package/openvpn/Makefile @@ -10,17 +10,15 @@ PKG_MD5SUM:= b273ed2b5ec8616fb9834cde8634bce7 PKG_DESCR:= Open Source VPN solution using SSL PKG_SECTION:= net/security PKG_DEPENDS:= kmod-tun libopenssl -PKG_BUILDDEP+= openssl -ifeq ($(ADK_PACKAGE_OPENVPN_WITH_LZO),y) -PKG_BUILDDEP+= liblzo -endif -PKG_URL:= http://openvpn.net -PKG_SITES:= http://openvpn.net/release/ \ - ${MASTER_SITE_SOURCEFORGE:=openvpn/} +PKG_BUILDDEP:= openssl +PKG_URL:= http://openvpn.net/ +PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=openvpn/} +PKG_SUBPKGS:= OPENVPN OPENVPN_EASY_RSA PKG_FLAVOURS:= WITH_LZO WITH_MANAGEMENT WITH_HTTPPROXY WITH_SOCKS PKGFD_WITH_LZO:= enable LZO compression support PKGFS_WITH_LZO:= liblzo +PKGFB_WITH_LZO:= liblzo PKGFD_WITH_MANAGEMENT:= enable management server support PKGFD_WITH_HTTPPROXY:= enable http proxy support PKGFD_WITH_SOCKS:= enable socks proxy support diff --git a/package/oprofile/Makefile b/package/oprofile/Makefile index 108f78db2..956f3a1a3 100644 --- a/package/oprofile/Makefile +++ b/package/oprofile/Makefile @@ -10,12 +10,12 @@ PKG_MD5SUM:= 4e407093ac06200185d5a5e6437d7242 PKG_DESCR:= system-wide profiles PKG_SECTION:= debug PKG_DEPENDS:= libpopt kmod-oprofile libbfd libstdcxx -PKG_BUILDDEP+= popt binutils -PKG_URL:= http://oprofile.sourceforge.net +PKG_BUILDDEP:= popt binutils +PKG_URL:= http://oprofile.sourceforge.net/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=oprofile/} -CFLINE_OPROFILE:= select BUSYBOX_EXPR PKG_TARGET_DEPENDS:= !foxboard +PKG_CFLINE_OPROFILE:= select BUSYBOX_EXPR include $(TOPDIR)/mk/package.mk diff --git a/package/osiris/Makefile b/package/osiris/Makefile index b7cb1ebc7..b07c1bbd8 100644 --- a/package/osiris/Makefile +++ b/package/osiris/Makefile @@ -10,8 +10,8 @@ PKG_MD5SUM:= 1951c7dc0fe729af9ffaf58910340d12 PKG_DESCR:= Host Integrity Monitoring System (scanning agent) PKG_SECTION:= admin PKG_DEPENDS:= libopenssl libpthread -PKG_BUILDDEP+= openssl -PKG_URL:= http://osiris.shmoo.com +PKG_BUILDDEP:= openssl +PKG_URL:= http://osiris.shmoo.com/ PKG_SITES:= http://osiris.shmoo.com/data/ include ${TOPDIR}/mk/package.mk diff --git a/package/owfs/Makefile b/package/owfs/Makefile index 7df4bbf83..b260dcb24 100644 --- a/package/owfs/Makefile +++ b/package/owfs/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= c287d96c629b5deb6c85e6a82eecdc8a PKG_DESCR:= software to access 1-wire devices PKG_SECTION:= misc -PKG_BUILDDEP+= fuse +PKG_BUILDDEP:= fuse PKG_URL:= http://owfs.org/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=owfs/} diff --git a/package/p910nd/Makefile b/package/p910nd/Makefile index 0de71ee63..eb561bf70 100644 --- a/package/p910nd/Makefile +++ b/package/p910nd/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 10 PKG_MD5SUM:= 7bf752532d26c9106f8039db95df3a6b PKG_DESCR:= A small non-spooling printer server PKG_SECTION:= net/misc -PKG_URL:= http://www.etherboot.org/p910nd +PKG_URL:= http://www.etherboot.org/p910nd/ PKG_SITES:= http://www.etherboot.org/p910nd/ DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 diff --git a/package/palantir/Makefile b/package/palantir/Makefile index 210dcdfc7..18143c0a1 100644 --- a/package/palantir/Makefile +++ b/package/palantir/Makefile @@ -10,8 +10,8 @@ PKG_MD5SUM:= 3a5b1fb340857f6d8e357bf39b77583e PKG_DESCR:= A multichannel interactive streaming solution PKG_SECTION:= multimedia PKG_DEPENDS:= libjpeg libpthread -PKG_BUILDDEP+= jpeg -PKG_URL:= http://www.fastpath.it/products/palantir +PKG_BUILDDEP:= jpeg +PKG_URL:= http://www.fastpath.it/products/palantir/ PKG_SITES:= http://www.fastpath.it/products/palantir/pub/ DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tgz diff --git a/package/pango/Makefile b/package/pango/Makefile index 3d84ecbb7..f2ce2392d 100644 --- a/package/pango/Makefile +++ b/package/pango/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= aa3dee16506275a36c6c9239c9e2dfdd PKG_DESCR:= pango library PKG_SECTION:= libs -PKG_URL:= http://www.pango.org +PKG_URL:= http://www.pango.org/ PKG_SITES:= ${MASTER_SITE_GNOME:=/pango/1.28/} ifeq ($(ADK_STATIC),y) diff --git a/package/parprouted/Makefile b/package/parprouted/Makefile index 600d7994d..118f1ee15 100644 --- a/package/parprouted/Makefile +++ b/package/parprouted/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 570f5deaf09600df8f80f589de79ecdb PKG_DESCR:= a proxy ARP daemon PKG_SECTION:= proxy PKG_DEPENDS:= libpthread -PKG_URL:= http://www.hazard.maks.net/parprouted +PKG_URL:= http://www.hazard.maks.net/parprouted/ PKG_SITES:= http://www.hazard.maks.net/parprouted/ include ${TOPDIR}/mk/package.mk diff --git a/package/parted/Makefile b/package/parted/Makefile index 3d237277b..cd8f73bd3 100644 --- a/package/parted/Makefile +++ b/package/parted/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 055305bc7bcf472ce38f9abf69a9d94d PKG_DESCR:= GNU parted PKG_SECTION:= fs PKG_DEPENDS:= libuuid libreadline libdevmapper libpthread -PKG_BUILDDEP+= e2fsprogs lvm readline +PKG_BUILDDEP:= e2fsprogs lvm readline PKG_URL:= http://www.gnu.org/software/parted/index.shtml PKG_SITES:= ${MASTER_SITE_GNU:=parted/} diff --git a/package/patch/Makefile b/package/patch/Makefile index 975da3970..909fdbf0d 100644 --- a/package/patch/Makefile +++ b/package/patch/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= dacfb618082f8d3a2194601193cf8716 PKG_DESCR:= GNU patch PKG_SECTION:= utils -PKG_URL:= http://www.gnu.org/software/patch +PKG_URL:= http://www.gnu.org/software/patch/ PKG_SITES:= ${MASTER_SITE_GNU:=patch/} include $(TOPDIR)/mk/package.mk diff --git a/package/pciutils/Makefile b/package/pciutils/Makefile index 688d83c3a..c7df89545 100644 --- a/package/pciutils/Makefile +++ b/package/pciutils/Makefile @@ -10,10 +10,9 @@ PKG_MD5SUM:= d07da501bb11e6af40acd036536c2e9a PKG_DESCR:= PCI Utilities PKG_SECTION:= utils PKG_DEPENDS:= zlib -PKG_BUILDDEP+= zlib -PKG_URL:= http://www.kernel.org/pub/software/utils/pciutils -PKG_SITES:= http://www.kernel.org/pub/software/utils/pciutils/ \ - ftp://atrey.karlin.mff.cuni.cz/pub/linux/pci/ +PKG_BUILDDEP:= zlib +PKG_URL:= http://www.kernel.org/pub/software/utils/pciutils/ +PKG_SITES:= http://www.kernel.org/pub/software/utils/pciutils/ include ${TOPDIR}/mk/package.mk diff --git a/package/pcmciautils/Makefile b/package/pcmciautils/Makefile index d99b1a7d1..3d987083b 100644 --- a/package/pcmciautils/Makefile +++ b/package/pcmciautils/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= ee5837214d297661c8b8189055a351fc PKG_DESCR:= Utilities for PCMCIA subsystem PKG_SECTION:= utils -PKG_BUILDDEP+= sysfsutils +PKG_BUILDDEP:= sysfsutils PKG_URL:= http://www.kernel.org/pub/linux/utils/kernel/pcmcia/pcmcia.html PKG_SITES:= http://www.kernel.org/pub/linux/utils/kernel/pcmcia/ diff --git a/package/pcre/Makefile b/package/pcre/Makefile index aabb33acf..9f6d88fad 100644 --- a/package/pcre/Makefile +++ b/package/pcre/Makefile @@ -9,9 +9,11 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 214462e9718e3f9197cba114dc6b00b8 PKG_DESCR:= a Perl Compatible Regular Expression library PKG_SECTION:= libs -PKG_URL:= http://www.pcre.org +PKG_URL:= http://www.pcre.org/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=pcre/} +PKG_SUBPKGS:= LIBPCRE + include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBPCRE,libpcre,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/pcsc-lite/Makefile b/package/pcsc-lite/Makefile index e055ccd70..efe299c71 100644 --- a/package/pcsc-lite/Makefile +++ b/package/pcsc-lite/Makefile @@ -9,8 +9,8 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= fc3fd0e83090ecc81e5b32700fa246c2 PKG_DESCR:= middleware for smartcards PKG_SECTION:= crypto -PKG_BUILDDEP+= libusb libusb-compat PKG_DEPENDS:= libusb libusb-compat libpthread ccid +PKG_BUILDDEP:= libusb libusb-compat PKG_URL:= http://pcsclite.alioth.debian.org/ PKG_SITES:= https://alioth.debian.org/frs/download.php/3279/ diff --git a/package/perl/Makefile b/package/perl/Makefile index f666c76fc..e273e83a9 100644 --- a/package/perl/Makefile +++ b/package/perl/Makefile @@ -4,34 +4,28 @@ include ${TOPDIR}/rules.mk PKG_NAME:= perl -PKG_VERSION:= 5.10.0 +PKG_VERSION:= 5.12.2 PKG_RELEASE:= 1 -PKG_MD5SUM:= d2c39b002ebfd2c3c5dba589365c5a71 -PKG_DESCR:= Perl without operating-specific functions +PKG_MD5SUM:= af2df531d46b77fdf0d97eecb03eddb2 +PKG_DESCR:= full-blown Perl PKG_SECTION:= lang -PKG_URL:= www.perl.org -PKG_SITES:= ftp://ftp.cpan.org/pub/CPAN/src/5.0/ \ - ftp://ftp.mpi-sb.mpg.de/pub/perl/CPAN/src/5.0/ \ - ftp://ftp.gmd.de/mirrors/CPAN/src/5.0/ \ - ftp://ftp.funet.fi/pub/languages/perl/CPAN/src/5.0/ +PKG_URL:= http://www.perl.org/ +PKG_SITES:= http://www.cpan.org/src/ -CFLINE_PERL:= depends on ADK_NATIVE +PKG_CFLINE_PERL:= depends on ADK_NATIVE include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,PERL,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) CONFIG_STYLE:= manual -INSTALL_STYLE:= manual pre-configure: - (cd ${WRKBUILD}; ./Configure -des -Dcc=gcc); + (cd ${WRKBUILD}; ./Configure -des -Dcc=gcc -Dprefix=/usr); -do-install: +post-install: ${INSTALL_DIR} ${IDIR_PERL}/usr/bin ${INSTALL_DIR} ${IDIR_PERL}/usr/lib/perl5/${PKG_VERSION} - ${INSTALL_BIN} ${WRKBUILD}/perl ${IDIR_PERL}/usr/bin/perl - ${INSTALL_DATA} ${WRKBUILD}/lib/strict.pm \ - ${IDIR_PERL}/usr/lib/perl5/${PKG_VERSION} + ${INSTALL_BIN} ${WRKINST}/usr/bin/perl ${IDIR_PERL}/usr/bin/perl include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/php/Makefile b/package/php/Makefile index 2ceac7f85..be9a982ad 100644 --- a/package/php/Makefile +++ b/package/php/Makefile @@ -7,42 +7,27 @@ PKG_NAME:= php PKG_VERSION:= 5.3.2 PKG_RELEASE:= 1 PKG_MD5SUM:= 4480d7c6d6b4a86de7b8ec8f0c2d1871 -PKG_DESCR:= PHP CLI +PKG_DESCR:= PHP language interpreter PKG_SECTION:= lang -PKG_MULTI:= 1 PKG_DEPENDS:= libopenssl zlib -PKG_BUILDDEP+= openssl zlib -ifneq ($(ADK_PACKAGE_PHP_MOD_CURL),) -PKG_BUILDDEP+= curl -endif -ifneq ($(ADK_PACKAGE_PHP_MOD_GD),) -PKG_BUILDDEP+= libgd libpng -endif -ifneq ($(ADK_PACKAGE_PHP_MOD_GMP),) -PKG_BUILDDEP+= gmp -endif -ifneq ($(ADK_PACKAGE_PHP_MOD_LDAP),) -PKG_BUILDDEP+= openldap -endif -ifneq ($(ADK_PACKAGE_PHP_MOD_MYSQL),) -PKG_BUILDDEP+= mysql -endif -ifneq ($(ADK_PACKAGE_PHP_MOD_PCRE),) -PKG_BUILDDEP+= pcre -endif -ifneq ($(ADK_PACKAGE_PHP_MOD_PGSQL),) -PKG_BUILDDEP+= postgresql -endif -ifneq ($(ADK_PACKAGE_PHP_MOD_SQLITE),) -PKG_BUILDDEP+= sqlite -endif -ifneq ($(ADK_PACKAGE_PHP_MOD_XML),) -PKG_BUILDDEP+= expat -endif -PHP_URL:= http://www.php.net +PKG_BUILDDEP:= openssl zlib +PHP_URL:= http://www.php.net/ PKG_SITES:= http://de.php.net/distributions/ +PKG_MULTI:= 1 + +PKG_SUBPKGS:= PHP PHP_CLI PHP_FASTCGI +PKGSD_PHP_FASTCGI:= PHP for FastCGI usage +PKGSD_PHP_CLI:= PHP CLI -PKG_DESCR_FCGI:= PHP for FastCGI usage +PKGSB_MOD_CURL:= curl +PKGSB_MOD_GD:= libgd libpng +PKGSB_MOD_GMP:= gmp +PKGSB_MOD_LDAP:= openldap +PKGSB_MOD_MYSQL:= mysql +PKGSB_MOD_PGSQL:= postgresql +PKGSB_MOD_PCRE:= pcre +PKGSB_MOD_SQLITE:= sqlite +PKGSB_MOD_XML:= expat PKG_HOST_DEPENDS:= !cygwin @@ -51,8 +36,8 @@ PKG_HOST_DEPENDS:= !cygwin include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,PHP,php,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,PHP_CLI,php-cli,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,PHP_FASTCGI,php-fastcgi,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_FCGI},${PKG_SECTION})) +$(eval $(call PKG_template,PHP_CLI,php-cli,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_PHP_CLI},${PKG_SECTION})) +$(eval $(call PKG_template,PHP_FASTCGI,php-fastcgi,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_PHP_FASTCGI},${PKG_SECTION})) define PKG_mod_template diff --git a/package/picocom/Makefile b/package/picocom/Makefile index 9b33eaf52..592a6beba 100644 --- a/package/picocom/Makefile +++ b/package/picocom/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 08fcc5f6bb9e7676a2569386d5ea9f70 PKG_DESCR:= minimal dumb-terminal emulation program PKG_SECTION:= serial -PKG_URL:= http://efault.net/npat/hacks/picocom +PKG_URL:= http://efault.net/npat/hacks/picocom/ PKG_SITES:= http://efault.net/npat/hacks/picocom/dist/ include ${TOPDIR}/mk/package.mk diff --git a/package/pkg-config/Makefile b/package/pkg-config/Makefile index 7fc7e0af9..23229b956 100644 --- a/package/pkg-config/Makefile +++ b/package/pkg-config/Makefile @@ -9,8 +9,8 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= a3270bab3f4b69b7dc6dbdacbcae9745 PKG_DESCR:= a helper tool used when compiling applications and libraries. PKG_SECTION:= lang -PKG_BUILDDEP+= glib popt PKG_DEPENDS:= glib libpopt +PKG_BUILDDEP:= glib popt PKG_URL:= http://pkg-config.freedesktop.org/wiki/ PKG_SITES:= http://pkgconfig.freedesktop.org/releases/ diff --git a/package/pkgmaker b/package/pkgmaker deleted file mode 100644 index e391c680b..000000000 --- a/package/pkgmaker +++ /dev/null @@ -1,354 +0,0 @@ -unset MAKEFLAGS -export MAKEFLAGS=s -cd "$(dirname "$0")" -export TOPDIR=$(realpath ..) -if gmake --help >/dev/null 2>&1; then - export GMAKE=gmake -else - export GMAKE=make -fi -GMAKE="$GMAKE --no-print-directory" -(( x_cols = (COLUMNS > 10) ? COLUMNS - 2 : 80 )) -typeset -L$x_cols pbar - -# check for trailing whitespace -#grep -H '[[:space:]]$' */Makefile && print "Found trailing whitespace, please fix" - -# build a cache of “ipkg package name†→ “package conf option†for -# use with dependency resolution -rm -rf pkglist.d -mkdir pkglist.d -for dn in */Makefile; do - dn=${dn%/*} - pbar="Pass 1: $dn ..." - print -nu2 "$pbar\r" - cd $dn - - # ALL_PKGOPTS: all subpackage conf options - # PKGNAME_*: subpackage (ipkg) package name, by subpackage option - eval $($GMAKE dump="ALL_PKGOPTS \ - \$(foreach x,\${ALL_PKGOPTS},PKGNAME_\${x})") - cd .. - - if [[ -z $ALL_PKGOPTS ]]; then - #print -u2 "Warning: $dn/Makefile contains no packages, skipped" - continue - fi - - for spcu in $ALL_PKGOPTS; do # spcu: package option, ucase - eval sppn=\$PKGNAME_$spcu # sppn: subpackage (ipkg) name - # once mksh R40 is out, use its new associative arrays here! - print -r -- "$spcu" >pkglist.d/"$sppn" - done -done - -# build Config.in files and resolve dependencies -rm -f package_sections -rm -rf pkgconfigs.d -mkdir pkgconfigs.d -for dn in */Makefile; do - dn=${dn%/*} - pbar="Pass 2: $dn ..." - print -nu2 "$pbar\r" - mkdir pkgconfigs.d/$dn - cd $dn - - # PKG_NAME: package name (directory, free-format) - # PKG_FLAVOURS: all package flavours (boolean options), uppercase - # PKG_CHOICES: all package choices (boolean options), uppercase - # PKG_DESCR: package description (directory) - # PKG_URL: package homepage - # PKG_CXX: uppercase varname part to use for CFrustFrust checks - # ALL_PKGOPTS: all subpackage conf options - # PKGNAME_*: subpackage (ipkg) package name, by subpackage option - # PKGDESC_*: subpackage description, by subpackage option - # PKGDEPS_*: subpackage depends on ipkg packages, by subpkg option - # PKGDFLT_*: subpackage 'default {:-n}', by subpackage option - # CFLINE_*: one free-format Config.in line per subpackage option - # PKGFD_*: flavour description, per package flavour option - # PKG_{HOST,TARGET}_DEPENDS: add host or target dependencies - eval $($GMAKE dump="PKG_NAME PKG_FLAVOURS PKG_CHOICES PKG_DESCR PKG_SECTION PKG_URL PKG_MULTI PKG_CXX \ - ALL_PKGOPTS \$(foreach x,\${ALL_PKGOPTS},PKGNAME_\${x} \ - PKGDESC_\${x} PKGDEPS_\${x} PKGDFLT_\${x} PKGSECT_\${x} CFLINE_\${x}) \ - \$(foreach x,\${PKG_FLAVOURS},PKGFD_\${x}) \ - \$(foreach x,\${PKG_FLAVOURS},PKGFS_\${x}) \ - \$(foreach x,\${PKG_FLAVOURS},PKGSUB_\${x}) \ - \$(foreach x,\${PKG_CHOICES},PKGCD_\${x}) \ - \$(foreach x,\${PKG_CHOICES},PKGCS_\${x}) \ - PKG_HOST_DEPENDS PKG_TARGET_DEPENDS") - - - # dnu: directory name, uppercase, y/-+/_X/ - typeset -u dnu=${dn//-/_} - dnu=${dnu//+/X} - - echo "pkgconfigs.d/$dn/Config.in ${PKG_SECTION:=none}" >>../package_sections - echo "$dn/Config.in.manual ${PKG_SECTION:=none}" >>../package_sections - - # skip if we take care of this one manually - [[ -s Config.in.manual ]] && { cd ..; continue; } - - exec 4>../pkgconfigs.d/$dn/Config.in - - # Handle master package (directory) - print -u4 "config ADK_COMPILE_$dnu" - if [[ -z $ALL_PKGOPTS ]]; then - # pseudo package, does not produce an ipkg package - ppnf=$PKG_NAME # ppnf: pseudopkg name, filled - if [[ -n $PKG_DESCR ]]; then - while (( ${#ppnf} < 23 )); do - ppnf=$ppnf. - done - ppnf="$ppnf $PKG_DESCR" - fi - print -u4 "\tprompt \"$ppnf\"" - fi - print -u4 \\ttristate - if [[ -n $ALL_PKGOPTS ]]; then - # real (master) package, contains 1+ ipkg (sub)packages - print -nu4 \\tdepends on - sp=' ' # local sp: space (or ' || ') - for spcu in $ALL_PKGOPTS; do # spcu: package option, ucase - if [[ -n $PKG_MULTI ]]; then - if [[ $dnu != $spcu ]]; then - print -nu4 "${sp}ADK_PACKAGE_$spcu" - sp=' || ' - else - print -nu4 "${sp}ADK_HAVE_DOT_CONFIG" - sp=' || ' - fi - else - print -nu4 "${sp}ADK_PACKAGE_$spcu" - sp=' || ' - fi - done - print -u4 - fi - print -u4 \\tdefault n - - # Handle NOT/ONLY_FOR_PLATFORM alikes - phd= # phd: PKG_HOST_DEPENDS expand. - if [[ -n $PKG_HOST_DEPENDS ]]; then - phd='\tdepends on' - if [[ $PKG_HOST_DEPENDS = *\!* ]]; then - sp=' !' - else - sp=' ' - fi - for x in $PKG_HOST_DEPENDS; do - typeset -u x=${x#!} - phd="$phd${sp}ADK_HOST_$x" - if [[ $PKG_HOST_DEPENDS = *\!* ]]; then - sp=' && !' - else - sp=' || ' - fi - done - fi - ptd= # ptd: PKG_TARGET_DEPENDS exp. - if [[ -n $PKG_TARGET_DEPENDS ]]; then - ptd='\tdepends on' - sp=' ' # local sp: space (or ' || ') - if [[ $PKG_TARGET_DEPENDS = *\!* ]]; then - sp=' !' - else - sp=' ' - fi - for x in $PKG_TARGET_DEPENDS; do - typeset -l x=${x#!} - #XXX cache this with mksh R40+ - found=0 - while read friendlyname sym; do - [[ $friendlyname = $x ]] || continue - found=1 - break - done <../../target/target.lst - if (( !found )); then - print -u2 "$dn: Target '$x' not found!" - exit 1 - fi - ptd="$ptd${sp}$sym" - if [[ $PKG_TARGET_DEPENDS = *\!* ]]; then - sp=' && !' - else - sp=' || ' - fi - done - fi - - # Handle subpackages / multipackages - for spcu in $ALL_PKGOPTS; do # spcu: package option, ucase - eval sppn=\$PKGNAME_$spcu # sppn: subpackage (ipkg) name - eval desc=\$PKGDESC_$spcu # desc: subpackage description - : ${desc:=$PKG_DESCR} # take from main pkg if empty - eval sect=\$PKGSECT_$spcu # sect: subpackage section - : ${sect:=$PKG_SECTION} # take from main pkg if empty - eval deps=\$PKGDEPS_$spcu # deps: subpackage dependencies - eval dflt=\$PKGDFLT_$spcu # dflt: config 'default' opt. - eval xline=\$CFLINE_$spcu # xline: one free-format line - - echo "pkgconfigs.d/$dn/Config.in.$sppn $sect" >>../package_sections - exec 4>../pkgconfigs.d/$dn/Config.in.$sppn - h=4 - - print -u$h config ADK_PACKAGE_$spcu - spnf=$sppn # spnf: subpackage name, filled - if [[ -n ${desc:-$PKG_NAME} ]]; then - while (( ${#spnf} < 23 )); do - spnf=$spnf. - done - spnf="$spnf ${desc:-$PKG_NAME}" - fi - print -u$h "\tprompt \"$spnf\"" - print -u$h \\ttristate - if [[ -n $PKG_MULTI ]]; then - if [[ $spcu != $dnu ]]; then - print -u$h "\tdepends on ADK_PACKAGE_$dnu" - fi - fi - [[ -n $phd ]] && print -u$h "$phd" - [[ -n $ptd ]] && print -u$h "$ptd" - print -u$h "\tdefault ${dflt:-n}" - for dep in $deps; do # dep: ipkg name of one rundep. - # skip dependencies on uclibc++ and libstdcxx iff - # we produce these automatically - [[ -n $PKG_CXX && $dep = @(uclibc++|libstdcxx) ]] && \ - continue - case $dep { - (kmod-*) - # produce dependency on kernel package - # which have special name→sym mangling - typeset -u udep=${dep//-/_} - print -u$h "\tselect ADK_KPACKAGE_$udep" - ;; - (*) - # produce dependency on regular package - # where the symbol is cached (see above) - if [[ ! -f ../pkglist.d/"$dep" ]]; then - print -u2 "Warning: $PKG_NAME: unreachable dependency '$dep'" - continue - fi - print -u$h '\tselect' \ - ADK_PACKAGE_$(<../pkglist.d/"$dep") - ;; - } - done - print -u$h \\tselect ADK_COMPILE_$dnu - [[ -n $xline ]] && print -u$h "\t$xline" - if [[ -n $desc$PKG_URL ]]; then - # produce (optional) help text - print -u$h \\thelp - [[ -n $desc ]] && print -u$h "\t $desc" - [[ -n $desc && -n $PKG_URL ]] && print -u$h '\t ' - [[ -n $PKG_URL ]] && print -u$h "\t WWW: $PKG_URL" - fi - done - - # Handle CFrustFrust library selection, if necessary - [[ -n $PKG_CXX ]] && cat >&4 <<EOF - -choice -prompt "C++ library to use" -depends on ADK_COMPILE_$dnu -default ADK_COMPILE_${PKG_CXX}_WITH_STDCXX if ADK_TARGET_LIB_GLIBC || ADK_TARGET_LIB_EGLIBC -default ADK_COMPILE_${PKG_CXX}_WITH_UCLIBCXX if ADK_TARGET_LIB_UCLIBC - -config ADK_COMPILE_${PKG_CXX}_WITH_STDCXX - bool "GNU C++ library" - select ADK_PACKAGE_LIBSTDCXX - -config ADK_COMPILE_${PKG_CXX}_WITH_UCLIBCXX - bool "uClibc++ library" - select ADK_PACKAGE_UCLIBCXX - -endchoice -EOF - - [[ -n $PKG_CHOICES ]] && cat >&4 <<EOF - -choice -prompt "Package flavour choice" -depends on ADK_COMPILE_$dnu -EOF - # Handle choices - for pfco in $PKG_CHOICES; do - eval pfcd=\$PKGCD_$pfco - eval pfcs=\$PKGCS_$pfco - typeset -u pfcs=${pfcs#!} - print - print config ADK_PACKAGE_${dnu}_$pfco - print "\tbool \"$pfcd\"" - print "\\tselect ADK_PACKAGE_${pfcs}" - done >&4 - [[ -n $PKG_CHOICES ]] && cat >&4 <<EOF - -endchoice -EOF - # Handle flavours (per directory) - for pfcu in $PKG_FLAVOURS; do # pfcu: pkg flavour conf opt. - fh=4 - eval pfd=\$PKGFD_$pfcu # pfd: pkg flavour description - eval pfs=\$PKGFS_$pfcu # pfs: pkg flavour dependencies - eval sub=\$PKGSUB_$pfcu # sub: add to subpackage - [[ -n ${sub} ]] && exec 5>>../pkgconfigs.d/$dn/Config.in.$sub && fh=5 - print -u$fh - print -u$fh config ADK_PACKAGE_${dnu}_$pfcu - print -u$fh "\tbool \"${pfd:-$PKG_NAME -> flavour $pfcu}\"" - print -u$fh \\tdefault n - print -u$fh \\tdepends on ADK_COMPILE_$dnu - for pfso in $pfs; do - typeset -u pfso=${pfso#!} - print -u$fh \\tselect ADK_PACKAGE_${pfso} - done - print -u$fh \\thelp - print -u$fh "\t flavour ADK_PACKAGE_${dnu}_$pfcu for $PKG_NAME" - done - cd .. -done - -# return good if given file exists and is non-empty -non_empty_file() { - [[ -f "$1" ]] || return 1 - [[ -n "$(cat "$1")" ]] || return 1 - return 0 -} - -# print the verbose section name for a given section tag -lookup_section_string() { - str="$(grep ^$1\ sections.lst | cut -d ' ' -f '2-')" - [[ -n $str ]] && { echo $str; return; } - echo $1 -} - -# print the first prompt's first word's value in a given Config.in file -get_first_prompt() { - prompt="$(grep "prompt " $1 |head -1| sed -n 's/.*"\([^ \.]*\)[ \.].*"/\1/p')" - [[ -n $prompt ]] && echo $prompt -} - -# prepare Config.in list for sorting -while read config_in section; do - pbar="Pass 3: $config_in ..." - print -nu2 "$pbar\r" - - non_empty_file $config_in || continue - prompt="$(get_first_prompt $config_in)" - [[ -n $prompt ]] || continue - echo "$prompt $config_in $(lookup_section_string $section)" -done <package_sections >package_section_list - -# create the Config.in.auto from the sorted list from above -cursec="" -sort -k 3 -k 1 -f package_section_list | while read name file section; do - if [[ $cursec != $section ]]; then - [[ -n $cursec ]] && print "endmenu\n" - - print "menu \"$section\"" - cursec="$section" - fi - print "source \"package/$file\"" - print -u3 "source \"package/${file%.*}\"" -done >Config.in.auto 3>Config.in.auto.pre -print "endmenu\n" >>Config.in.auto -grep pkgconfigs.d Config.in.auto.pre | sort | uniq > Config.in.auto.global -rm -f package_sections package_section_list Config.in.auto.pre diff --git a/package/pmacct/Makefile b/package/pmacct/Makefile index 0b9c6c1ae..3e4460c87 100644 --- a/package/pmacct/Makefile +++ b/package/pmacct/Makefile @@ -4,25 +4,18 @@ include $(TOPDIR)/rules.mk PKG_NAME:= pmacct -PKG_VERSION:= 0.12.2 +PKG_VERSION:= 0.12.3 PKG_RELEASE:= 1 -PKG_MD5SUM:= 1c656ea9ca13455c54e8efb9f8299b3d +PKG_MD5SUM:= 7e4196c0f87f1382a8eed4eb1bdecdc1 PKG_DESCR:= IP accounting daemons PKG_SECTION:= net/misc PKG_DEPENDS:= libpcap -PKG_BUILDDEP+= libpcap -ifneq ($(ADK_COMPILE_PMACCT_MYSQL),) -PKG_BUILDDEP+= mysql -endif -ifneq ($(ADK_COMPILE_PMACCT_PGSQL),) -PKG_BUILDDEP+= postgresql -endif -ifneq ($(ADK_COMPILE_PMACCT_SQLITE),) -PKG_BUILDDEP+= sqlite -endif +PKG_BUILDDEP:= libpcap PKG_URL:= http://www.pmacct.net/ PKG_SITES:= http://www.pmacct.net/ +PKG_SUBPKGS:= NFACCTD PMACCTD SFACCTD PMACCT_CLIENT + include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,NFACCTD,nfacctd,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/popt/Makefile b/package/popt/Makefile index 0e3a0362b..f8d43aac0 100644 --- a/package/popt/Makefile +++ b/package/popt/Makefile @@ -10,10 +10,12 @@ PKG_MD5SUM:= c61ef795fa450eb692602a661ec8d7f1 PKG_DESCR:= a command line option parsing library PKG_SECTION:= libs PKG_DEPENDS:= libiconv -PKG_BUILDDEP+= libiconv -PKG_URL:= http://rpm5.org +PKG_BUILDDEP:= libiconv +PKG_URL:= http://rpm5.org/ PKG_SITES:= http://rpm5.org/files/popt/ +PKG_SUBPKGS:= LIBPOPT + include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBPOPT,libpopt,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/portmap/Makefile b/package/portmap/Makefile index 28f3e4b7f..e885b20a0 100644 --- a/package/portmap/Makefile +++ b/package/portmap/Makefile @@ -9,11 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= ac108ab68bf0f34477f8317791aaf1ff PKG_DESCR:= RPC portmapper PKG_SECTION:= net/misc -ifneq ($(strip ${ADK_PACKAGE_PORTMAP_LIBWRAP}),) -PKG_DEPENDS:= libwrap -PKG_BUILDDEP+= tcp_wrappers -endif -PKG_URL:= http://neil.brown.name/portmap +PKG_URL:= http://neil.brown.name/portmap/ PKG_SITES:= http://neil.brown.name/portmap/ DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tgz diff --git a/package/postgresql/Makefile b/package/postgresql/Makefile index 2b178e2e6..834817160 100644 --- a/package/postgresql/Makefile +++ b/package/postgresql/Makefile @@ -9,12 +9,11 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= ae7f305eb9388b187e8f07dee0cec55c PKG_DESCR:= PostgreSQL database library PKG_SECTION:= db -PKG_BUILDDEP+= zlib +PKG_BUILDDEP:= zlib PKG_URL:= http://www.postgresql.org -PKG_SITES:= ftp://ftp7.de.postgresql.org/pub/ftp.postgresql.org/source/v${PKG_VERSION}/ \ - ftp://ftp8.de.postgresql.org/pub/ftp.postgresql.org/source/v${PKG_VERSION}/ \ - ftp://ftp.be.postgresql.org/pub/postgresql/source/v${PKG_VERSION}/ \ - ftp://ftp.tw.postgresql.org/pub/postgresql/source/v${PKG_VERSION}/ +PKG_SITES:= ftp://ftp7.de.postgresql.org/pub/ftp.postgresql.org/source/v${PKG_VERSION}/ + +PKG_SUBPKGS:= LIBPQ include ${TOPDIR}/mk/package.mk diff --git a/package/ppp/Makefile b/package/ppp/Makefile index a04d5b798..df995bfa3 100644 --- a/package/ppp/Makefile +++ b/package/ppp/Makefile @@ -9,10 +9,13 @@ PKG_RELEASE:= 4 PKG_MD5SUM:= 4621bc56167b6953ec4071043fe0ec57 PKG_DESCR:= Point-to-Point Protocol software PKG_SECTION:= ppp -PKG_MULTI:= 1 PKG_DEPENDS:= kmod-ppp -PKG_URL:= http://ppp.samba.org +PKG_URL:= http://ppp.samba.org/ PKG_SITES:= ftp://ftp.samba.org/pub/ppp/ +PKG_MULTI:= 1 + +PKG_SUBPKGS:= PPP PPP_MOD_PPPOA PPP_MOD_PPPOE PPP_MOD_RADIUS +PKG_SUBPKGS+= PPP_MOD_CHAT PPP_MOD_PPPDUMP PPP_MOD_PPPSTATS PPP_MOD_PPPUMTS PKG_DEPENDS_PPPOE:= kmod-pppoe PKG_DEPENDS_UMTS:= comgt diff --git a/package/pptpd/Makefile b/package/pptpd/Makefile index 8930056c4..2d912c99f 100644 --- a/package/pptpd/Makefile +++ b/package/pptpd/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= b38df9c431041922c997c1148bedf591 PKG_DESCR:= a Point-to-Point Tunneling Protocol (PPTP) server PKG_SECTION:= ppp PKG_DEPENDS:= ppp kmod-crypto kmod-mppe kmod-ppp -PKG_URL:= http://www.poptop.org +PKG_URL:= http://www.poptop.org/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=poptop/} include ${TOPDIR}/mk/package.mk diff --git a/package/privoxy/Makefile b/package/privoxy/Makefile index bfc137378..ef55349b5 100644 --- a/package/privoxy/Makefile +++ b/package/privoxy/Makefile @@ -11,8 +11,8 @@ PKG_MD5SUM:= 6571dc9524e945e79c2af62fefe7b107 PKG_DESCR:= web proxy with advanced filtering capabilities PKG_SECTION:= proxy PKG_DEPENDS:= libpthread libpcre -PKG_BUILDDEP+= pcre -PKG_URL:= http://www.privoxy.org +PKG_BUILDDEP:= pcre +PKG_URL:= http://www.privoxy.org/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=ijbswa/} DISTFILES:= ${PKG_NAME}-${PKG_VERSION}-${PKG_VARIANT}-src.tar.gz diff --git a/package/procmail/Makefile b/package/procmail/Makefile index dfea50341..3bd2b7da3 100644 --- a/package/procmail/Makefile +++ b/package/procmail/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 1678ea99b973eb77eda4ecf6acae53f1 PKG_DESCR:= Mail processing tools PKG_SECTION:= mail -PKG_URL:= http://www.procmail.org +PKG_URL:= http://www.procmail.org/ PKG_SITES:= http://www.procmail.org/ include ${TOPDIR}/mk/package.mk diff --git a/package/procps/Makefile b/package/procps/Makefile index 3e4a90250..cba4846d2 100644 --- a/package/procps/Makefile +++ b/package/procps/Makefile @@ -10,8 +10,8 @@ PKG_MD5SUM:= f490bca772b16472962c7b9f23b1e97d PKG_DESCR:= The /proc file system utilities PKG_SECTION:= utils PKG_DEPENDS:= libncurses -PKG_BUILDDEP+= ncurses -PKG_URL:= http://procps.sourceforge.net +PKG_BUILDDEP:= ncurses +PKG_URL:= http://procps.sourceforge.net/ PKG_SITES:= http://procps.sourceforge.net/ include ${TOPDIR}/mk/package.mk diff --git a/package/proftpd/Makefile b/package/proftpd/Makefile index 6f446e646..6cfa849ac 100644 --- a/package/proftpd/Makefile +++ b/package/proftpd/Makefile @@ -9,9 +9,9 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 97ad29f31f4fe633a9f8d021bab2df20 PKG_DESCR:= A very configurable FTP server PKG_SECTION:= www -PKG_NOPARALLEL:= 1 PKG_URL:= http://www.proftpd.org/ PKG_SITES:= ftp://ftp.proftpd.org/distrib/source/ +PKG_NOPARALLEL:= 1 include $(TOPDIR)/mk/package.mk diff --git a/package/ptunnel/Makefile b/package/ptunnel/Makefile index 85f30e5f7..214be62ab 100644 --- a/package/ptunnel/Makefile +++ b/package/ptunnel/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= b45f73875f2af48f101816672f83a5fe PKG_DESCR:= Tunnel TCP connections over ICMP packets PKG_SECTION:= net/security PKG_DEPENDS:= libpcap libpthread -PKG_BUILDDEP+= libpcap +PKG_BUILDDEP:= libpcap PKG_URL:= http://www.cti.ecp.fr/~beauxir5/ptunnel/ PKG_SITES:= http://www.cti.ecp.fr/~beauxir5/ptunnel/ diff --git a/package/python/Makefile b/package/python/Makefile index 32f7de0e4..7f8ab7c4f 100644 --- a/package/python/Makefile +++ b/package/python/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= f1317dbb2398374d6691edd5bff1b91d PKG_DESCR:= Python scripting language PKG_SECTION:= lang -PKG_URL:= http://www.python.org +PKG_URL:= http://www.python.org/ PKG_SITES:= http://www.python.org/ftp/python/3.1.1/ PKG_HOST_DEPENDS:= !netbsd !openbsd !cygwin diff --git a/package/python2/Makefile b/package/python2/Makefile index 02e54ba93..459e37eb5 100644 --- a/package/python2/Makefile +++ b/package/python2/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 17dcac33e4f3adb69a57c2607b6de246 PKG_DESCR:= Python scripting language (Version 2) PKG_SECTION:= lang -PKG_URL:= http://www.python.org +PKG_URL:= http://www.python.org/ PKG_SITES:= http://www.python.org/ftp/python/${PKG_VERSION}/ PKG_HOST_DEPENDS:= !netbsd !openbsd !cygwin diff --git a/package/qingy/Makefile b/package/qingy/Makefile index f1016d8a8..ba6bd7a92 100644 --- a/package/qingy/Makefile +++ b/package/qingy/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 34f40172a71e9a6c2c77ddce11d2a63a PKG_DESCR:= a DirectFB getty replacement PKG_SECTION:= x11/apps PKG_DEPENDS:= directfb libxscrnsaver -PKG_BUILDDEP+= DirectFB libXScrnSaver +PKG_BUILDDEP:= DirectFB libXScrnSaver PKG_URL:= http://qingy.sourceforge.net/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=qingy/} diff --git a/package/quagga/Makefile b/package/quagga/Makefile index caad9ad89..119f3c636 100644 --- a/package/quagga/Makefile +++ b/package/quagga/Makefile @@ -9,31 +9,32 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 350fb150be526cdfc4d2b093cb4d69a7 PKG_DESCR:= A routing software package PKG_SECTION:= route -PKG_BUILDDEP+= readline ncurses -PKG_MULTI:= 1 +PKG_BUILDDEP:= readline ncurses PKG_URL:= http://www.quagga.net/ PKG_SITES:= http://www.quagga.net/download/ +PKG_MULTI:= 1 + +PKG_SUBPKGS:= QUAGGA QUAGGA_BGPD QUAGGA_OSPFD QUAGGA_OSPF6D +PKG_SUBPKGS+= QUAGGA_RIPNGD QUAGGA_RIPD QUAGGA_VTYSH +PKGSD_QUAGGA_BGPD:= BGP daemon +PKGSD_QUAGGA_OSPFD:= OSPF daemon +PKGSD_QUAGGA_OSPF6D:= OSPF IPv6 daemon +PKGSD_QUAGGA_RIPNGD:= RIPng daemon +PKGSD_QUAGGA_RIPD:= RIP daemon +PKGSD_QUAGGA_VTYSH:= vtysh utility PKG_FLAVOURS:= WITH_IPV6 PKGFD_WITH_IPV6:= enable IPv6 support -PKG_DESCR_1:= BGP daemon -PKG_DESCR_2:= OSPF daemon -PKG_DESCR_3:= OSPF IPv6 daemon -PKG_DESCR_4:= RIPng daemon -PKG_DESCR_5:= RIP daemon -PKG_DESCR_6:= vtysh utility - - include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,QUAGGA,quagga,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,QUAGGA_BGPD,quagga-bgpd,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_1},${PKG_SECTION})) -$(eval $(call PKG_template,QUAGGA_OSPFD,quagga-ospfd,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_2},${PKG_SECTION})) -$(eval $(call PKG_template,QUAGGA_OSPF6D,quagga-ospf6d,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_3},${PKG_SECTION})) -$(eval $(call PKG_template,QUAGGA_RIPNGD,quagga-ripngd,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_4},${PKG_SECTION})) -$(eval $(call PKG_template,QUAGGA_RIPD,quagga-ripd,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_5},${PKG_SECTION})) -$(eval $(call PKG_template,QUAGGA_VTYSH,quagga-vtysh,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_6},${PKG_SECTION})) +$(eval $(call PKG_template,QUAGGA_BGPD,quagga-bgpd,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_QUAGGA_BGPD},${PKG_SECTION})) +$(eval $(call PKG_template,QUAGGA_OSPFD,quagga-ospfd,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_QUAGGA_OSPFD},${PKG_SECTION})) +$(eval $(call PKG_template,QUAGGA_OSPF6D,quagga-ospf6d,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_QUAGGA_OSPF6D},${PKG_SECTION})) +$(eval $(call PKG_template,QUAGGA_RIPNGD,quagga-ripngd,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_QUAGGA_RIPNGD},${PKG_SECTION})) +$(eval $(call PKG_template,QUAGGA_RIPD,quagga-ripd,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_QUAGGA_RIPD},${PKG_SECTION})) +$(eval $(call PKG_template,QUAGGA_VTYSH,quagga-vtysh,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_QUAGGA_VTYSH},${PKG_SECTION})) CONFIGURE_ENV+= quagga_cv_ipforward_method="proc" CONFIGURE_ARGS+= --localstatedir=/var/run/quagga \ diff --git a/package/raddump/Makefile b/package/raddump/Makefile index 19819b202..c43d6ccaf 100755 --- a/package/raddump/Makefile +++ b/package/raddump/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= f8c29c67141ea78bb6ae8b97d5149480 PKG_DESCR:= interprets captured RADIUS packets PKG_SECTION:= ppp PKG_DEPENDS:= libpcap libopenssl -PKG_BUILDDEP+= openssl libpcap +PKG_BUILDDEP:= openssl libpcap PKG_URL:= http://sourceforge.net/projects/raddump PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=raddump/} diff --git a/package/radvd/Makefile b/package/radvd/Makefile index 3f52ff986..e4fbeee04 100644 --- a/package/radvd/Makefile +++ b/package/radvd/Makefile @@ -10,9 +10,8 @@ PKG_MD5SUM:= 78598b60ed9d64920739189c3dc0934d PKG_DESCR:= Routing Advertisement Daemon for IPv6 PKG_SECTION:= ipv6 PKG_DEPENDS:= kmod-ipv6 -PKG_URL:= http://www.litech.org/radvd -PKG_SITES:= http://v6web.litech.org/radvd/dist/ \ - http://download.sourcemage.org/mirror/ +PKG_URL:= http://www.litech.org/radvd/ +PKG_SITES:= http://v6web.litech.org/radvd/dist/ PKG_HOST_DEPENDS:= !freebsd diff --git a/package/randrproto/Makefile b/package/randrproto/Makefile index fd022fe54..72b576cf6 100644 --- a/package/randrproto/Makefile +++ b/package/randrproto/Makefile @@ -8,6 +8,7 @@ PKG_VERSION:= 1.3.1 PKG_RELEASE:= 1 PKG_MD5SUM:= 15266124b9e2dfcfb25ce6cba24cdd66 PKG_SITES:= ${MASTER_SITE_XORG} +PKG_SUBPKGS:= include $(TOPDIR)/mk/package.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/rarpd/Makefile b/package/rarpd/Makefile index 4dfd18dea..831bb5173 100644 --- a/package/rarpd/Makefile +++ b/package/rarpd/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 04e2ca849e758d0b88c8281775ec3b58 PKG_DESCR:= Reverse ARP Daemon PKG_SECTION:= net/misc PKG_DEPENDS:= libnet -PKG_BUILDDEP+= libnet +PKG_BUILDDEP:= libnet PKG_SITES:= ftp://ftp.dementia.org/pub/net-tools/ include ${TOPDIR}/mk/package.mk diff --git a/package/rdate/Makefile b/package/rdate/Makefile index 13bf70d98..0997d3db9 100644 --- a/package/rdate/Makefile +++ b/package/rdate/Makefile @@ -3,13 +3,13 @@ include ${TOPDIR}/rules.mk -PKG_NAME= rdate -PKG_VERSION= 20070817 -PKG_RELEASE= 2 -PKG_MD5SUM= 9a6489d7de4311678a3fab001bb503df +PKG_NAME:= rdate +PKG_VERSION:= 20070817 +PKG_RELEASE:= 2 +PKG_MD5SUM:= 9a6489d7de4311678a3fab001bb503df PKG_DESCR:= A small rdate and NTP client PKG_SECTION:= ntp -PKG_SITES= ${MASTER_SITE_MIRBSD:distfiles/=dist/mir/rdate/} +PKG_SITES:= ${MASTER_SITE_MIRBSD:distfiles/=dist/mir/rdate/} WRKDIST= ${WRKDIR}/${PKG_NAME} diff --git a/package/readline/Makefile b/package/readline/Makefile index 7895198a5..3126e9a33 100644 --- a/package/readline/Makefile +++ b/package/readline/Makefile @@ -10,9 +10,11 @@ PKG_MD5SUM:= fc2f7e714fe792db1ce6ddc4c9fb4ef3 PKG_DESCR:= Command line editing library PKG_SECTION:= libs PKG_DEPENDS:= libncurses -PKG_BUILDDEP+= ncurses +PKG_BUILDDEP:= ncurses PKG_SITES:= ${MASTER_SITE_GNU:=readline/} +PKG_SUBPKGS:= LIBREADLINE + include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBREADLINE,libreadline,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/reaim/Makefile b/package/reaim/Makefile index b06011ddd..2c33a918e 100644 --- a/package/reaim/Makefile +++ b/package/reaim/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 647d2ab72ec454f89294accfb3182c09 PKG_DESCR:= A transparent AIM / MSN proxy PKG_SECTION:= chat PKG_DEPENDS:= iptables -PKG_URL:= http://reaim.sourceforge.net +PKG_URL:= http://reaim.sourceforge.net/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=reaim/} include ${TOPDIR}/mk/package.mk diff --git a/package/renderproto/Makefile b/package/renderproto/Makefile index f2a7beae7..1a5d77ec4 100644 --- a/package/renderproto/Makefile +++ b/package/renderproto/Makefile @@ -8,6 +8,7 @@ PKG_VERSION:= 0.11 PKG_RELEASE:= 1 PKG_MD5SUM:= 57216f25b9a5edc561b83a7484cb17e8 PKG_SITES:= ${MASTER_SITE_XORG} +PKG_SUBPKGS:= include $(TOPDIR)/mk/package.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/resourceproto/Makefile b/package/resourceproto/Makefile index 770d1b203..01f66fead 100644 --- a/package/resourceproto/Makefile +++ b/package/resourceproto/Makefile @@ -8,6 +8,7 @@ PKG_VERSION:= 1.1.0 PKG_RELEASE:= 1 PKG_MD5SUM:= 587333b4995a3e11ebe4c8ba2742efaf PKG_SITES:= ${MASTER_SITE_XORG} +PKG_SUBPKGS:= include $(TOPDIR)/mk/package.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/rng-tools/Makefile b/package/rng-tools/Makefile index dc56c66f9..079a64f2e 100644 --- a/package/rng-tools/Makefile +++ b/package/rng-tools/Makefile @@ -12,7 +12,7 @@ PKG_SECTION:= crypto PKG_URL:= http://gkernel.sourceforge.net/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=gkernel/} -CFLINE_RNG_TOOLS:= depends on ADK_TARGET_LIB_GLIBC || ADK_TARGET_LIB_EGLIBC +PKG_CFLINE_RNG_TOOLS:= depends on ADK_TARGET_LIB_GLIBC || ADK_TARGET_LIB_EGLIBC include $(TOPDIR)/mk/package.mk diff --git a/package/rp-pppoe/Makefile b/package/rp-pppoe/Makefile index 29b480f29..403564bb7 100644 --- a/package/rp-pppoe/Makefile +++ b/package/rp-pppoe/Makefile @@ -10,9 +10,11 @@ PKG_MD5SUM:= d58a13cc4185bca6121a606ff456dec0 PKG_DESCR:= PPPoE (PPP over Ethernet) tools PKG_SECTION:= ppp PKG_DEPENDS:= ppp -PKG_URL:= http://www.roaringpenguin.com +PKG_URL:= http://www.roaringpenguin.com/ PKG_SITES:= http://www.roaringpenguin.com/files/download/ +PKG_SUBPKGS:= PPPOE_CLIENT PPPOE_RELAY PPPOE_SERVER PPPOE_SNIFF + WRKSRC= ${WRKDIST}/src include ${TOPDIR}/mk/package.mk diff --git a/package/rpcbind/Makefile b/package/rpcbind/Makefile index a25bb0281..535c1b6c1 100644 --- a/package/rpcbind/Makefile +++ b/package/rpcbind/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 1a77ddb1aaea8099ab19c351eeb26316 PKG_DESCR:= converts RPC program numbers into universal addresses PKG_SECTION:= net/misc PKG_DEPENDS:= libtirpc -PKG_BUILDDEP+= libtirpc +PKG_BUILDDEP:= libtirpc PKG_URL:= http://sourceforge.net/projects/rpcbind/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=rpcbind/} diff --git a/package/rpm/Makefile b/package/rpm/Makefile index 88a0954a1..ef8256231 100644 --- a/package/rpm/Makefile +++ b/package/rpm/Makefile @@ -9,14 +9,14 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 224715646325df4cd3904e3ac9e16186 PKG_DESCR:= Package Manager PKG_SECTION:= base -PKG_BUILDDEP+= nss libdb -PKG_URL:= http://www.rpm.org +PKG_BUILDDEP:= nss libdb +PKG_URL:= http://www.rpm.org/ PKG_SITES:= http://rpm.org/releases/rpm-4.7.x/ -DISTFILES:= ${PKG_NAME}-$(PKG_VERSION).tar.bz2 - -PKG_TARGET_DEPENDS:= !foxboard PKG_HOST_DEPENDS:= !cygwin +PKG_TARGET_DEPENDS:= !foxboard + +DISTFILES:= ${PKG_NAME}-$(PKG_VERSION).tar.bz2 include $(TOPDIR)/mk/package.mk diff --git a/package/rrdcollect/Makefile b/package/rrdcollect/Makefile index 8a73aa105..1a025f37e 100644 --- a/package/rrdcollect/Makefile +++ b/package/rrdcollect/Makefile @@ -10,9 +10,11 @@ PKG_MD5SUM:= 5e4305c612bc3cccbaf802c275c81a11 PKG_DESCR:= Round-Robin Database (RRD) collecting daemon PKG_SECTION:= admin PKG_DEPENDS:= librrd -PKG_BUILDDEP+= rrdtool +PKG_BUILDDEP:= rrdtool PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=rrdcollect/} +PKG_SUBPKGS:= RRDCOLLECT RRDCOLLECT_EXAMPLE + ifneq (${ADK_PACKAGE_LIBRRD},) RRDTOOL_LIBS:=-lart_lgpl_2 -lfreetype -lpng endif diff --git a/package/rrdtool/Makefile b/package/rrdtool/Makefile index 36d642daf..e3549d5e0 100644 --- a/package/rrdtool/Makefile +++ b/package/rrdtool/Makefile @@ -10,10 +10,11 @@ PKG_MD5SUM:= 19b24f7184a8dbf7b48c1bbb565ad9fb PKG_DESCR:= Round Robin Database (RRD) management library and tools PKG_SECTION:= libs PKG_DEPENDS:= libart libfreetype libpng zlib -PKG_BUILDDEP+= libxml2 cgilib freetype libart libpng +PKG_BUILDDEP:= libxml2 cgilib freetype libart libpng PKG_URL:= http://oss.oetiker.ch/ PKG_SITES:= http://oss.oetiker.ch/rrdtool/pub/ +PKG_SUBPKGS:= LIBRRD RRDCGI RRDTOOL PKG_SECTION_RRDCGI:= misc PKG_SECTION_RRDTOOL:= misc diff --git a/package/rrs/Makefile b/package/rrs/Makefile index cd5144daf..ba32293f0 100644 --- a/package/rrs/Makefile +++ b/package/rrs/Makefile @@ -9,68 +9,29 @@ PKG_RELEASE:= 2 PKG_MD5SUM:= b400d03c0e39e3e78a7327ba78f789f0 PKG_DESCR:= A reverse (connecting) remote shell, with SSL support. PKG_SECTION:= net/misc -PKG_CXX:= RRS -PKG_BUILDDEP+= zlib -ifneq ($(ADK_PACKAGE_RRS),) -PKG_BUILDDEP+= openssl -endif -PKG_URL:= http://www.cycom.se/dl/rrs +PKG_DEPENDS:= zlib libopenssl +PKG_BUILDDEP:= zlib openssl +PKG_URL:= http://www.cycom.se/dl/rrs/ PKG_SITES:= http://www.cycom.se/uploads/36/19/ - -PKG_DEPENDS:= libopenssl zlib -PKG_DEPENDS_NOSSL:= zlib - -ifeq ($(ADK_COMPILE_RRS_WITH_UCLIBCXX),y) -PKG_DEPENDS_NOSSL+= uclibc++ -else -PKG_DEPENDS_NOSSL+= libstdcxx -endif +PKG_CXX:= RRS include ${TOPDIR}/mk/package.mk -$(eval $(call PKG_template,RRS,rrs,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,RRS_NOSSL,rrs-nossl,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_NOSSL},${PKG_DESCR},${PKG_SECTION})) +$(eval $(call PKG_template,RRS,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) CONFIG_STYLE:= manual -BUILD_STYLE:= manual +BUILD_STYLE:= manual INSTALL_STYLE:= manual -ifeq ($(ADK_COMPILE_RRS_WITH_UCLIBCXX),y) -PKG_FLAGS=-fno-builtin -fno-rtti -nostdinc++ -fPIC -PKG_LDFLAGS=-nodefaultlibs -luClibc++ -lc -lm -else -PKG_FLAGS=-fPIC -PKG_LDFLAGS=-shared -endif - do-build: -ifneq (${ADK_PACKAGE_RRS},) ${MAKE} -C ${WRKBUILD} \ CC="${TARGET_CC}" \ CFLAGS="${TARGET_CFLAGS} -I${STAGING_DIR}/usr/include ${PKG_FLAGS}" \ LDFLAGS="-L${STAGING_DIR}/usr/lib -L${STAGING_DIR}/lib ${PKG_LDFLAGS} -lutil -lssl -lcrypto -lz" \ generic - { cd ${WRKBUILD}; mv rrs rrs-ssl; } - -${MAKE} -C ${WRKBUILD} \ - clean -endif -ifneq (${ADK_PACKAGE_RRS_NOSSL},) - ${MAKE} -C ${WRKBUILD} \ - CC="${TARGET_CC}" \ - CFLAGS="${TARGET_CFLAGS} -I${STAGING_DIR}/usr/include ${PKG_FLAGS}" \ - LDFLAGSNOSSL="-L${STAGING_DIR}/usr/lib -L${STAGING_DIR}/lib ${PKG_LDFLAGS} -lutil" \ - generic-nossl - { cd ${WRKBUILD}; mv rrs rrs-nossl; } -endif do-install: -ifneq (${ADK_PACKAGE_RRS},) ${INSTALL_DIR} ${IDIR_RRS}/usr/bin - ${INSTALL_BIN} ${WRKBUILD}/rrs-ssl ${IDIR_RRS}/usr/bin/rrs -endif -ifneq (${ADK_PACKAGE_RRS_NOSSL},) - ${INSTALL_DIR} ${IDIR_RRS_NOSSL}/usr/bin - ${INSTALL_BIN} ${WRKBUILD}/rrs-nossl ${IDIR_RRS_NOSSL}/usr/bin/rrs -endif + ${INSTALL_BIN} ${WRKBUILD}/rrs ${IDIR_RRS}/usr/bin/ include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/rsync/Makefile b/package/rsync/Makefile index b0ce107d9..f41b4382c 100644 --- a/package/rsync/Makefile +++ b/package/rsync/Makefile @@ -10,8 +10,8 @@ PKG_MD5SUM:= b53525900817cf1ba7ad3a516ab5bfe9 PKG_DESCR:= utility that provides fast incremental file transfer PKG_SECTION:= net/misc PKG_DEPENDS:= libpopt -PKG_BUILDDEP+= popt -PKG_URL:= http://rsync.samba.org +PKG_BUILDDEP:= popt +PKG_URL:= http://rsync.samba.org/ PKG_SITES:= http://rsync.samba.org/ftp/rsync/ include ${TOPDIR}/mk/package.mk diff --git a/package/rtorrent/Makefile b/package/rtorrent/Makefile index 85f828290..303c6037c 100644 --- a/package/rtorrent/Makefile +++ b/package/rtorrent/Makefile @@ -10,8 +10,8 @@ PKG_MD5SUM:= e701095e1824b7e512a17000f4c0a783 PKG_DESCR:= console torrent application PKG_SECTION:= p2p PKG_DEPENDS:= libncurses libtorrent libcurl -PKG_BUILDDEP+= ncurses libtorrent curl -PKG_URL:= http://libtorrent.rakshasa.no +PKG_BUILDDEP:= ncurses libtorrent curl +PKG_URL:= http://libtorrent.rakshasa.no/ PKG_SITES:= http://libtorrent.rakshasa.no/downloads/ include ${TOPDIR}/mk/package.mk diff --git a/package/ruby/Makefile b/package/ruby/Makefile index d82665427..dc6ec4ed0 100644 --- a/package/ruby/Makefile +++ b/package/ruby/Makefile @@ -9,9 +9,10 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 0f6d7630f26042e00bc59875755cf879 PKG_DESCR:= interpreter for the ruby language PKG_SECTION:= lang -PKG_NOPARALLEL:= 1 -PKG_URL:= http://www.ruby-lang.org +PKG_URL:= http://www.ruby-lang.org/ PKG_SITES:= ftp://ftp.ruby-lang.org/pub/ruby/ +PKG_NOPARALLEL:= 1 + PKG_HOST_DEPENDS:= !freebsd !cygwin DISTFILES:= ${PKG_NAME}-${PKG_VERSION}-p429.tar.gz diff --git a/package/rxvt-unicode/Makefile b/package/rxvt-unicode/Makefile index b56e219e6..0d504387d 100644 --- a/package/rxvt-unicode/Makefile +++ b/package/rxvt-unicode/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 49bb52c99e002bf85eb41d8385d903b5 PKG_DESCR:= x-term with unicode support PKG_SECTION:= x11/apps PKG_DEPENDS:= libx11 fontconfig libxft libxml2 -PKG_BUILDDEP+= libX11 fontconfig libXft libxml2 +PKG_BUILDDEP:= libX11 fontconfig libXft libxml2 PKG_URL:= http://software.schmorp.de/pkg/rxvt-unicode.html PKG_SITES:= http://dist.schmorp.de/rxvt-unicode/ diff --git a/package/samba/Makefile b/package/samba/Makefile index f3addd17f..67f9924eb 100644 --- a/package/samba/Makefile +++ b/package/samba/Makefile @@ -9,9 +9,11 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 7c8d2a34b649380d5df838c3e030dbec PKG_DESCR:= NetBIOS/SMB file and print server PKG_SECTION:= net/fs -PKG_URL:= http://www.samba.org +PKG_URL:= http://www.samba.org/ PKG_SITES:= http://samba.org/samba/ftp/stable/ +PKG_SUBPKGS:= SAMBA SAMBA_CLIENT SAMBA_PASSWD + WRKSRC= ${WRKDIST}/source3 include ${TOPDIR}/mk/package.mk diff --git a/package/sane-backends/Makefile b/package/sane-backends/Makefile index 218a097c7..2f1a5bacf 100644 --- a/package/sane-backends/Makefile +++ b/package/sane-backends/Makefile @@ -10,13 +10,27 @@ PKG_MD5SUM:= a0cfdfdebca2feb4f2ba5d3418b15a42 PKG_DESCR:= Scanner access now easy PKG_SECTION:= misc PKG_DEPENDS:= libpthread -PKG_BUILDDEP+= libpthread libusb +PKG_BUILDDEP:= libpthread libusb +PKG_URL:= http://www.sane-project.org/ +PKG_SITES:= ftp://ftp2.sane-project.org/pub/sane/${PKG_NAME}-${PKG_VERSION}/ PKG_MULTI:= 1 -PKG_URL:= http://www.sane-project.org -PKG_SITES:= ftp://ftp2.sane-project.org/pub/sane/${PKG_NAME}-${PKG_VERSION}/ \ - ftp://ftp3.sane-project.org/pub/sane/${PKG_NAME}-${PKG_VERSION}/ \ - ftp://ftp4.sane-project.org/pub/sane/${PKG_NAME}-${PKG_VERSION}/ \ - ftp://ftp5.sane-project.org/pub/sane/${PKG_NAME}-${PKG_VERSION}/ + +PKG_SUBPKGS:= SANE_BACKENDS SANE_BACKEND_NET SANE_BACKEND_ABATON SANE_BACKEND_AGFAFOCUS +PKG_SUBPKGS+= SANE_BACKEND_APPLE SANE_BACKEND_ARTEC_EPLUS48U SANE_BACKEND_ARTEC SANE_BACKEND_AS6E +PKG_SUBPKGS+= SANE_BACKEND_AVISION SANE_BACKEND_BH SANE_BACKEND_CANON630U SANE_BACKEND_CANON +PKG_SUBPKGS+= SANE_BACKEND_COOLSCAN2 SANE_BACKEND_COOLSCAN SANE_BACKEND_DC25 SANE_BACKEND_DMC +PKG_SUBPKGS+= SANE_BACKEND_EPSON SANE_BACKEND_FUJITSU SANE_BACKEND_GENESYS SANE_BACKEND_GT68XX +PKG_SUBPKGS+= SANE_BACKEND_HP3500 SANE_BACKEND_HP4200 SANE_BACKEND_HP5400 SANE_BACKEND_HP +PKG_SUBPKGS+= SANE_BACKEND_IBM SANE_BACKEND_LEO SANE_BACKEND_LEXMARK SANE_BACKEND_MA1509 +PKG_SUBPKGS+= SANE_BACKEND_MATSUSHITA SANE_BACKEND_MICROTEK2 SANE_BACKEND_MICROTEK +PKG_SUBPKGS+= SANE_BACKEND_MUSTEK SANE_BACKEND_MUSTEK_USB SANE_BACKEND_MUSTEK_USB2 +PKG_SUBPKGS+= SANE_BACKEND_NEC SANE_BACKEND_NIASH SANE_BACKEND_PIE SANE_BACKEND_PIXMA +PKG_SUBPKGS+= SANE_BACKEND_PLUSTEK_PP SANE_BACKEND_PLUSTEK SANE_BACKEND_RICOH +PKG_SUBPKGS+= SANE_BACKEND_S9036 SANE_BACKEND_SCEPTRE SANE_BACKEND_SHARP SANE_BACKEND_SM3600 +PKG_SUBPKGS+= SANE_BACKEND_SM3840 SANE_BACKEND_SNAPSCAN SANE_BACKEND_SP15C SANE_BACKEND_ST400 +PKG_SUBPKGS+= SANE_BACKEND_STV680 SANE_BACKEND_TAMARACK SANE_BACKEND_TECO1 SANE_BACKEND_TECO2 +PKG_SUBPKGS+= SANE_BACKEND_TECO3 SANE_BACKEND_TEST SANE_BACKEND_U12 SANE_BACKEND_UMAX1220U +PKG_SUBPKGS+= SANE_BACKEND_UMAX_PP SANE_BACKEND_UMAX include ${TOPDIR}/mk/package.mk diff --git a/package/sangam-atm/Makefile b/package/sangam-atm/Makefile index 4277fb7c7..207ef5299 100644 --- a/package/sangam-atm/Makefile +++ b/package/sangam-atm/Makefile @@ -7,7 +7,7 @@ PKG_NAME:= sangam-atm PKG_VERSION:= 1.0 PKG_RELEASE:= 1 PKG_MD5SUM:= 3843f3e670967fe81561770ac960c1cd -PKG_DESCR:= sangam-atm DSL modem driver for TI AR7 boards +PKG_DESCR:= DSL modem driver for TI AR7 boards PKG_SECTION:= kernel PKG_DEPENDS:= kmod-fw-loader kmod-atm PKG_SITES:= http://openadk.org/distfiles/ diff --git a/package/scanlogd/Makefile b/package/scanlogd/Makefile index 29bfad43b..4ae1dcadf 100644 --- a/package/scanlogd/Makefile +++ b/package/scanlogd/Makefile @@ -10,11 +10,9 @@ PKG_MD5SUM:= 7b8187ea718ebe47f22805b921b909ab PKG_DESCR:= Portscan logger PKG_SECTION:= net/security PKG_DEPENDS:= libpcap libnet libnids -PKG_BUILDDEP+= libpcap libnids libnet -PKG_URL:= http://www.openwall.com/scanlogd -PKG_SITES:= http://www.openwall.com/scanlogd/ \ - ftp://ftp.wiretapped.net/pub/openwall/ \ - http://distro.ibiblio.org/pub/linux/distributions/openwall/ +PKG_BUILDDEP:= libpcap libnids libnet +PKG_URL:= http://www.openwall.com/scanlogd/ +PKG_SITES:= http://www.openwall.com/scanlogd/ include ${TOPDIR}/mk/package.mk diff --git a/package/screen/Makefile b/package/screen/Makefile index 1f7b023f2..2214c37b8 100644 --- a/package/screen/Makefile +++ b/package/screen/Makefile @@ -10,8 +10,8 @@ PKG_MD5SUM:= 8506fd205028a96c741e4037de6e3c42 PKG_DESCR:= A window manager for the terminal session PKG_SECTION:= misc PKG_DEPENDS:= libncurses -PKG_BUILDDEP+= ncurses -PKG_URL:= http://www.gnu.org/software/screen +PKG_BUILDDEP:= ncurses +PKG_URL:= http://www.gnu.org/software/screen/ PKG_SITES:= ${MASTER_SITE_GNU:=screen/} include ${TOPDIR}/mk/package.mk diff --git a/package/scrnsaverproto/Makefile b/package/scrnsaverproto/Makefile index 19496f2c5..4549d2f67 100644 --- a/package/scrnsaverproto/Makefile +++ b/package/scrnsaverproto/Makefile @@ -8,6 +8,7 @@ PKG_VERSION:= 1.2.0 PKG_RELEASE:= 1 PKG_MD5SUM:= 0ed88bdd6945ba207c4f734af48e7e25 PKG_SITES:= ${MASTER_SITE_XORG} +PKG_SUBPKGS:= include $(TOPDIR)/mk/package.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/sdl-image/Makefile b/package/sdl-image/Makefile index f3980c7f3..37c0b9a98 100644 --- a/package/sdl-image/Makefile +++ b/package/sdl-image/Makefile @@ -11,10 +11,12 @@ PKG_DESCR:= Simple DirectMedia Layer PKG_SECTION:= libs PKG_DEPENDS:= libpng libtiff libjpeg libsdl PKG_BUILDDEP:= libpng libtiff jpeg sdl -PKG_URL:= http://www.libsdl.org +PKG_URL:= http://www.libsdl.org/ PKG_SITES:= http://www.libsdl.org/projects/SDL_image/release/ -PKG_DESCR_LIB_DEV:= development files for sdlimage -PKG_SECTION_LIB_DEV:= devel + +PKG_SUBPKGS:= LIBSDL_IMAGE LIBSDL_IMAGE_DEV +PKGSD_LIBSDL_IMAGE_DEV:=development files for sdlimage +PKGSC_LIBSDL_IMAGE_DEV:=devel DISTFILES:= SDL_image-${PKG_VERSION}.tar.gz WRKDIST= ${WRKDIR}/SDL_image-${PKG_VERSION} @@ -22,7 +24,7 @@ WRKDIST= ${WRKDIR}/SDL_image-${PKG_VERSION} include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,LIBSDL_IMAGE,libsdl-image,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,LIBSDL_IMAGE_DEV,libsdl-image-dev,$(PKG_VERSION)-${PKG_RELEASE},libsdl-image,${PKG_DESCR_LIB_DEV},${PKG_SECTION_LIB_DEV})) +$(eval $(call PKG_template,LIBSDL_IMAGE_DEV,libsdl-image-dev,$(PKG_VERSION)-${PKG_RELEASE},libsdl-image,${PKGSD_LIBSDL_IMAGE_DEV},${PKGSC_LIBSDL_IMAGE_DEV})) SUB_INSTALLS-y:= SUB_INSTALLS-m:= diff --git a/package/sdl/Makefile b/package/sdl/Makefile index 483022ec7..9fb10463a 100644 --- a/package/sdl/Makefile +++ b/package/sdl/Makefile @@ -10,11 +10,13 @@ PKG_MD5SUM:= e52086d1b508fa0b76c52ee30b55bec4 PKG_DESCR:= Simple DirectMedia Layer PKG_SECTION:= libs PKG_DEPENDS:= libusb alsa-lib libpthread tslib -PKG_BUILDDEP+= libusb alsa-lib tslib -PKG_URL:= http://www.libsdl.org +PKG_BUILDDEP:= libusb alsa-lib tslib +PKG_URL:= http://www.libsdl.org/ PKG_SITES:= http://www.libsdl.org/release/ -PKG_DESCR_LIB_DEV:= development files for libsdl -PKG_SECTION_LIB_DEV:= devel + +PKG_SUBPKGS:= LIBSDL LIBSDL_DEV +PKGSD_LIBSDL_DEV:= development files for libsdl +PKGSC_LIBSDL_DEV:= devel DISTFILES:= SDL-${PKG_VERSION}.tar.gz WRKDIST= ${WRKDIR}/SDL-${PKG_VERSION} @@ -22,7 +24,7 @@ WRKDIST= ${WRKDIR}/SDL-${PKG_VERSION} include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,LIBSDL,libsdl,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -$(eval $(call PKG_template,LIBSDL_DEV,libsdl-dev,$(PKG_VERSION)-${PKG_RELEASE},libsdl,${PKG_DESCR_LIB_DEV},${PKG_SECTION_LIB_DEV})) +$(eval $(call PKG_template,LIBSDL_DEV,libsdl-dev,$(PKG_VERSION)-${PKG_RELEASE},libsdl,${PKGSD_LIBSDL_DEV},${PKGSC_LIBSDL_DEV})) SUB_INSTALLS-y:= SUB_INSTALLS-m:= diff --git a/package/section.lst b/package/section.lst new file mode 100644 index 000000000..55340301f --- /dev/null +++ b/package/section.lst @@ -0,0 +1,46 @@ +base Base System +bluetooth Bluetooth +browser Browser / Editor / Pager +editor Browser / Editor / Pager +pager Browser / Editor / Pager +chat IRC / ICQ / JABBER +comp Computing +archive Compression and Archivers +crypto Cryptography +db Databases +debug Debugging / Analyzing +devel Development / Headers +dns DNS / DHCP +dhcp DNS / DHCP +firewall Firewall / Routing / Bridging +kernel External Kernel Modules +route Firewall / Routing / Bridging +bridge Firewall / Routing / Bridging +fs Filesystem / Blockdevice utilities +ipv6 IPv6 +lang Programming / Languages +libs Libraries +mail Mail +misc Misc +multimedia Multimedia +net Networking +net/fs Network Filesystems +net/misc Networking Misc +net/security Network Security +ntp NTP +p2p P2P +phone Telephony +ppp PPP / PPTP / RADIUS +proxy Proxy +scm SCM +serial Serial communications & terminal emulation +shells Shells +admin System Administration +utils Utilities +www HTTP / FTP +wifi Wireless +x11/apps X applications +x11/drivers X server and drivers +x11/server X server and drivers +x11/libs X libraries +x11/fonts X fonts diff --git a/package/sections.lst b/package/sections.lst deleted file mode 100644 index 05fe0cb58..000000000 --- a/package/sections.lst +++ /dev/null @@ -1,53 +0,0 @@ -admin System Administration -archive Compression and Archivers -base Base System -bluetooth Bluetooth -browser Browser / Editor / Pager -editor Browser / Editor / Pager -pager Browser / Editor / Pager -chat IRC / ICQ / JABBER -comp Computing -console Console Utilities -crypto Cryptography -db Databases -debug Debugging / Analyzing -devel Development / Headers -dns DNS / DHCP -dhcp DNS / DHCP -firewall Firewall / Routing / Bridging -kernel External Kernel Modules -route Firewall / Routing / Bridging -bridge Firewall / Routing / Bridging -fs Filesystem / Blockdevice utilities -ipv6 IPv6 -lang Programming / Languages -libs Libraries -mail Mail -misc Misc -multimedia Multimedia -net Networking -net/fs Network Filesystems -net/misc Networking Misc -net/security Network Security -none Unclassified -ntp NTP -p2p P2P -phone Telephony -ppp PPP / PPTP / RADIUS -proxy Proxy -scm SCM -serial Serial communications & terminal emulation -shells Shells -sound Sound -sys System -text Text -utils Utilities -video Video -web World Wide Web -www HTTP / FTP -wifi Wireless -x11/apps X applications -x11/drivers X server and drivers -x11/server X server and drivers -x11/libs X libraries -x11/fonts X fonts diff --git a/package/serdisplib/Makefile b/package/serdisplib/Makefile index 3107667f4..f13830610 100644 --- a/package/serdisplib/Makefile +++ b/package/serdisplib/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 2aa91c43d01d2dfc9fbc1116e3063ae1 PKG_DESCR:= display drivers (serial, parallel, USB) PKG_SECTION:= serial -PKG_BUILDDEP+= libgd libusb +PKG_BUILDDEP:= libgd libusb PKG_URL:= http://serdisplib.sourceforge.net PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=serdisplib/} diff --git a/package/siproxd/Makefile b/package/siproxd/Makefile index a5c56b84b..40eb3e5a5 100644 --- a/package/siproxd/Makefile +++ b/package/siproxd/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 45e5a44803181e2bf3361d562060c904 PKG_DESCR:= a SIP (Session Initiation Protocol) proxy PKG_SECTION:= proxy PKG_DEPENDS:= libosip2 libpthread -PKG_BUILDDEP+= libosip2 +PKG_BUILDDEP:= libosip2 PKG_URL:= http://siproxd.sourceforge.net PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=siproxd/} diff --git a/package/sipsak/Makefile b/package/sipsak/Makefile index 0e6b9d292..ac11b5520 100644 --- a/package/sipsak/Makefile +++ b/package/sipsak/Makefile @@ -10,10 +10,9 @@ PKG_MD5SUM:= c4eb8e282902e75f4f040f09ea9d99d5 PKG_DESCR:= a SIP stress and diagnostics utility PKG_SECTION:= net PKG_DEPENDS:= libopenssl -PKG_BUILDDEP+= openssl -PKG_URL:= http://sipsak.org -PKG_SITES:= http://download.berlios.de/sipsak/ \ - http://ftp.iptel.org/pub/sipsak/ +PKG_BUILDDEP:= openssl +PKG_URL:= http://sipsak.org/ +PKG_SITES:= http://download.berlios.de/sipsak/ include ${TOPDIR}/mk/package.mk diff --git a/package/sispmctl/Makefile b/package/sispmctl/Makefile index fc2d67823..13bac7bc4 100644 --- a/package/sispmctl/Makefile +++ b/package/sispmctl/Makefile @@ -10,8 +10,8 @@ PKG_MD5SUM:= 2457f76cd129f880634f3381be0aeb76 PKG_DESCR:= control application for power sockets PKG_SECTION:= utils PKG_DEPENDS:= libusb libusb-compat -PKG_BUILDDEP+= libusb libusb-compat -PKG_URL:= http://sispmctl.sourceforge.net +PKG_BUILDDEP:= libusb libusb-compat +PKG_URL:= http://sispmctl.sourceforge.net/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=sispmctl/} include ${TOPDIR}/mk/package.mk diff --git a/package/snort/Makefile b/package/snort/Makefile index aa14d88c2..e14ce7d7a 100644 --- a/package/snort/Makefile +++ b/package/snort/Makefile @@ -9,11 +9,11 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= e6a8bc5aa1ebe4d2100533d7709c4a9e PKG_DESCR:= a flexible Network Intrusion Detection System (NIDS) PKG_SECTION:= net/security -PKG_NOPARALLEL:= 1 PKG_DEPENDS:= libnet libpcap libpcre -PKG_BUILDDEP+= libnet libpcap pcre +PKG_BUILDDEP:= libnet libpcap pcre PKG_URL:= http://www.snort.org/ PKG_SITES:= http://dl.snort.org/snort-current/ +PKG_NOPARALLEL:= 1 include ${TOPDIR}/mk/package.mk diff --git a/package/socat/Makefile b/package/socat/Makefile index 93dda9a99..0e5750123 100644 --- a/package/socat/Makefile +++ b/package/socat/Makefile @@ -10,8 +10,8 @@ PKG_MD5SUM:= 82967132b5a8ca4d07e54370fdcb2662 PKG_DESCR:= A multipurpose relay (SOcket CAT) PKG_SECTION:= net/misc PKG_DEPENDS:= libpthread libopenssl -PKG_BUILDDEP+= openssl -PKG_URL:= http://www.dest-unreach.org/socat +PKG_BUILDDEP:= openssl +PKG_URL:= http://www.dest-unreach.org/socat/ PKG_SITES:= http://www.dest-unreach.org/socat/download/ include ${TOPDIR}/mk/package.mk diff --git a/package/speex/Makefile b/package/speex/Makefile index a345b1a97..873ad347a 100644 --- a/package/speex/Makefile +++ b/package/speex/Makefile @@ -9,9 +9,11 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= c4438b22c08e5811ff10e2b06ee9b9ae PKG_DESCR:= an open source patent-free speech compression codec PKG_SECTION:= libs -PKG_URL:= http://speex.org +PKG_URL:= http://speex.org/ PKG_SITES:= http://downloads.us.xiph.org/releases/speex/ +PKG_SUBPKGS:= LIBSPEEX + include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBSPEEX,libspeex,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/sqlite/Makefile b/package/sqlite/Makefile index 9fa748083..45c2bf6f5 100644 --- a/package/sqlite/Makefile +++ b/package/sqlite/Makefile @@ -9,10 +9,12 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 0faf8fc8ccff5297513c6532b2b4ce23 PKG_DESCR:= embeddable SQL database PKG_SECTION:= db -PKG_BUILDDEP+= ncurses readline +PKG_BUILDDEP:= ncurses readline PKG_URL:= http://www.sqlite.org/ PKG_SITES:= http://www.sqlite.org/ +PKG_SUBPKGS:= LIBSQLITE SQLITE_CLI + include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LIBSQLITE,libsqlite,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/squid/Makefile b/package/squid/Makefile index 109e2ce95..29b038734 100644 --- a/package/squid/Makefile +++ b/package/squid/Makefile @@ -10,12 +10,15 @@ PKG_MD5SUM:= c70ef1198e6a6c1ae80bc57cd3592e36 PKG_DESCR:= squid web and cache proxy PKG_SECTION:= proxy PKG_DEPENDS:= libopenssl libpthread -PKG_BUILDDEP+= openssl -PKG_URL:= http://www.squid-cache.org +PKG_BUILDDEP:= openssl +PKG_URL:= http://www.squid-cache.org/ PKG_SITES:= http://www.squid-cache.org/Versions/v3/3.1/ PKG_MULTI:= 1 -#PKG_CXX:= SQUID +PKG_SUBPKGS:= SQUID SQUID_MOD_BASIC_AUTH_GETPWNAM SQUID_MOD_BASIC_AUTH_NCSA +PKG_SUBPKGS+= SQUID_MOD_BASIC_AUTH_SMB SQUID_MOD_DIGEST_AUTH_PASSWORD +PKG_SUBPKGS+= SQUID_MOD_EXTERNAL_ACL_IP_USER SQUID_MOD_EXTERNAL_ACL_UNIX_GROUP +PKG_SUBPKGS+= SQUID_MOD_NTLM_AUTH_FAKEAUTH PKG_HOST_DEPENDS:= !netbsd !cygwin AUTH_MODULES:= basic digest ntlm @@ -72,12 +75,6 @@ $(eval $(call PKG_mod_template,SQUID_MOD_EXTERNAL_ACL_LDAP_GROUP,ldap_auth)) $(eval $(call PKG_mod_template,SQUID_MOD_EXTERNAL_ACL_UNIX_GROUP,squid_unix_group)) $(eval $(call PKG_mod_template,SQUID_MOD_NTLM_AUTH_FAKEAUTH,fakeauth_auth)) -#ifeq ($(ADK_COMPILE_SQUID_WITH_UCLIBCXX),y) -#CONFIGURE_ENV+= CXXFLAGS="-fno-threadsafe-statics -fno-builtin -nostdinc++ \ -# -I${STAGING_DIR}/usr/include/uClibc++" \ -# LIBS="-nodefaultlibs -luClibc++ -ldl -lm" -#endif - CONFIGURE_ENV+= ac_cv_sizeof_void_p=4 \ ac_cv_sizeof_short=2 \ ac_cv_sizeof_int=4 \ @@ -135,13 +132,6 @@ CONFIGURE_ARGS+= --datadir=/usr/share/squid \ --enable-digest-auth-helpers="${DIGEST_AUTH_HELPERS}" \ --enable-external-acl-helpers="${EXTERNAL_ACL_HELPERS}" -#ifeq (${ADK_COMPILE_SQUID_WITH_UCLIBCXX},y) -# add workaround because libtool tries to link libstdc++ -#post-configure: -# ${SED} 's#postdeps="-lstdc.*#postdeps="-lm"#' \ -# ${WRKBUILD}/libtool -#endif - post-install: ${INSTALL_MODS_y} ${INSTALL_MODS_m} ${INSTALL_DIR} ${IDIR_SQUID}/etc/squid ${INSTALL_DATA} ${WRKINST}/etc/squid/mime.conf \ diff --git a/package/ssltunnel/Makefile b/package/ssltunnel/Makefile index 7f497bc26..be5ab32f6 100644 --- a/package/ssltunnel/Makefile +++ b/package/ssltunnel/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 4039b50566a33a4077883ea974e476d5 PKG_DESCR:= A PPP over SSL vpn tool PKG_SECTION:= net/security PKG_DEPENDS:= libopenssl ppp -PKG_BUILDDEP+= openssl ppp +PKG_BUILDDEP:= openssl ppp PKG_SITES:= http://www.hsc.fr/ressources/outils/ssltunnel/download/ include ${TOPDIR}/mk/package.mk diff --git a/package/strace/Makefile b/package/strace/Makefile index 0e5e5a625..92addc429 100644 --- a/package/strace/Makefile +++ b/package/strace/Makefile @@ -11,10 +11,10 @@ PKG_DESCR:= System call trace program PKG_SECTION:= debug PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=strace/} -DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 - PKG_TARGET_DEPENDS:= !foxboard +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 + include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,STRACE,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/strongswan/Makefile b/package/strongswan/Makefile index 79f4afc5b..fc9444cfe 100644 --- a/package/strongswan/Makefile +++ b/package/strongswan/Makefile @@ -15,28 +15,22 @@ PKG_DEPENDS+= kmod-inet-xfrm-mode-tunnel kmod-inet-xfrm-mode-transport PKG_DEPENDS+= kmod-crypto-sha1 kmod-crypto-md5 PKG_DEPENDS+= kmod-crypto-null kmod-crypto-des kmod-crypto-aes PKG_DEPENDS+= kmod-crypto-hmac kmod-crypto-cbc kmod-crypto-authenc -ifeq (${ADK_PACKAGE_STRONGSWAN_WITH_OPENSSL},y) -PKG_BUILDDEP+= openssl -endif -ifeq (${ADK_PACKAGE_STRONGSWAN_WITH_GNUTLS},y) -PKG_BUILDDEP+= gnutls -endif -ifeq (${ADK_PACKAGE_STRONGSWAN_WITH_GMP},y) -PKG_BUILDDEP+= gmp -endif PKG_URL:= http://strongswan.org/index.htm PKG_SITES:= http://download.strongswan.org/ PKG_CHOICES:= WITH_GMP WITH_OPENSSL WITH_GNUTLS PKGCD_WITH_GMP:= use GMP for crypto PKGCS_WITH_GMP:= libgmp +PKGCB_WITH_GMP:= gmp PKGCD_WITH_OPENSSL:= use OpenSSL for crypto PKGCS_WITH_OPENSSL:= libopenssl +PKGCB_WITH_OPENSSL:= openssl PKGCD_WITH_GNUTLS:= use GnuTLS for crypto PKGCS_WITH_GNUTLS:= libgnutls +PKGCB_WITH_GNUTLS:= gnutls ifeq (${ADK_PACKAGE_STRONGSWAN_WITH_OPENSSL},y) -CFLINE_STRONGSWAN:= select ADK_PACKAGE_OPENSSL_WITH_EC +PKG_CFLINE_STRONGSWAN:= select ADK_PACKAGE_OPENSSL_WITH_EC endif include $(TOPDIR)/mk/package.mk diff --git a/package/subversion/Makefile b/package/subversion/Makefile index 7851bd2a4..e255d4e95 100644 --- a/package/subversion/Makefile +++ b/package/subversion/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= ae008ac355581c90494fba86cbfc3413 PKG_DESCR:= revision control program PKG_SECTION:= scm PKG_DEPENDS:= zlib apr apr-util libiconv libexpat libsqlite neon -PKG_BUILDDEP+= apr-util expat apr zlib libiconv sqlite neon +PKG_BUILDDEP:= apr-util expat apr zlib libiconv sqlite neon PKG_SITES:= http://subversion.tigris.org/downloads/ PKG_URL:= http://subversion.apache.org/ diff --git a/package/syslog-ng/Makefile b/package/syslog-ng/Makefile index 3289f0097..3aae8652f 100644 --- a/package/syslog-ng/Makefile +++ b/package/syslog-ng/Makefile @@ -10,8 +10,8 @@ PKG_MD5SUM:= a3cbfdb6e1e5beea181a7349749719f3 PKG_DESCR:= A powerful syslog daemon PKG_SECTION:= admin PKG_DEPENDS:= libol libwrap -PKG_BUILDDEP+= libol tcp_wrappers -PKG_URL:= http://www.balabit.com +PKG_BUILDDEP:= libol tcp_wrappers +PKG_URL:= http://www.balabit.com/ PKG_SITES:= http://www.balabit.com/downloads/files/syslog-ng/sources/1.6/src/ include ${TOPDIR}/mk/package.mk diff --git a/package/tcp_wrappers/Makefile b/package/tcp_wrappers/Makefile index d04433f08..fb042c6b0 100644 --- a/package/tcp_wrappers/Makefile +++ b/package/tcp_wrappers/Makefile @@ -9,8 +9,10 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= e6fa25f71226d090f34de3f6b122fb5a PKG_DESCR:= IP based access control PKG_SECTION:= libs -PKG_NOPARALLEL:= 1 PKG_SITES:= ftp://ftp.porcupine.org/pub/security/ +PKG_NOPARALLEL:= 1 + +PKG_SUBPKGS:= LIBWRAP DISTFILES:= ${PKG_NAME}_${PKG_VERSION}.tar.gz WRKDIST= ${WRKDIR}/${PKG_NAME}_${PKG_VERSION} diff --git a/package/tcpdump/Makefile b/package/tcpdump/Makefile index f728e2b25..2eed511aa 100644 --- a/package/tcpdump/Makefile +++ b/package/tcpdump/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= d0dd58bbd6cd36795e05c6f1f74420b0 PKG_DESCR:= A tool for network monitoring and data acquisition PKG_SECTION:= net PKG_DEPENDS:= libpcap -PKG_BUILDDEP+= libpcap +PKG_BUILDDEP:= libpcap PKG_URL:= http://www.tcpdump.org/ PKG_SITES:= http://www.tcpdump.org/release/ diff --git a/package/tcsh/Makefile b/package/tcsh/Makefile index b0e85a79a..a1fa2db00 100644 --- a/package/tcsh/Makefile +++ b/package/tcsh/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= c47de903e3d52f6824c8dd0c91eeb477 PKG_DESCR:= alternative csh PKG_SECTION:= shells PKG_DEPENDS:= libncurses -PKG_BUILDDEP+= ncurses +PKG_BUILDDEP:= ncurses PKG_URL:= http://www.tcsh.org/Welcome PKG_SITES:= ftp://ftp.astron.com/pub/tcsh/ diff --git a/package/tinc/Makefile b/package/tinc/Makefile index 895593f68..3825cadcc 100644 --- a/package/tinc/Makefile +++ b/package/tinc/Makefile @@ -10,8 +10,8 @@ PKG_MD5SUM:= ee0b1a3366c6e379cae34be6fa5dcb15 PKG_DESCR:= VPN tunnel daemon PKG_SECTION:= net/security PKG_DEPENDS:= zlib liblzo libopenssl kmod-tun -PKG_BUILDDEP+= zlib liblzo openssl -PKG_URL:= http://www.tinc-vpn.org +PKG_BUILDDEP:= zlib liblzo openssl +PKG_URL:= http://www.tinc-vpn.org/ PKG_SITES:= http://www.tinc-vpn.org/packages/ include ${TOPDIR}/mk/package.mk diff --git a/package/tinyproxy/Makefile b/package/tinyproxy/Makefile index d384eab1e..925ac1bb7 100644 --- a/package/tinyproxy/Makefile +++ b/package/tinyproxy/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 2 PKG_MD5SUM:= 2b2862ba33d2939e4572688d442ba415 PKG_DESCR:= Tinyproxy is a lightweight HTTP and HTTPS proxy. PKG_SECTION:= proxy -PKG_URL:= https://www.banu.com/tinyproxy +PKG_URL:= https://www.banu.com/tinyproxy/ PKG_SITES:= https://www.banu.com/pub/tinyproxy/1.6/ include ${TOPDIR}/mk/package.mk diff --git a/package/tmsnc/Makefile b/package/tmsnc/Makefile index 73be4f1bd..1f46c4c67 100644 --- a/package/tmsnc/Makefile +++ b/package/tmsnc/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 337dae91d4775e03b6681f61db56d2a7 PKG_DESCR:= a textbased MSN client PKG_SECTION:= chat -PKG_URL:= http://tmsnc.sourceforge.net +PKG_URL:= http://tmsnc.sourceforge.net/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=tmsnc/} include ${TOPDIR}/mk/package.mk diff --git a/package/tntnet/Makefile b/package/tntnet/Makefile index 9f9f37277..e6f1ddb90 100644 --- a/package/tntnet/Makefile +++ b/package/tntnet/Makefile @@ -10,54 +10,23 @@ PKG_MD5SUM:= e2c3c5075a890711a7569730493c0996 PKG_DESCR:= small C++ application server PKG_SECTION:= www PKG_DEPENDS:= cxxtools zlib libiconv libpthread -PKG_BUILDDEP+= cxxtools zlib libiconv -ifneq (${ADK_COMPILE_TNTNET_WITH_OPENSSL},) -PKG_BUILDDEP+= openssl -else ifneq (${ADK_COMPILE_TNTNET_WITH_GNUTLS},) -PKG_BUILDDEP+= gnutls -endif -PKG_URL:= http://www.tntnet.org +PKG_BUILDDEP:= cxxtools zlib libiconv +PKG_URL:= http://www.tntnet.org/ PKG_SITES:= http://www.tntnet.org/download/ -#PKG_CXX:= TNTNET include ${TOPDIR}/mk/package.mk -ifneq (${ADK_COMPILE_TNTNET_WITH_OPENSSL},) -PKG_DEPENDS+= libopenssl -else ifneq (${ADK_COMPILE_TNTNET_WITH_GNUTLS},) -PKG_DEPENDS+= libgnutls -endif - $(eval $(call PKG_template,TNTNET,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) -ifeq (${ADK_COMPILE_TNTNET_WITH_UCLIBCXX},y) -TCXXFLAGS+= -fno-builtin -nostdinc++ -nodefaultlibs -I${STAGING_DIR}/usr/include/uClibc++ -Wl,-E -TLDFLAGS+= -nodefaultlibs -luClibc++ -liconv -lpthread -lcxxtools -lm -ldl -else -TLDFLAGS+= -liconv -lpthread -lcxxtools -lm -ldl -endif - CONFIGURE_ARGS+= --without-epoll \ --without-sdk \ --without-cgi \ - --without-sendfile -ifeq (${ADK_COMPILE_TNTNET_WITH_OPENSSL},y) -CONFIGURE_ARGS+= --with-ssl=openssl -else ifeq (${ADK_COMPILE_TNTNET_WITH_GNUTLS},y) -CONFIGURE_ARGS+= --with-ssl=gnutls -else -CONFIGURE_ARGS+= --without-ssl -endif + --without-sendfile \ + --without-ssl + CONFIGURE_ENV+= CXXFLAGS='${TCXXFLAGS}' \ ac_cv_path_cxxtools_config=${STAGING_DIR}/usr/bin -#ifeq (${ADK_COMPILE_TNTNET_WITH_UCLIBCXX},y) -# add workaround because libtool tries to link libstdc++ -#post-configure: -# ${SED} 's#postdeps="-lstdc.*#postdeps="-lm"#' \ -# ${WRKBUILD}/libtool -#endif - post-install: ${INSTALL_DIR} ${IDIR_TNTNET}/www ${INSTALL_DIR} ${IDIR_TNTNET}/etc/tntnet diff --git a/package/tor/Makefile b/package/tor/Makefile index 41dde662c..f7af0bfa6 100644 --- a/package/tor/Makefile +++ b/package/tor/Makefile @@ -10,9 +10,9 @@ PKG_MD5SUM:= cb5629b2709ada82d34c22fef3ed77a9 PKG_DESCR:= An anonymous Internet communication system PKG_SECTION:= proxy PKG_DEPENDS:= libevent libopenssl zlib libpthread -PKG_BUILDDEP+= libevent openssl zlib -PKG_URL:= http://tor.eff.org -PKG_SITES:= http://tor.eff.org/dist/ \ +PKG_BUILDDEP:= libevent openssl zlib +PKG_URL:= http://tor.eff.org/ +PKG_SITES:= http://tor.eff.org/dist/ include ${TOPDIR}/mk/package.mk diff --git a/package/trafshow/Makefile b/package/trafshow/Makefile index af82cb4e1..4ef0d742b 100644 --- a/package/trafshow/Makefile +++ b/package/trafshow/Makefile @@ -10,7 +10,6 @@ PKG_MD5SUM:= 0b2f0bb23b7832138b7d841437b9e182 PKG_DESCR:= traffic analyzing tool PKG_SECTION:= net PKG_SITES:= http://www.sfr-fresh.com/linux/misc/ - PKG_NOPARALLEL:= 1 DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tgz diff --git a/package/tslib/Makefile b/package/tslib/Makefile index 2ebd83179..ff0afe6c9 100644 --- a/package/tslib/Makefile +++ b/package/tslib/Makefile @@ -10,8 +10,7 @@ PKG_MD5SUM:= 92b2eb55b1e4ef7e2c0347069389390e PKG_DESCR:= touchscreen library PKG_SECTION:= libs PKG_URL:= http://tslib.berlios.de/ -PKG_SITES:= http://download.berlios.de/tslib/ \ - http://download2.berlios.de/tslib/ +PKG_SITES:= http://download.berlios.de/tslib/ DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 diff --git a/package/twm/Makefile b/package/twm/Makefile index 7e2a70482..9412aeb5d 100644 --- a/package/twm/Makefile +++ b/package/twm/Makefile @@ -10,8 +10,8 @@ PKG_MD5SUM:= 109979bd39d48bd761e7939b30006a48 PKG_DESCR:= X.Org twm application PKG_SECTION:= x11/apps PKG_DEPENDS:= xorg-server -PKG_BUILDDEP+= xorg-server -PKG_URL:= http://xorg.freedesktop.org +PKG_BUILDDEP:= xorg-server +PKG_URL:= http://xorg.freedesktop.org/ PKG_SITES:= http://xorg.freedesktop.org/archive/individual/app/ PKG_TARGET_DEPENDS:= !foxboard diff --git a/package/uclibc++/Makefile b/package/uclibc++/Makefile index 6d358b317..760258bdd 100644 --- a/package/uclibc++/Makefile +++ b/package/uclibc++/Makefile @@ -9,12 +9,12 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 1ceef3209cca88be8f1bd9de99735954 PKG_DESCR:= A standard c++ library for embedded systems PKG_SECTION:= libs -PKG_URL:= http://cxx.uclibc.org +PKG_URL:= http://cxx.uclibc.org/ PKG_SITES:= http://cxx.uclibc.org/src/ DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 -CFLINE_UCLIBCXX:= depends on ADK_TARGET_LIB_UCLIBC +PKG_CFLINE_UCLIBCXX:= depends on ADK_TARGET_LIB_UCLIBC include ${TOPDIR}/mk/package.mk diff --git a/package/uclibc/Makefile b/package/uclibc/Makefile index ba9f9b379..ad9739f8c 100644 --- a/package/uclibc/Makefile +++ b/package/uclibc/Makefile @@ -7,15 +7,17 @@ include $(TOPDIR)/toolchain/uClibc/Makefile.inc PKG_DESCR:= embedded C library PKG_SECTION:= base PKG_OPTS:= noremove -PKG_DESCR_LIB_DEV:= development files for uclibc -PKG_SECTION_LIB_DEV:= devel + +PKG_SUBPKGS:= UCLIBC UCLIBC_DEV +PKGSD_UCLIBC_DEV:= development files for uclibc +PKGSC_UCLIBC_DEV:= devel NO_DISTFILES:= 1 include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,UCLIBC,uclibc,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},${PKG_OPTS})) -$(eval $(call PKG_template,UCLIBC_DEV,uclibc-dev,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_LIB_DEV},${PKG_SECTION_LIB_DEV},${PKG_OPTS})) +$(eval $(call PKG_template,UCLIBC_DEV,uclibc-dev,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_UCLIBC_DEV},${PKGSC_UCLIBC_DEV},${PKG_OPTS})) CONFIG_STYLE:= manual BUILD_STYLE:= manual diff --git a/package/udev/Makefile b/package/udev/Makefile index 609106ac3..4292c16a2 100644 --- a/package/udev/Makefile +++ b/package/udev/Makefile @@ -12,9 +12,9 @@ PKG_SECTION:= utils PKG_URL:= http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html PKG_SITES:= ${MASTER_SITE_KERNEL:=utils/kernel/hotplug/} -DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 +PKG_CFLINE_UDEV:= depends on ADK_TARGET_LIB_EGLIBC || ADK_TARGET_LIB_GLIBC -CFLINE_UDEV:= depends on ADK_TARGET_LIB_EGLIBC || ADK_TARGET_LIB_GLIBC\n\t +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 include ${TOPDIR}/mk/package.mk diff --git a/package/udp-broadcast-relay/Makefile b/package/udp-broadcast-relay/Makefile index 4ba2052f9..0c370e896 100644 --- a/package/udp-broadcast-relay/Makefile +++ b/package/udp-broadcast-relay/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= a32f983b7063d6ac670e6b22be9b9d24 PKG_DESCR:= listens for packets on a specified UDP broadcast port PKG_SECTION:= net/misc -PKG_URL:= http://www.joachim-breitner.de/udp-broadcast-relay +PKG_URL:= http://www.joachim-breitner.de/udp-broadcast-relay/ PKG_SITES:= http://www.joachim-breitner.de/udp-broadcast-relay/files/ include ${TOPDIR}/mk/package.mk diff --git a/package/ulogd/Makefile b/package/ulogd/Makefile index ab516d1e8..6993fed64 100644 --- a/package/ulogd/Makefile +++ b/package/ulogd/Makefile @@ -9,26 +9,22 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 21143aecf8e39008d143a0fb0f742b0c PKG_DESCR:= Netfilter userspace logging daemon PKG_SECTION:= firewall -PKG_MULTI:= 1 -PKG_NOPARALLEL:= 1 PKG_DEPENDS:= iptables libnetfilter-conntrack libnetfilter-log -PKG_BUILDDEP+= iptables libnetfilter_conntrack libnetfilter_log -ifneq ($(ADK_PACKAGE_ULOGD_MOD_MYSQL),) -PKG_BUILDDEP+= mysql -endif -ifneq ($(ADK_PACKAGE_ULOGD_MOD_PGSQL),) -PKG_BUILDDEP+= postgresql -endif -ifneq ($(ADK_PACKAGE_ULOGD_MOD_SQLITE),) -PKG_BUILDDEP+= sqlite -endif +PKG_BUILDDEP:= iptables libnetfilter_conntrack libnetfilter_log PKG_URL:= http://www.netfilter.org/projects/ulogd/ PKG_SITES:= http://www.netfilter.org/projects/ulogd/files/ +PKG_MULTI:= 1 +PKG_NOPARALLEL:= 1 -DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 +PKG_SUBPKGS:= ULOGD ULOGD_MOD_MYSQL ULOGD_MOD_PCAP ULOGD_MOD_PGSQL ULOGD_MOD_SQLITE ULOGD_MOD_EXTRA +PKGSB_MOD_MYSQL:= mysql +PKGSB_MOD_PGSQL:= postgresql +PKGSB_MOD_SQLITE:= sqlite PKG_HOST_DEPENDS:= !cygwin +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 + include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,ULOGD,ulogd,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/updatedd/Makefile b/package/updatedd/Makefile index a8779fcd2..66b2b09f7 100644 --- a/package/updatedd/Makefile +++ b/package/updatedd/Makefile @@ -9,8 +9,12 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 95655596eb6e0e381d60a458f6a45fee PKG_DESCR:= A tool to update dynamic dns services. PKG_SECTION:= dns -PKG_MULTI:= 1 PKG_SITES:= http://savannah.nongnu.org/download/updatedd/ +PKG_MULTI:= 1 + +PKG_SUBPKGS:= UPDATEDD UPDATEDD_MOD_CHANGEIP UPDATEDD_MOD_DYNDNS UPDATEDD_MOD_EURODYNDNS +PKG_SUBPKGS+= UPDATEDD_MOD_HN UPDATEDD_MOD_NOIP UPDATEDD_MOD_ODS UPDATEDD_MOD_OVH +PKG_SUBPKGS+= UPDATEDD_MOD_REGFISH UPDATEDD_MOD_TZO DISTFILES:= ${PKG_NAME}_${PKG_VERSION}.tar.gz diff --git a/package/usbutils/Makefile b/package/usbutils/Makefile index fd79c90bb..21ec416ed 100644 --- a/package/usbutils/Makefile +++ b/package/usbutils/Makefile @@ -10,9 +10,11 @@ PKG_MD5SUM:= 34979f675d2bcb3e1b45012fa830a53f PKG_DESCR:= A program to list USB devices PKG_SECTION:= utils PKG_DEPENDS:= libusb libusb-compat libpthread -PKG_BUILDDEP+= libusb libusb-compat +PKG_BUILDDEP:= libusb libusb-compat PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=linux-usb/} +PKG_SUBPKGS:= LSUSB + include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,LSUSB,lsusb,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/ussp-push/Makefile b/package/ussp-push/Makefile index db71ffad0..1d0d2d7b9 100644 --- a/package/ussp-push/Makefile +++ b/package/ussp-push/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 5c44983ee27809867041feff6bb4423a PKG_DESCR:= OBEX push command PKG_SECTION:= bluetooth PKG_DEPENDS:= openobex -PKG_BUILDDEP+= openobex +PKG_BUILDDEP:= openobex PKG_SITES:= http://xmailserver.org/ include ${TOPDIR}/mk/package.mk diff --git a/package/util-linux-ng/Makefile b/package/util-linux-ng/Makefile index c6fcaad95..a974ea4fa 100644 --- a/package/util-linux-ng/Makefile +++ b/package/util-linux-ng/Makefile @@ -9,26 +9,27 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 4c810430e86d53b6ea5e7ae279b39186 PKG_DESCR:= Linux utilities PKG_SECTION:= fs -PKG_BUILDDEP+= e2fsprogs ncurses +PKG_BUILDDEP:= e2fsprogs ncurses PKG_URL:= http://userweb.kernel.org/~kzak/util-linux-ng PKG_SITES:= ${MASTER_SITE_KERNEL:=utils/util-linux-ng/v2.17/} -PKG_DESCR_FDISK:= Partition table manipulation utility -PKG_DESCR_SFDISK:= Scriptable Partition table manipulation utility -PKG_DESCR_SWAP:= Swap space management utilities -PKG_DEPENDS_SWAP:= libblkid -PKG_DESCR_LOOP:= Loop devices management utilities -PKG_DEPENDS_LOOP:= kmod-blk-dev-loop -PKG_DESCR_MCOOKIE:= Generate magic cookies for xauth -PKG_SECT_MCOOKIE:= x11/apps +PKG_SUBPKGS:= FDISK SFDISK SWAP_UTILS LOSETUP MCOOKIE +PKGSD_FDISK:= Partition table manipulation utility +PKGSD_SFDISK:= Scriptable Partition table manipulation utility +PKGSD_SWAP_UTILS:= Swap space management utilities +PKGSS_SWAP_UTILS:= libblkid +PKGSD_LOSETUP:= Loop devices management utilities +PKGSS_LOSETUP:= kmod-blk-dev-loop +PKGSD_MCOOKIE:= Generate magic cookies for xauth +PKGSC_MCOOKIE:= x11/apps include ${TOPDIR}/mk/package.mk -$(eval $(call PKG_template,FDISK,fdisk,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_FDISK},${PKG_SECTION})) -$(eval $(call PKG_template,SFDISK,sfdisk,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_SFDISK},${PKG_SECTION})) -$(eval $(call PKG_template,SWAP_UTILS,swap-utils,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_SWAP},${PKG_DESCR_SWAP},${PKG_SECTION})) -$(eval $(call PKG_template,LOSETUP,losetup,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS_LOOP},${PKG_DESCR_LOOP},${PKG_SECTION})) -$(eval $(call PKG_template,MCOOKIE,mcookie,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR_MCOOKIE},${PKG_SECT_MCOOKIE})) +$(eval $(call PKG_template,FDISK,fdisk,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_FDISK},${PKG_SECTION})) +$(eval $(call PKG_template,SFDISK,sfdisk,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_SFDISK},${PKG_SECTION})) +$(eval $(call PKG_template,SWAP_UTILS,swap-utils,${PKG_VERSION}-${PKG_RELEASE},${PKGSS_SWAP},${PKGSD_SWAP},${PKG_SECTION})) +$(eval $(call PKG_template,LOSETUP,losetup,${PKG_VERSION}-${PKG_RELEASE},${PKGSS_LOOP},${PKGSD_LOOP},${PKG_SECTION})) +$(eval $(call PKG_template,MCOOKIE,mcookie,${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_MCOOKIE},${PKGSC_MCOOKIE})) CONFIGURE_ARGS+= --disable-use-tty-group \ --disable-schedutils \ diff --git a/package/uvd/Makefile b/package/uvd/Makefile index 92a6b07a2..448f9c375 100644 --- a/package/uvd/Makefile +++ b/package/uvd/Makefile @@ -8,7 +8,7 @@ PKG_VERSION:= 0.1 PKG_RELEASE:= 2 PKG_DESCR:= udp server for version information PKG_SECTION:= base -PKG_URL:= http://www.openadk.org +PKG_URL:= http://www.openadk.org/ NO_DISTFILES:= 1 diff --git a/package/valgrind/Makefile b/package/valgrind/Makefile index 24e99390d..ffc76e9c3 100644 --- a/package/valgrind/Makefile +++ b/package/valgrind/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= f03522a4687cf76c676c9494fcc0a517 PKG_DESCR:= memory management debugging PKG_SECTION:= debug -PKG_URL:= http://valgrind.org +PKG_URL:= http://valgrind.org/ PKG_SITES:= http://valgrind.org/downloads/ PKG_TARGET_DEPENDS:= x86 x86_64 diff --git a/package/vgp/Makefile b/package/vgp/Makefile index 9420bc8bb..5b134075e 100755 --- a/package/vgp/Makefile +++ b/package/vgp/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= b8c25b5dfcb944f78bbc584be9c230c7 PKG_DESCR:= vgp is a daemon working like Cisco HSRP PKG_SECTION:= net/misc -PKG_URL:= http://vgpd.freaknet.org +PKG_URL:= http://vgpd.freaknet.org/ PKG_SITES:= http://vgpd.freaknet.org/files/ include ${TOPDIR}/mk/package.mk diff --git a/package/videoproto/Makefile b/package/videoproto/Makefile index c28b0a4da..42b9a044d 100644 --- a/package/videoproto/Makefile +++ b/package/videoproto/Makefile @@ -8,6 +8,7 @@ PKG_VERSION:= 2.3.0 PKG_RELEASE:= 1 PKG_MD5SUM:= 888543493cd69c6c78002ac59c3f077f PKG_SITES:= ${MASTER_SITE_XORG} +PKG_SUBPKGS:= include $(TOPDIR)/mk/package.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/vilistextum/Makefile b/package/vilistextum/Makefile index 01202e94b..4899b3591 100644 --- a/package/vilistextum/Makefile +++ b/package/vilistextum/Makefile @@ -6,11 +6,11 @@ include ${TOPDIR}/rules.mk PKG_NAME:= vilistextum PKG_VERSION:= 2.6.9 PKG_RELEASE:= 1 -PKG_BUILDDEP+= libiconv PKG_MD5SUM:= 5ba56ffdc56758da716bb46c3e0f517e PKG_DESCR:= html to ascii converter PKG_SECTION:= mail PKG_DEPENDS:= libiconv +PKG_BUILDDEP:= libiconv PKG_SITES:= http://bhaak.dyndns.org/${PKG_NAME}/ include ${TOPDIR}/mk/package.mk diff --git a/package/vim/Makefile b/package/vim/Makefile index cc3bb6e4d..d9b2bfdfb 100644 --- a/package/vim/Makefile +++ b/package/vim/Makefile @@ -3,16 +3,16 @@ include ${TOPDIR}/rules.mk -PKG_NAME= vim -PKG_VERSION= 7.2 -PKG_RELEASE= 2 -PKG_BUILDDEP+= ncurses -PKG_MD5SUM= f0901284b338e448bfd79ccca0041254 +PKG_NAME:= vim +PKG_VERSION:= 7.2 +PKG_RELEASE:= 2 +PKG_MD5SUM:= f0901284b338e448bfd79ccca0041254 PKG_DESCR:= The text editor PKG_SECTION:= editor PKG_DEPENDS:= libncurses +PKG_BUILDDEP:= ncurses PKG_URL:= http://www.vim.org/ -PKG_SITES= ftp://ftp.vim.org/pub/vim/unix/ +PKG_SITES:= ftp://ftp.vim.org/pub/vim/unix/ DISTFILES= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 WRKDIST= ${WRKDIR}/vim72 diff --git a/package/vnc-reflector/Makefile b/package/vnc-reflector/Makefile index 7cdc7ba14..72aefd342 100644 --- a/package/vnc-reflector/Makefile +++ b/package/vnc-reflector/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= c3f88bc62f228b335c25c07f9744ab0c PKG_DESCR:= specialized VNC server which acts as a proxy PKG_SECTION:= proxy PKG_DEPENDS:= libjpeg zlib -PKG_BUILDDEP+= jpeg zlib +PKG_BUILDDEP:= jpeg zlib PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=vnc-reflector/} DISTFILES:= vnc_reflector-${PKG_VERSION}.tar.gz diff --git a/package/vpnc/Makefile b/package/vpnc/Makefile index 72fa69459..0c4fd12ef 100644 --- a/package/vpnc/Makefile +++ b/package/vpnc/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 4378f9551d5b077e1770bbe09995afb3 PKG_DESCR:= client for cisco3000 VPN Concentrator. PKG_SECTION:= net/security PKG_DEPENDS:= libgcrypt libgpg-error kmod-tun -PKG_BUILDDEP+= libgcrypt libgpg-error +PKG_BUILDDEP:= libgcrypt libgpg-error PKG_URL:= http://www.unix-ag.uni-kl.de/~massar/vpnc/ PKG_SITES:= http://www.unix-ag.uni-kl.de/~massar/vpnc/ diff --git a/package/vsftpd/Makefile b/package/vsftpd/Makefile index 20a71844b..61e1f80da 100644 --- a/package/vsftpd/Makefile +++ b/package/vsftpd/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= e4eb190af270ae65d57a84274a38ec31 PKG_DESCR:= a fast and secure FTP server PKG_SECTION:= www -PKG_URL:= http://vsftpd.beasts.org +PKG_URL:= http://vsftpd.beasts.org/ PKG_SITES:= ftp://vsftpd.beasts.org/users/cevans/ include ${TOPDIR}/mk/package.mk diff --git a/package/vtun/Makefile b/package/vtun/Makefile index 781e54be1..8c437aec4 100644 --- a/package/vtun/Makefile +++ b/package/vtun/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= c342ffe77055d4248a38f0b380f28c1b PKG_DESCR:= A VPN tunnel daemon PKG_SECTION:= net/misc PKG_DEPENDS:= zlib libopenssl liblzo kmod-tun -PKG_BUILDDEP+= zlib openssl liblzo +PKG_BUILDDEP:= zlib openssl liblzo PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=vtun/} PKG_HOST_DEPENDS:= !freebsd diff --git a/package/wdfs/Makefile b/package/wdfs/Makefile index 25169868a..fb55d5b4c 100644 --- a/package/wdfs/Makefile +++ b/package/wdfs/Makefile @@ -3,15 +3,15 @@ include ${TOPDIR}/rules.mk -PKG_NAME= wdfs -PKG_VERSION= 1.4.2 -PKG_RELEASE= 2 -PKG_MD5SUM= 628bb44194d04c1cf8aacc446ed0a230 +PKG_NAME:= wdfs +PKG_VERSION:= 1.4.2 +PKG_RELEASE:= 2 +PKG_MD5SUM:= 628bb44194d04c1cf8aacc446ed0a230 PKG_DESCR:= WebDAV filesystem PKG_SECTION:= fs PKG_DEPENDS:= libopenssl fuse-utils kmod-fuse-fs neon glib -PKG_BUILDDEP+= openssl fuse neon glib -PKG_SITES= http://noedler.de/projekte/wdfs/ +PKG_BUILDDEP:= openssl fuse neon glib +PKG_SITES:= http://noedler.de/projekte/wdfs/ include ${TOPDIR}/mk/package.mk diff --git a/package/weechat/Makefile b/package/weechat/Makefile index ca77c5672..ff95435f3 100644 --- a/package/weechat/Makefile +++ b/package/weechat/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 0c4f6e7196703c6eca12217f254612aa PKG_DESCR:= Lightweight IRC client PKG_SECTION:= chat PKG_DEPENDS:= libncurses libiconv -PKG_BUILDDEP+= ncurses libiconv +PKG_BUILDDEP:= ncurses libiconv PKG_URL:= http://www.weechat.org/ PKG_SITES:= http://www.weechat.org/files/src/ diff --git a/package/wifidog/Makefile b/package/wifidog/Makefile index 629982ef8..d726a0779 100644 --- a/package/wifidog/Makefile +++ b/package/wifidog/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= abe5f7123179a0f08c493ce59fb3cb31 PKG_DESCR:= a complete and embeddable captive portal PKG_SECTION:= wifi PKG_DEPENDS:= iptables -PKG_URL:= http://dev.wifidog.org +PKG_URL:= http://dev.wifidog.org/ PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=${PKG_NAME}/} include ${TOPDIR}/mk/package.mk diff --git a/package/wondershaper/Makefile b/package/wondershaper/Makefile index 1a7d78847..126479da3 100644 --- a/package/wondershaper/Makefile +++ b/package/wondershaper/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 7 PKG_MD5SUM:= bbc5a3a4485ab286e337ce8550e7b990 PKG_DESCR:= WonderShaper is a tc based traffic shaping tool. PKG_SECTION:= firewall -PKG_URL:= http://lartc.org/wondershaper +PKG_URL:= http://lartc.org/wondershaper/ PKG_SITES:= http://lartc.org/wondershaper/ include ${TOPDIR}/mk/package.mk diff --git a/package/wpa_supplicant/Makefile b/package/wpa_supplicant/Makefile index b46e31db6..104e98c5e 100644 --- a/package/wpa_supplicant/Makefile +++ b/package/wpa_supplicant/Makefile @@ -10,13 +10,7 @@ PKG_MD5SUM:= 0e2cb7e4c35667351d8b7ec28c783e6a PKG_DESCR:= WPA Supplicant with support for WPA and WPA2 PKG_SECTION:= wifi PKG_DEPENDS:= libnl -PKG_BUILDDEP+= libnl -ifeq (${ADK_PACKAGE_WPA_SUPPLICANT_WITH_OPENSSL},y) -PKG_BUILDDEP+= openssl -endif -ifeq (${ADK_PACKAGE_WPA_SUPPLICANT_WITH_GNUTLS},y) -PKG_BUILDDEP+= gnutls -endif +PKG_BUILDDEP:= libnl PKG_SITES:= http://hostap.epitest.fi/releases/ WRKSRC= ${WRKDIST}/${PKG_NAME} @@ -24,8 +18,10 @@ WRKSRC= ${WRKDIST}/${PKG_NAME} PKG_CHOICES:= WITH_OPENSSL WITH_GNUTLS PKGCD_WITH_OPENSSL:= use OpenSSL for crypto PKGCS_WITH_OPENSSL:= libopenssl +PKGCB_WITH_OPENSSL:= openssl PKGCD_WITH_GNUTLS:= use GnuTLS for crypto PKGCS_WITH_GNUTLS:= libgnutls +PKGCB_WITH_GNUTLS:= gnutls include ${TOPDIR}/mk/package.mk diff --git a/package/xauth/Makefile b/package/xauth/Makefile index 26ebb1426..150f2e813 100644 --- a/package/xauth/Makefile +++ b/package/xauth/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= 2eb3cc3e4421e1b747c4ac16aac20cda PKG_DESCR:= X authority file utility PKG_SECTION:= x11/apps PKG_DEPENDS:= libx11 libxext libxmu -PKG_BUILDDEP+= libX11 libXext libXmu +PKG_BUILDDEP:= libX11 libXext libXmu PKG_URL:= http://www.x.org PKG_SITES:= ${MASTER_SITE_XORG} diff --git a/package/xcb-proto/Makefile b/package/xcb-proto/Makefile index 67bcf625e..1e3665010 100644 --- a/package/xcb-proto/Makefile +++ b/package/xcb-proto/Makefile @@ -8,6 +8,7 @@ PKG_VERSION:= 1.6 PKG_RELEASE:= 1 PKG_MD5SUM:= 8d29695e8faf5fcdce568c66eaeaa5ee PKG_SITES:= http://xcb.freedesktop.org/dist/ +PKG_SUBPKGS:= include $(TOPDIR)/mk/package.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/xcmiscproto/Makefile b/package/xcmiscproto/Makefile index df4b324c2..e33f78c66 100644 --- a/package/xcmiscproto/Makefile +++ b/package/xcmiscproto/Makefile @@ -8,6 +8,7 @@ PKG_VERSION:= 1.2.0 PKG_RELEASE:= 1 PKG_MD5SUM:= bacfb0f3cb4d6e1a71770307bfdba129 PKG_SITES:= ${MASTER_SITE_XORG} +PKG_SUBPKGS:= include $(TOPDIR)/mk/package.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/xextproto/Makefile b/package/xextproto/Makefile index 8d61db142..eb21715cf 100644 --- a/package/xextproto/Makefile +++ b/package/xextproto/Makefile @@ -8,6 +8,7 @@ PKG_VERSION:= 7.1.1 PKG_RELEASE:= 1 PKG_MD5SUM:= 6c55283718dbeb826bcf899b9e89faba PKG_SITES:= ${MASTER_SITE_XORG} +PKG_SUBPKGS:= include $(TOPDIR)/mk/package.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/xf86-input-evtouch/Makefile b/package/xf86-input-evtouch/Makefile index 487ade6c2..f5f2b22dd 100644 --- a/package/xf86-input-evtouch/Makefile +++ b/package/xf86-input-evtouch/Makefile @@ -10,13 +10,13 @@ PKG_MD5SUM:= 4d8e092356d8353002f60a4907046c13 PKG_DESCR:= X11 driver for touchscreen PKG_SECTION:= x11/drivers PKG_DEPENDS:= xorg-server kmod-input-evdev -PKG_BUILDDEP+= xorg-server +PKG_BUILDDEP:= xorg-server PKG_SITES:= http://www.conan.de/touchscreen/ -DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 - PKG_TARGET_DEPENDS:= alix1c +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 + include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,XF86_INPUT_EVTOUCH,${PKG_NAME},$(PKG_VERSION)-$(PKG_RELEASE),${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/xf86-input-keyboard/Makefile b/package/xf86-input-keyboard/Makefile index 085ddffd1..dbd52876d 100644 --- a/package/xf86-input-keyboard/Makefile +++ b/package/xf86-input-keyboard/Makefile @@ -9,8 +9,8 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= fc836be5364d80604cb11f4daacceb23 PKG_DESCR:= X11 driver for keyboard PKG_SECTION:= x11/drivers -PKG_BUILDDEP+= xorg-server PKG_DEPENDS:= xorg-server +PKG_BUILDDEP:= xorg-server PKG_SITES:= ${MASTER_SITE_XORG} PKG_TARGET_DEPENDS:= alix1c lemote ibmx40 shuttle diff --git a/package/xf86-input-mouse/Makefile b/package/xf86-input-mouse/Makefile index d926a190a..cfaa9619e 100644 --- a/package/xf86-input-mouse/Makefile +++ b/package/xf86-input-mouse/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= a662883fd9709c3dad7fb113ad8d2908 PKG_DESCR:= X11 driver for mouse PKG_SECTION:= x11/drivers PKG_DEPENDS:= xorg-server -PKG_BUILDDEP+= xorg-server +PKG_BUILDDEP:= xorg-server PKG_SITES:= ${MASTER_SITE_XORG} PKG_TARGET_DEPENDS:= alix1c lemote ibmx40 shuttle diff --git a/package/xf86-video-cirrus/Makefile b/package/xf86-video-cirrus/Makefile index 742a62df6..705eb8ff3 100644 --- a/package/xf86-video-cirrus/Makefile +++ b/package/xf86-video-cirrus/Makefile @@ -6,11 +6,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:= xf86-video-cirrus PKG_VERSION:= 1.3.2 PKG_RELEASE:= 1 -PKG_BUILDDEP+= xorg-server PKG_MD5SUM:= c63a29917c48d0c317445991fc36d09a PKG_DESCR:= X11 driver for Cirrus VGA chips PKG_SECTION:= x11/drivers PKG_DEPENDS:= xorg-server +PKG_BUILDDEP:= xorg-server PKG_SITES:= http://xorg.freedesktop.org/releases/individual/driver/ PKG_TARGET_DEPENDS:= x86_qemu x86_64_qemu diff --git a/package/xf86-video-fbdev/Makefile b/package/xf86-video-fbdev/Makefile index 7da4c871e..7d3ca9f76 100644 --- a/package/xf86-video-fbdev/Makefile +++ b/package/xf86-video-fbdev/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= c297e40b93b3636a72189cfac43d1a87 PKG_DESCR:= X11 driver for Linux Framebuffer devices PKG_SECTION:= x11/drivers PKG_DEPENDS:= xorg-server -PKG_BUILDDEP+= xorg-server +PKG_BUILDDEP:= xorg-server PKG_SITES:= http://xorg.freedesktop.org/releases/individual/driver/ PKG_TARGET_DEPENDS:= alix1c lemote ibmx40 diff --git a/package/xf86-video-geode/Makefile b/package/xf86-video-geode/Makefile index 7cb85e12f..e41a83584 100644 --- a/package/xf86-video-geode/Makefile +++ b/package/xf86-video-geode/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= a673c0f88037d12fbb96d9fefc82785b PKG_DESCR:= X11 driver for AMD Geode VGA chip PKG_SECTION:= x11/drivers PKG_DEPENDS:= xorg-server -PKG_BUILDDEP+= xorg-server +PKG_BUILDDEP:= xorg-server PKG_SITES:= http://xorg.freedesktop.org/releases/individual/driver/ PKG_TARGET_DEPENDS:= alix1c diff --git a/package/xf86-video-intel/Makefile b/package/xf86-video-intel/Makefile index d1a70117e..024eb0985 100644 --- a/package/xf86-video-intel/Makefile +++ b/package/xf86-video-intel/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= b1926dc68cc10209fc2200729fb6162b PKG_DESCR:= X11 driver for Intel VGA chip PKG_SECTION:= x11/drivers PKG_DEPENDS:= xorg-server libdrm -PKG_BUILDDEP+= xorg-server libdrm +PKG_BUILDDEP:= xorg-server libdrm PKG_SITES:= http://www.x.org/releases/X11R7.5/src/driver/ PKG_TARGET_DEPENDS:= ibmx40 diff --git a/package/xf86-video-siliconmotion/Makefile b/package/xf86-video-siliconmotion/Makefile index e372928ff..64e818667 100644 --- a/package/xf86-video-siliconmotion/Makefile +++ b/package/xf86-video-siliconmotion/Makefile @@ -10,10 +10,10 @@ PKG_MD5SUM:= 39da891cd368960443613e7a61398216 PKG_DESCR:= X11 driver for Silicon Motion VGA chips PKG_SECTION:= x11/drivers PKG_DEPENDS:= xorg-server -PKG_BUILDDEP+= xorg-server +PKG_BUILDDEP:= xorg-server PKG_SITES:= http://xorg.freedesktop.org/releases/individual/driver/ -PKG_TARGET_DEPENDS:= lemote +PKG_TARGET_DEPENDS:= lemote native include $(TOPDIR)/mk/package.mk diff --git a/package/xf86dga/Makefile b/package/xf86dga/Makefile index c3e7e5e86..77558173b 100644 --- a/package/xf86dga/Makefile +++ b/package/xf86dga/Makefile @@ -6,9 +6,10 @@ include $(TOPDIR)/rules.mk PKG_NAME:= xf86dga PKG_VERSION:= 1.0.2 PKG_RELEASE:= 1 -PKG_BUILDDEP+= libXxf86dga PKG_MD5SUM:= ac30b5705f487554c5de0b466e846c31 +PKG_BUILDDEP:= libXxf86dga PKG_SITES:= ${MASTER_SITE_XORG} +PKG_SUBPKGS:= include $(TOPDIR)/mk/package.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/xf86dgaproto/Makefile b/package/xf86dgaproto/Makefile index 34009118f..ba8dda7c7 100644 --- a/package/xf86dgaproto/Makefile +++ b/package/xf86dgaproto/Makefile @@ -8,6 +8,7 @@ PKG_VERSION:= 2.1 PKG_RELEASE:= 1 PKG_MD5SUM:= 1fe79dc07857ad3e1fb8b8f2bdd70d1b PKG_SITES:= ${MASTER_SITE_XORG} +PKG_SUBPKGS:= include $(TOPDIR)/mk/package.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/xf86driproto/Makefile b/package/xf86driproto/Makefile index 27e3dca18..77a292ac8 100644 --- a/package/xf86driproto/Makefile +++ b/package/xf86driproto/Makefile @@ -8,6 +8,8 @@ PKG_VERSION:= 2.1.0 PKG_RELEASE:= 1 PKG_MD5SUM:= 309d552732666c3333d7dc63e80d042f PKG_SITES:= http://xorg.freedesktop.org/releases/individual/proto/ +PKG_SUBPKGS:= + DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 include $(TOPDIR)/mk/package.mk diff --git a/package/xf86vidmodeproto/Makefile b/package/xf86vidmodeproto/Makefile index 2f1d5a8c3..86e7d3a55 100644 --- a/package/xf86vidmodeproto/Makefile +++ b/package/xf86vidmodeproto/Makefile @@ -8,6 +8,7 @@ PKG_VERSION:= 2.3 PKG_RELEASE:= 1 PKG_MD5SUM:= 934b400f2f8d1bcab20bb056e0910291 PKG_SITES:= http://xorg.freedesktop.org/releases/individual/proto/ +PKG_SUBPKGS:= include $(TOPDIR)/mk/package.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/xfsprogs/Makefile b/package/xfsprogs/Makefile index 7dfe22149..5f702689e 100644 --- a/package/xfsprogs/Makefile +++ b/package/xfsprogs/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= c2308b46ee707597ac50aae418d321b8 PKG_DESCR:= Utilities for XFS filesystems PKG_SECTION:= fs PKG_DEPENDS:= libuuid libpthread -PKG_BUILDDEP+= e2fsprogs +PKG_BUILDDEP:= e2fsprogs PKG_URL:= http://oss.sgi.com/projects/xfs PKG_SITES:= ftp://oss.sgi.com/projects/xfs/cmd_tars/ \ ftp://oss.sgi.com/projects/xfs/previous/cmd_tars/ diff --git a/package/xinetd/Makefile b/package/xinetd/Makefile index 868678b4d..37ab2be35 100644 --- a/package/xinetd/Makefile +++ b/package/xinetd/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= 567382d7972613090215c6c54f9b82d9 PKG_DESCR:= a powerful and secure superserver PKG_SECTION:= net/misc -PKG_URL:= http://www.xinetd.org +PKG_URL:= http://www.xinetd.org/ PKG_SITES:= http://www.xinetd.org/ include $(TOPDIR)/mk/package.mk diff --git a/package/xinit/Makefile b/package/xinit/Makefile index 6a1461826..8c5b5da5c 100644 --- a/package/xinit/Makefile +++ b/package/xinit/Makefile @@ -10,8 +10,8 @@ PKG_MD5SUM:= 7ad82221ebd6600a8d33712ec3b62efb PKG_DESCR:= X Window System initializer PKG_SECTION:= x11/apps PKG_DEPENDS:= xorg-server mcookie xauth xset -PKG_BUILDDEP+= xorg-server -PKG_URL:= http://xorg.freedesktop.org +PKG_BUILDDEP:= xorg-server +PKG_URL:= http://xorg.freedesktop.org/ PKG_SITES:= http://xorg.freedesktop.org/archive/individual/app/ PKG_TARGET_DEPENDS:= !foxboard diff --git a/package/xkeyboard-config/Makefile b/package/xkeyboard-config/Makefile index e53b1cd6e..55e556908 100644 --- a/package/xkeyboard-config/Makefile +++ b/package/xkeyboard-config/Makefile @@ -9,7 +9,7 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= f049d15f1e9d95776a940f222df9404b PKG_DESCR:= X keyboard config PKG_SECTION:= x11/libs -PKG_BUILDDEP+= xkbcomp +PKG_BUILDDEP:= xkbcomp PKG_SITES:= http://xlibs.freedesktop.org/xkbdesc/ include $(TOPDIR)/mk/package.mk diff --git a/package/xorg-server/Makefile b/package/xorg-server/Makefile index cf009036e..351d96371 100644 --- a/package/xorg-server/Makefile +++ b/package/xorg-server/Makefile @@ -9,27 +9,24 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= ba0360b4ec1f6e541b264e45906bf5f2 PKG_DESCR:= Xorg server PKG_SECTION:= x11/server -PKG_DEPENDS:= libopenssl libxfont pixman libpciaccess libxkbfile \ - libfontenc xkeyboard-config xkbcomp libxau libxaw \ - libxmu libxpm libxrender libxt libxxf86dga libxext \ - libxdmcp libxv libsm libice libx11 -PKG_BUILDDEP+= libX11 randrproto renderproto fixesproto damageproto \ - scrnsaverproto resourceproto fontsproto videoproto \ - compositeproto evieext libxkbfile libXfont pixman \ - libpciaccess openssl xf86dgaproto -ifeq (${ADK_PACKAGE_XORG_SERVER_WITH_DRI},y) -PKG_BUILDDEP+= xf86driproto glproto dri2proto MesaLib -endif -PKG_URL:= http://www.x.org +PKG_DEPENDS:= libopenssl libxfont pixman libpciaccess libxkbfile +PKG_DEPENDS+= libfontenc xkeyboard-config xkbcomp libxau libxaw +PKG_DEPENDS+= libxmu libxpm libxrender libxt libxxf86dga libxext +PKG_DEPENDS+= libxdmcp libxv libsm libice libx11 +PKG_BUILDDEP:= libX11 randrproto renderproto fixesproto damageproto +PKG_BUILDDEP+= scrnsaverproto resourceproto fontsproto videoproto +PKG_BUILDDEP+= compositeproto evieext libxkbfile libXfont pixman +PKG_BUILDDEP+= libpciaccess openssl xf86dgaproto +PKG_URL:= http://www.x.org/ PKG_SITES:= http://xorg.freedesktop.org/archive/individual/xserver/ PKG_TARGET_DEPENDS:= !foxboard - -CFLINE_XORG_SERVER:= depends on ADK_TARGET_WITH_VGA +PKG_CFLINE_XORG_SERVER:=depends on ADK_TARGET_WITH_VGA PKG_FLAVOURS:= WITH_DRI PKGFS_WITH_DRI:= mesalib PKGFD_WITH_DRI:= enable DRI/DRI2 support +PKGFB_WITH_DRI:= xf86driproto glproto dri2proto MesaLib include $(TOPDIR)/mk/package.mk diff --git a/package/xproto/Makefile b/package/xproto/Makefile index a3c76afe2..5aa23ad20 100644 --- a/package/xproto/Makefile +++ b/package/xproto/Makefile @@ -8,6 +8,7 @@ PKG_VERSION:= 7.0.16 PKG_RELEASE:= 1 PKG_MD5SUM:= 6e6b6510ccd568f82093ebd7ae58700b PKG_SITES:= ${MASTER_SITE_XORG} +PKG_SUBPKGS:= include $(TOPDIR)/mk/package.mk diff --git a/package/xterm/Makefile b/package/xterm/Makefile index fe9aa5e83..35a302662 100644 --- a/package/xterm/Makefile +++ b/package/xterm/Makefile @@ -13,9 +13,10 @@ PKG_DEPENDS:= xorg-server libxaw PKG_URL:= http://invisible-island.net/xterm/xterm.html PKG_SITES:= ftp://invisible-island.net/xterm/ -DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tgz PKG_TARGET_DEPENDS:= !foxboard !foxg20 !ag241 +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tgz + include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,XTERM,$(PKG_NAME),$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) diff --git a/package/xtrans/Makefile b/package/xtrans/Makefile index 280b98219..b2715edd6 100644 --- a/package/xtrans/Makefile +++ b/package/xtrans/Makefile @@ -8,6 +8,7 @@ PKG_VERSION:= 1.2.5 PKG_RELEASE:= 1 PKG_MD5SUM:= b2f47d49faf1f24e8294b624b21b9b93 PKG_SITES:= ${MASTER_SITE_XORG} +PKG_SUBPKGS:= include $(TOPDIR)/mk/package.mk diff --git a/package/xvinfo/Makefile b/package/xvinfo/Makefile index 124e263a7..18b21d9f3 100644 --- a/package/xvinfo/Makefile +++ b/package/xvinfo/Makefile @@ -10,7 +10,7 @@ PKG_MD5SUM:= cc00d609136ecc0b6b571dc42740a675 PKG_DESCR:= Print out X-Video extension adaptor information PKG_SECTION:= x11/apps PKG_DEPENDS:= xorg-server -KG_BUILDDEP+= xorg-server +PKG_BUILDDEP:= xorg-server PKG_URL:= http://xorg.freedesktop.org/ PKG_SITES:= http://xorg.freedesktop.org/archive/individual/app/ diff --git a/package/zlib/Makefile b/package/zlib/Makefile index 58957b639..a05e9caf2 100644 --- a/package/zlib/Makefile +++ b/package/zlib/Makefile @@ -9,12 +9,13 @@ PKG_RELEASE:= 1 PKG_MD5SUM:= be1e89810e66150f5b0327984d8625a0 PKG_DESCR:= implementation of the deflate compression method PKG_SECTION:= libs -PKG_URL:= http://www.zlib.net -PKG_SITES:= http://www.zlib.net/ \ - ${MASTER_SITE_SOURCEFORGE:=zlib/} +PKG_URL:= http://www.zlib.net/ +PKG_SITES:= ${MASTER_SITE_SOURCEFORGE:=zlib/} + +PKG_SUBPKGS:= ZLIB ZLIB_DEV +PKGSD_ZLIB_DEV:= development files for zlib +PKGSC_ZLIB_DEV:= devel -PKG_DESCR_LIB_DEV:= development files for zlib -PKG_SECTION_LIB_DEV:= devel DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 ifeq ($(ADK_STATIC),y) diff --git a/scripts/split-cfg.sh b/scripts/split-cfg.sh index f5d2db07f..816bdfc02 100644 --- a/scripts/split-cfg.sh +++ b/scripts/split-cfg.sh @@ -2,6 +2,7 @@ # material, please see the LICENCE file in the top-level directory. # Note: this is slow, but it's not the "progress stuff" which cau- # ses the slow-down. +set -x TOPDIR=$1 TARGET=$2 diff --git a/target/Config.in b/target/Config.in index fc3e07b97..8d18ad8c5 100644 --- a/target/Config.in +++ b/target/Config.in @@ -20,6 +20,9 @@ config ADK_TARGET_WITH_MINIPCI config ADK_TARGET_WITH_VGA bool +config ADK_TARGET_WITH_HDD + bool + config ADK_TARGET_WITH_INPUT bool @@ -202,6 +205,7 @@ config ADK_TARGET default "rescue-mipsel" if ADK_mipsel_rescue default "shuttle" if ADK_shuttle + # c library config ADK_uclibc tristate @@ -229,6 +233,8 @@ config ADK_LINUX_NATIVE bool "Native platform" select ADK_NATIVE depends on ADK_HOST_LINUX + select ADK_TARGET_WITH_VGA + select ADK_TARGET_WITH_USB help Make a native build. Use host tools. No toolchain will be created. @@ -274,28 +280,8 @@ config ADK_LINUX_CRIS_FOXBOARD config ADK_LINUX_MIPS64_LEMOTE bool "Lemote Subnotebook Yeeloong" select ADK_lemote + select ADK_HARDWARE_YEELONG select ADK_LINUX_64 - select ADK_KERNEL_USB - select ADK_KERNEL_NLS - select ADK_KERNEL_EXT2_FS - select ADK_KERNEL_SCSI - select ADK_KERNEL_ATA - select ADK_KERNEL_BLK_DEV_SD - select ADK_KERNEL_INPUT_KEYBOARD - select ADK_KERNEL_NETDEVICES - select ADK_KERNEL_NET_PCI - select ADK_KERNEL_NET_ETHERNET - select ADK_KERNEL_MII - select ADK_KERNEL_SWAP - select ADK_TARGET_WITH_USB - select ADK_TARGET_WITH_VGA - select ADK_TARGET_WITH_INPUT - select ADK_TARGET_WITH_RTC - select ADK_PACKAGE_KMOD_USB_CONTROLLER - select ADK_KPACKAGE_KMOD_MAC80211 - select ADK_KPACKAGE_KMOD_SND - select ADK_KPACKAGE_KMOD_SND_CS5535AUDIO - select ADK_KPACKAGE_KMOD_SND_OSSEMUL help Lemote Subnotebook. http://www.lemote.com/english/index.html @@ -385,16 +371,7 @@ config ADK_LINUX_TOOLCHAIN config ADK_LINUX_X86_IBMX40 bool "IBM X40 laptop" select ADK_ibmx40 - select ADK_TARGET_WITH_USB - select ADK_TARGET_WITH_VGA - select ADK_TARGET_WITH_PCI - select ADK_TARGET_WITH_INPUT - select ADK_TARGET_WITH_CARDBUS - select ADK_KERNEL_INPUT_KEYBOARD - select ADK_KERNEL_SCSI - select ADK_KERNEL_NETDEVICES - select ADK_KERNEL_NET_PCI - select ADK_KERNEL_NET_ETHERNET + select ADK_HARDWARE_IBMX40 help Support for a IBM X40 laptop. Status: development diff --git a/target/Makefile b/target/Makefile index 5e7259d8a..dc2d3dd5a 100644 --- a/target/Makefile +++ b/target/Makefile @@ -39,9 +39,13 @@ config-prepare: $(TOPDIR)/.config sed 's/=y/=m/' >${BUILD_DIR}/.kernelconfig.modkernel @sed -n '/^# ADK_KERNEL/s//# CONFIG/p' ${TOPDIR}/.config \ >${BUILD_DIR}/.kernelconfig.nokernel -# if native build, first try /proc/config.gz ifeq ($(ADK_NATIVE),y) - @if [ -f /proc/config.gz ];then zcat /proc/config.gz > ${BUILD_DIR}/.kernelconfig.board; else cp ${ADK_TARGET}/kernel.config.$(ARCH) ${BUILD_DIR}/.kernelconfig.board; fi + @if [ -f /etc/adktarget ];then \ + target=$$(cat /etc/adktarget); \ + cp $(TOPDIR)/target/$$target/kernel.config ${BUILD_DIR}/.kernelconfig.board; \ + else \ + if [ -f /proc/config.gz ];then zcat /proc/config.gz > ${BUILD_DIR}/.kernelconfig.board; else cp ${ADK_TARGET}/kernel.config.$(ARCH) ${BUILD_DIR}/.kernelconfig.board; fi; \ + fi else @cp ${ADK_TARGET}/kernel.config ${BUILD_DIR}/.kernelconfig.board endif diff --git a/target/lemote/kernel.config b/target/lemote/kernel.config index 6b536c015..f6188f044 100644 --- a/target/lemote/kernel.config +++ b/target/lemote/kernel.config @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit # Linux kernel version: 2.6.35 -# Thu Aug 5 22:28:58 2010 +# Thu Aug 12 17:36:41 2010 # CONFIG_MIPS=y @@ -360,7 +360,7 @@ CONFIG_SUSPEND_NVS=y CONFIG_SUSPEND=y CONFIG_SUSPEND_FREEZER=y CONFIG_HIBERNATION=y -CONFIG_PM_STD_PARTITION="/dev/mapper/swap" +CONFIG_PM_STD_PARTITION="/dev/sda3" # CONFIG_PM_RUNTIME is not set CONFIG_PM_OPS=y CONFIG_MIPS_EXTERNAL_TIMER=y @@ -508,7 +508,6 @@ CONFIG_BLK_DEV=y # # CONFIG_BLK_DEV_NBD is not set # CONFIG_BLK_DEV_SX8 is not set -# CONFIG_BLK_DEV_UB is not set # CONFIG_BLK_DEV_RAM is not set # CONFIG_CDROM_PKTCDVD is not set # CONFIG_ATA_OVER_ETH is not set @@ -739,22 +738,11 @@ CONFIG_8139TOO_TUNE_TWISTER=y CONFIG_WLAN=y # CONFIG_ATMEL is not set # CONFIG_PRISM54 is not set -# CONFIG_USB_ZD1201 is not set # CONFIG_HOSTAP is not set # # Enable WiMAX (Networking options) to see the WiMAX drivers # - -# -# USB Network Adapters -# -# CONFIG_USB_CATC is not set -# CONFIG_USB_KAWETH is not set -# CONFIG_USB_PEGASUS is not set -# CONFIG_USB_RTL8150 is not set -# CONFIG_USB_USBNET is not set -# CONFIG_USB_IPHETH is not set # CONFIG_WAN is not set # CONFIG_FDDI is not set # CONFIG_HIPPI is not set @@ -810,8 +798,6 @@ CONFIG_MOUSE_PS2_SYNAPTICS=y # CONFIG_MOUSE_PS2_SENTELIC is not set # CONFIG_MOUSE_PS2_TOUCHKIT is not set # CONFIG_MOUSE_SERIAL is not set -# CONFIG_MOUSE_APPLETOUCH is not set -# CONFIG_MOUSE_BCM5974 is not set # CONFIG_MOUSE_INPORT is not set # CONFIG_MOUSE_LOGIBM is not set # CONFIG_MOUSE_PC110PAD is not set @@ -954,16 +940,7 @@ CONFIG_SSB_POSSIBLE=y # Sonics Silicon Backplane # # CONFIG_SSB is not set -CONFIG_MFD_SUPPORT=y -# CONFIG_MFD_CORE is not set -# CONFIG_MFD_SM501 is not set -# CONFIG_HTC_PASIC3 is not set -# CONFIG_MFD_TMIO is not set -# CONFIG_ABX500_CORE is not set -# CONFIG_MFD_TIMBERDALE is not set -# CONFIG_LPC_SCH is not set -# CONFIG_MFD_RDC321X is not set -# CONFIG_MFD_JANZ_CMODIO is not set +# CONFIG_MFD_SUPPORT is not set # CONFIG_REGULATOR is not set # CONFIG_MEDIA_SUPPORT is not set @@ -1049,133 +1026,24 @@ CONFIG_DUMMY_CONSOLE=y CONFIG_FRAMEBUFFER_CONSOLE=y # CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set # CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set -# CONFIG_FONTS is not set -CONFIG_FONT_8x8=y +CONFIG_FONTS=y +# CONFIG_FONT_8x8 is not set CONFIG_FONT_8x16=y +# CONFIG_FONT_6x11 is not set +# CONFIG_FONT_7x14 is not set +# CONFIG_FONT_PEARL_8x8 is not set +# CONFIG_FONT_ACORN_8x8 is not set +# CONFIG_FONT_MINI_4x6 is not set +# CONFIG_FONT_SUN8x16 is not set +# CONFIG_FONT_SUN12x22 is not set +# CONFIG_FONT_10x18 is not set CONFIG_LOGO=y # CONFIG_LOGO_LINUX_MONO is not set # CONFIG_LOGO_LINUX_VGA16 is not set CONFIG_LOGO_LINUX_CLUT224=y # CONFIG_SOUND is not set -CONFIG_HID_SUPPORT=y -CONFIG_HID=y -# CONFIG_HIDRAW is not set - -# -# USB Input Devices -# -# CONFIG_USB_HID is not set -# CONFIG_HID_PID is not set - -# -# USB HID Boot Protocol drivers -# -# CONFIG_USB_KBD is not set -# CONFIG_USB_MOUSE is not set - -# -# Special HID drivers -# -CONFIG_USB_SUPPORT=y -CONFIG_USB_ARCH_HAS_HCD=y -CONFIG_USB_ARCH_HAS_OHCI=y -CONFIG_USB_ARCH_HAS_EHCI=y -CONFIG_USB=y -# CONFIG_USB_DEBUG is not set -# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set - -# -# Miscellaneous USB options -# -# CONFIG_USB_DEVICEFS is not set -# CONFIG_USB_DEVICE_CLASS is not set -CONFIG_USB_DYNAMIC_MINORS=y -# CONFIG_USB_OTG_WHITELIST is not set -# CONFIG_USB_OTG_BLACKLIST_HUB is not set -# CONFIG_USB_MON is not set -# CONFIG_USB_WUSB is not set -# CONFIG_USB_WUSB_CBAF is not set - -# -# USB Host Controller Drivers -# -# CONFIG_USB_C67X00_HCD is not set -# CONFIG_USB_XHCI_HCD is not set -CONFIG_USB_EHCI_HCD=y -CONFIG_USB_EHCI_ROOT_HUB_TT=y -# CONFIG_USB_EHCI_TT_NEWSCHED is not set -# CONFIG_USB_OXU210HP_HCD is not set -# CONFIG_USB_ISP116X_HCD is not set -# CONFIG_USB_ISP1760_HCD is not set -# CONFIG_USB_ISP1362_HCD is not set -CONFIG_USB_OHCI_HCD=y -# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set -# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set -CONFIG_USB_OHCI_LITTLE_ENDIAN=y -# CONFIG_USB_UHCI_HCD is not set -# CONFIG_USB_SL811_HCD is not set -# CONFIG_USB_R8A66597_HCD is not set -# CONFIG_USB_WHCI_HCD is not set -# CONFIG_USB_HWA_HCD is not set - -# -# USB Device Class drivers -# -# CONFIG_USB_ACM is not set -# CONFIG_USB_PRINTER is not set -# CONFIG_USB_WDM is not set -# CONFIG_USB_TMC is not set - -# -# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may -# - -# -# also be needed; see USB_STORAGE Help for more info -# -# CONFIG_USB_STORAGE is not set -# CONFIG_USB_LIBUSUAL is not set - -# -# USB Imaging devices -# -# CONFIG_USB_MDC800 is not set -# CONFIG_USB_MICROTEK is not set - -# -# USB port drivers -# -# CONFIG_USB_SERIAL is not set - -# -# USB Miscellaneous drivers -# -# CONFIG_USB_EMI62 is not set -# CONFIG_USB_EMI26 is not set -# CONFIG_USB_ADUTUX is not set -# CONFIG_USB_SEVSEG is not set -# CONFIG_USB_RIO500 is not set -# CONFIG_USB_LEGOTOWER is not set -# CONFIG_USB_LCD is not set -# CONFIG_USB_LED is not set -# CONFIG_USB_CYPRESS_CY7C63 is not set -# CONFIG_USB_CYTHERM is not set -# CONFIG_USB_IDMOUSE is not set -# CONFIG_USB_FTDI_ELAN is not set -# CONFIG_USB_APPLEDISPLAY is not set -# CONFIG_USB_SISUSBVGA is not set -# CONFIG_USB_LD is not set -# CONFIG_USB_TRANCEVIBRATOR is not set -# CONFIG_USB_IOWARRIOR is not set -# CONFIG_USB_TEST is not set -# CONFIG_USB_ISIGHTFW is not set -# CONFIG_USB_GADGET is not set - -# -# OTG and related infrastructure -# -# CONFIG_USB_GPIO_VBUS is not set -# CONFIG_NOP_USB_XCEIV is not set +# CONFIG_HID_SUPPORT is not set +# CONFIG_USB_SUPPORT is not set # CONFIG_UWB is not set CONFIG_MMC=y # CONFIG_MMC_DEBUG is not set @@ -1244,21 +1112,13 @@ CONFIG_RTC_DRV_CMOS=y # CONFIG_UIO is not set CONFIG_STAGING=y # CONFIG_STAGING_EXCLUDE_BUILD is not set -# CONFIG_USB_IP_COMMON is not set -# CONFIG_PRISM2_USB is not set # CONFIG_ECHO is not set # CONFIG_COMEDI is not set -# CONFIG_ASUS_OLED is not set # CONFIG_R8187SE is not set -# CONFIG_RTL8192SU is not set -# CONFIG_RTL8192U is not set # CONFIG_RTL8192E is not set -# CONFIG_TRANZPORT is not set # CONFIG_POHMELFS is not set # CONFIG_IDE_PHISON is not set # CONFIG_VT6655 is not set -# CONFIG_VT6656 is not set -# CONFIG_FB_UDL is not set # CONFIG_VME_BUS is not set # diff --git a/target/lemote/patches/lemote.patch b/target/lemote/patches/lemote.patch index 7785becb0..5922697e7 100644 --- a/target/lemote/patches/lemote.patch +++ b/target/lemote/patches/lemote.patch @@ -1468,32419 +1468,6 @@ diff -Nur linux-2.6.35.orig/drivers/ide/ide-iops.c linux-2.6.35/drivers/ide/ide- for (list = nien_quirk_list; *list != NULL; list++) if (strstr(m, *list) != NULL) { drive->dev_flags |= IDE_DFLAG_NIEN_QUIRK; -diff -Nur linux-2.6.35.orig/drivers/net/wireless/Kconfig linux-2.6.35/drivers/net/wireless/Kconfig ---- linux-2.6.35.orig/drivers/net/wireless/Kconfig 2010-08-02 00:11:14.000000000 +0200 -+++ linux-2.6.35/drivers/net/wireless/Kconfig 2010-08-05 21:12:33.893625922 +0200 -@@ -219,6 +219,19 @@ - - source "drivers/net/wireless/rtl818x/Kconfig" - -+config RTL8187B -+ tristate "Realtek 8187B wifi support for yeeloong2f laptop" -+ depends on MAC80211 && USB && LEMOTE_MACH2F -+ depends on RFKILL || !RFKILL -+ select CRYPTO -+ select WIRELESS_EXT -+ select WEXT_PRIV -+ ---help--- -+ This is a driver for RTL8187B based cards, this driver is especially -+ for yeeloon2f laptop. -+ -+ Thanks to Realtek for their support! -+ - config ADM8211 - tristate "ADMtek ADM8211 support" - depends on MAC80211 && PCI && EXPERIMENTAL -diff -Nur linux-2.6.35.orig/drivers/net/wireless/Makefile linux-2.6.35/drivers/net/wireless/Makefile ---- linux-2.6.35.orig/drivers/net/wireless/Makefile 2010-08-02 00:11:14.000000000 +0200 -+++ linux-2.6.35/drivers/net/wireless/Makefile 2010-08-05 21:12:33.933623443 +0200 -@@ -24,6 +24,7 @@ - obj-$(CONFIG_ZD1211RW) += zd1211rw/ - obj-$(CONFIG_RTL8180) += rtl818x/ - obj-$(CONFIG_RTL8187) += rtl818x/ -+obj-$(CONFIG_RTL8187B) += rtl8187b/ - - # 16-bit wireless PCMCIA client drivers - obj-$(CONFIG_PCMCIA_RAYCS) += ray_cs.o -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/dot11d.h linux-2.6.35/drivers/net/wireless/rtl8187b/dot11d.h ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/dot11d.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/dot11d.h 2010-08-05 21:12:33.973622039 +0200 -@@ -0,0 +1,102 @@ -+#ifndef __INC_DOT11D_H -+#define __INC_DOT11D_H -+ -+#include "ieee80211/ieee80211.h" -+ -+//#define ENABLE_DOT11D -+ -+//#define DOT11D_MAX_CHNL_NUM 83 -+ -+typedef struct _CHNL_TXPOWER_TRIPLE { -+ u8 FirstChnl; -+ u8 NumChnls; -+ u8 MaxTxPowerInDbm; -+}CHNL_TXPOWER_TRIPLE, *PCHNL_TXPOWER_TRIPLE; -+ -+typedef enum _DOT11D_STATE { -+ DOT11D_STATE_NONE = 0, -+ DOT11D_STATE_LEARNED, -+ DOT11D_STATE_DONE, -+}DOT11D_STATE; -+ -+typedef struct _RT_DOT11D_INFO { -+ //DECLARE_RT_OBJECT(RT_DOT11D_INFO); -+ -+ bool bEnabled; // dot11MultiDomainCapabilityEnabled -+ -+ u16 CountryIeLen; // > 0 if CountryIeBuf[] contains valid country information element. -+ u8 CountryIeBuf[MAX_IE_LEN]; -+ u8 CountryIeSrcAddr[6]; // Source AP of the country IE. -+ u8 CountryIeWatchdog; -+ -+ u8 channel_map[MAX_CHANNEL_NUMBER+1]; //!!!Value 0: Invalid, 1: Valid (active scan), 2: Valid (passive scan) -+ //u8 ChnlListLen; // #Bytes valid in ChnlList[]. -+ //u8 ChnlList[DOT11D_MAX_CHNL_NUM]; -+ u8 MaxTxPwrDbmList[MAX_CHANNEL_NUMBER+1]; -+ -+ DOT11D_STATE State; -+}RT_DOT11D_INFO, *PRT_DOT11D_INFO; -+#define eqMacAddr(a,b) ( ((a)[0]==(b)[0] && (a)[1]==(b)[1] && (a)[2]==(b)[2] && (a)[3]==(b)[3] && (a)[4]==(b)[4] && (a)[5]==(b)[5]) ? 1:0 ) -+#define cpMacAddr(des,src) ((des)[0]=(src)[0],(des)[1]=(src)[1],(des)[2]=(src)[2],(des)[3]=(src)[3],(des)[4]=(src)[4],(des)[5]=(src)[5]) -+#define GET_DOT11D_INFO(__pIeeeDev) ((PRT_DOT11D_INFO)((__pIeeeDev)->pDot11dInfo)) -+ -+#define IS_DOT11D_ENABLE(__pIeeeDev) GET_DOT11D_INFO(__pIeeeDev)->bEnabled -+#define IS_COUNTRY_IE_VALID(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen > 0) -+ -+#define IS_EQUAL_CIE_SRC(__pIeeeDev, __pTa) eqMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa) -+#define UPDATE_CIE_SRC(__pIeeeDev, __pTa) cpMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa) -+ -+#define IS_COUNTRY_IE_CHANGED(__pIeeeDev, __Ie) \ -+ (((__Ie).Length == 0 || (__Ie).Length != GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen) ? \ -+ FALSE : \ -+ (!memcmp(GET_DOT11D_INFO(__pIeeeDev)->CountryIeBuf, (__Ie).Octet, (__Ie).Length))) -+ -+#define CIE_WATCHDOG_TH 1 -+#define GET_CIE_WATCHDOG(__pIeeeDev) GET_DOT11D_INFO(__pIeeeDev)->CountryIeWatchdog -+#define RESET_CIE_WATCHDOG(__pIeeeDev) GET_CIE_WATCHDOG(__pIeeeDev) = 0 -+#define UPDATE_CIE_WATCHDOG(__pIeeeDev) ++GET_CIE_WATCHDOG(__pIeeeDev) -+ -+#define IS_DOT11D_STATE_DONE(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->State == DOT11D_STATE_DONE) -+ -+ -+void -+Dot11d_Init( -+ struct ieee80211_device *dev -+ ); -+ -+void -+Dot11d_Reset( -+ struct ieee80211_device *dev -+ ); -+ -+void -+Dot11d_UpdateCountryIe( -+ struct ieee80211_device *dev, -+ u8 * pTaddr, -+ u16 CoutryIeLen, -+ u8 * pCoutryIe -+ ); -+ -+u8 -+DOT11D_GetMaxTxPwrInDbm( -+ struct ieee80211_device *dev, -+ u8 Channel -+ ); -+ -+void -+DOT11D_ScanComplete( -+ struct ieee80211_device * dev -+ ); -+ -+int IsLegalChannel( -+ struct ieee80211_device * dev, -+ u8 channel -+); -+ -+int ToLegalChannel( -+ struct ieee80211_device * dev, -+ u8 channel -+); -+ -+void dump_chnl_map(u8 * channel_map); -+#endif // #ifndef __INC_DOT11D_H -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/arc4.c linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/arc4.c ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/arc4.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/arc4.c 2010-08-05 21:12:34.013621816 +0200 -@@ -0,0 +1,103 @@ -+/* -+ * Cryptographic API -+ * -+ * ARC4 Cipher Algorithm -+ * -+ * Jon Oberheide <jon@oberheide.org> -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ */ -+#include <linux/module.h> -+#include <linux/init.h> -+#include "rtl_crypto.h" -+ -+#define ARC4_MIN_KEY_SIZE 1 -+#define ARC4_MAX_KEY_SIZE 256 -+#define ARC4_BLOCK_SIZE 1 -+ -+struct arc4_ctx { -+ u8 S[256]; -+ u8 x, y; -+}; -+ -+static int arc4_set_key(void *ctx_arg, const u8 *in_key, unsigned int key_len, u32 *flags) -+{ -+ struct arc4_ctx *ctx = ctx_arg; -+ int i, j = 0, k = 0; -+ -+ ctx->x = 1; -+ ctx->y = 0; -+ -+ for(i = 0; i < 256; i++) -+ ctx->S[i] = i; -+ -+ for(i = 0; i < 256; i++) -+ { -+ u8 a = ctx->S[i]; -+ j = (j + in_key[k] + a) & 0xff; -+ ctx->S[i] = ctx->S[j]; -+ ctx->S[j] = a; -+ if(++k >= key_len) -+ k = 0; -+ } -+ -+ return 0; -+} -+ -+static void arc4_crypt(void *ctx_arg, u8 *out, const u8 *in) -+{ -+ struct arc4_ctx *ctx = ctx_arg; -+ -+ u8 *const S = ctx->S; -+ u8 x = ctx->x; -+ u8 y = ctx->y; -+ u8 a, b; -+ -+ a = S[x]; -+ y = (y + a) & 0xff; -+ b = S[y]; -+ S[x] = b; -+ S[y] = a; -+ x = (x + 1) & 0xff; -+ *out++ = *in ^ S[(a + b) & 0xff]; -+ -+ ctx->x = x; -+ ctx->y = y; -+} -+ -+static struct crypto_alg arc4_alg = { -+ .cra_name = "arc4", -+ .cra_flags = CRYPTO_ALG_TYPE_CIPHER, -+ .cra_blocksize = ARC4_BLOCK_SIZE, -+ .cra_ctxsize = sizeof(struct arc4_ctx), -+ .cra_module = THIS_MODULE, -+ .cra_list = LIST_HEAD_INIT(arc4_alg.cra_list), -+ .cra_u = { .cipher = { -+ .cia_min_keysize = ARC4_MIN_KEY_SIZE, -+ .cia_max_keysize = ARC4_MAX_KEY_SIZE, -+ .cia_setkey = arc4_set_key, -+ .cia_encrypt = arc4_crypt, -+ .cia_decrypt = arc4_crypt } } -+}; -+ -+static int __init arc4_init(void) -+{ -+ return crypto_register_alg(&arc4_alg); -+} -+ -+ -+static void __exit arc4_exit(void) -+{ -+ crypto_unregister_alg(&arc4_alg); -+} -+ -+module_init(arc4_init); -+module_exit(arc4_exit); -+ -+MODULE_LICENSE("GPL"); -+MODULE_DESCRIPTION("ARC4 Cipher Algorithm"); -+MODULE_AUTHOR("Jon Oberheide <jon@oberheide.org>"); -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/dot11d.c linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/dot11d.c ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/dot11d.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/dot11d.c 2010-08-05 21:12:34.063620315 +0200 -@@ -0,0 +1,244 @@ -+#ifdef ENABLE_DOT11D -+//----------------------------------------------------------------------------- -+// File: -+// Dot11d.c -+// -+// Description: -+// Implement 802.11d. -+// -+//----------------------------------------------------------------------------- -+ -+#include "dot11d.h" -+ -+void -+Dot11d_Init(struct ieee80211_device *ieee) -+{ -+ PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(ieee); -+ -+ pDot11dInfo->bEnabled = 0; -+ -+ pDot11dInfo->State = DOT11D_STATE_NONE; -+ pDot11dInfo->CountryIeLen = 0; -+ memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER+1); -+ memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER+1); -+ RESET_CIE_WATCHDOG(ieee); -+ -+ //printk("Dot11d_Init()\n"); -+} -+ -+// -+// Description: -+// Reset to the state as we are just entering a regulatory domain. -+// -+void -+Dot11d_Reset(struct ieee80211_device *ieee) -+{ -+ u32 i; -+ PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(ieee); -+ -+ // Clear old channel map -+ memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER+1); -+ memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER+1); -+ // Set new channel map -+ for (i=1; i<=11; i++) { -+ (pDot11dInfo->channel_map)[i] = 1; -+ } -+ for (i=12; i<=14; i++) { -+ (pDot11dInfo->channel_map)[i] = 2; -+ } -+ -+ pDot11dInfo->State = DOT11D_STATE_NONE; -+ pDot11dInfo->CountryIeLen = 0; -+ RESET_CIE_WATCHDOG(ieee); -+ -+ //printk("Dot11d_Reset()\n"); -+} -+ -+// -+// Description: -+// Update country IE from Beacon or Probe Resopnse -+// and configure PHY for operation in the regulatory domain. -+// -+// TODO: -+// Configure Tx power. -+// -+// Assumption: -+// 1. IS_DOT11D_ENABLE() is TRUE. -+// 2. Input IE is an valid one. -+// -+void -+Dot11d_UpdateCountryIe( -+ struct ieee80211_device *dev, -+ u8 * pTaddr, -+ u16 CoutryIeLen, -+ u8 * pCoutryIe -+ ) -+{ -+ PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); -+ u8 i, j, NumTriples, MaxChnlNum; -+ PCHNL_TXPOWER_TRIPLE pTriple; -+ -+ if((CoutryIeLen - 3)%3 != 0) -+ { -+ printk("Dot11d_UpdateCountryIe(): Invalid country IE, skip it........1\n"); -+ Dot11d_Reset(dev); -+ return; -+ } -+ -+ memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER+1); -+ memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER+1); -+ MaxChnlNum = 0; -+ NumTriples = (CoutryIeLen - 3) / 3; // skip 3-byte country string. -+ pTriple = (PCHNL_TXPOWER_TRIPLE)(pCoutryIe + 3); -+ for(i = 0; i < NumTriples; i++) -+ { -+ if(MaxChnlNum >= pTriple->FirstChnl) -+ { // It is not in a monotonically increasing order, so stop processing. -+ printk("Dot11d_UpdateCountryIe(): Invalid country IE, skip it........1\n"); -+ Dot11d_Reset(dev); -+ return; -+ } -+ if(MAX_CHANNEL_NUMBER < (pTriple->FirstChnl + pTriple->NumChnls)) -+ { // It is not a valid set of channel id, so stop processing. -+ printk("Dot11d_UpdateCountryIe(): Invalid country IE, skip it........2\n"); -+ Dot11d_Reset(dev); -+ return; -+ } -+ -+ for(j = 0 ; j < pTriple->NumChnls; j++) -+ { -+ pDot11dInfo->channel_map[pTriple->FirstChnl + j] = 1; -+ pDot11dInfo->MaxTxPwrDbmList[pTriple->FirstChnl + j] = pTriple->MaxTxPowerInDbm; -+ MaxChnlNum = pTriple->FirstChnl + j; -+ } -+ -+ pTriple = (PCHNL_TXPOWER_TRIPLE)((u8*)pTriple + 3); -+ } -+#if 1 -+ //printk("Dot11d_UpdateCountryIe(): Channel List:\n"); -+ printk("Channel List:"); -+ for(i=1; i<= MAX_CHANNEL_NUMBER; i++) -+ if(pDot11dInfo->channel_map[i] > 0) -+ printk(" %d", i); -+ printk("\n"); -+#endif -+ -+ UPDATE_CIE_SRC(dev, pTaddr); -+ -+ pDot11dInfo->CountryIeLen = CoutryIeLen; -+ memcpy(pDot11dInfo->CountryIeBuf, pCoutryIe,CoutryIeLen); -+ pDot11dInfo->State = DOT11D_STATE_LEARNED; -+} -+ -+void dump_chnl_map(u8 * channel_map) -+{ -+ int i; -+ printk("Channel List:"); -+ for(i=1; i<= MAX_CHANNEL_NUMBER; i++) -+ if(channel_map[i] > 0) -+ printk(" %d(%d)", i, channel_map[i]); -+ printk("\n"); -+} -+ -+u8 -+DOT11D_GetMaxTxPwrInDbm( -+ struct ieee80211_device *dev, -+ u8 Channel -+ ) -+{ -+ PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); -+ u8 MaxTxPwrInDbm = 255; -+ -+ if(MAX_CHANNEL_NUMBER < Channel) -+ { -+ printk("DOT11D_GetMaxTxPwrInDbm(): Invalid Channel\n"); -+ return MaxTxPwrInDbm; -+ } -+ if(pDot11dInfo->channel_map[Channel]) -+ { -+ MaxTxPwrInDbm = pDot11dInfo->MaxTxPwrDbmList[Channel]; -+ } -+ -+ return MaxTxPwrInDbm; -+} -+ -+ -+void -+DOT11D_ScanComplete( -+ struct ieee80211_device * dev -+ ) -+{ -+ PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); -+ -+ switch(pDot11dInfo->State) -+ { -+ case DOT11D_STATE_LEARNED: -+ pDot11dInfo->State = DOT11D_STATE_DONE; -+ break; -+ -+ case DOT11D_STATE_DONE: -+ if( GET_CIE_WATCHDOG(dev) == 0 ) -+ { // Reset country IE if previous one is gone. -+ Dot11d_Reset(dev); -+ } -+ break; -+ case DOT11D_STATE_NONE: -+ break; -+ } -+} -+ -+int IsLegalChannel( -+ struct ieee80211_device * dev, -+ u8 channel -+) -+{ -+ PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); -+ -+ if(MAX_CHANNEL_NUMBER < channel) -+ { -+ printk("IsLegalChannel(): Invalid Channel\n"); -+ return 0; -+ } -+ if(pDot11dInfo->channel_map[channel] > 0) -+ return 1; -+ return 0; -+} -+ -+int ToLegalChannel( -+ struct ieee80211_device * dev, -+ u8 channel -+) -+{ -+ PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); -+ u8 default_chn = 0; -+ u32 i = 0; -+ -+ for (i=1; i<= MAX_CHANNEL_NUMBER; i++) -+ { -+ if(pDot11dInfo->channel_map[i] > 0) -+ { -+ default_chn = i; -+ break; -+ } -+ } -+ -+ if(MAX_CHANNEL_NUMBER < channel) -+ { -+ printk("IsLegalChannel(): Invalid Channel\n"); -+ return default_chn; -+ } -+ -+ if(pDot11dInfo->channel_map[channel] > 0) -+ return channel; -+ -+ return default_chn; -+} -+ -+EXPORT_SYMBOL(Dot11d_Init); -+EXPORT_SYMBOL(Dot11d_Reset); -+EXPORT_SYMBOL(Dot11d_UpdateCountryIe); -+EXPORT_SYMBOL(DOT11D_GetMaxTxPwrInDbm); -+EXPORT_SYMBOL(DOT11D_ScanComplete); -+EXPORT_SYMBOL(IsLegalChannel); -+EXPORT_SYMBOL(ToLegalChannel); -+#endif -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/dot11d.h linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/dot11d.h ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/dot11d.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/dot11d.h 2010-08-05 21:12:34.103620371 +0200 -@@ -0,0 +1,102 @@ -+#ifndef __INC_DOT11D_H -+#define __INC_DOT11D_H -+ -+#include "ieee80211.h" -+ -+//#define ENABLE_DOT11D -+ -+//#define DOT11D_MAX_CHNL_NUM 83 -+ -+typedef struct _CHNL_TXPOWER_TRIPLE { -+ u8 FirstChnl; -+ u8 NumChnls; -+ u8 MaxTxPowerInDbm; -+}CHNL_TXPOWER_TRIPLE, *PCHNL_TXPOWER_TRIPLE; -+ -+typedef enum _DOT11D_STATE { -+ DOT11D_STATE_NONE = 0, -+ DOT11D_STATE_LEARNED, -+ DOT11D_STATE_DONE, -+}DOT11D_STATE; -+ -+typedef struct _RT_DOT11D_INFO { -+ //DECLARE_RT_OBJECT(RT_DOT11D_INFO); -+ -+ bool bEnabled; // dot11MultiDomainCapabilityEnabled -+ -+ u16 CountryIeLen; // > 0 if CountryIeBuf[] contains valid country information element. -+ u8 CountryIeBuf[MAX_IE_LEN]; -+ u8 CountryIeSrcAddr[6]; // Source AP of the country IE. -+ u8 CountryIeWatchdog; -+ -+ u8 channel_map[MAX_CHANNEL_NUMBER+1]; //!!!Value 0: Invalid, 1: Valid (active scan), 2: Valid (passive scan) -+ //u8 ChnlListLen; // #Bytes valid in ChnlList[]. -+ //u8 ChnlList[DOT11D_MAX_CHNL_NUM]; -+ u8 MaxTxPwrDbmList[MAX_CHANNEL_NUMBER+1]; -+ -+ DOT11D_STATE State; -+}RT_DOT11D_INFO, *PRT_DOT11D_INFO; -+#define eqMacAddr(a,b) ( ((a)[0]==(b)[0] && (a)[1]==(b)[1] && (a)[2]==(b)[2] && (a)[3]==(b)[3] && (a)[4]==(b)[4] && (a)[5]==(b)[5]) ? 1:0 ) -+#define cpMacAddr(des,src) ((des)[0]=(src)[0],(des)[1]=(src)[1],(des)[2]=(src)[2],(des)[3]=(src)[3],(des)[4]=(src)[4],(des)[5]=(src)[5]) -+#define GET_DOT11D_INFO(__pIeeeDev) ((PRT_DOT11D_INFO)((__pIeeeDev)->pDot11dInfo)) -+ -+#define IS_DOT11D_ENABLE(__pIeeeDev) GET_DOT11D_INFO(__pIeeeDev)->bEnabled -+#define IS_COUNTRY_IE_VALID(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen > 0) -+ -+#define IS_EQUAL_CIE_SRC(__pIeeeDev, __pTa) eqMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa) -+#define UPDATE_CIE_SRC(__pIeeeDev, __pTa) cpMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa) -+ -+#define IS_COUNTRY_IE_CHANGED(__pIeeeDev, __Ie) \ -+ (((__Ie).Length == 0 || (__Ie).Length != GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen) ? \ -+ FALSE : \ -+ (!memcmp(GET_DOT11D_INFO(__pIeeeDev)->CountryIeBuf, (__Ie).Octet, (__Ie).Length))) -+ -+#define CIE_WATCHDOG_TH 1 -+#define GET_CIE_WATCHDOG(__pIeeeDev) GET_DOT11D_INFO(__pIeeeDev)->CountryIeWatchdog -+#define RESET_CIE_WATCHDOG(__pIeeeDev) GET_CIE_WATCHDOG(__pIeeeDev) = 0 -+#define UPDATE_CIE_WATCHDOG(__pIeeeDev) ++GET_CIE_WATCHDOG(__pIeeeDev) -+ -+#define IS_DOT11D_STATE_DONE(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->State == DOT11D_STATE_DONE) -+ -+ -+void -+Dot11d_Init( -+ struct ieee80211_device *dev -+ ); -+ -+void -+Dot11d_Reset( -+ struct ieee80211_device *dev -+ ); -+ -+void -+Dot11d_UpdateCountryIe( -+ struct ieee80211_device *dev, -+ u8 * pTaddr, -+ u16 CoutryIeLen, -+ u8 * pCoutryIe -+ ); -+ -+u8 -+DOT11D_GetMaxTxPwrInDbm( -+ struct ieee80211_device *dev, -+ u8 Channel -+ ); -+ -+void -+DOT11D_ScanComplete( -+ struct ieee80211_device * dev -+ ); -+ -+int IsLegalChannel( -+ struct ieee80211_device * dev, -+ u8 channel -+); -+ -+int ToLegalChannel( -+ struct ieee80211_device * dev, -+ u8 channel -+); -+ -+void dump_chnl_map(u8 * channel_map); -+#endif // #ifndef __INC_DOT11D_H -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_crypt.c linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_crypt.c ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_crypt.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_crypt.c 2010-08-05 21:12:34.143621803 +0200 -@@ -0,0 +1,275 @@ -+/* -+ * Host AP crypto routines -+ * -+ * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> -+ * Portions Copyright (C) 2004, Intel Corporation <jketreno@linux.intel.com> -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. See README and COPYING for -+ * more details. -+ * -+ */ -+ -+//#include <linux/config.h> -+#include <linux/version.h> -+#include <linux/module.h> -+#include <linux/init.h> -+#include <linux/slab.h> -+#include <asm/string.h> -+#include <asm/errno.h> -+ -+#include "ieee80211.h" -+ -+MODULE_AUTHOR("Jouni Malinen"); -+MODULE_DESCRIPTION("HostAP crypto"); -+MODULE_LICENSE("GPL"); -+ -+struct ieee80211_crypto_alg { -+ struct list_head list; -+ struct ieee80211_crypto_ops *ops; -+}; -+ -+ -+struct ieee80211_crypto { -+ struct list_head algs; -+ spinlock_t lock; -+}; -+ -+static struct ieee80211_crypto *hcrypt; -+ -+void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, -+ int force) -+{ -+ struct list_head *ptr, *n; -+ struct ieee80211_crypt_data *entry; -+ -+ for (ptr = ieee->crypt_deinit_list.next, n = ptr->next; -+ ptr != &ieee->crypt_deinit_list; ptr = n, n = ptr->next) { -+ entry = list_entry(ptr, struct ieee80211_crypt_data, list); -+ -+ if (atomic_read(&entry->refcnt) != 0 && !force) -+ continue; -+ -+ list_del(ptr); -+ -+ if (entry->ops) { -+ entry->ops->deinit(entry->priv); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) -+ module_put(entry->ops->owner); -+#else -+ __MOD_DEC_USE_COUNT(entry->ops->owner); -+#endif -+ } -+ kfree(entry); -+ } -+} -+ -+void ieee80211_crypt_deinit_handler(unsigned long data) -+{ -+ struct ieee80211_device *ieee = (struct ieee80211_device *)data; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&ieee->lock, flags); -+ ieee80211_crypt_deinit_entries(ieee, 0); -+ if (!list_empty(&ieee->crypt_deinit_list)) { -+ printk(KERN_DEBUG "%s: entries remaining in delayed crypt " -+ "deletion list\n", ieee->dev->name); -+ ieee->crypt_deinit_timer.expires = jiffies + HZ; -+ add_timer(&ieee->crypt_deinit_timer); -+ } -+ spin_unlock_irqrestore(&ieee->lock, flags); -+ -+} -+ -+void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, -+ struct ieee80211_crypt_data **crypt) -+{ -+ struct ieee80211_crypt_data *tmp; -+ unsigned long flags; -+ -+ if (*crypt == NULL) -+ return; -+ -+ tmp = *crypt; -+ *crypt = NULL; -+ -+ /* must not run ops->deinit() while there may be pending encrypt or -+ * decrypt operations. Use a list of delayed deinits to avoid needing -+ * locking. */ -+ -+ spin_lock_irqsave(&ieee->lock, flags); -+ list_add(&tmp->list, &ieee->crypt_deinit_list); -+ if (!timer_pending(&ieee->crypt_deinit_timer)) { -+ ieee->crypt_deinit_timer.expires = jiffies + HZ; -+ add_timer(&ieee->crypt_deinit_timer); -+ } -+ spin_unlock_irqrestore(&ieee->lock, flags); -+} -+ -+int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops) -+{ -+ unsigned long flags; -+ struct ieee80211_crypto_alg *alg; -+ -+ if (hcrypt == NULL) -+ return -1; -+ -+ alg = kmalloc(sizeof(*alg), GFP_KERNEL); -+ if (alg == NULL) -+ return -ENOMEM; -+ -+ memset(alg, 0, sizeof(*alg)); -+ alg->ops = ops; -+ -+ spin_lock_irqsave(&hcrypt->lock, flags); -+ list_add(&alg->list, &hcrypt->algs); -+ spin_unlock_irqrestore(&hcrypt->lock, flags); -+ -+ printk(KERN_DEBUG "ieee80211_crypt: registered algorithm '%s'\n", -+ ops->name); -+ -+ return 0; -+} -+ -+int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops) -+{ -+ unsigned long flags; -+ struct list_head *ptr; -+ struct ieee80211_crypto_alg *del_alg = NULL; -+ -+ if (hcrypt == NULL) -+ return -1; -+ -+ spin_lock_irqsave(&hcrypt->lock, flags); -+ for (ptr = hcrypt->algs.next; ptr != &hcrypt->algs; ptr = ptr->next) { -+ struct ieee80211_crypto_alg *alg = -+ (struct ieee80211_crypto_alg *) ptr; -+ if (alg->ops == ops) { -+ list_del(&alg->list); -+ del_alg = alg; -+ break; -+ } -+ } -+ spin_unlock_irqrestore(&hcrypt->lock, flags); -+ -+ if (del_alg) { -+ printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm " -+ "'%s'\n", ops->name); -+ kfree(del_alg); -+ } -+ -+ return del_alg ? 0 : -1; -+} -+ -+ -+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name) -+{ -+ unsigned long flags; -+ struct list_head *ptr; -+ struct ieee80211_crypto_alg *found_alg = NULL; -+ -+ if (hcrypt == NULL) -+ return NULL; -+ -+ spin_lock_irqsave(&hcrypt->lock, flags); -+ for (ptr = hcrypt->algs.next; ptr != &hcrypt->algs; ptr = ptr->next) { -+ struct ieee80211_crypto_alg *alg = -+ (struct ieee80211_crypto_alg *) ptr; -+ if (strcmp(alg->ops->name, name) == 0) { -+ found_alg = alg; -+ break; -+ } -+ } -+ spin_unlock_irqrestore(&hcrypt->lock, flags); -+ -+ if (found_alg) -+ return found_alg->ops; -+ else -+ return NULL; -+} -+ -+ -+static void * ieee80211_crypt_null_init(int keyidx) { return (void *) 1; } -+static void ieee80211_crypt_null_deinit(void *priv) {} -+ -+static struct ieee80211_crypto_ops ieee80211_crypt_null = { -+ .name = "NULL", -+ .init = ieee80211_crypt_null_init, -+ .deinit = ieee80211_crypt_null_deinit, -+ .encrypt_mpdu = NULL, -+ .decrypt_mpdu = NULL, -+ .encrypt_msdu = NULL, -+ .decrypt_msdu = NULL, -+ .set_key = NULL, -+ .get_key = NULL, -+ .extra_prefix_len = 0, -+ .extra_postfix_len = 0, -+ .owner = THIS_MODULE, -+}; -+ -+ -+int __init ieee80211_crypto_init(void) -+{ -+ int ret = -ENOMEM; -+ -+ hcrypt = kmalloc(sizeof(*hcrypt), GFP_KERNEL); -+ if (!hcrypt) -+ goto out; -+ -+ memset(hcrypt, 0, sizeof(*hcrypt)); -+ INIT_LIST_HEAD(&hcrypt->algs); -+ spin_lock_init(&hcrypt->lock); -+ -+ ret = ieee80211_register_crypto_ops(&ieee80211_crypt_null); -+ if (ret < 0) { -+ kfree(hcrypt); -+ hcrypt = NULL; -+ } -+out: -+ return ret; -+} -+ -+ -+void __exit ieee80211_crypto_deinit(void) -+{ -+ struct list_head *ptr, *n; -+ -+ if (hcrypt == NULL) -+ return; -+ -+ for (ptr = hcrypt->algs.next, n = ptr->next; ptr != &hcrypt->algs; -+ ptr = n, n = ptr->next) { -+ struct ieee80211_crypto_alg *alg = -+ (struct ieee80211_crypto_alg *) ptr; -+ list_del(ptr); -+ printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm " -+ "'%s' (deinit)\n", alg->ops->name); -+ kfree(alg); -+ } -+ -+ kfree(hcrypt); -+} -+ -+#if 0 -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) -+EXPORT_SYMBOL(ieee80211_crypt_deinit_entries); -+EXPORT_SYMBOL(ieee80211_crypt_deinit_handler); -+EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit); -+ -+EXPORT_SYMBOL(ieee80211_register_crypto_ops); -+EXPORT_SYMBOL(ieee80211_unregister_crypto_ops); -+EXPORT_SYMBOL(ieee80211_get_crypto_ops); -+#else -+EXPORT_SYMBOL_NOVERS(ieee80211_crypt_deinit_entries); -+EXPORT_SYMBOL_NOVERS(ieee80211_crypt_deinit_handler); -+EXPORT_SYMBOL_NOVERS(ieee80211_crypt_delayed_deinit); -+ -+EXPORT_SYMBOL_NOVERS(ieee80211_register_crypto_ops); -+EXPORT_SYMBOL_NOVERS(ieee80211_unregister_crypto_ops); -+EXPORT_SYMBOL_NOVERS(ieee80211_get_crypto_ops); -+#endif -+ -+module_init(ieee80211_crypto_init); -+module_exit(ieee80211_crypto_deinit); -+#endif -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_crypt_ccmp.c linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_crypt_ccmp.c ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_crypt_ccmp.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_crypt_ccmp.c 2010-08-05 21:12:34.183623662 +0200 -@@ -0,0 +1,524 @@ -+/* -+ * Host AP crypt: host-based CCMP encryption implementation for Host AP driver -+ * -+ * Copyright (c) 2003-2004, Jouni Malinen <jkmaline@cc.hut.fi> -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. See README and COPYING for -+ * more details. -+ */ -+ -+//#include <linux/config.h> -+#include <linux/version.h> -+#include <linux/module.h> -+#include <linux/init.h> -+#include <linux/slab.h> -+#include <linux/random.h> -+#include <linux/skbuff.h> -+#include <linux/netdevice.h> -+#include <linux/if_ether.h> -+#include <linux/if_arp.h> -+#include <asm/string.h> -+#include <linux/wireless.h> -+ -+#include "ieee80211.h" -+ -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) -+#include "rtl_crypto.h" -+#else -+#include <linux/crypto.h> -+#endif -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -+ #include <asm/scatterlist.h> -+#else -+ #include <linux/scatterlist.h> -+#endif -+ -+//#include <asm/scatterlist.h> -+ -+MODULE_AUTHOR("Jouni Malinen"); -+MODULE_DESCRIPTION("Host AP crypt: CCMP"); -+MODULE_LICENSE("GPL"); -+ -+#define AES_BLOCK_LEN 16 -+#define CCMP_HDR_LEN 8 -+#define CCMP_MIC_LEN 8 -+#define CCMP_TK_LEN 16 -+#define CCMP_PN_LEN 6 -+ -+struct ieee80211_ccmp_data { -+ u8 key[CCMP_TK_LEN]; -+ int key_set; -+ -+ u8 tx_pn[CCMP_PN_LEN]; -+ u8 rx_pn[CCMP_PN_LEN]; -+ -+ u32 dot11RSNAStatsCCMPFormatErrors; -+ u32 dot11RSNAStatsCCMPReplays; -+ u32 dot11RSNAStatsCCMPDecryptErrors; -+ -+ int key_idx; -+ -+ struct crypto_tfm *tfm; -+ -+ /* scratch buffers for virt_to_page() (crypto API) */ -+ u8 tx_b0[AES_BLOCK_LEN], tx_b[AES_BLOCK_LEN], -+ tx_e[AES_BLOCK_LEN], tx_s0[AES_BLOCK_LEN]; -+ u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN]; -+}; -+ -+void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm, -+ const u8 pt[16], u8 ct[16]) -+{ -+ #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) -+ struct scatterlist src, dst; -+ -+ src.page = virt_to_page(pt); -+ src.offset = offset_in_page(pt); -+ src.length = AES_BLOCK_LEN; -+ -+ dst.page = virt_to_page(ct); -+ dst.offset = offset_in_page(ct); -+ dst.length = AES_BLOCK_LEN; -+ -+ crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN); -+ #else -+ crypto_cipher_encrypt_one((void*)tfm, ct, pt); -+ #endif -+} -+ -+static void * ieee80211_ccmp_init(int key_idx) -+{ -+ struct ieee80211_ccmp_data *priv; -+ -+ priv = kmalloc(sizeof(*priv), GFP_ATOMIC); -+ if (priv == NULL) -+ goto fail; -+ memset(priv, 0, sizeof(*priv)); -+ priv->key_idx = key_idx; -+ -+ #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) -+ priv->tfm = crypto_alloc_tfm("aes", 0); -+ if (priv->tfm == NULL) { -+ printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate " -+ "crypto API aes\n"); -+ goto fail; -+ } -+ #else -+ priv->tfm = (void*)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); -+ if (IS_ERR(priv->tfm)) { -+ printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate " -+ "crypto API aes\n"); -+ priv->tfm = NULL; -+ goto fail; -+ } -+ #endif -+ return priv; -+ -+fail: -+ if (priv) { -+ if (priv->tfm) -+ #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) -+ crypto_free_tfm(priv->tfm); -+ #else -+ crypto_free_cipher((void*)priv->tfm); -+ #endif -+ kfree(priv); -+ } -+ -+ return NULL; -+} -+ -+ -+static void ieee80211_ccmp_deinit(void *priv) -+{ -+ struct ieee80211_ccmp_data *_priv = priv; -+ if (_priv && _priv->tfm) -+ #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) -+ crypto_free_tfm(_priv->tfm); -+ #else -+ crypto_free_cipher((void*)_priv->tfm); -+ #endif -+ kfree(priv); -+} -+ -+ -+static inline void xor_block(u8 *b, u8 *a, size_t len) -+{ -+ int i; -+ for (i = 0; i < len; i++) -+ b[i] ^= a[i]; -+} -+ -+#ifndef JOHN_CCMP -+static void ccmp_init_blocks(struct crypto_tfm *tfm, -+ struct ieee80211_hdr *hdr, -+ u8 *pn, size_t dlen, u8 *b0, u8 *auth, -+ u8 *s0) -+{ -+ u8 *pos, qc = 0; -+ size_t aad_len; -+ u16 fc; -+ int a4_included, qc_included; -+ u8 aad[2 * AES_BLOCK_LEN]; -+ -+ fc = le16_to_cpu(hdr->frame_ctl); -+ a4_included = ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == -+ (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)); -+ /* -+ qc_included = ((WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) && -+ (WLAN_FC_GET_STYPE(fc) & 0x08)); -+ */ -+ // fixed by David :2006.9.6 -+ qc_included = ((WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) && -+ (WLAN_FC_GET_STYPE(fc) & 0x80)); -+ aad_len = 22; -+ if (a4_included) -+ aad_len += 6; -+ if (qc_included) { -+ pos = (u8 *) &hdr->addr4; -+ if (a4_included) -+ pos += 6; -+ qc = *pos & 0x0f; -+ aad_len += 2; -+ } -+ /* CCM Initial Block: -+ * Flag (Include authentication header, M=3 (8-octet MIC), -+ * L=1 (2-octet Dlen)) -+ * Nonce: 0x00 | A2 | PN -+ * Dlen */ -+ b0[0] = 0x59; -+ b0[1] = qc; -+ memcpy(b0 + 2, hdr->addr2, ETH_ALEN); -+ memcpy(b0 + 8, pn, CCMP_PN_LEN); -+ b0[14] = (dlen >> 8) & 0xff; -+ b0[15] = dlen & 0xff; -+ -+ /* AAD: -+ * FC with bits 4..6 and 11..13 masked to zero; 14 is always one -+ * A1 | A2 | A3 -+ * SC with bits 4..15 (seq#) masked to zero -+ * A4 (if present) -+ * QC (if present) -+ */ -+ pos = (u8 *) hdr; -+ aad[0] = 0; /* aad_len >> 8 */ -+ aad[1] = aad_len & 0xff; -+ aad[2] = pos[0] & 0x8f; -+ aad[3] = pos[1] & 0xc7; -+ memcpy(aad + 4, hdr->addr1, 3 * ETH_ALEN); -+ pos = (u8 *) &hdr->seq_ctl; -+ aad[22] = pos[0] & 0x0f; -+ aad[23] = 0; /* all bits masked */ -+ memset(aad + 24, 0, 8); -+ if (a4_included) -+ memcpy(aad + 24, hdr->addr4, ETH_ALEN); -+ if (qc_included) { -+ aad[a4_included ? 30 : 24] = qc; -+ /* rest of QC masked */ -+ } -+ -+ /* Start with the first block and AAD */ -+ ieee80211_ccmp_aes_encrypt(tfm, b0, auth); -+ xor_block(auth, aad, AES_BLOCK_LEN); -+ ieee80211_ccmp_aes_encrypt(tfm, auth, auth); -+ xor_block(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN); -+ ieee80211_ccmp_aes_encrypt(tfm, auth, auth); -+ b0[0] &= 0x07; -+ b0[14] = b0[15] = 0; -+ ieee80211_ccmp_aes_encrypt(tfm, b0, s0); -+} -+#endif -+ -+static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) -+{ -+ struct ieee80211_ccmp_data *key = priv; -+ int data_len, i; -+ u8 *pos; -+ struct ieee80211_hdr *hdr; -+#ifndef JOHN_CCMP -+ int blocks, last, len; -+ u8 *mic; -+ u8 *b0 = key->tx_b0; -+ u8 *b = key->tx_b; -+ u8 *e = key->tx_e; -+ u8 *s0 = key->tx_s0; -+#endif -+ if (skb_headroom(skb) < CCMP_HDR_LEN || -+ skb_tailroom(skb) < CCMP_MIC_LEN || -+ skb->len < hdr_len) -+ return -1; -+ -+ data_len = skb->len - hdr_len; -+ pos = skb_push(skb, CCMP_HDR_LEN); -+ memmove(pos, pos + CCMP_HDR_LEN, hdr_len); -+ pos += hdr_len; -+// mic = skb_put(skb, CCMP_MIC_LEN); -+ -+ i = CCMP_PN_LEN - 1; -+ while (i >= 0) { -+ key->tx_pn[i]++; -+ if (key->tx_pn[i] != 0) -+ break; -+ i--; -+ } -+ -+ *pos++ = key->tx_pn[5]; -+ *pos++ = key->tx_pn[4]; -+ *pos++ = 0; -+ *pos++ = (key->key_idx << 6) | (1 << 5) /* Ext IV included */; -+ *pos++ = key->tx_pn[3]; -+ *pos++ = key->tx_pn[2]; -+ *pos++ = key->tx_pn[1]; -+ *pos++ = key->tx_pn[0]; -+ -+ hdr = (struct ieee80211_hdr *) skb->data; -+#ifndef JOHN_CCMP -+ //mic is moved to here by john -+ mic = skb_put(skb, CCMP_MIC_LEN); -+ -+ ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0); -+ -+ blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN; -+ last = data_len % AES_BLOCK_LEN; -+ -+ for (i = 1; i <= blocks; i++) { -+ len = (i == blocks && last) ? last : AES_BLOCK_LEN; -+ /* Authentication */ -+ xor_block(b, pos, len); -+ ieee80211_ccmp_aes_encrypt(key->tfm, b, b); -+ /* Encryption, with counter */ -+ b0[14] = (i >> 8) & 0xff; -+ b0[15] = i & 0xff; -+ ieee80211_ccmp_aes_encrypt(key->tfm, b0, e); -+ xor_block(pos, e, len); -+ pos += len; -+ } -+ -+ for (i = 0; i < CCMP_MIC_LEN; i++) -+ mic[i] = b[i] ^ s0[i]; -+#endif -+ return 0; -+} -+ -+ -+static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) -+{ -+ struct ieee80211_ccmp_data *key = priv; -+ u8 keyidx, *pos; -+ struct ieee80211_hdr *hdr; -+ u8 pn[6]; -+#ifndef JOHN_CCMP -+ size_t data_len = skb->len - hdr_len - CCMP_HDR_LEN - CCMP_MIC_LEN; -+ u8 *mic = skb->data + skb->len - CCMP_MIC_LEN; -+ u8 *b0 = key->rx_b0; -+ u8 *b = key->rx_b; -+ u8 *a = key->rx_a; -+ int i, blocks, last, len; -+#endif -+ if (skb->len < hdr_len + CCMP_HDR_LEN + CCMP_MIC_LEN) { -+ key->dot11RSNAStatsCCMPFormatErrors++; -+ return -1; -+ } -+ -+ hdr = (struct ieee80211_hdr *) skb->data; -+ pos = skb->data + hdr_len; -+ keyidx = pos[3]; -+ if (!(keyidx & (1 << 5))) { -+ if (net_ratelimit()) { -+ printk(KERN_DEBUG "CCMP: received packet without ExtIV" -+ " flag from " MAC_FMT "\n", MAC_ARG(hdr->addr2)); -+ } -+ key->dot11RSNAStatsCCMPFormatErrors++; -+ return -2; -+ } -+ keyidx >>= 6; -+ if (key->key_idx != keyidx) { -+ printk(KERN_DEBUG "CCMP: RX tkey->key_idx=%d frame " -+ "keyidx=%d priv=%p\n", key->key_idx, keyidx, priv); -+ return -6; -+ } -+ if (!key->key_set) { -+ if (net_ratelimit()) { -+ printk(KERN_DEBUG "CCMP: received packet from " MAC_FMT -+ " with keyid=%d that does not have a configured" -+ " key\n", MAC_ARG(hdr->addr2), keyidx); -+ } -+ return -3; -+ } -+ -+ pn[0] = pos[7]; -+ pn[1] = pos[6]; -+ pn[2] = pos[5]; -+ pn[3] = pos[4]; -+ pn[4] = pos[1]; -+ pn[5] = pos[0]; -+ pos += 8; -+#if 0 -+ if (memcmp(pn, key->rx_pn, CCMP_PN_LEN) <= 0) { -+ if (net_ratelimit()) { -+ printk(KERN_DEBUG "CCMP: replay detected: STA=" MAC_FMT -+ " previous PN %02x%02x%02x%02x%02x%02x " -+ "received PN %02x%02x%02x%02x%02x%02x\n", -+ MAC_ARG(hdr->addr2), MAC_ARG(key->rx_pn), -+ MAC_ARG(pn)); -+ } -+ key->dot11RSNAStatsCCMPReplays++; -+ return -4; -+ } -+#endif -+#ifndef JOHN_CCMP -+ ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b); -+ xor_block(mic, b, CCMP_MIC_LEN); -+ -+ blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN; -+ last = data_len % AES_BLOCK_LEN; -+ -+ for (i = 1; i <= blocks; i++) { -+ len = (i == blocks && last) ? last : AES_BLOCK_LEN; -+ /* Decrypt, with counter */ -+ b0[14] = (i >> 8) & 0xff; -+ b0[15] = i & 0xff; -+ ieee80211_ccmp_aes_encrypt(key->tfm, b0, b); -+ xor_block(pos, b, len); -+ /* Authentication */ -+ xor_block(a, pos, len); -+ ieee80211_ccmp_aes_encrypt(key->tfm, a, a); -+ pos += len; -+ } -+ -+ if (memcmp(mic, a, CCMP_MIC_LEN) != 0) { -+ if (net_ratelimit()) { -+ printk(KERN_DEBUG "CCMP: decrypt failed: STA=" -+ MAC_FMT "\n", MAC_ARG(hdr->addr2)); -+ } -+ key->dot11RSNAStatsCCMPDecryptErrors++; -+ return -5; -+ } -+ -+ memcpy(key->rx_pn, pn, CCMP_PN_LEN); -+ -+#endif -+ /* Remove hdr and MIC */ -+ memmove(skb->data + CCMP_HDR_LEN, skb->data, hdr_len); -+ skb_pull(skb, CCMP_HDR_LEN); -+ skb_trim(skb, skb->len - CCMP_MIC_LEN); -+ -+ return keyidx; -+} -+ -+ -+static int ieee80211_ccmp_set_key(void *key, int len, u8 *seq, void *priv) -+{ -+ struct ieee80211_ccmp_data *data = priv; -+ int keyidx; -+ struct crypto_tfm *tfm = data->tfm; -+ -+ keyidx = data->key_idx; -+ memset(data, 0, sizeof(*data)); -+ data->key_idx = keyidx; -+ data->tfm = tfm; -+ if (len == CCMP_TK_LEN) { -+ memcpy(data->key, key, CCMP_TK_LEN); -+ data->key_set = 1; -+ if (seq) { -+ data->rx_pn[0] = seq[5]; -+ data->rx_pn[1] = seq[4]; -+ data->rx_pn[2] = seq[3]; -+ data->rx_pn[3] = seq[2]; -+ data->rx_pn[4] = seq[1]; -+ data->rx_pn[5] = seq[0]; -+ } -+ crypto_cipher_setkey((void*)data->tfm, data->key, CCMP_TK_LEN); -+ } else if (len == 0) -+ data->key_set = 0; -+ else -+ return -1; -+ -+ return 0; -+} -+ -+ -+static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv) -+{ -+ struct ieee80211_ccmp_data *data = priv; -+ -+ if (len < CCMP_TK_LEN) -+ return -1; -+ -+ if (!data->key_set) -+ return 0; -+ memcpy(key, data->key, CCMP_TK_LEN); -+ -+ if (seq) { -+ seq[0] = data->tx_pn[5]; -+ seq[1] = data->tx_pn[4]; -+ seq[2] = data->tx_pn[3]; -+ seq[3] = data->tx_pn[2]; -+ seq[4] = data->tx_pn[1]; -+ seq[5] = data->tx_pn[0]; -+ } -+ -+ return CCMP_TK_LEN; -+} -+ -+ -+static char * ieee80211_ccmp_print_stats(char *p, void *priv) -+{ -+ struct ieee80211_ccmp_data *ccmp = priv; -+ p += sprintf(p, "key[%d] alg=CCMP key_set=%d " -+ "tx_pn=%02x%02x%02x%02x%02x%02x " -+ "rx_pn=%02x%02x%02x%02x%02x%02x " -+ "format_errors=%d replays=%d decrypt_errors=%d\n", -+ ccmp->key_idx, ccmp->key_set, -+ MAC_ARG(ccmp->tx_pn), MAC_ARG(ccmp->rx_pn), -+ ccmp->dot11RSNAStatsCCMPFormatErrors, -+ ccmp->dot11RSNAStatsCCMPReplays, -+ ccmp->dot11RSNAStatsCCMPDecryptErrors); -+ -+ return p; -+} -+ -+void ieee80211_ccmp_null(void) -+{ -+ // printk("============>%s()\n", __FUNCTION__); -+ return; -+} -+static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = { -+ .name = "CCMP", -+ .init = ieee80211_ccmp_init, -+ .deinit = ieee80211_ccmp_deinit, -+ .encrypt_mpdu = ieee80211_ccmp_encrypt, -+ .decrypt_mpdu = ieee80211_ccmp_decrypt, -+ .encrypt_msdu = NULL, -+ .decrypt_msdu = NULL, -+ .set_key = ieee80211_ccmp_set_key, -+ .get_key = ieee80211_ccmp_get_key, -+ .print_stats = ieee80211_ccmp_print_stats, -+ .extra_prefix_len = CCMP_HDR_LEN, -+ .extra_postfix_len = CCMP_MIC_LEN, -+ .owner = THIS_MODULE, -+}; -+ -+ -+int __init ieee80211_crypto_ccmp_init(void) -+{ -+ return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp); -+} -+ -+ -+void __exit ieee80211_crypto_ccmp_exit(void) -+{ -+ ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp); -+} -+#if 0 -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) -+EXPORT_SYMBOL(ieee80211_ccmp_null); -+#else -+EXPORT_SYMBOL_NOVERS(ieee80211_ccmp_null); -+#endif -+ -+module_init(ieee80211_crypto_ccmp_init); -+module_exit(ieee80211_crypto_ccmp_exit); -+#endif -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_crypt.h linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_crypt.h ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_crypt.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_crypt.h 2010-08-05 21:12:34.223620464 +0200 -@@ -0,0 +1,91 @@ -+/* -+ * Original code based on Host AP (software wireless LAN access point) driver -+ * for Intersil Prism2/2.5/3. -+ * -+ * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen -+ * <jkmaline@cc.hut.fi> -+ * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> -+ * -+ * Adaption to a generic IEEE 802.11 stack by James Ketrenos -+ * <jketreno@linux.intel.com> -+ * -+ * Copyright (c) 2004, Intel Corporation -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. See README and COPYING for -+ * more details. -+ */ -+ -+/* -+ * This file defines the interface to the ieee80211 crypto module. -+ */ -+#ifndef IEEE80211_CRYPT_H -+#define IEEE80211_CRYPT_H -+ -+#include <linux/skbuff.h> -+ -+struct ieee80211_crypto_ops { -+ const char *name; -+ -+ /* init new crypto context (e.g., allocate private data space, -+ * select IV, etc.); returns NULL on failure or pointer to allocated -+ * private data on success */ -+ void * (*init)(int keyidx); -+ -+ /* deinitialize crypto context and free allocated private data */ -+ void (*deinit)(void *priv); -+ -+ /* encrypt/decrypt return < 0 on error or >= 0 on success. The return -+ * value from decrypt_mpdu is passed as the keyidx value for -+ * decrypt_msdu. skb must have enough head and tail room for the -+ * encryption; if not, error will be returned; these functions are -+ * called for all MPDUs (i.e., fragments). -+ */ -+ int (*encrypt_mpdu)(struct sk_buff *skb, int hdr_len, void *priv); -+ int (*decrypt_mpdu)(struct sk_buff *skb, int hdr_len, void *priv); -+ -+ /* These functions are called for full MSDUs, i.e. full frames. -+ * These can be NULL if full MSDU operations are not needed. */ -+ int (*encrypt_msdu)(struct sk_buff *skb, int hdr_len, void *priv); -+ int (*decrypt_msdu)(struct sk_buff *skb, int keyidx, int hdr_len, -+ void *priv); -+ -+ int (*set_key)(void *key, int len, u8 *seq, void *priv); -+ int (*get_key)(void *key, int len, u8 *seq, void *priv); -+ -+ /* procfs handler for printing out key information and possible -+ * statistics */ -+ char * (*print_stats)(char *p, void *priv); -+ -+ /* maximum number of bytes added by encryption; encrypt buf is -+ * allocated with extra_prefix_len bytes, copy of in_buf, and -+ * extra_postfix_len; encrypt need not use all this space, but -+ * the result must start at the beginning of the buffer and correct -+ * length must be returned */ -+ int extra_prefix_len, extra_postfix_len; -+ -+ struct module *owner; -+}; -+ -+struct ieee80211_crypt_data { -+ struct list_head list; /* delayed deletion list */ -+ struct ieee80211_crypto_ops *ops; -+ void *priv; -+ atomic_t refcnt; -+}; -+ -+int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops); -+int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops); -+struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name); -+void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int); -+void ieee80211_crypt_deinit_handler(unsigned long); -+void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, -+ struct ieee80211_crypt_data **crypt); -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) -+#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) -+#define crypto_alloc_tfm crypto_alloc_tfm_rtl -+#define crypto_free_tfm crypto_free_tfm_rtl -+#endif -+ -+#endif -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_crypt_tkip.c linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_crypt_tkip.c ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_crypt_tkip.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_crypt_tkip.c 2010-08-05 21:12:34.263619025 +0200 -@@ -0,0 +1,996 @@ -+/* -+ * Host AP crypt: host-based TKIP encryption implementation for Host AP driver -+ * -+ * Copyright (c) 2003-2004, Jouni Malinen <jkmaline@cc.hut.fi> -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. See README and COPYING for -+ * more details. -+ */ -+ -+//#include <linux/config.h> -+#include <linux/version.h> -+#include <linux/module.h> -+#include <linux/init.h> -+#include <linux/slab.h> -+#include <linux/random.h> -+#include <linux/skbuff.h> -+#include <linux/netdevice.h> -+#include <linux/if_ether.h> -+#include <linux/if_arp.h> -+#include <asm/string.h> -+ -+#include "ieee80211.h" -+ -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) -+#include "rtl_crypto.h" -+#else -+#include <linux/crypto.h> -+#endif -+//#include <asm/scatterlist.h> -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -+ #include <asm/scatterlist.h> -+#else -+ #include <linux/scatterlist.h> -+#endif -+ -+#include <linux/crc32.h> -+ -+MODULE_AUTHOR("Jouni Malinen"); -+MODULE_DESCRIPTION("Host AP crypt: TKIP"); -+MODULE_LICENSE("GPL"); -+ -+struct ieee80211_tkip_data { -+#define TKIP_KEY_LEN 32 -+ u8 key[TKIP_KEY_LEN]; -+ int key_set; -+ -+ u32 tx_iv32; -+ u16 tx_iv16; -+ u16 tx_ttak[5]; -+ int tx_phase1_done; -+ -+ u32 rx_iv32; -+ u16 rx_iv16; -+ u16 rx_ttak[5]; -+ int rx_phase1_done; -+ u32 rx_iv32_new; -+ u16 rx_iv16_new; -+ -+ u32 dot11RSNAStatsTKIPReplays; -+ u32 dot11RSNAStatsTKIPICVErrors; -+ u32 dot11RSNAStatsTKIPLocalMICFailures; -+ -+ int key_idx; -+ -+ #if(LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) -+ struct crypto_blkcipher *rx_tfm_arc4; -+ struct crypto_hash *rx_tfm_michael; -+ struct crypto_blkcipher *tx_tfm_arc4; -+ struct crypto_hash *tx_tfm_michael; -+ #endif -+ -+ struct crypto_tfm *tfm_arc4; -+ struct crypto_tfm *tfm_michael; -+ -+ /* scratch buffers for virt_to_page() (crypto API) */ -+ u8 rx_hdr[16], tx_hdr[16]; -+}; -+ -+static void * ieee80211_tkip_init(int key_idx) -+{ -+ struct ieee80211_tkip_data *priv; -+ -+ priv = kmalloc(sizeof(*priv), GFP_ATOMIC); -+ if (priv == NULL) -+ goto fail; -+ memset(priv, 0, sizeof(*priv)); -+ priv->key_idx = key_idx; -+ -+ #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) -+ priv->tfm_arc4 = crypto_alloc_tfm("arc4", 0); -+ if (priv->tfm_arc4 == NULL) { -+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " -+ "crypto API arc4\n"); -+ goto fail; -+ } -+ -+ priv->tfm_michael = crypto_alloc_tfm("michael_mic", 0); -+ if (priv->tfm_michael == NULL) { -+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " -+ "crypto API michael_mic\n"); -+ goto fail; -+ } -+ -+ #else -+ priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, -+ CRYPTO_ALG_ASYNC); -+ if (IS_ERR(priv->tx_tfm_arc4)) { -+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " -+ "crypto API arc4\n"); -+ priv->tx_tfm_arc4 = NULL; -+ goto fail; -+ } -+ -+ priv->tx_tfm_michael = crypto_alloc_hash("michael_mic", 0, -+ CRYPTO_ALG_ASYNC); -+ if (IS_ERR(priv->tx_tfm_michael)) { -+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " -+ "crypto API michael_mic\n"); -+ priv->tx_tfm_michael = NULL; -+ goto fail; -+ } -+ -+ priv->rx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, -+ CRYPTO_ALG_ASYNC); -+ if (IS_ERR(priv->rx_tfm_arc4)) { -+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " -+ "crypto API arc4\n"); -+ priv->rx_tfm_arc4 = NULL; -+ goto fail; -+ } -+ -+ priv->rx_tfm_michael = crypto_alloc_hash("michael_mic", 0, -+ CRYPTO_ALG_ASYNC); -+ if (IS_ERR(priv->rx_tfm_michael)) { -+ printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " -+ "crypto API michael_mic\n"); -+ priv->rx_tfm_michael = NULL; -+ goto fail; -+ } -+ #endif -+ return priv; -+ -+fail: -+ if (priv) { -+ #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) -+ if (priv->tfm_michael) -+ crypto_free_tfm(priv->tfm_michael); -+ if (priv->tfm_arc4) -+ crypto_free_tfm(priv->tfm_arc4); -+ #else -+ if (priv->tx_tfm_michael) -+ crypto_free_hash(priv->tx_tfm_michael); -+ if (priv->tx_tfm_arc4) -+ crypto_free_blkcipher(priv->tx_tfm_arc4); -+ if (priv->rx_tfm_michael) -+ crypto_free_hash(priv->rx_tfm_michael); -+ if (priv->rx_tfm_arc4) -+ crypto_free_blkcipher(priv->rx_tfm_arc4); -+ #endif -+ kfree(priv); -+ } -+ -+ return NULL; -+} -+ -+ -+static void ieee80211_tkip_deinit(void *priv) -+{ -+ struct ieee80211_tkip_data *_priv = priv; -+ #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) -+ if (_priv && _priv->tfm_michael) -+ crypto_free_tfm(_priv->tfm_michael); -+ if (_priv && _priv->tfm_arc4) -+ crypto_free_tfm(_priv->tfm_arc4); -+ #else -+ if (_priv) { -+ if (_priv->tx_tfm_michael) -+ crypto_free_hash(_priv->tx_tfm_michael); -+ if (_priv->tx_tfm_arc4) -+ crypto_free_blkcipher(_priv->tx_tfm_arc4); -+ if (_priv->rx_tfm_michael) -+ crypto_free_hash(_priv->rx_tfm_michael); -+ if (_priv->rx_tfm_arc4) -+ crypto_free_blkcipher(_priv->rx_tfm_arc4); -+ } -+ #endif -+ kfree(priv); -+} -+ -+ -+static inline u16 RotR1(u16 val) -+{ -+ return (val >> 1) | (val << 15); -+} -+ -+ -+static inline u8 Lo8(u16 val) -+{ -+ return val & 0xff; -+} -+ -+ -+static inline u8 Hi8(u16 val) -+{ -+ return val >> 8; -+} -+ -+ -+static inline u16 Lo16(u32 val) -+{ -+ return val & 0xffff; -+} -+ -+ -+static inline u16 Hi16(u32 val) -+{ -+ return val >> 16; -+} -+ -+ -+static inline u16 Mk16(u8 hi, u8 lo) -+{ -+ return lo | (((u16) hi) << 8); -+} -+ -+ -+static inline u16 Mk16_le(u16 *v) -+{ -+ return le16_to_cpu(*v); -+} -+ -+ -+static const u16 Sbox[256] = -+{ -+ 0xC6A5, 0xF884, 0xEE99, 0xF68D, 0xFF0D, 0xD6BD, 0xDEB1, 0x9154, -+ 0x6050, 0x0203, 0xCEA9, 0x567D, 0xE719, 0xB562, 0x4DE6, 0xEC9A, -+ 0x8F45, 0x1F9D, 0x8940, 0xFA87, 0xEF15, 0xB2EB, 0x8EC9, 0xFB0B, -+ 0x41EC, 0xB367, 0x5FFD, 0x45EA, 0x23BF, 0x53F7, 0xE496, 0x9B5B, -+ 0x75C2, 0xE11C, 0x3DAE, 0x4C6A, 0x6C5A, 0x7E41, 0xF502, 0x834F, -+ 0x685C, 0x51F4, 0xD134, 0xF908, 0xE293, 0xAB73, 0x6253, 0x2A3F, -+ 0x080C, 0x9552, 0x4665, 0x9D5E, 0x3028, 0x37A1, 0x0A0F, 0x2FB5, -+ 0x0E09, 0x2436, 0x1B9B, 0xDF3D, 0xCD26, 0x4E69, 0x7FCD, 0xEA9F, -+ 0x121B, 0x1D9E, 0x5874, 0x342E, 0x362D, 0xDCB2, 0xB4EE, 0x5BFB, -+ 0xA4F6, 0x764D, 0xB761, 0x7DCE, 0x527B, 0xDD3E, 0x5E71, 0x1397, -+ 0xA6F5, 0xB968, 0x0000, 0xC12C, 0x4060, 0xE31F, 0x79C8, 0xB6ED, -+ 0xD4BE, 0x8D46, 0x67D9, 0x724B, 0x94DE, 0x98D4, 0xB0E8, 0x854A, -+ 0xBB6B, 0xC52A, 0x4FE5, 0xED16, 0x86C5, 0x9AD7, 0x6655, 0x1194, -+ 0x8ACF, 0xE910, 0x0406, 0xFE81, 0xA0F0, 0x7844, 0x25BA, 0x4BE3, -+ 0xA2F3, 0x5DFE, 0x80C0, 0x058A, 0x3FAD, 0x21BC, 0x7048, 0xF104, -+ 0x63DF, 0x77C1, 0xAF75, 0x4263, 0x2030, 0xE51A, 0xFD0E, 0xBF6D, -+ 0x814C, 0x1814, 0x2635, 0xC32F, 0xBEE1, 0x35A2, 0x88CC, 0x2E39, -+ 0x9357, 0x55F2, 0xFC82, 0x7A47, 0xC8AC, 0xBAE7, 0x322B, 0xE695, -+ 0xC0A0, 0x1998, 0x9ED1, 0xA37F, 0x4466, 0x547E, 0x3BAB, 0x0B83, -+ 0x8CCA, 0xC729, 0x6BD3, 0x283C, 0xA779, 0xBCE2, 0x161D, 0xAD76, -+ 0xDB3B, 0x6456, 0x744E, 0x141E, 0x92DB, 0x0C0A, 0x486C, 0xB8E4, -+ 0x9F5D, 0xBD6E, 0x43EF, 0xC4A6, 0x39A8, 0x31A4, 0xD337, 0xF28B, -+ 0xD532, 0x8B43, 0x6E59, 0xDAB7, 0x018C, 0xB164, 0x9CD2, 0x49E0, -+ 0xD8B4, 0xACFA, 0xF307, 0xCF25, 0xCAAF, 0xF48E, 0x47E9, 0x1018, -+ 0x6FD5, 0xF088, 0x4A6F, 0x5C72, 0x3824, 0x57F1, 0x73C7, 0x9751, -+ 0xCB23, 0xA17C, 0xE89C, 0x3E21, 0x96DD, 0x61DC, 0x0D86, 0x0F85, -+ 0xE090, 0x7C42, 0x71C4, 0xCCAA, 0x90D8, 0x0605, 0xF701, 0x1C12, -+ 0xC2A3, 0x6A5F, 0xAEF9, 0x69D0, 0x1791, 0x9958, 0x3A27, 0x27B9, -+ 0xD938, 0xEB13, 0x2BB3, 0x2233, 0xD2BB, 0xA970, 0x0789, 0x33A7, -+ 0x2DB6, 0x3C22, 0x1592, 0xC920, 0x8749, 0xAAFF, 0x5078, 0xA57A, -+ 0x038F, 0x59F8, 0x0980, 0x1A17, 0x65DA, 0xD731, 0x84C6, 0xD0B8, -+ 0x82C3, 0x29B0, 0x5A77, 0x1E11, 0x7BCB, 0xA8FC, 0x6DD6, 0x2C3A, -+}; -+ -+ -+static inline u16 _S_(u16 v) -+{ -+ u16 t = Sbox[Hi8(v)]; -+ return Sbox[Lo8(v)] ^ ((t << 8) | (t >> 8)); -+} -+ -+#ifndef JOHN_TKIP -+#define PHASE1_LOOP_COUNT 8 -+ -+static void tkip_mixing_phase1(u16 *TTAK, const u8 *TK, const u8 *TA, u32 IV32) -+{ -+ int i, j; -+ -+ /* Initialize the 80-bit TTAK from TSC (IV32) and TA[0..5] */ -+ TTAK[0] = Lo16(IV32); -+ TTAK[1] = Hi16(IV32); -+ TTAK[2] = Mk16(TA[1], TA[0]); -+ TTAK[3] = Mk16(TA[3], TA[2]); -+ TTAK[4] = Mk16(TA[5], TA[4]); -+ -+ for (i = 0; i < PHASE1_LOOP_COUNT; i++) { -+ j = 2 * (i & 1); -+ TTAK[0] += _S_(TTAK[4] ^ Mk16(TK[1 + j], TK[0 + j])); -+ TTAK[1] += _S_(TTAK[0] ^ Mk16(TK[5 + j], TK[4 + j])); -+ TTAK[2] += _S_(TTAK[1] ^ Mk16(TK[9 + j], TK[8 + j])); -+ TTAK[3] += _S_(TTAK[2] ^ Mk16(TK[13 + j], TK[12 + j])); -+ TTAK[4] += _S_(TTAK[3] ^ Mk16(TK[1 + j], TK[0 + j])) + i; -+ } -+} -+ -+ -+static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK, -+ u16 IV16) -+{ -+ /* Make temporary area overlap WEP seed so that the final copy can be -+ * avoided on little endian hosts. */ -+ u16 *PPK = (u16 *) &WEPSeed[4]; -+ -+ /* Step 1 - make copy of TTAK and bring in TSC */ -+ PPK[0] = TTAK[0]; -+ PPK[1] = TTAK[1]; -+ PPK[2] = TTAK[2]; -+ PPK[3] = TTAK[3]; -+ PPK[4] = TTAK[4]; -+ PPK[5] = TTAK[4] + IV16; -+ -+ /* Step 2 - 96-bit bijective mixing using S-box */ -+ PPK[0] += _S_(PPK[5] ^ Mk16_le((u16 *) &TK[0])); -+ PPK[1] += _S_(PPK[0] ^ Mk16_le((u16 *) &TK[2])); -+ PPK[2] += _S_(PPK[1] ^ Mk16_le((u16 *) &TK[4])); -+ PPK[3] += _S_(PPK[2] ^ Mk16_le((u16 *) &TK[6])); -+ PPK[4] += _S_(PPK[3] ^ Mk16_le((u16 *) &TK[8])); -+ PPK[5] += _S_(PPK[4] ^ Mk16_le((u16 *) &TK[10])); -+ -+ PPK[0] += RotR1(PPK[5] ^ Mk16_le((u16 *) &TK[12])); -+ PPK[1] += RotR1(PPK[0] ^ Mk16_le((u16 *) &TK[14])); -+ PPK[2] += RotR1(PPK[1]); -+ PPK[3] += RotR1(PPK[2]); -+ PPK[4] += RotR1(PPK[3]); -+ PPK[5] += RotR1(PPK[4]); -+ -+ /* Step 3 - bring in last of TK bits, assign 24-bit WEP IV value -+ * WEPSeed[0..2] is transmitted as WEP IV */ -+ WEPSeed[0] = Hi8(IV16); -+ WEPSeed[1] = (Hi8(IV16) | 0x20) & 0x7F; -+ WEPSeed[2] = Lo8(IV16); -+ WEPSeed[3] = Lo8((PPK[5] ^ Mk16_le((u16 *) &TK[0])) >> 1); -+ -+#ifdef __BIG_ENDIAN -+ { -+ int i; -+ for (i = 0; i < 6; i++) -+ PPK[i] = (PPK[i] << 8) | (PPK[i] >> 8); -+ } -+#endif -+} -+#endif -+static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) -+{ -+ struct ieee80211_tkip_data *tkey = priv; -+ #if(LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) -+ struct blkcipher_desc desc = {.tfm = tkey->tx_tfm_arc4}; -+ #endif -+ int len; -+ u8 *pos; -+ struct ieee80211_hdr *hdr; -+#ifndef JOHN_TKIP -+ u8 rc4key[16],*icv; -+ u32 crc; -+ struct scatterlist sg; -+#endif -+ #if(LINUX_VERSION_CODE >=KERNEL_VERSION(2,6,21)) -+ int ret; -+ #endif -+ -+ if (skb_headroom(skb) < 8 || skb_tailroom(skb) < 4 || -+ skb->len < hdr_len) -+ return -1; -+ -+ hdr = (struct ieee80211_hdr *) skb->data; -+#if 0 -+printk("@@ tkey\n"); -+printk("%x|", ((u32*)tkey->key)[0]); -+printk("%x|", ((u32*)tkey->key)[1]); -+printk("%x|", ((u32*)tkey->key)[2]); -+printk("%x|", ((u32*)tkey->key)[3]); -+printk("%x|", ((u32*)tkey->key)[4]); -+printk("%x|", ((u32*)tkey->key)[5]); -+printk("%x|", ((u32*)tkey->key)[6]); -+printk("%x\n", ((u32*)tkey->key)[7]); -+#endif -+ -+#ifndef JOHN_TKIP -+ if (!tkey->tx_phase1_done) { -+ tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2, -+ tkey->tx_iv32); -+ tkey->tx_phase1_done = 1; -+ } -+ tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16); -+ -+#else -+ tkey->tx_phase1_done = 1; -+#endif /*JOHN_TKIP*/ -+ -+ len = skb->len - hdr_len; -+ pos = skb_push(skb, 8); -+ memmove(pos, pos + 8, hdr_len); -+ pos += hdr_len; -+ -+#ifdef JOHN_TKIP -+ *pos++ = Hi8(tkey->tx_iv16); -+ *pos++ = (Hi8(tkey->tx_iv16) | 0x20) & 0x7F; -+ *pos++ = Lo8(tkey->tx_iv16); -+#else -+ *pos++ = rc4key[0]; -+ *pos++ = rc4key[1]; -+ *pos++ = rc4key[2]; -+#endif -+ *pos++ = (tkey->key_idx << 6) | (1 << 5) /* Ext IV included */; -+ *pos++ = tkey->tx_iv32 & 0xff; -+ *pos++ = (tkey->tx_iv32 >> 8) & 0xff; -+ *pos++ = (tkey->tx_iv32 >> 16) & 0xff; -+ *pos++ = (tkey->tx_iv32 >> 24) & 0xff; -+#ifndef JOHN_TKIP -+ icv = skb_put(skb, 4); -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) -+ crc = ~crc32_le(~0, pos, len); -+#else -+ crc = ~ether_crc_le(len, pos); -+#endif -+ icv[0] = crc; -+ icv[1] = crc >> 8; -+ icv[2] = crc >> 16; -+ icv[3] = crc >> 24; -+ #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) -+ crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16); -+ sg.page = virt_to_page(pos); -+ sg.offset = offset_in_page(pos); -+ sg.length = len + 4; -+ crypto_cipher_encrypt(tkey->tfm_arc4, &sg, &sg, len + 4); -+ #else -+ crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16); -+ #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) -+ sg.page = virt_to_page(pos); -+ sg.offset = offset_in_page(pos); -+ sg.length = len + 4; -+ #else -+ sg_init_one(&sg, pos, len + 4); -+ #endif -+ ret= crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4); -+ #endif -+#endif -+ tkey->tx_iv16++; -+ if (tkey->tx_iv16 == 0) { -+ tkey->tx_phase1_done = 0; -+ tkey->tx_iv32++; -+ } -+#ifndef JOHN_TKIP -+ #if(LINUX_VERSION_CODE <KERNEL_VERSION(2,6,21)) -+ return 0; -+ #else -+ return ret; -+ #endif -+#else -+ return 0; -+#endif -+} -+ -+static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) -+{ -+ struct ieee80211_tkip_data *tkey = priv; -+ #if(LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) -+ struct blkcipher_desc desc = {.tfm = tkey->rx_tfm_arc4}; -+ #endif -+ u8 keyidx, *pos; -+ u32 iv32; -+ u16 iv16; -+ struct ieee80211_hdr *hdr; -+#ifndef JOHN_TKIP -+ u8 icv[4]; -+ u32 crc; -+ struct scatterlist sg; -+ u8 rc4key[16]; -+ int plen; -+#endif -+ if (skb->len < hdr_len + 8 + 4) -+ return -1; -+ -+ hdr = (struct ieee80211_hdr *) skb->data; -+ pos = skb->data + hdr_len; -+ keyidx = pos[3]; -+ if (!(keyidx & (1 << 5))) { -+ if (net_ratelimit()) { -+ printk(KERN_DEBUG "TKIP: received packet without ExtIV" -+ " flag from " MAC_FMT "\n", MAC_ARG(hdr->addr2)); -+ } -+ return -2; -+ } -+ keyidx >>= 6; -+ if (tkey->key_idx != keyidx) { -+ printk(KERN_DEBUG "TKIP: RX tkey->key_idx=%d frame " -+ "keyidx=%d priv=%p\n", tkey->key_idx, keyidx, priv); -+ return -6; -+ } -+ if (!tkey->key_set) { -+ if (net_ratelimit()) { -+ printk(KERN_DEBUG "TKIP: received packet from " MAC_FMT -+ " with keyid=%d that does not have a configured" -+ " key\n", MAC_ARG(hdr->addr2), keyidx); -+ } -+ return -3; -+ } -+ iv16 = (pos[0] << 8) | pos[2]; -+ iv32 = pos[4] | (pos[5] << 8) | (pos[6] << 16) | (pos[7] << 24); -+ pos += 8; -+#ifndef JOHN_TKIP -+#if 0 -+ if (iv32 < tkey->rx_iv32 || -+ (iv32 == tkey->rx_iv32 && iv16 <= tkey->rx_iv16)) { -+ if (net_ratelimit()) { -+ printk(KERN_DEBUG "TKIP: replay detected: STA=" MAC_FMT -+ " previous TSC %08x%04x received TSC " -+ "%08x%04x\n", MAC_ARG(hdr->addr2), -+ tkey->rx_iv32, tkey->rx_iv16, iv32, iv16); -+ } -+ tkey->dot11RSNAStatsTKIPReplays++; -+ return -4; -+ } -+#endif -+ if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) { -+ tkip_mixing_phase1(tkey->rx_ttak, tkey->key, hdr->addr2, iv32); -+ tkey->rx_phase1_done = 1; -+ } -+ tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16); -+ -+ plen = skb->len - hdr_len - 12; -+ #if(LINUX_VERSION_CODE <KERNEL_VERSION(2,6,21)) -+ crypto_cipher_setkey(tkey->tfm_arc4, rc4key, 16); -+ sg.page = virt_to_page(pos); -+ sg.offset = offset_in_page(pos); -+ sg.length = plen + 4; -+ crypto_cipher_decrypt(tkey->tfm_arc4, &sg, &sg, plen + 4); -+ #else -+ crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16); -+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)) -+ sg.page = virt_to_page(pos); -+ sg.offset = offset_in_page(pos); -+ sg.length = plen + 4; -+ #else -+ sg_init_one(&sg, pos, plen + 4); -+ #endif -+ if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) { -+ if (net_ratelimit()) { -+ printk(KERN_DEBUG ": TKIP: failed to decrypt " -+ "received packet from " MAC_FMT "\n", -+ MAC_ARG(hdr->addr2)); -+ } -+ return -7; -+ } -+ #endif -+ -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) -+ crc = ~crc32_le(~0, pos, plen); -+#else -+ crc = ~ether_crc_le(plen, pos); -+#endif -+ icv[0] = crc; -+ icv[1] = crc >> 8; -+ icv[2] = crc >> 16; -+ icv[3] = crc >> 24; -+ if (memcmp(icv, pos + plen, 4) != 0) { -+ if (iv32 != tkey->rx_iv32) { -+ /* Previously cached Phase1 result was already lost, so -+ * it needs to be recalculated for the next packet. */ -+ tkey->rx_phase1_done = 0; -+ } -+ if (net_ratelimit()) { -+ printk(KERN_DEBUG "TKIP: ICV error detected: STA=" -+ MAC_FMT "\n", MAC_ARG(hdr->addr2)); -+ } -+ tkey->dot11RSNAStatsTKIPICVErrors++; -+ return -5; -+ } -+ -+#endif /* JOHN_TKIP */ -+ -+ /* Update real counters only after Michael MIC verification has -+ * completed */ -+ tkey->rx_iv32_new = iv32; -+ tkey->rx_iv16_new = iv16; -+ -+ /* Remove IV and ICV */ -+ memmove(skb->data + 8, skb->data, hdr_len); -+ skb_pull(skb, 8); -+ skb_trim(skb, skb->len - 4); -+ -+//john's test -+#ifdef JOHN_DUMP -+if( ((u16*)skb->data)[0] & 0x4000){ -+ printk("@@ rx decrypted skb->data"); -+ int i; -+ for(i=0;i<skb->len;i++){ -+ if( (i%24)==0 ) printk("\n"); -+ printk("%2x ", ((u8*)skb->data)[i]); -+ } -+ printk("\n"); -+} -+#endif /*JOHN_DUMP*/ -+ return keyidx; -+} -+ -+#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) -+static int michael_mic(struct ieee80211_tkip_data *tkey, u8 *key, u8 *hdr, -+ u8 *data, size_t data_len, u8 *mic) -+{ -+ struct scatterlist sg[2]; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) -+ struct hash_desc desc; -+ int ret=0; -+#endif -+ if (tkey->tfm_michael == NULL) { -+ printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n"); -+ return -1; -+ } -+ sg[0].page = virt_to_page(hdr); -+ sg[0].offset = offset_in_page(hdr); -+ sg[0].length = 16; -+ -+ sg[1].page = virt_to_page(data); -+ sg[1].offset = offset_in_page(data); -+ sg[1].length = data_len; -+ -+ //crypto_digest_init(tkey->tfm_michael); -+ //crypto_digest_setkey(tkey->tfm_michael, key, 8); -+ //crypto_digest_update(tkey->tfm_michael, sg, 2); -+ //crypto_digest_final(tkey->tfm_michael, mic); -+ -+ //return 0; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -+ crypto_digest_init(tkey->tfm_michael); -+ crypto_digest_setkey(tkey->tfm_michael, key, 8); -+ crypto_digest_update(tkey->tfm_michael, sg, 2); -+ crypto_digest_final(tkey->tfm_michael, mic); -+ -+ return 0; -+#else -+if (crypto_hash_setkey(tkey->tfm_michael, key, 8)) -+ return -1; -+ -+// return 0; -+ desc.tfm = tkey->tfm_michael; -+ desc.flags = 0; -+ ret = crypto_hash_digest(&desc, sg, data_len + 16, mic); -+ return ret; -+#endif -+} -+#else -+static int michael_mic(struct crypto_hash *tfm_michael, u8 * key, u8 * hdr, -+ u8 * data, size_t data_len, u8 * mic) -+{ -+ struct hash_desc desc; -+ struct scatterlist sg[2]; -+ -+ if (tfm_michael == NULL) { -+ printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n"); -+ return -1; -+ } -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) -+ sg[0].page = virt_to_page(hdr); -+ sg[0].offset = offset_in_page(hdr); -+ sg[0].length = 16; -+ -+ sg[1].page = virt_to_page(data); -+ sg[1].offset = offset_in_page(data); -+ sg[1].length = data_len; -+#else -+ sg_init_table(sg, 2); -+ sg_set_buf(&sg[0], hdr, 16); -+ sg_set_buf(&sg[1], data, data_len); -+#endif -+ if (crypto_hash_setkey(tfm_michael, key, 8)) -+ return -1; -+ -+ desc.tfm = tfm_michael; -+ desc.flags = 0; -+ return crypto_hash_digest(&desc, sg, data_len + 16, mic); -+} -+#endif -+ -+ -+ -+static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr) -+{ -+ struct ieee80211_hdr *hdr11; -+ -+ hdr11 = (struct ieee80211_hdr *) skb->data; -+ switch (le16_to_cpu(hdr11->frame_ctl) & -+ (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) { -+ case IEEE80211_FCTL_TODS: -+ memcpy(hdr, hdr11->addr3, ETH_ALEN); /* DA */ -+ memcpy(hdr + ETH_ALEN, hdr11->addr2, ETH_ALEN); /* SA */ -+ break; -+ case IEEE80211_FCTL_FROMDS: -+ memcpy(hdr, hdr11->addr1, ETH_ALEN); /* DA */ -+ memcpy(hdr + ETH_ALEN, hdr11->addr3, ETH_ALEN); /* SA */ -+ break; -+ case IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS: -+ memcpy(hdr, hdr11->addr3, ETH_ALEN); /* DA */ -+ memcpy(hdr + ETH_ALEN, hdr11->addr4, ETH_ALEN); /* SA */ -+ break; -+ case 0: -+ memcpy(hdr, hdr11->addr1, ETH_ALEN); /* DA */ -+ memcpy(hdr + ETH_ALEN, hdr11->addr2, ETH_ALEN); /* SA */ -+ break; -+ } -+ -+ hdr[12] = 0; /* priority */ -+ -+ hdr[13] = hdr[14] = hdr[15] = 0; /* reserved */ -+} -+ -+ -+static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *priv) -+{ -+ struct ieee80211_tkip_data *tkey = priv; -+ u8 *pos; -+ struct ieee80211_hdr *hdr; -+ -+ hdr = (struct ieee80211_hdr *) skb->data; -+ -+ if (skb_tailroom(skb) < 8 || skb->len < hdr_len) { -+ printk(KERN_DEBUG "Invalid packet for Michael MIC add " -+ "(tailroom=%d hdr_len=%d skb->len=%d)\n", -+ skb_tailroom(skb), hdr_len, skb->len); -+ return -1; -+ } -+ -+ michael_mic_hdr(skb, tkey->tx_hdr); -+ -+ // { david, 2006.9.1 -+ // fix the wpa process with wmm enabled. -+ if(IEEE80211_QOS_HAS_SEQ(le16_to_cpu(hdr->frame_ctl))) { -+ tkey->tx_hdr[12] = *(skb->data + hdr_len - 2) & 0x07; -+ } -+ // } -+ pos = skb_put(skb, 8); -+ #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) -+ if (michael_mic(tkey, &tkey->key[16], tkey->tx_hdr, -+ skb->data + hdr_len, skb->len - 8 - hdr_len, pos)) -+ #else -+ if (michael_mic(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr, -+ skb->data + hdr_len, skb->len - 8 - hdr_len, pos)) -+ #endif -+ return -1; -+ -+ return 0; -+} -+ -+ -+#if WIRELESS_EXT >= 18 -+static void ieee80211_michael_mic_failure(struct net_device *dev, -+ struct ieee80211_hdr *hdr, -+ int keyidx) -+{ -+ union iwreq_data wrqu; -+ struct iw_michaelmicfailure ev; -+ -+ /* TODO: needed parameters: count, keyid, key type, TSC */ -+ memset(&ev, 0, sizeof(ev)); -+ ev.flags = keyidx & IW_MICFAILURE_KEY_ID; -+ if (hdr->addr1[0] & 0x01) -+ ev.flags |= IW_MICFAILURE_GROUP; -+ else -+ ev.flags |= IW_MICFAILURE_PAIRWISE; -+ ev.src_addr.sa_family = ARPHRD_ETHER; -+ memcpy(ev.src_addr.sa_data, hdr->addr2, ETH_ALEN); -+ memset(&wrqu, 0, sizeof(wrqu)); -+ wrqu.data.length = sizeof(ev); -+ wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev); -+} -+#elif WIRELESS_EXT >= 15 -+static void ieee80211_michael_mic_failure(struct net_device *dev, -+ struct ieee80211_hdr *hdr, -+ int keyidx) -+{ -+ union iwreq_data wrqu; -+ char buf[128]; -+ -+ /* TODO: needed parameters: count, keyid, key type, TSC */ -+ sprintf(buf, "MLME-MICHAELMICFAILURE.indication(keyid=%d %scast addr=" -+ MAC_FMT ")", keyidx, hdr->addr1[0] & 0x01 ? "broad" : "uni", -+ MAC_ARG(hdr->addr2)); -+ memset(&wrqu, 0, sizeof(wrqu)); -+ wrqu.data.length = strlen(buf); -+ wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf); -+} -+#else /* WIRELESS_EXT >= 15 */ -+static inline void ieee80211_michael_mic_failure(struct net_device *dev, -+ struct ieee80211_hdr *hdr, -+ int keyidx) -+{ -+} -+#endif /* WIRELESS_EXT >= 15 */ -+ -+ -+static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx, -+ int hdr_len, void *priv) -+{ -+ struct ieee80211_tkip_data *tkey = priv; -+ u8 mic[8]; -+ struct ieee80211_hdr *hdr; -+ -+ hdr = (struct ieee80211_hdr *) skb->data; -+ -+ if (!tkey->key_set) -+ return -1; -+ -+ michael_mic_hdr(skb, tkey->rx_hdr); -+ // { david, 2006.9.1 -+ // fix the wpa process with wmm enabled. -+ if(IEEE80211_QOS_HAS_SEQ(le16_to_cpu(hdr->frame_ctl))) { -+ tkey->rx_hdr[12] = *(skb->data + hdr_len - 2) & 0x07; -+ } -+ // } -+ #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) -+ if (michael_mic(tkey, &tkey->key[24], tkey->rx_hdr, -+ skb->data + hdr_len, skb->len - 8 - hdr_len, mic)) -+ #else -+ if (michael_mic(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr, -+ skb->data + hdr_len, skb->len - 8 - hdr_len, mic)) -+ #endif -+ return -1; -+ if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) { -+ struct ieee80211_hdr *hdr; -+ hdr = (struct ieee80211_hdr *) skb->data; -+ printk(KERN_DEBUG "%s: Michael MIC verification failed for " -+ "MSDU from " MAC_FMT " keyidx=%d\n", -+ skb->dev ? skb->dev->name : "N/A", MAC_ARG(hdr->addr2), -+ keyidx); -+ if (skb->dev) -+ ieee80211_michael_mic_failure(skb->dev, hdr, keyidx); -+ tkey->dot11RSNAStatsTKIPLocalMICFailures++; -+ return -1; -+ } -+ -+ /* Update TSC counters for RX now that the packet verification has -+ * completed. */ -+ tkey->rx_iv32 = tkey->rx_iv32_new; -+ tkey->rx_iv16 = tkey->rx_iv16_new; -+ -+ skb_trim(skb, skb->len - 8); -+ -+ return 0; -+} -+ -+ -+static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv) -+{ -+ struct ieee80211_tkip_data *tkey = priv; -+ int keyidx; -+ #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) -+ struct crypto_tfm *tfm = tkey->tfm_michael; -+ struct crypto_tfm *tfm2 = tkey->tfm_arc4; -+ #else -+ struct crypto_hash *tfm = tkey->tx_tfm_michael; -+ struct crypto_blkcipher *tfm2 = tkey->tx_tfm_arc4; -+ struct crypto_hash *tfm3 = tkey->rx_tfm_michael; -+ struct crypto_blkcipher *tfm4 = tkey->rx_tfm_arc4; -+ #endif -+ -+ keyidx = tkey->key_idx; -+ memset(tkey, 0, sizeof(*tkey)); -+ tkey->key_idx = keyidx; -+ -+ #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) -+ tkey->tfm_michael = tfm; -+ tkey->tfm_arc4 = tfm2; -+ #else -+ tkey->tx_tfm_michael = tfm; -+ tkey->tx_tfm_arc4 = tfm2; -+ tkey->rx_tfm_michael = tfm3; -+ tkey->rx_tfm_arc4 = tfm4; -+ #endif -+ -+ if (len == TKIP_KEY_LEN) { -+ memcpy(tkey->key, key, TKIP_KEY_LEN); -+ tkey->key_set = 1; -+ tkey->tx_iv16 = 1; /* TSC is initialized to 1 */ -+ if (seq) { -+ tkey->rx_iv32 = (seq[5] << 24) | (seq[4] << 16) | -+ (seq[3] << 8) | seq[2]; -+ tkey->rx_iv16 = (seq[1] << 8) | seq[0]; -+ } -+ } else if (len == 0) -+ tkey->key_set = 0; -+ else -+ return -1; -+ -+ return 0; -+} -+ -+ -+static int ieee80211_tkip_get_key(void *key, int len, u8 *seq, void *priv) -+{ -+ struct ieee80211_tkip_data *tkey = priv; -+ -+ if (len < TKIP_KEY_LEN) -+ return -1; -+ -+ if (!tkey->key_set) -+ return 0; -+ memcpy(key, tkey->key, TKIP_KEY_LEN); -+ -+ if (seq) { -+ /* Return the sequence number of the last transmitted frame. */ -+ u16 iv16 = tkey->tx_iv16; -+ u32 iv32 = tkey->tx_iv32; -+ if (iv16 == 0) -+ iv32--; -+ iv16--; -+ seq[0] = tkey->tx_iv16; -+ seq[1] = tkey->tx_iv16 >> 8; -+ seq[2] = tkey->tx_iv32; -+ seq[3] = tkey->tx_iv32 >> 8; -+ seq[4] = tkey->tx_iv32 >> 16; -+ seq[5] = tkey->tx_iv32 >> 24; -+ } -+ -+ return TKIP_KEY_LEN; -+} -+ -+ -+static char * ieee80211_tkip_print_stats(char *p, void *priv) -+{ -+ struct ieee80211_tkip_data *tkip = priv; -+ p += sprintf(p, "key[%d] alg=TKIP key_set=%d " -+ "tx_pn=%02x%02x%02x%02x%02x%02x " -+ "rx_pn=%02x%02x%02x%02x%02x%02x " -+ "replays=%d icv_errors=%d local_mic_failures=%d\n", -+ tkip->key_idx, tkip->key_set, -+ (tkip->tx_iv32 >> 24) & 0xff, -+ (tkip->tx_iv32 >> 16) & 0xff, -+ (tkip->tx_iv32 >> 8) & 0xff, -+ tkip->tx_iv32 & 0xff, -+ (tkip->tx_iv16 >> 8) & 0xff, -+ tkip->tx_iv16 & 0xff, -+ (tkip->rx_iv32 >> 24) & 0xff, -+ (tkip->rx_iv32 >> 16) & 0xff, -+ (tkip->rx_iv32 >> 8) & 0xff, -+ tkip->rx_iv32 & 0xff, -+ (tkip->rx_iv16 >> 8) & 0xff, -+ tkip->rx_iv16 & 0xff, -+ tkip->dot11RSNAStatsTKIPReplays, -+ tkip->dot11RSNAStatsTKIPICVErrors, -+ tkip->dot11RSNAStatsTKIPLocalMICFailures); -+ return p; -+} -+ -+ -+static struct ieee80211_crypto_ops ieee80211_crypt_tkip = { -+ .name = "TKIP", -+ .init = ieee80211_tkip_init, -+ .deinit = ieee80211_tkip_deinit, -+ .encrypt_mpdu = ieee80211_tkip_encrypt, -+ .decrypt_mpdu = ieee80211_tkip_decrypt, -+ .encrypt_msdu = ieee80211_michael_mic_add, -+ .decrypt_msdu = ieee80211_michael_mic_verify, -+ .set_key = ieee80211_tkip_set_key, -+ .get_key = ieee80211_tkip_get_key, -+ .print_stats = ieee80211_tkip_print_stats, -+ .extra_prefix_len = 4 + 4, /* IV + ExtIV */ -+ .extra_postfix_len = 8 + 4, /* MIC + ICV */ -+ .owner = THIS_MODULE, -+}; -+ -+ -+int __init ieee80211_crypto_tkip_init(void) -+{ -+ return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip); -+} -+ -+ -+void __exit ieee80211_crypto_tkip_exit(void) -+{ -+ ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip); -+} -+ -+ -+void ieee80211_tkip_null(void) -+{ -+// printk("============>%s()\n", __FUNCTION__); -+ return; -+} -+ -+#if 0 -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) -+EXPORT_SYMBOL(ieee80211_tkip_null); -+#else -+EXPORT_SYMBOL_NOVERS(ieee80211_tkip_null); -+#endif -+ -+ -+module_init(ieee80211_crypto_tkip_init); -+module_exit(ieee80211_crypto_tkip_exit); -+#endif -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_crypt_wep.c linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_crypt_wep.c ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_crypt_wep.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_crypt_wep.c 2010-08-05 21:12:34.313620509 +0200 -@@ -0,0 +1,383 @@ -+/* -+ * Host AP crypt: host-based WEP encryption implementation for Host AP driver -+ * -+ * Copyright (c) 2002-2004, Jouni Malinen <jkmaline@cc.hut.fi> -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. See README and COPYING for -+ * more details. -+ */ -+ -+//#include <linux/config.h> -+#include <linux/version.h> -+#include <linux/module.h> -+#include <linux/init.h> -+#include <linux/slab.h> -+#include <linux/random.h> -+#include <linux/skbuff.h> -+#include <asm/string.h> -+ -+#include "ieee80211.h" -+ -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) -+#include "rtl_crypto.h" -+#else -+#include <linux/crypto.h> -+#endif -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -+ #include <asm/scatterlist.h> -+#else -+ #include <linux/scatterlist.h> -+#endif -+//#include <asm/scatterlist.h> -+#include <linux/crc32.h> -+ -+MODULE_AUTHOR("Jouni Malinen"); -+MODULE_DESCRIPTION("Host AP crypt: WEP"); -+MODULE_LICENSE("GPL"); -+ -+ -+struct prism2_wep_data { -+ u32 iv; -+#define WEP_KEY_LEN 13 -+ u8 key[WEP_KEY_LEN + 1]; -+ u8 key_len; -+ u8 key_idx; -+ #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) -+ struct crypto_tfm *tfm; -+ #else -+ struct crypto_blkcipher *tx_tfm; -+ struct crypto_blkcipher *rx_tfm; -+ #endif -+}; -+ -+ -+static void * prism2_wep_init(int keyidx) -+{ -+ struct prism2_wep_data *priv; -+ -+ priv = kmalloc(sizeof(*priv), GFP_ATOMIC); -+ if (priv == NULL) -+ goto fail; -+ memset(priv, 0, sizeof(*priv)); -+ priv->key_idx = keyidx; -+ #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) -+ priv->tfm = crypto_alloc_tfm("arc4", 0); -+ if (priv->tfm == NULL) { -+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " -+ "crypto API arc4\n"); -+ goto fail; -+ } -+ #else -+ priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); -+ if (IS_ERR(priv->tx_tfm)) { -+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " -+ "crypto API arc4\n"); -+ priv->tx_tfm = NULL; -+ goto fail; -+ } -+ priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); -+ if (IS_ERR(priv->rx_tfm)) { -+ printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " -+ "crypto API arc4\n"); -+ priv->rx_tfm = NULL; -+ goto fail; -+ } -+ #endif -+ -+ /* start WEP IV from a random value */ -+ get_random_bytes(&priv->iv, 4); -+ -+ return priv; -+ -+fail: -+ #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) -+ if (priv) { -+ if (priv->tfm) -+ crypto_free_tfm(priv->tfm); -+ kfree(priv); -+ } -+ #else -+ if (priv) { -+ if (priv->tx_tfm) -+ crypto_free_blkcipher(priv->tx_tfm); -+ if (priv->rx_tfm) -+ crypto_free_blkcipher(priv->rx_tfm); -+ kfree(priv); -+ } -+ #endif -+ return NULL; -+} -+ -+ -+static void prism2_wep_deinit(void *priv) -+{ -+ struct prism2_wep_data *_priv = priv; -+ #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) -+ if (_priv && _priv->tfm) -+ crypto_free_tfm(_priv->tfm); -+ #else -+ if (_priv) { -+ if (_priv->tx_tfm) -+ crypto_free_blkcipher(_priv->tx_tfm); -+ if (_priv->rx_tfm) -+ crypto_free_blkcipher(_priv->rx_tfm); -+ } -+ #endif -+ kfree(priv); -+} -+ -+ -+/* Perform WEP encryption on given skb that has at least 4 bytes of headroom -+ * for IV and 4 bytes of tailroom for ICV. Both IV and ICV will be transmitted, -+ * so the payload length increases with 8 bytes. -+ * -+ * WEP frame payload: IV + TX key idx, RC4(data), ICV = RC4(CRC32(data)) -+ */ -+static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) -+{ -+ struct prism2_wep_data *wep = priv; -+#if(LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) -+ struct blkcipher_desc desc = {.tfm = wep->tx_tfm}; -+#endif -+ u32 klen, len; -+ u8 key[WEP_KEY_LEN + 3]; -+ u8 *pos; -+#ifndef JOHN_HWSEC -+ u32 crc; -+ u8 *icv; -+ struct scatterlist sg; -+#endif -+ if (skb_headroom(skb) < 4 || skb_tailroom(skb) < 4 || -+ skb->len < hdr_len) -+ return -1; -+ -+ len = skb->len - hdr_len; -+ pos = skb_push(skb, 4); -+ memmove(pos, pos + 4, hdr_len); -+ pos += hdr_len; -+ -+ klen = 3 + wep->key_len; -+ -+ wep->iv++; -+ -+ /* Fluhrer, Mantin, and Shamir have reported weaknesses in the key -+ * scheduling algorithm of RC4. At least IVs (KeyByte + 3, 0xff, N) -+ * can be used to speedup attacks, so avoid using them. */ -+ if ((wep->iv & 0xff00) == 0xff00) { -+ u8 B = (wep->iv >> 16) & 0xff; -+ if (B >= 3 && B < klen) -+ wep->iv += 0x0100; -+ } -+ -+ /* Prepend 24-bit IV to RC4 key and TX frame */ -+ *pos++ = key[0] = (wep->iv >> 16) & 0xff; -+ *pos++ = key[1] = (wep->iv >> 8) & 0xff; -+ *pos++ = key[2] = wep->iv & 0xff; -+ *pos++ = wep->key_idx << 6; -+ -+ /* Copy rest of the WEP key (the secret part) */ -+ memcpy(key + 3, wep->key, wep->key_len); -+ -+#ifndef JOHN_HWSEC -+ /* Append little-endian CRC32 and encrypt it to produce ICV */ -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) -+ crc = ~crc32_le(~0, pos, len); -+#else -+ crc = ~ether_crc_le(len, pos); -+#endif -+ icv = skb_put(skb, 4); -+ icv[0] = crc; -+ icv[1] = crc >> 8; -+ icv[2] = crc >> 16; -+ icv[3] = crc >> 24; -+ -+ #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) -+ crypto_cipher_setkey(wep->tfm, key, klen); -+ sg.page = virt_to_page(pos); -+ sg.offset = offset_in_page(pos); -+ sg.length = len + 4; -+ crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4); -+ -+ return 0; -+ #else -+ crypto_blkcipher_setkey(wep->tx_tfm, key, klen); -+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)) -+ sg.page = virt_to_page(pos); -+ sg.offset = offset_in_page(pos); -+ sg.length = len + 4; -+ #else -+ sg_init_one(&sg, pos, len + 4); -+ #endif -+ return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4); -+ #endif -+#endif /* JOHN_HWSEC */ -+ return 0; -+} -+ -+ -+/* Perform WEP decryption on given buffer. Buffer includes whole WEP part of -+ * the frame: IV (4 bytes), encrypted payload (including SNAP header), -+ * ICV (4 bytes). len includes both IV and ICV. -+ * -+ * Returns 0 if frame was decrypted successfully and ICV was correct and -1 on -+ * failure. If frame is OK, IV and ICV will be removed. -+ */ -+static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv) -+{ -+ struct prism2_wep_data *wep = priv; -+ #if(LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) -+ struct blkcipher_desc desc = {.tfm = wep->rx_tfm}; -+ #endif -+ u32 klen, plen; -+ u8 key[WEP_KEY_LEN + 3]; -+ u8 keyidx, *pos; -+#ifndef JOHN_HWSEC -+ u32 crc; -+ u8 icv[4]; -+ struct scatterlist sg; -+#endif -+ if (skb->len < hdr_len + 8) -+ return -1; -+ -+ pos = skb->data + hdr_len; -+ key[0] = *pos++; -+ key[1] = *pos++; -+ key[2] = *pos++; -+ keyidx = *pos++ >> 6; -+ if (keyidx != wep->key_idx) -+ return -1; -+ -+ klen = 3 + wep->key_len; -+ -+ /* Copy rest of the WEP key (the secret part) */ -+ memcpy(key + 3, wep->key, wep->key_len); -+ -+ /* Apply RC4 to data and compute CRC32 over decrypted data */ -+ plen = skb->len - hdr_len - 8; -+#ifndef JOHN_HWSEC -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) -+ crypto_cipher_setkey(wep->tfm, key, klen); -+ sg.page = virt_to_page(pos); -+ sg.offset = offset_in_page(pos); -+ sg.length = plen + 4; -+ crypto_cipher_decrypt(wep->tfm, &sg, &sg, plen + 4); -+#else -+ crypto_blkcipher_setkey(wep->rx_tfm, key, klen); -+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) -+ sg.page = virt_to_page(pos); -+ sg.offset = offset_in_page(pos); -+ sg.length = plen + 4; -+ #else -+ sg_init_one(&sg, pos, plen + 4); -+ #endif -+ if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) -+ return -7; -+#endif -+ -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) -+ crc = ~crc32_le(~0, pos, plen); -+#else -+ crc = ~ether_crc_le(plen, pos); -+#endif -+ icv[0] = crc; -+ icv[1] = crc >> 8; -+ icv[2] = crc >> 16; -+ icv[3] = crc >> 24; -+ -+ if (memcmp(icv, pos + plen, 4) != 0) { -+ /* ICV mismatch - drop frame */ -+ return -2; -+ } -+#endif /* JOHN_HWSEC */ -+ -+ /* Remove IV and ICV */ -+ memmove(skb->data + 4, skb->data, hdr_len); -+ skb_pull(skb, 4); -+ skb_trim(skb, skb->len - 4); -+ return 0; -+} -+ -+ -+static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv) -+{ -+ struct prism2_wep_data *wep = priv; -+ -+ if (len < 0 || len > WEP_KEY_LEN) -+ return -1; -+ -+ memcpy(wep->key, key, len); -+ wep->key_len = len; -+ -+ return 0; -+} -+ -+ -+static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv) -+{ -+ struct prism2_wep_data *wep = priv; -+ -+ if (len < wep->key_len) -+ return -1; -+ -+ memcpy(key, wep->key, wep->key_len); -+ -+ return wep->key_len; -+} -+ -+ -+static char * prism2_wep_print_stats(char *p, void *priv) -+{ -+ struct prism2_wep_data *wep = priv; -+ p += sprintf(p, "key[%d] alg=WEP len=%d\n", -+ wep->key_idx, wep->key_len); -+ return p; -+} -+ -+ -+static struct ieee80211_crypto_ops ieee80211_crypt_wep = { -+ .name = "WEP", -+ .init = prism2_wep_init, -+ .deinit = prism2_wep_deinit, -+ .encrypt_mpdu = prism2_wep_encrypt, -+ .decrypt_mpdu = prism2_wep_decrypt, -+ .encrypt_msdu = NULL, -+ .decrypt_msdu = NULL, -+ .set_key = prism2_wep_set_key, -+ .get_key = prism2_wep_get_key, -+ .print_stats = prism2_wep_print_stats, -+ .extra_prefix_len = 4, /* IV */ -+ .extra_postfix_len = 4, /* ICV */ -+ .owner = THIS_MODULE, -+}; -+ -+ -+int __init ieee80211_crypto_wep_init(void) -+{ -+ return ieee80211_register_crypto_ops(&ieee80211_crypt_wep); -+} -+ -+ -+void __exit ieee80211_crypto_wep_exit(void) -+{ -+ ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep); -+} -+ -+ -+void ieee80211_wep_null(void) -+{ -+// printk("============>%s()\n", __FUNCTION__); -+ return; -+} -+#if 0 -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) -+EXPORT_SYMBOL(ieee80211_wep_null); -+#else -+EXPORT_SYMBOL_NOVERS(ieee80211_wep_null); -+#endif -+ -+module_init(ieee80211_crypto_wep_init); -+module_exit(ieee80211_crypto_wep_exit); -+#endif -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/ieee80211.h linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/ieee80211.h ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/ieee80211.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/ieee80211.h 2010-08-05 21:12:34.353620599 +0200 -@@ -0,0 +1,1903 @@ -+/* -+ * Merged with mainline ieee80211.h in Aug 2004. Original ieee802_11 -+ * remains copyright by the original authors -+ * -+ * Portions of the merged code are based on Host AP (software wireless -+ * LAN access point) driver for Intersil Prism2/2.5/3. -+ * -+ * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen -+ * <jkmaline@cc.hut.fi> -+ * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> -+ * -+ * Adaption to a generic IEEE 802.11 stack by James Ketrenos -+ * <jketreno@linux.intel.com> -+ * Copyright (c) 2004, Intel Corporation -+ * -+ * Modified for Realtek's wi-fi cards by Andrea Merello -+ * <andreamrl@tiscali.it> -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. See README and COPYING for -+ * more details. -+ */ -+#ifndef IEEE80211_H -+#define IEEE80211_H -+#include <linux/if_ether.h> /* ETH_ALEN */ -+#include <linux/kernel.h> /* ARRAY_SIZE */ -+#include <linux/version.h> -+#include <linux/module.h> -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) -+#include <linux/jiffies.h> -+#else -+#include <linux/jffs.h> -+#include <linux/tqueue.h> -+#endif -+#include <linux/timer.h> -+#include <linux/sched.h> -+ -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)) -+#include <linux/wireless.h> -+#endif -+/* -+#ifndef bool -+#define bool int -+#endif -+ -+#ifndef true -+#define true 1 -+#endif -+ -+#ifndef false -+#define false 0 -+#endif -+*/ -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) -+#ifndef bool -+typedef enum{false = 0, true} bool; -+#endif -+#endif -+//#ifdef JOHN_HWSEC -+#define KEY_TYPE_NA 0x0 -+#define KEY_TYPE_WEP40 0x1 -+#define KEY_TYPE_TKIP 0x2 -+#define KEY_TYPE_CCMP 0x4 -+#define KEY_TYPE_WEP104 0x5 -+//#endif -+ -+ -+#define aSifsTime 10 -+ -+#define MGMT_QUEUE_NUM 5 -+ -+ -+#define IEEE_CMD_SET_WPA_PARAM 1 -+#define IEEE_CMD_SET_WPA_IE 2 -+#define IEEE_CMD_SET_ENCRYPTION 3 -+#define IEEE_CMD_MLME 4 -+ -+#define IEEE_PARAM_WPA_ENABLED 1 -+#define IEEE_PARAM_TKIP_COUNTERMEASURES 2 -+#define IEEE_PARAM_DROP_UNENCRYPTED 3 -+#define IEEE_PARAM_PRIVACY_INVOKED 4 -+#define IEEE_PARAM_AUTH_ALGS 5 -+#define IEEE_PARAM_IEEE_802_1X 6 -+//It should consistent with the driver_XXX.c -+// David, 2006.9.26 -+#define IEEE_PARAM_WPAX_SELECT 7 -+//Added for notify the encryption type selection -+// David, 2006.9.26 -+#define IEEE_PROTO_WPA 1 -+#define IEEE_PROTO_RSN 2 -+//Added for notify the encryption type selection -+// David, 2006.9.26 -+#define IEEE_WPAX_USEGROUP 0 -+#define IEEE_WPAX_WEP40 1 -+#define IEEE_WPAX_TKIP 2 -+#define IEEE_WPAX_WRAP 3 -+#define IEEE_WPAX_CCMP 4 -+#define IEEE_WPAX_WEP104 5 -+ -+#define IEEE_KEY_MGMT_IEEE8021X 1 -+#define IEEE_KEY_MGMT_PSK 2 -+ -+ -+ -+#define IEEE_MLME_STA_DEAUTH 1 -+#define IEEE_MLME_STA_DISASSOC 2 -+ -+ -+#define IEEE_CRYPT_ERR_UNKNOWN_ALG 2 -+#define IEEE_CRYPT_ERR_UNKNOWN_ADDR 3 -+#define IEEE_CRYPT_ERR_CRYPT_INIT_FAILED 4 -+#define IEEE_CRYPT_ERR_KEY_SET_FAILED 5 -+#define IEEE_CRYPT_ERR_TX_KEY_SET_FAILED 6 -+#define IEEE_CRYPT_ERR_CARD_CONF_FAILED 7 -+ -+ -+#define IEEE_CRYPT_ALG_NAME_LEN 16 -+ -+//#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,10)) -+#define ieee80211_wx_get_scan ieee80211_wx_get_scan_rtl -+#define ieee80211_wx_set_encode ieee80211_wx_set_encode_rtl -+#define ieee80211_wx_get_encode ieee80211_wx_get_encode_rtl -+//////////////////////////////// -+// added for kernel conflict under FC5 -+#define ieee80211_wx_get_name ieee80211_wx_get_name_rtl -+#define free_ieee80211 free_ieee80211_rtl -+#define alloc_ieee80211 alloc_ieee80211_rtl -+/////////////////////////////// -+//#endif -+#define ieee80211_rx ieee80211_rx_rtl -+#define ieee80211_wake_queue ieee80211_wake_queue_rtl -+#define ieee80211_stop_queue ieee80211_stop_queue_rtl -+#define ieee80211_wx_set_auth ieee80211_wx_set_auth_rtl -+#define ieee80211_get_crypto_ops ieee80211_get_crypto_ops_rtl -+#define ieee80211_crypt_delayed_deinit ieee80211_crypt_delayed_deinit_rtl -+ -+#define ieee80211_start_scan ieee80211_start_scan_rtl -+#define ieee80211_register_crypto_ops ieee80211_register_crypto_ops_rtl -+#define ieee80211_unregister_crypto_ops ieee80211_unregister_crypto_ops_rtl -+#define ieee80211_crypt_deinit_entries ieee80211_crypt_deinit_entries_rtl -+#define ieee80211_crypt_deinit_handler ieee80211_crypt_deinit_handler_rtl -+typedef struct ieee_param { -+ u32 cmd; -+ u8 sta_addr[ETH_ALEN]; -+ union { -+ struct { -+ u8 name; -+ u32 value; -+ } wpa_param; -+ struct { -+ u32 len; -+ u8 reserved[32]; -+ u8 data[0]; -+ } wpa_ie; -+ struct{ -+ int command; -+ int reason_code; -+ } mlme; -+ struct { -+ u8 alg[IEEE_CRYPT_ALG_NAME_LEN]; -+ u8 set_tx; -+ u32 err; -+ u8 idx; -+ u8 seq[8]; /* sequence counter (set: RX, get: TX) */ -+ u16 key_len; -+ u8 key[0]; -+ } crypt; -+ -+ } u; -+}ieee_param; -+ -+ -+#if WIRELESS_EXT < 17 -+#define IW_QUAL_QUAL_INVALID 0x10 -+#define IW_QUAL_LEVEL_INVALID 0x20 -+#define IW_QUAL_NOISE_INVALID 0x40 -+#define IW_QUAL_QUAL_UPDATED 0x1 -+#define IW_QUAL_LEVEL_UPDATED 0x2 -+#define IW_QUAL_NOISE_UPDATED 0x4 -+#endif -+ -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) -+static inline void tq_init(struct tq_struct * task, void(*func)(void *), void *data) -+{ -+ task->routine = func; -+ task->data = data; -+ //task->next = NULL; -+ INIT_LIST_HEAD(&task->list); -+ task->sync = 0; -+} -+#endif -+ -+// linux under 2.6.9 release may not support it, so modify it for common use -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)) -+//#define MSECS(t) (1000 * ((t) / HZ) + 1000 * ((t) % HZ) / HZ) -+#define MSECS(t) (HZ * ((t) / 1000) + (HZ * ((t) % 1000)) / 1000) -+static inline unsigned long msleep_interruptible_rtl(unsigned int msecs) -+{ -+ unsigned long timeout = MSECS(msecs) + 1; -+ -+ while (timeout) { -+ set_current_state(TASK_UNINTERRUPTIBLE); -+ timeout = schedule_timeout(timeout); -+ } -+ return timeout; -+} -+#else -+#define MSECS(t) msecs_to_jiffies(t) -+#define msleep_interruptible_rtl msleep_interruptible -+#endif -+ -+#define IEEE80211_DATA_LEN 2304 -+/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section -+ 6.2.1.1.2. -+ -+ The figure in section 7.1.2 suggests a body size of up to 2312 -+ bytes is allowed, which is a bit confusing, I suspect this -+ represents the 2304 bytes of real data, plus a possible 8 bytes of -+ WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */ -+ -+ -+#define IEEE80211_HLEN 30 -+#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) -+ -+/* this is stolen and modified from the madwifi driver*/ -+#define IEEE80211_FC0_TYPE_MASK 0x0c -+#define IEEE80211_FC0_TYPE_DATA 0x08 -+#define IEEE80211_FC0_SUBTYPE_MASK 0xB0 -+#define IEEE80211_FC0_SUBTYPE_QOS 0x80 -+ -+#define IEEE80211_QOS_HAS_SEQ(fc) \ -+ (((fc) & (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) == \ -+ (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS)) -+ -+/* this is stolen from ipw2200 driver */ -+#define IEEE_IBSS_MAC_HASH_SIZE 31 -+#define IEEE_MESH_MAC_HASH_SIZE 31 -+struct ieee_ibss_seq { -+ u8 mac[ETH_ALEN]; -+ u16 seq_num[17]; -+ u16 frag_num[17]; -+ unsigned long packet_time[17]; -+ struct list_head list; -+}; -+ -+struct ieee_mesh_seq { -+ u8 mac[ETH_ALEN]; -+ u16 seq_num; -+ u16 frag_num; -+ unsigned long packet_time; -+ struct list_head list; -+}; -+ -+struct ieee80211_hdr { -+ u16 frame_ctl; -+ u16 duration_id; -+ u8 addr1[ETH_ALEN]; -+ u8 addr2[ETH_ALEN]; -+ u8 addr3[ETH_ALEN]; -+ u16 seq_ctl; -+ u8 addr4[ETH_ALEN]; -+} __attribute__ ((packed)); -+ -+struct ieee80211_hdr_QOS { -+ u16 frame_ctl; -+ u16 duration_id; -+ u8 addr1[ETH_ALEN]; -+ u8 addr2[ETH_ALEN]; -+ u8 addr3[ETH_ALEN]; -+ u16 seq_ctl; -+ u8 addr4[ETH_ALEN]; -+ u16 QOS_ctl; -+} __attribute__ ((packed)); -+ -+struct ieee80211_hdr_3addr { -+ u16 frame_ctl; -+ u16 duration_id; -+ u8 addr1[ETH_ALEN]; -+ u8 addr2[ETH_ALEN]; -+ u8 addr3[ETH_ALEN]; -+ u16 seq_ctl; -+} __attribute__ ((packed)); -+ -+struct ieee80211_hdr_3addr_QOS { -+ u16 frame_ctl; -+ u16 duration_id; -+ u8 addr1[ETH_ALEN]; -+ u8 addr2[ETH_ALEN]; -+ u8 addr3[ETH_ALEN]; -+ u16 seq_ctl; -+ u16 QOS_ctl; -+} __attribute__ ((packed)); -+ -+enum eap_type { -+ EAP_PACKET = 0, -+ EAPOL_START, -+ EAPOL_LOGOFF, -+ EAPOL_KEY, -+ EAPOL_ENCAP_ASF_ALERT -+}; -+ -+//by lizhaoming for LED 2008.6.23 from r8187_led.h -+#ifdef LED -+typedef enum _LED_CTL_MODE { -+ LED_CTL_POWER_ON, -+ LED_CTL_POWER_OFF, -+ LED_CTL_LINK, -+ LED_CTL_NO_LINK, -+ LED_CTL_TX, -+ LED_CTL_RX, -+ LED_CTL_SITE_SURVEY, -+} LED_CTL_MODE; -+#endif -+ -+static const char *eap_types[] = { -+ [EAP_PACKET] = "EAP-Packet", -+ [EAPOL_START] = "EAPOL-Start", -+ [EAPOL_LOGOFF] = "EAPOL-Logoff", -+ [EAPOL_KEY] = "EAPOL-Key", -+ [EAPOL_ENCAP_ASF_ALERT] = "EAPOL-Encap-ASF-Alert" -+}; -+ -+static inline const char *eap_get_type(int type) -+{ -+ return (type >= ARRAY_SIZE(eap_types)) ? "Unknown" : eap_types[type]; -+} -+ -+struct eapol { -+ u8 snap[6]; -+ u16 ethertype; -+ u8 version; -+ u8 type; -+ u16 length; -+} __attribute__ ((packed)); -+ -+#define IEEE80211_3ADDR_LEN 24 -+#define IEEE80211_4ADDR_LEN 30 -+#define IEEE80211_FCS_LEN 4 -+ -+#define MIN_FRAG_THRESHOLD 256U -+#define MAX_FRAG_THRESHOLD 2346U -+ -+/* Frame control field constants */ -+#define IEEE80211_FCTL_VERS 0x0002 -+#define IEEE80211_FCTL_FTYPE 0x000c -+#define IEEE80211_FCTL_STYPE 0x00f0 -+#define IEEE80211_FCTL_TODS 0x0100 -+#define IEEE80211_FCTL_FROMDS 0x0200 -+#define IEEE80211_FCTL_DSTODS 0x0300 //added by david -+#define IEEE80211_FCTL_MOREFRAGS 0x0400 -+#define IEEE80211_FCTL_RETRY 0x0800 -+#define IEEE80211_FCTL_PM 0x1000 -+#define IEEE80211_FCTL_MOREDATA 0x2000 -+#define IEEE80211_FCTL_WEP 0x4000 -+#define IEEE80211_FCTL_ORDER 0x8000 -+ -+#define IEEE80211_FTYPE_MGMT 0x0000 -+#define IEEE80211_FTYPE_CTL 0x0004 -+#define IEEE80211_FTYPE_DATA 0x0008 -+ -+/* management */ -+#define IEEE80211_STYPE_ASSOC_REQ 0x0000 -+#define IEEE80211_STYPE_ASSOC_RESP 0x0010 -+#define IEEE80211_STYPE_REASSOC_REQ 0x0020 -+#define IEEE80211_STYPE_REASSOC_RESP 0x0030 -+#define IEEE80211_STYPE_PROBE_REQ 0x0040 -+#define IEEE80211_STYPE_PROBE_RESP 0x0050 -+#define IEEE80211_STYPE_BEACON 0x0080 -+#define IEEE80211_STYPE_ATIM 0x0090 -+#define IEEE80211_STYPE_DISASSOC 0x00A0 -+#define IEEE80211_STYPE_AUTH 0x00B0 -+#define IEEE80211_STYPE_DEAUTH 0x00C0 -+#define IEEE80211_STYPE_MANAGE_ACT 0x00D0 -+ -+/* control */ -+#define IEEE80211_STYPE_PSPOLL 0x00A0 -+#define IEEE80211_STYPE_RTS 0x00B0 -+#define IEEE80211_STYPE_CTS 0x00C0 -+#define IEEE80211_STYPE_ACK 0x00D0 -+#define IEEE80211_STYPE_CFEND 0x00E0 -+#define IEEE80211_STYPE_CFENDACK 0x00F0 -+ -+/* data */ -+#define IEEE80211_STYPE_DATA 0x0000 -+#define IEEE80211_STYPE_DATA_CFACK 0x0010 -+#define IEEE80211_STYPE_DATA_CFPOLL 0x0020 -+#define IEEE80211_STYPE_DATA_CFACKPOLL 0x0030 -+#define IEEE80211_STYPE_NULLFUNC 0x0040 -+#define IEEE80211_STYPE_CFACK 0x0050 -+#define IEEE80211_STYPE_CFPOLL 0x0060 -+#define IEEE80211_STYPE_CFACKPOLL 0x0070 -+#define IEEE80211_STYPE_QOS_DATA 0x0080 //added for WMM 2006/8/2 -+#define IEEE80211_STYPE_QOS_NULL 0x00C0 -+ -+ -+#define IEEE80211_SCTL_FRAG 0x000F -+#define IEEE80211_SCTL_SEQ 0xFFF0 -+ -+ -+/* debug macros */ -+ -+#ifdef CONFIG_IEEE80211_DEBUG -+extern u32 ieee80211_debug_level; -+#define IEEE80211_DEBUG(level, fmt, args...) \ -+do { if (ieee80211_debug_level & (level)) \ -+ printk(KERN_DEBUG "ieee80211: %c %s " fmt, \ -+ in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) -+#else -+#define IEEE80211_DEBUG(level, fmt, args...) do {} while (0) -+#endif /* CONFIG_IEEE80211_DEBUG */ -+ -+/* -+ * To use the debug system; -+ * -+ * If you are defining a new debug classification, simply add it to the #define -+ * list here in the form of: -+ * -+ * #define IEEE80211_DL_xxxx VALUE -+ * -+ * shifting value to the left one bit from the previous entry. xxxx should be -+ * the name of the classification (for example, WEP) -+ * -+ * You then need to either add a IEEE80211_xxxx_DEBUG() macro definition for your -+ * classification, or use IEEE80211_DEBUG(IEEE80211_DL_xxxx, ...) whenever you want -+ * to send output to that classification. -+ * -+ * To add your debug level to the list of levels seen when you perform -+ * -+ * % cat /proc/net/ipw/debug_level -+ * -+ * you simply need to add your entry to the ipw_debug_levels array. -+ * -+ * If you do not see debug_level in /proc/net/ipw then you do not have -+ * CONFIG_IEEE80211_DEBUG defined in your kernel configuration -+ * -+ */ -+ -+#define IEEE80211_DL_INFO (1<<0) -+#define IEEE80211_DL_WX (1<<1) -+#define IEEE80211_DL_SCAN (1<<2) -+#define IEEE80211_DL_STATE (1<<3) -+#define IEEE80211_DL_MGMT (1<<4) -+#define IEEE80211_DL_FRAG (1<<5) -+#define IEEE80211_DL_EAP (1<<6) -+#define IEEE80211_DL_DROP (1<<7) -+ -+#define IEEE80211_DL_TX (1<<8) -+#define IEEE80211_DL_RX (1<<9) -+ -+#define IEEE80211_ERROR(f, a...) printk(KERN_ERR "ieee80211: " f, ## a) -+#define IEEE80211_WARNING(f, a...) printk(KERN_WARNING "ieee80211: " f, ## a) -+#define IEEE80211_DEBUG_INFO(f, a...) IEEE80211_DEBUG(IEEE80211_DL_INFO, f, ## a) -+ -+#define IEEE80211_DEBUG_WX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_WX, f, ## a) -+#define IEEE80211_DEBUG_SCAN(f, a...) IEEE80211_DEBUG(IEEE80211_DL_SCAN, f, ## a) -+#define IEEE80211_DEBUG_STATE(f, a...) IEEE80211_DEBUG(IEEE80211_DL_STATE, f, ## a) -+#define IEEE80211_DEBUG_MGMT(f, a...) IEEE80211_DEBUG(IEEE80211_DL_MGMT, f, ## a) -+#define IEEE80211_DEBUG_FRAG(f, a...) IEEE80211_DEBUG(IEEE80211_DL_FRAG, f, ## a) -+#define IEEE80211_DEBUG_EAP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_EAP, f, ## a) -+#define IEEE80211_DEBUG_DROP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_DROP, f, ## a) -+#define IEEE80211_DEBUG_TX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_TX, f, ## a) -+#define IEEE80211_DEBUG_RX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a) -+#include <linux/netdevice.h> -+#include <linux/wireless.h> -+#include <linux/if_arp.h> /* ARPHRD_ETHER */ -+ -+#ifndef WIRELESS_SPY -+#define WIRELESS_SPY // enable iwspy support -+#endif -+#include <net/iw_handler.h> // new driver API -+ -+#ifndef ETH_P_PAE -+#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ -+#endif /* ETH_P_PAE */ -+ -+#define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */ -+ -+#ifndef ETH_P_80211_RAW -+#define ETH_P_80211_RAW (ETH_P_ECONET + 1) -+#endif -+ -+/* IEEE 802.11 defines */ -+ -+#define P80211_OUI_LEN 3 -+ -+struct ieee80211_snap_hdr { -+ -+ u8 dsap; /* always 0xAA */ -+ u8 ssap; /* always 0xAA */ -+ u8 ctrl; /* always 0x03 */ -+ u8 oui[P80211_OUI_LEN]; /* organizational universal id */ -+ -+} __attribute__ ((packed)); -+ -+#define SNAP_SIZE sizeof(struct ieee80211_snap_hdr) -+ -+#define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE) -+#define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE) -+ -+#define WLAN_GET_SEQ_FRAG(seq) ((seq) & IEEE80211_SCTL_FRAG) -+#define WLAN_GET_SEQ_SEQ(seq) ((seq) & IEEE80211_SCTL_SEQ) -+ -+/* Authentication algorithms */ -+#define WLAN_AUTH_OPEN 0 -+#define WLAN_AUTH_SHARED_KEY 1 -+ -+#define WLAN_AUTH_CHALLENGE_LEN 128 -+ -+#define WLAN_CAPABILITY_BSS (1<<0) -+#define WLAN_CAPABILITY_IBSS (1<<1) -+#define WLAN_CAPABILITY_CF_POLLABLE (1<<2) -+#define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3) -+#define WLAN_CAPABILITY_PRIVACY (1<<4) -+#define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5) -+#define WLAN_CAPABILITY_PBCC (1<<6) -+#define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7) -+#define WLAN_CAPABILITY_SHORT_SLOT (1<<10) -+ -+/* Status codes */ -+#define WLAN_STATUS_SUCCESS 0 -+#define WLAN_STATUS_UNSPECIFIED_FAILURE 1 -+#define WLAN_STATUS_CAPS_UNSUPPORTED 10 -+#define WLAN_STATUS_REASSOC_NO_ASSOC 11 -+#define WLAN_STATUS_ASSOC_DENIED_UNSPEC 12 -+#define WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG 13 -+#define WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION 14 -+#define WLAN_STATUS_CHALLENGE_FAIL 15 -+#define WLAN_STATUS_AUTH_TIMEOUT 16 -+#define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17 -+#define WLAN_STATUS_ASSOC_DENIED_RATES 18 -+/* 802.11b */ -+#define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19 -+#define WLAN_STATUS_ASSOC_DENIED_NOPBCC 20 -+#define WLAN_STATUS_ASSOC_DENIED_NOAGILITY 21 -+ -+/* Reason codes */ -+#define WLAN_REASON_UNSPECIFIED 1 -+#define WLAN_REASON_PREV_AUTH_NOT_VALID 2 -+#define WLAN_REASON_DEAUTH_LEAVING 3 -+#define WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY 4 -+#define WLAN_REASON_DISASSOC_AP_BUSY 5 -+#define WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6 -+#define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7 -+#define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8 -+#define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9 -+ -+ -+/* Information Element IDs */ -+#define WLAN_EID_SSID 0 -+#define WLAN_EID_SUPP_RATES 1 -+#define WLAN_EID_FH_PARAMS 2 -+#define WLAN_EID_DS_PARAMS 3 -+#define WLAN_EID_CF_PARAMS 4 -+#define WLAN_EID_TIM 5 -+#define WLAN_EID_IBSS_PARAMS 6 -+#define WLAN_EID_CHALLENGE 16 -+#define WLAN_EID_RSN 48 -+#define WLAN_EID_GENERIC 221 -+ -+#define IEEE80211_MGMT_HDR_LEN 24 -+#define IEEE80211_DATA_HDR3_LEN 24 -+#define IEEE80211_DATA_HDR4_LEN 30 -+ -+ -+#define IEEE80211_STATMASK_SIGNAL (1<<0) -+#define IEEE80211_STATMASK_RSSI (1<<1) -+#define IEEE80211_STATMASK_NOISE (1<<2) -+#define IEEE80211_STATMASK_RATE (1<<3) -+#define IEEE80211_STATMASK_WEMASK 0x7 -+ -+ -+#define IEEE80211_CCK_MODULATION (1<<0) -+#define IEEE80211_OFDM_MODULATION (1<<1) -+ -+#define IEEE80211_24GHZ_BAND (1<<0) -+#define IEEE80211_52GHZ_BAND (1<<1) -+ -+#define IEEE80211_CCK_RATE_LEN 4 -+#define IEEE80211_CCK_RATE_1MB 0x02 -+#define IEEE80211_CCK_RATE_2MB 0x04 -+#define IEEE80211_CCK_RATE_5MB 0x0B -+#define IEEE80211_CCK_RATE_11MB 0x16 -+#define IEEE80211_OFDM_RATE_LEN 8 -+#define IEEE80211_OFDM_RATE_6MB 0x0C -+#define IEEE80211_OFDM_RATE_9MB 0x12 -+#define IEEE80211_OFDM_RATE_12MB 0x18 -+#define IEEE80211_OFDM_RATE_18MB 0x24 -+#define IEEE80211_OFDM_RATE_24MB 0x30 -+#define IEEE80211_OFDM_RATE_36MB 0x48 -+#define IEEE80211_OFDM_RATE_48MB 0x60 -+#define IEEE80211_OFDM_RATE_54MB 0x6C -+#define IEEE80211_BASIC_RATE_MASK 0x80 -+ -+#define IEEE80211_CCK_RATE_1MB_MASK (1<<0) -+#define IEEE80211_CCK_RATE_2MB_MASK (1<<1) -+#define IEEE80211_CCK_RATE_5MB_MASK (1<<2) -+#define IEEE80211_CCK_RATE_11MB_MASK (1<<3) -+#define IEEE80211_OFDM_RATE_6MB_MASK (1<<4) -+#define IEEE80211_OFDM_RATE_9MB_MASK (1<<5) -+#define IEEE80211_OFDM_RATE_12MB_MASK (1<<6) -+#define IEEE80211_OFDM_RATE_18MB_MASK (1<<7) -+#define IEEE80211_OFDM_RATE_24MB_MASK (1<<8) -+#define IEEE80211_OFDM_RATE_36MB_MASK (1<<9) -+#define IEEE80211_OFDM_RATE_48MB_MASK (1<<10) -+#define IEEE80211_OFDM_RATE_54MB_MASK (1<<11) -+ -+#define IEEE80211_CCK_RATES_MASK 0x0000000F -+#define IEEE80211_CCK_BASIC_RATES_MASK (IEEE80211_CCK_RATE_1MB_MASK | \ -+ IEEE80211_CCK_RATE_2MB_MASK) -+#define IEEE80211_CCK_DEFAULT_RATES_MASK (IEEE80211_CCK_BASIC_RATES_MASK | \ -+ IEEE80211_CCK_RATE_5MB_MASK | \ -+ IEEE80211_CCK_RATE_11MB_MASK) -+ -+#define IEEE80211_OFDM_RATES_MASK 0x00000FF0 -+#define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \ -+ IEEE80211_OFDM_RATE_12MB_MASK | \ -+ IEEE80211_OFDM_RATE_24MB_MASK) -+#define IEEE80211_OFDM_DEFAULT_RATES_MASK (IEEE80211_OFDM_BASIC_RATES_MASK | \ -+ IEEE80211_OFDM_RATE_9MB_MASK | \ -+ IEEE80211_OFDM_RATE_18MB_MASK | \ -+ IEEE80211_OFDM_RATE_36MB_MASK | \ -+ IEEE80211_OFDM_RATE_48MB_MASK | \ -+ IEEE80211_OFDM_RATE_54MB_MASK) -+#define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \ -+ IEEE80211_CCK_DEFAULT_RATES_MASK) -+ -+#define IEEE80211_NUM_OFDM_RATES 8 -+#define IEEE80211_NUM_CCK_RATES 4 -+#define IEEE80211_OFDM_SHIFT_MASK_A 4 -+ -+ -+ -+ -+/* NOTE: This data is for statistical purposes; not all hardware provides this -+ * information for frames received. Not setting these will not cause -+ * any adverse affects. */ -+struct ieee80211_rx_stats { -+ u32 mac_time[2]; -+ u8 signalstrength; -+ s8 rssi; -+ u8 signal; -+ u8 noise; -+ u16 rate; /* in 100 kbps */ -+ u8 received_channel; -+ u8 control; -+ u8 mask; -+ u8 freq; -+ u16 len; -+ u8 nic_type; -+}; -+ -+/* IEEE 802.11 requires that STA supports concurrent reception of at least -+ * three fragmented frames. This define can be increased to support more -+ * concurrent frames, but it should be noted that each entry can consume about -+ * 2 kB of RAM and increasing cache size will slow down frame reassembly. */ -+#define IEEE80211_FRAG_CACHE_LEN 4 -+ -+struct ieee80211_frag_entry { -+ unsigned long first_frag_time; -+ unsigned int seq; -+ unsigned int last_frag; -+ struct sk_buff *skb; -+ u8 src_addr[ETH_ALEN]; -+ u8 dst_addr[ETH_ALEN]; -+}; -+ -+struct ieee80211_stats { -+ unsigned int tx_unicast_frames; -+ unsigned int tx_multicast_frames; -+ unsigned int tx_fragments; -+ unsigned int tx_unicast_octets; -+ unsigned int tx_multicast_octets; -+ unsigned int tx_deferred_transmissions; -+ unsigned int tx_single_retry_frames; -+ unsigned int tx_multiple_retry_frames; -+ unsigned int tx_retry_limit_exceeded; -+ unsigned int tx_discards; -+ unsigned int rx_unicast_frames; -+ unsigned int rx_multicast_frames; -+ unsigned int rx_fragments; -+ unsigned int rx_unicast_octets; -+ unsigned int rx_multicast_octets; -+ unsigned int rx_fcs_errors; -+ unsigned int rx_discards_no_buffer; -+ unsigned int tx_discards_wrong_sa; -+ unsigned int rx_discards_undecryptable; -+ unsigned int rx_message_in_msg_fragments; -+ unsigned int rx_message_in_bad_msg_fragments; -+}; -+ -+struct ieee80211_softmac_stats{ -+ unsigned int rx_ass_ok; -+ unsigned int rx_ass_err; -+ unsigned int rx_probe_rq; -+ unsigned int tx_probe_rs; -+ unsigned int tx_beacons; -+ unsigned int rx_auth_rq; -+ unsigned int rx_auth_rs_ok; -+ unsigned int rx_auth_rs_err; -+ unsigned int tx_auth_rq; -+ unsigned int no_auth_rs; -+ unsigned int no_ass_rs; -+ unsigned int tx_ass_rq; -+ unsigned int rx_ass_rq; -+ unsigned int tx_probe_rq; -+ unsigned int reassoc; -+ unsigned int swtxstop; -+ unsigned int swtxawake; -+}; -+ -+struct ieee80211_device; -+ -+#include "ieee80211_crypt.h" -+ -+#define SEC_KEY_1 (1<<0) -+#define SEC_KEY_2 (1<<1) -+#define SEC_KEY_3 (1<<2) -+#define SEC_KEY_4 (1<<3) -+#define SEC_ACTIVE_KEY (1<<4) -+#define SEC_AUTH_MODE (1<<5) -+#define SEC_UNICAST_GROUP (1<<6) -+#define SEC_LEVEL (1<<7) -+#define SEC_ENABLED (1<<8) -+ -+#define SEC_LEVEL_0 0 /* None */ -+#define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */ -+#define SEC_LEVEL_2 2 /* Level 1 + TKIP */ -+#define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */ -+#define SEC_LEVEL_3 4 /* Level 2 + CCMP */ -+ -+#define WEP_KEYS 4 -+#define WEP_KEY_LEN 13 -+#define ALG_KEY_LEN 32 -+ -+#ifdef _RTL8187_EXT_PATCH_ -+#define MAX_MP 16 -+#endif -+struct ieee80211_security { -+ u16 active_key:2, -+ enabled:1, -+ auth_mode:2, -+ auth_algo:4, -+ unicast_uses_group:1; -+ u8 key_sizes[WEP_KEYS]; -+ u8 keys[WEP_KEYS][ALG_KEY_LEN]; -+ u8 level; -+ u16 flags; -+} __attribute__ ((packed)); -+ -+ -+/* -+ -+ 802.11 data frame from AP -+ -+ ,-------------------------------------------------------------------. -+Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | -+ |------|------|---------|---------|---------|------|---------|------| -+Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs | -+ | | tion | (BSSID) | | | ence | data | | -+ `-------------------------------------------------------------------' -+ -+Total: 28-2340 bytes -+ -+*/ -+ -+struct ieee80211_header_data { -+ u16 frame_ctl; -+ u16 duration_id; -+ u8 addr1[6]; -+ u8 addr2[6]; -+ u8 addr3[6]; -+ u16 seq_ctrl; -+}; -+ -+#define BEACON_PROBE_SSID_ID_POSITION 12 -+ -+/* Management Frame Information Element Types */ -+#define MFIE_TYPE_SSID 0 -+#define MFIE_TYPE_RATES 1 -+#define MFIE_TYPE_FH_SET 2 -+#define MFIE_TYPE_DS_SET 3 -+#define MFIE_TYPE_CF_SET 4 -+#define MFIE_TYPE_TIM 5 -+#define MFIE_TYPE_IBSS_SET 6 -+#define MFIE_TYPE_COUNTRY 7 -+#define MFIE_TYPE_CHALLENGE 16 -+#define MFIE_TYPE_ERP 42 -+#define MFIE_TYPE_RSN 48 -+#define MFIE_TYPE_RATES_EX 50 -+#define MFIE_TYPE_GENERIC 221 -+ -+#ifdef ENABLE_DOT11D -+typedef enum -+{ -+ COUNTRY_CODE_FCC = 0, -+ COUNTRY_CODE_IC = 1, -+ COUNTRY_CODE_ETSI = 2, -+ COUNTRY_CODE_SPAIN = 3, -+ COUNTRY_CODE_FRANCE = 4, -+ COUNTRY_CODE_MKK = 5, -+ COUNTRY_CODE_MKK1 = 6, -+ COUNTRY_CODE_ISRAEL = 7, -+ COUNTRY_CODE_TELEC = 8, -+ COUNTRY_CODE_GLOBAL_DOMAIN = 9, -+ COUNTRY_CODE_WORLD_WIDE_13_INDEX = 10 -+}country_code_type_t; -+#endif -+ -+ -+struct ieee80211_info_element_hdr { -+ u8 id; -+ u8 len; -+} __attribute__ ((packed)); -+ -+struct ieee80211_info_element { -+ u8 id; -+ u8 len; -+ u8 data[0]; -+} __attribute__ ((packed)); -+ -+/* -+ * These are the data types that can make up management packets -+ * -+ u16 auth_algorithm; -+ u16 auth_sequence; -+ u16 beacon_interval; -+ u16 capability; -+ u8 current_ap[ETH_ALEN]; -+ u16 listen_interval; -+ struct { -+ u16 association_id:14, reserved:2; -+ } __attribute__ ((packed)); -+ u32 time_stamp[2]; -+ u16 reason; -+ u16 status; -+*/ -+ -+#define IEEE80211_DEFAULT_TX_ESSID "Penguin" -+#define IEEE80211_DEFAULT_BASIC_RATE 10 -+#define IEEE80211_DEFAULT_MESHID "802.11s" -+#define IEEE80211_DEFAULT_MESH_CHAN 1 -+ -+struct ieee80211_authentication { -+ struct ieee80211_header_data header; -+ u16 algorithm; -+ u16 transaction; -+ u16 status; -+ //struct ieee80211_info_element_hdr info_element; -+} __attribute__ ((packed)); -+ -+ -+struct ieee80211_probe_response { -+ struct ieee80211_header_data header; -+ u32 time_stamp[2]; -+ u16 beacon_interval; -+ u16 capability; -+ struct ieee80211_info_element info_element; -+} __attribute__ ((packed)); -+ -+struct ieee80211_probe_request { -+ struct ieee80211_header_data header; -+ /*struct ieee80211_info_element info_element;*/ -+} __attribute__ ((packed)); -+ -+struct ieee80211_assoc_request_frame { -+ struct ieee80211_hdr_3addr header; -+ u16 capability; -+ u16 listen_interval; -+ //u8 current_ap[ETH_ALEN]; -+ struct ieee80211_info_element_hdr info_element; -+} __attribute__ ((packed)); -+ -+struct ieee80211_assoc_response_frame { -+ struct ieee80211_hdr_3addr header; -+ u16 capability; -+ u16 status; -+ u16 aid; -+ struct ieee80211_info_element info_element; /* supported rates */ -+} __attribute__ ((packed)); -+ -+ -+struct ieee80211_txb { -+ u8 nr_frags; -+ u8 encrypted; -+ u16 reserved; -+ u16 frag_size; -+ u16 payload_size; -+ struct sk_buff *fragments[0]; -+}; -+ -+struct ieee80211_wmm_ac_param { -+ u8 ac_aci_acm_aifsn; -+ u8 ac_ecwmin_ecwmax; -+ u16 ac_txop_limit; -+}; -+ -+struct ieee80211_wmm_ts_info { -+ u8 ac_dir_tid; -+ u8 ac_up_psb; -+ u8 reserved; -+} __attribute__ ((packed)); -+ -+struct ieee80211_wmm_tspec_elem { -+ struct ieee80211_wmm_ts_info ts_info; -+ u16 norm_msdu_size; -+ u16 max_msdu_size; -+ u32 min_serv_inter; -+ u32 max_serv_inter; -+ u32 inact_inter; -+ u32 suspen_inter; -+ u32 serv_start_time; -+ u32 min_data_rate; -+ u32 mean_data_rate; -+ u32 peak_data_rate; -+ u32 max_burst_size; -+ u32 delay_bound; -+ u32 min_phy_rate; -+ u16 surp_band_allow; -+ u16 medium_time; -+}__attribute__((packed)); -+ -+enum {WMM_all_frame, WMM_two_frame, WMM_four_frame, WMM_six_frame}; -+#define MAX_SP_Len (WMM_all_frame << 4) -+#define IEEE80211_QOS_TID 0x0f -+#define QOS_CTL_NOTCONTAIN_ACK (0x01 << 5) -+ -+/* SWEEP TABLE ENTRIES NUMBER*/ -+#define MAX_SWEEP_TAB_ENTRIES 42 -+#define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7 -+/* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs -+ * only use 8, and then use extended rates for the remaining supported -+ * rates. Other APs, however, stick all of their supported rates on the -+ * main rates information element... */ -+#define MAX_RATES_LENGTH ((u8)12) -+#define MAX_RATES_EX_LENGTH ((u8)16) -+#define MAX_NETWORK_COUNT 128 -+#ifdef ENABLE_DOT11D -+#define MAX_CHANNEL_NUMBER 165 //YJ,modified,080625 -+#define MAX_IE_LEN 0xFF //+YJ,080625 -+#else -+#define MAX_CHANNEL_NUMBER 161 -+#endif -+ -+//#define IEEE80211_SOFTMAC_SCAN_TIME 400 -+#define IEEE80211_SOFTMAC_SCAN_TIME 100//lzm mod 081209 -+//(HZ / 2) -+#define IEEE80211_SOFTMAC_ASSOC_RETRY_TIME (HZ * 2) -+ -+#define CRC_LENGTH 4U -+ -+#define MAX_WPA_IE_LEN 64 -+ -+#define NETWORK_EMPTY_ESSID (1<<0) -+#define NETWORK_HAS_OFDM (1<<1) -+#define NETWORK_HAS_CCK (1<<2) -+ -+#define IEEE80211_DTIM_MBCAST 4 -+#define IEEE80211_DTIM_UCAST 2 -+#define IEEE80211_DTIM_VALID 1 -+#define IEEE80211_DTIM_INVALID 0 -+ -+#define IEEE80211_PS_DISABLED 0 -+#define IEEE80211_PS_UNICAST IEEE80211_DTIM_UCAST -+#define IEEE80211_PS_MBCAST IEEE80211_DTIM_MBCAST -+ -+//added by David for QoS 2006/6/30 -+//#define WMM_Hang_8187 -+#ifdef WMM_Hang_8187 -+#undef WMM_Hang_8187 -+#endif -+ -+#define WME_AC_BE 0x00 -+#define WME_AC_BK 0x01 -+#define WME_AC_VI 0x02 -+#define WME_AC_VO 0x03 -+#define WME_ACI_MASK 0x03 -+#define WME_AIFSN_MASK 0x03 -+#define WME_AC_PRAM_LEN 16 -+ -+//UP Mapping to AC, using in MgntQuery_SequenceNumber() and maybe for DSCP -+//#define UP2AC(up) ((up<3) ? ((up==0)?1:0) : (up>>1)) -+#define UP2AC(up) ( \ -+ ((up) < 1) ? WME_AC_BE : \ -+ ((up) < 3) ? WME_AC_BK : \ -+ ((up) < 4) ? WME_AC_BE : \ -+ ((up) < 6) ? WME_AC_VI : \ -+ WME_AC_VO) -+//AC Mapping to UP, using in Tx part for selecting the corresponding TX queue -+#define AC2UP(_ac) ( \ -+ ((_ac) == WME_AC_VO) ? 6 : \ -+ ((_ac) == WME_AC_VI) ? 5 : \ -+ ((_ac) == WME_AC_BK) ? 1 : \ -+ 0) -+ -+#define ETHER_ADDR_LEN 6 /* length of an Ethernet address */ -+struct ether_header { -+ u8 ether_dhost[ETHER_ADDR_LEN]; -+ u8 ether_shost[ETHER_ADDR_LEN]; -+ u16 ether_type; -+} __attribute__((packed)); -+ -+#ifndef ETHERTYPE_PAE -+#define ETHERTYPE_PAE 0x888e /* EAPOL PAE/802.1x */ -+#endif -+#ifndef ETHERTYPE_IP -+#define ETHERTYPE_IP 0x0800 /* IP protocol */ -+#endif -+ -+struct ieee80211_network { -+ /* These entries are used to identify a unique network */ -+ u8 bssid[ETH_ALEN]; -+ u8 channel; -+ /* Ensure null-terminated for any debug msgs */ -+ u8 ssid[IW_ESSID_MAX_SIZE + 1]; -+ u8 ssid_len; -+ -+ /* These are network statistics */ -+ struct ieee80211_rx_stats stats; -+ u16 capability; -+ u8 rates[MAX_RATES_LENGTH]; -+ u8 rates_len; -+ u8 rates_ex[MAX_RATES_EX_LENGTH]; -+ u8 rates_ex_len; -+ unsigned long last_scanned; -+ u8 mode; -+ u8 flags; -+ u32 last_associate; -+ u32 time_stamp[2]; -+ u16 beacon_interval; -+ u16 listen_interval; -+ u16 atim_window; -+ u8 wpa_ie[MAX_WPA_IE_LEN]; -+ size_t wpa_ie_len; -+ u8 rsn_ie[MAX_WPA_IE_LEN]; -+ size_t rsn_ie_len; -+ u8 dtim_period; -+ u8 dtim_data; -+ u32 last_dtim_sta_time[2]; -+#ifdef _RTL8187_EXT_PATCH_ -+ void *ext_entry; -+#endif -+ struct list_head list; -+ //appeded for QoS -+ u8 wmm_info; -+ struct ieee80211_wmm_ac_param wmm_param[4]; -+ u8 QoS_Enable; -+ u8 SignalStrength; -+#ifdef THOMAS_TURBO -+ u8 Turbo_Enable;//enable turbo mode, added by thomas -+#endif -+ -+#ifdef ENABLE_DOT11D -+ u16 CountryIeLen; -+ u8 CountryIeBuf[MAX_IE_LEN]; -+#endif -+ -+}; -+ -+enum ieee80211_state { -+ -+ /* the card is not linked at all */ -+ IEEE80211_NOLINK = 0, -+ -+ /* IEEE80211_ASSOCIATING* are for BSS client mode -+ * the driver shall not perform RX filtering unless -+ * the state is LINKED. -+ * The driver shall just check for the state LINKED and -+ * defaults to NOLINK for ALL the other states (including -+ * LINKED_SCANNING) -+ */ -+ -+ /* the association procedure will start (wq scheduling)*/ -+ IEEE80211_ASSOCIATING, -+ IEEE80211_ASSOCIATING_RETRY, -+ -+ /* the association procedure is sending AUTH request*/ -+ IEEE80211_ASSOCIATING_AUTHENTICATING, -+ -+ /* the association procedure has successfully authentcated -+ * and is sending association request -+ */ -+ IEEE80211_ASSOCIATING_AUTHENTICATED, -+ -+ /* the link is ok. the card associated to a BSS or linked -+ * to a ibss cell or acting as an AP and creating the bss -+ */ -+ IEEE80211_LINKED, -+ -+ /* same as LINKED, but the driver shall apply RX filter -+ * rules as we are in NO_LINK mode. As the card is still -+ * logically linked, but it is doing a syncro site survey -+ * then it will be back to LINKED state. -+ */ -+ IEEE80211_LINKED_SCANNING, -+//by amy for mesh -+ IEEE80211_MESH_SCANNING, -+ IEEE80211_MESH_LINKED, -+//by amy for mesh -+ -+}; -+ -+#define DEFAULT_MAX_SCAN_AGE (15 * HZ) -+#define DEFAULT_FTS 2346 -+#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" -+#define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5] -+ -+ -+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11)) -+extern inline int is_multicast_ether_addr(const u8 *addr) -+{ -+ return ((addr[0] != 0xff) && (0x01 & addr[0])); -+} -+#endif -+ -+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13)) -+extern inline int is_broadcast_ether_addr(const u8 *addr) -+{ -+ return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \ -+ (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); -+} -+#endif -+ -+#define CFG_IEEE80211_RESERVE_FCS (1<<0) -+#define CFG_IEEE80211_COMPUTE_FCS (1<<1) -+ -+typedef struct tx_pending_t{ -+ int frag; -+ struct ieee80211_txb *txb; -+}tx_pending_t; -+ -+#ifdef _RTL8187_EXT_PATCH_ -+struct ieee80211_crypt_data_list{ -+ u8 used; -+ u8 mac_addr[ETH_ALEN]; //record mac_add -+ struct ieee80211_crypt_data *crypt[WEP_KEYS]; -+}__attribute__((packed)); -+ -+#endif -+ -+struct ieee80211_device { -+ struct net_device *dev; -+ -+ /* Bookkeeping structures */ -+ struct net_device_stats stats; -+ struct ieee80211_stats ieee_stats; -+ struct ieee80211_softmac_stats softmac_stats; -+ -+ /* Probe / Beacon management */ -+ struct list_head network_free_list; -+ struct list_head network_list; -+ struct ieee80211_network *networks; -+ int scans; -+ int scan_age; -+ -+ int iw_mode; /* operating mode (IW_MODE_*) */ -+#ifdef _RTL8187_EXT_PATCH_ -+ int iw_ext_mode; // if iw_mode == iw_ext_mode, do ext_patch_**(); -+#endif -+ -+ spinlock_t lock; -+ spinlock_t wpax_suitlist_lock; -+ -+ int tx_headroom; /* Set to size of any additional room needed at front -+ * of allocated Tx SKBs */ -+ u32 config; -+ -+ /* WEP and other encryption related settings at the device level */ -+ int open_wep; /* Set to 1 to allow unencrypted frames */ -+ -+ int reset_on_keychange; /* Set to 1 if the HW needs to be reset on -+ * WEP key changes */ -+ -+ /* If the host performs {en,de}cryption, then set to 1 */ -+ int host_encrypt; -+ int host_decrypt; -+ int ieee802_1x; /* is IEEE 802.1X used */ -+ -+ /* WPA data */ -+ int wpa_enabled; -+ int drop_unencrypted; -+ int tkip_countermeasures; -+ int privacy_invoked; -+ size_t wpa_ie_len; -+ u8 *wpa_ie; -+ -+//#ifdef JOHN_TKIP -+ u8 ap_mac_addr[6]; -+ u16 pairwise_key_type; -+ u16 broadcast_key_type; -+//#endif -+ struct list_head crypt_deinit_list; -+#ifdef _RTL8187_EXT_PATCH_ -+ struct ieee80211_crypt_data_list* cryptlist[MAX_MP]; -+#else -+ struct ieee80211_crypt_data *crypt[WEP_KEYS]; -+#endif -+ int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */ -+ struct timer_list crypt_deinit_timer; -+ -+ int bcrx_sta_key; /* use individual keys to override default keys even -+ * with RX of broad/multicast frames */ -+ -+ /* Fragmentation structures */ -+ // each streaming contain a entry -+ struct ieee80211_frag_entry frag_cache[17][IEEE80211_FRAG_CACHE_LEN]; -+ unsigned int frag_next_idx[17]; -+ u16 fts; /* Fragmentation Threshold */ -+ -+ /* This stores infos for the current network. -+ * Either the network we are associated in INFRASTRUCTURE -+ * or the network that we are creating in MASTER mode. -+ * ad-hoc is a mixture ;-). -+ * Note that in infrastructure mode, even when not associated, -+ * fields bssid and essid may be valid (if wpa_set and essid_set -+ * are true) as thy carry the value set by the user via iwconfig -+ */ -+ struct ieee80211_network current_network; -+ -+ -+ enum ieee80211_state state; -+ -+ int short_slot; -+ int mode; /* A, B, G */ -+ int modulation; /* CCK, OFDM */ -+ int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */ -+ int abg_true; /* ABG flag */ -+ -+ /* used for forcing the ibss workqueue to terminate -+ * without wait for the syncro scan to terminate -+ */ -+ short sync_scan_hurryup; -+ -+#ifdef ENABLE_DOT11D -+ void * pDot11dInfo; -+ bool bGlobalDomain; -+ bool bWorldWide13;//lzm add 20081205 -+ -+ // For Liteon Ch12~13 passive scan -+ u8 MinPassiveChnlNum; -+ u8 IbssStartChnl; -+#else -+ /* map of allowed channels. 0 is dummy */ -+ // FIXME: remeber to default to a basic channel plan depending of the PHY type -+ int channel_map[MAX_CHANNEL_NUMBER+1]; -+#endif -+ -+ int rate; /* current rate */ -+ int basic_rate; -+ //FIXME: pleace callback, see if redundant with softmac_features -+ short active_scan; -+ -+#ifdef _RTL8187_EXT_PATCH_ -+// short ch_lock; -+ short meshScanMode; -+#endif -+ /* this contains flags for selectively enable softmac support */ -+ u16 softmac_features; -+ -+ /* if the sequence control field is not filled by HW */ -+ u16 seq_ctrl[5]; -+ -+ /* association procedure transaction sequence number */ -+ u16 associate_seq; -+ -+ /* AID for RTXed association responses */ -+ u16 assoc_id; -+ -+ /* power save mode related*/ -+ short ps; -+ short sta_sleep; -+ int ps_timeout; -+ struct tasklet_struct ps_task; -+ u32 ps_th; -+ u32 ps_tl; -+ -+ short raw_tx; -+ /* used if IEEE_SOFTMAC_TX_QUEUE is set */ -+ short queue_stop; -+ short scanning; -+ short scan_watchdog;//lzm add 081215 for roaming -+ short proto_started; -+ -+ struct semaphore wx_sem; -+ struct semaphore scan_sem; -+ struct semaphore ips_sem; -+ spinlock_t mgmt_tx_lock; -+ spinlock_t beacon_lock; -+ spinlock_t beaconflag_lock; -+ short beacon_txing; -+ -+ short wap_set; -+ short ssid_set; -+ -+ u8 wpax_type_set; //{added by David, 2006.9.28} -+ u32 wpax_type_notify; //{added by David, 2006.9.26} -+ -+ /* QoS related flag */ -+ char init_wmmparam_flag; -+ -+ /* for discarding duplicated packets in IBSS */ -+ struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE]; -+ -+ /* for discarding duplicated packets in Mesh */ //added by david 2008.2.28/ -+ struct list_head mesh_mac_hash[IEEE_MESH_MAC_HASH_SIZE]; -+ -+ /* for discarding duplicated packets in BSS */ -+ u16 last_rxseq_num[17]; /* rx seq previous per-tid */ -+ u16 last_rxfrag_num[17];/* tx frag previous per-tid */ -+ unsigned long last_packet_time[17]; -+ -+ /* for PS mode */ -+ unsigned long last_rx_ps_time; -+ -+ /* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */ -+ struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM]; -+ int mgmt_queue_head; -+ int mgmt_queue_tail; -+//by amy for ps -+ bool bInactivePs; -+ bool actscanning; -+ u16 ListenInterval; -+ u32 NumRxData; -+ unsigned long NumRxDataInPeriod; //YJ,add,080828 -+ unsigned long NumRxBcnInPeriod; //YJ,add,080828 -+//by amy for ps -+ short meshid_set; -+ /* used if IEEE_SOFTMAC_TX_QUEUE is set */ -+ struct tx_pending_t tx_pending; -+ -+ /* used if IEEE_SOFTMAC_ASSOCIATE is set */ -+ struct timer_list associate_timer; -+ -+ /* used if IEEE_SOFTMAC_BEACONS is set */ -+ struct timer_list beacon_timer; -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+ struct work_struct associate_complete_wq; -+// struct work_struct associate_retry_wq; -+// struct work_struct start_ibss_wq; -+ struct work_struct associate_procedure_wq; -+ struct work_struct ips_leave_wq; //YJ,add,081230,for IPS -+ bool bHwRadioOff;//by lizhaoming -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) -+ struct delayed_work softmac_scan_wq; -+ struct delayed_work start_ibss_wq; -+ struct delayed_work associate_retry_wq; -+//by amy for rate adaptive -+ struct delayed_work rate_adapter_wq; -+//by amy for rate adaptive -+ struct delayed_work watch_dog_wq; -+ struct delayed_work hw_dig_wq; -+ struct delayed_work tx_pw_wq; -+ -+#ifdef SW_ANTE_DIVERSITY -+ struct delayed_work SwAntennaWorkItem; -+#endif -+ -+#else -+ struct work_struct softmac_scan_wq; -+ struct work_struct start_ibss_wq; -+ struct work_struct associate_retry_wq; -+//by amy for rate adaptive -+ struct work_struct rate_adapter_wq; -+//by amy for rate adaptive -+ struct work_struct watch_dog_wq; -+ struct work_struct hw_dig_wq; -+ struct work_struct tx_pw_wq; -+ -+#ifdef SW_ANTE_DIVERSITY -+ struct work_struct SwAntennaWorkItem; -+#endif -+ -+#endif -+ -+//struct work_struct softmac_scan_wq; -+ struct work_struct wx_sync_scan_wq; -+ struct work_struct wmm_param_update_wq; -+#ifdef _RTL8187_EXT_PATCH_ -+ struct work_struct ext_stop_scan_wq; -+ struct work_struct ext_send_beacon_wq; -+#endif -+ struct workqueue_struct *wq; -+#else -+ /* used for periodly scan */ -+ struct timer_list scan_timer; -+ -+ struct tq_struct associate_complete_wq; -+ struct tq_struct associate_retry_wq; -+ struct tq_struct start_ibss_wq; -+ struct tq_struct associate_procedure_wq; -+ struct tq_struct ips_leave_wq; //YJ,add,081230,for IPS -+ struct tq_struct softmac_scan_wq; -+ struct tq_struct wx_sync_scan_wq; -+ struct tq_struct wmm_param_update_wq; -+#ifdef _RTL8187_EXT_PATCH_ -+ struct tq_struct ext_stop_scan_wq; -+ struct tq_struct ext_send_beacon_wq; -+#endif -+#endif -+ -+ /* Callback functions */ -+ void (*set_security)(struct net_device *dev, -+ struct ieee80211_security *sec); -+ -+ /* Used to TX data frame by using txb structs. -+ * this is not used if in the softmac_features -+ * is set the flag IEEE_SOFTMAC_TX_QUEUE -+ */ -+ int (*hard_start_xmit)(struct ieee80211_txb *txb, -+ struct net_device *dev); -+ -+ int (*reset_port)(struct net_device *dev); -+ -+ /* Softmac-generated frames (mamagement) are TXed via this -+ * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is -+ * not set. As some cards may have different HW queues that -+ * one might want to use for data and management frames -+ * the option to have two callbacks might be useful. -+ * This fucntion can't sleep. -+ */ -+ int (*softmac_hard_start_xmit)(struct sk_buff *skb, -+ struct net_device *dev); -+ -+ /* used instead of hard_start_xmit (not softmac_hard_start_xmit) -+ * if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data -+ * frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set -+ * then also management frames are sent via this callback. -+ * This function can't sleep. -+ */ -+ void (*softmac_data_hard_start_xmit)(struct sk_buff *skb, -+ struct net_device *dev,int rate); -+ -+ /* stops the HW queue for DATA frames. Useful to avoid -+ * waste time to TX data frame when we are reassociating -+ * This function can sleep. -+ */ -+ void (*data_hard_stop)(struct net_device *dev); -+ -+ /* OK this is complementar to data_poll_hard_stop */ -+ void (*data_hard_resume)(struct net_device *dev); -+ -+ /* ask to the driver to retune the radio . -+ * This function can sleep. the driver should ensure -+ * the radio has been swithced before return. -+ */ -+ void (*set_chan)(struct net_device *dev,short ch); -+ -+ /* These are not used if the ieee stack takes care of -+ * scanning (IEEE_SOFTMAC_SCAN feature set). -+ * In this case only the set_chan is used. -+ * -+ * The syncro version is similar to the start_scan but -+ * does not return until all channels has been scanned. -+ * this is called in user context and should sleep, -+ * it is called in a work_queue when swithcing to ad-hoc mode -+ * or in behalf of iwlist scan when the card is associated -+ * and root user ask for a scan. -+ * the fucntion stop_scan should stop both the syncro and -+ * background scanning and can sleep. -+ * The fucntion start_scan should initiate the background -+ * scanning and can't sleep. -+ */ -+ void (*scan_syncro)(struct net_device *dev); -+ void (*start_scan)(struct net_device *dev); -+ void (*stop_scan)(struct net_device *dev); -+ -+ /* indicate the driver that the link state is changed -+ * for example it may indicate the card is associated now. -+ * Driver might be interested in this to apply RX filter -+ * rules or simply light the LINK led -+ */ -+ void (*link_change)(struct net_device *dev); -+ -+ /* these two function indicates to the HW when to start -+ * and stop to send beacons. This is used when the -+ * IEEE_SOFTMAC_BEACONS is not set. For now the -+ * stop_send_bacons is NOT guaranteed to be called only -+ * after start_send_beacons. -+ */ -+ void (*start_send_beacons) (struct net_device *dev); -+ void (*stop_send_beacons) (struct net_device *dev); -+ -+ /* power save mode related */ -+ void (*sta_wake_up) (struct net_device *dev); -+ void (*ps_request_tx_ack) (struct net_device *dev); -+ void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl); -+ short (*ps_is_queue_empty) (struct net_device *dev); -+ -+//by lizhaoming for LED 2008.6.23 -+#ifdef LED -+ void (*ieee80211_led_contorl) (struct net_device *dev, LED_CTL_MODE LedAction); -+#endif -+#ifdef CONFIG_IPS -+ void (*ieee80211_ips_leave) (struct net_device *dev); -+#endif -+ /* QoS related */ -+ //void (*wmm_param_update) (struct net_device *dev, u8 *ac_param); -+ //void (*wmm_param_update) (struct ieee80211_device *ieee); -+ -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ -+ /// ieee80211_softmac.c -+ int (*ext_patch_ieee80211_start_protocol) (struct ieee80211_device *ieee); // start special mode -+ -+ short (*ext_patch_ieee80211_probe_req_1) (struct ieee80211_device *ieee); // return = 0: no more phases, >0: another phase -+ u8* (*ext_patch_ieee80211_probe_req_2) (struct ieee80211_device *ieee, struct sk_buff *skb, u8 *tag); // return tag -+ -+ void (*ext_patch_ieee80211_stop_protocol) (struct ieee80211_device *ieee); // stop timer -+ -+ void (*ext_patch_ieee80211_association_req_1) (struct ieee80211_assoc_request_frame *hdr); -+ u8* (*ext_patch_ieee80211_association_req_2) (struct ieee80211_device *ieee, struct ieee80211_network *pstat, struct sk_buff *skb); -+ -+ int (*ext_patch_ieee80211_rx_frame_softmac_on_assoc_req) (struct ieee80211_device *ieee, struct sk_buff *skb); -+ int (*ext_patch_ieee80211_rx_frame_softmac_on_assoc_rsp) (struct ieee80211_device *ieee, struct sk_buff *skb); -+ -+ void (*ext_patch_ieee80211_assoc_resp_by_net_1) (struct ieee80211_assoc_response_frame *assoc); -+ u8* (*ext_patch_ieee80211_assoc_resp_by_net_2) (struct ieee80211_device *ieee, struct ieee80211_network *pstat, int pkt_type, struct sk_buff *skb); -+ -+ int (*ext_patch_ieee80211_ext_stop_scan_wq_set_channel) (struct ieee80211_device *ieee); -+ -+ int (*ext_patch_ieee80211_softmac_xmit_get_rate) (struct ieee80211_device *ieee, struct sk_buff *skb); -+ -+ int (*ext_patch_ieee80211_rx_frame_softmac_on_auth)(struct ieee80211_device *ieee, struct sk_buff *skb, struct ieee80211_rx_stats *rx_stats); -+ int (*ext_patch_ieee80211_rx_frame_softmac_on_deauth)(struct ieee80211_device *ieee, struct sk_buff *skb, struct ieee80211_rx_stats *rx_stats); -+//by amy for mesh -+ void (*ext_patch_ieee80211_start_mesh)(struct ieee80211_device *ieee); -+//by amy for mesh -+ // ieee80211_rx.c -+ // rz -+ void (*ext_patch_ieee80211_rx_mgt_on_probe_req) ( struct ieee80211_device *ieee, struct ieee80211_probe_request *beacon, struct ieee80211_rx_stats *stats); -+ unsigned int(*ext_patch_ieee80211_process_probe_response_1)(struct ieee80211_device *ieee, struct ieee80211_probe_response *beacon, struct ieee80211_rx_stats *stats); -+ -+ void (*ext_patch_ieee80211_rx_mgt_update_expire) ( struct ieee80211_device *ieee, struct sk_buff *skb); -+ struct sk_buff* (*ext_patch_get_beacon_get_probersp)(struct ieee80211_device *ieee, u8 *dest, struct ieee80211_network *net); -+ -+ // success(return 0) is responsible to free skb -+ int (*ext_patch_ieee80211_rx_on_rx) (struct ieee80211_device *ieee, struct sk_buff *skb, struct ieee80211_rx_stats *rx_stats, u16 type, u16 stype); -+ -+ int (*ext_patch_ieee80211_rx_frame_get_hdrlen) (struct ieee80211_device *ieee, struct sk_buff *skb); -+ -+ // Check whether or not accept the incoming frame. return 0: not accept, >0: accept -+ int (*ext_patch_ieee80211_rx_is_valid_framectl) (struct ieee80211_device *ieee, u16 fc, u16 type, u16 stype); -+ -+ // return > 0 is success. 0 when failed -+ // success(return >0) is responsible to free skb -+ int (*ext_patch_ieee80211_rx_process_dataframe) (struct ieee80211_device *ieee, struct sk_buff *skb, struct ieee80211_rx_stats *rx_stats); -+ -+ /* added by david for setting acl dynamically */ -+ u8 (*ext_patch_ieee80211_acl_query) (struct ieee80211_device *ieee, u8 *sa); -+ -+ // int (*ext_patch_is_duplicate_packet) (struct ieee80211_device *ieee, struct ieee80211_hdr *header, u16 type, u16 stype); -+ -+ // ieee80211_tx.c -+ -+ // locked by ieee->lock. Call ieee80211_softmac_xmit afterward -+ struct ieee80211_txb* (*ext_patch_ieee80211_xmit) (struct sk_buff *skb, struct net_device *dev); -+ -+ -+#endif // _RTL8187_EXT_PATCH_ -+ -+ /* This must be the last item so that it points to the data -+ * allocated beyond this structure by alloc_ieee80211 */ -+ u8 priv[0]; -+}; -+ -+#define IEEE_A (1<<0) -+#define IEEE_B (1<<1) -+#define IEEE_G (1<<2) -+#define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G) -+ -+/* Generate a 802.11 header */ -+ -+/* Uses the channel change callback directly -+ * instead of [start/stop] scan callbacks -+ */ -+#define IEEE_SOFTMAC_SCAN (1<<2) -+ -+/* Perform authentication and association handshake */ -+#define IEEE_SOFTMAC_ASSOCIATE (1<<3) -+ -+/* Generate probe requests */ -+#define IEEE_SOFTMAC_PROBERQ (1<<4) -+ -+/* Generate respones to probe requests */ -+#define IEEE_SOFTMAC_PROBERS (1<<5) -+ -+/* The ieee802.11 stack will manages the netif queue -+ * wake/stop for the driver, taking care of 802.11 -+ * fragmentation. See softmac.c for details. */ -+#define IEEE_SOFTMAC_TX_QUEUE (1<<7) -+ -+/* Uses only the softmac_data_hard_start_xmit -+ * even for TX management frames. -+ */ -+#define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8) -+ -+/* Generate beacons. The stack will enqueue beacons -+ * to the card -+ */ -+#define IEEE_SOFTMAC_BEACONS (1<<6) -+#ifdef _RTL8187_EXT_PATCH_ -+extern inline int ieee80211_find_MP(struct ieee80211_device* ieee, const u8* addr, u8 set) -+{ -+ int i=0; -+ for (i=1; i<MAX_MP; i++) -+ { -+ if ((ieee->cryptlist[i]->used == 0)&&set) -+ {//entry is empty -+ memcpy(ieee->cryptlist[i]->mac_addr, addr, ETH_ALEN); -+ ieee->cryptlist[i]->used = 1; -+ return i; -+ } -+ else if (0 == memcmp(ieee->cryptlist[i]->mac_addr, addr, ETH_ALEN)) //find matched entry -+ { -+ return i; -+ } -+ } -+ return -1; -+} -+#endif -+ -+ -+ -+static inline void *ieee80211_priv(struct net_device *dev) -+{ -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+ return ((struct ieee80211_device *)netdev_priv(dev))->priv; -+#else -+ return ((struct ieee80211_device *)dev->priv)->priv; -+#endif -+} -+ -+extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) -+{ -+ /* Single white space is for Linksys APs */ -+ if (essid_len == 1 && essid[0] == ' ') -+ return 1; -+ -+ /* Otherwise, if the entire essid is 0, we assume it is hidden */ -+ while (essid_len) { -+ essid_len--; -+ if (essid[essid_len] != '\0') -+ return 0; -+ } -+ -+ return 1; -+} -+ -+extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode) -+{ -+ /* -+ * It is possible for both access points and our device to support -+ * combinations of modes, so as long as there is one valid combination -+ * of ap/device supported modes, then return success -+ * -+ */ -+ if ((mode & IEEE_A) && -+ (ieee->modulation & IEEE80211_OFDM_MODULATION) && -+ (ieee->freq_band & IEEE80211_52GHZ_BAND)) -+ return 1; -+ -+ if ((mode & IEEE_G) && -+ (ieee->modulation & IEEE80211_OFDM_MODULATION) && -+ (ieee->freq_band & IEEE80211_24GHZ_BAND)) -+ return 1; -+ -+ if ((mode & IEEE_B) && -+ (ieee->modulation & IEEE80211_CCK_MODULATION) && -+ (ieee->freq_band & IEEE80211_24GHZ_BAND)) -+ return 1; -+ -+ return 0; -+} -+ -+extern inline int ieee80211_get_hdrlen(u16 fc) -+{ -+ int hdrlen = 24; -+ -+ switch (WLAN_FC_GET_TYPE(fc)) { -+ case IEEE80211_FTYPE_DATA: -+ if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS)) -+ hdrlen = 30; /* Addr4 */ -+ if(IEEE80211_QOS_HAS_SEQ(fc)) -+ hdrlen += 2; /* QOS ctrl*/ -+ break; -+ case IEEE80211_FTYPE_CTL: -+ switch (WLAN_FC_GET_STYPE(fc)) { -+ case IEEE80211_STYPE_CTS: -+ case IEEE80211_STYPE_ACK: -+ hdrlen = 10; -+ break; -+ default: -+ hdrlen = 16; -+ break; -+ } -+ break; -+ } -+ -+ return hdrlen; -+} -+ -+ -+ -+/* ieee80211.c */ -+extern void free_ieee80211(struct net_device *dev); -+extern struct net_device *alloc_ieee80211(int sizeof_priv); -+ -+extern int ieee80211_set_encryption(struct ieee80211_device *ieee); -+ -+/* ieee80211_tx.c */ -+ -+extern int ieee80211_encrypt_fragment( -+ struct ieee80211_device *ieee, -+ struct sk_buff *frag, -+ int hdr_len); -+ -+extern int ieee80211_xmit(struct sk_buff *skb, -+ struct net_device *dev); -+extern void ieee80211_txb_free(struct ieee80211_txb *); -+ -+ -+/* ieee80211_rx.c */ -+extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, -+ struct ieee80211_rx_stats *rx_stats); -+extern void ieee80211_rx_mgt(struct ieee80211_device *ieee, -+ struct ieee80211_hdr *header, -+ struct ieee80211_rx_stats *stats); -+ -+/* ieee80211_wx.c */ -+extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *key); -+extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *key); -+extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *key); -+extern int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee, -+ struct iw_request_info *info, -+ union iwreq_data* wrqu, char *extra); -+int ieee80211_wx_set_auth(struct ieee80211_device *ieee, -+ struct iw_request_info *info, -+ struct iw_param *data, char *extra); -+int ieee80211_wx_set_mlme(struct ieee80211_device *ieee, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra); -+ -+int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len); -+/* ieee80211_softmac.c */ -+extern short ieee80211_is_54g(struct ieee80211_network net); -+extern short ieee80211_is_shortslot(struct ieee80211_network net); -+extern int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, -+ struct ieee80211_rx_stats *rx_stats, u16 type, -+ u16 stype); -+extern void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net); -+ -+extern void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee); -+extern void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee); -+extern void ieee80211_start_bss(struct ieee80211_device *ieee); -+extern void ieee80211_start_master_bss(struct ieee80211_device *ieee); -+extern void ieee80211_start_ibss(struct ieee80211_device *ieee); -+extern void ieee80211_softmac_init(struct ieee80211_device *ieee); -+extern void ieee80211_softmac_free(struct ieee80211_device *ieee); -+extern void ieee80211_associate_abort(struct ieee80211_device *ieee); -+extern void ieee80211_disassociate(struct ieee80211_device *ieee); -+extern void ieee80211_stop_scan(struct ieee80211_device *ieee); -+extern void ieee80211_start_scan_syncro(struct ieee80211_device *ieee); -+extern void ieee80211_check_all_nets(struct ieee80211_device *ieee); -+extern void ieee80211_start_protocol(struct ieee80211_device *ieee); -+extern void ieee80211_stop_protocol(struct ieee80211_device *ieee); -+extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee); -+extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee); -+extern void ieee80211_reset_queue(struct ieee80211_device *ieee); -+extern void ieee80211_wake_queue(struct ieee80211_device *ieee); -+extern void ieee80211_stop_queue(struct ieee80211_device *ieee); -+extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee); -+extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee); -+extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee); -+extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p); -+extern void notify_wx_assoc_event(struct ieee80211_device *ieee); -+extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success); -+extern void ieee80211_start_scan(struct ieee80211_device *ieee); -+ -+#ifdef _RTL8187_EXT_PATCH_ -+extern void ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb); -+extern void ieee80211_ext_issue_assoc_req(struct ieee80211_device *ieee, struct ieee80211_network *pstat); -+extern void ieee80211_associate_step1(struct ieee80211_device *ieee); -+extern void ieee80211_ext_issue_disassoc(struct ieee80211_device *ieee, struct ieee80211_network *pstat, int reason, unsigned char extReason); -+extern void ieee80211_ext_issue_assoc_rsp(struct ieee80211_device *ieee, u8 *dest, unsigned short status, struct ieee80211_network *pstat, int pkt_type); -+extern void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee); -+extern struct sk_buff* ieee80211_ext_probe_resp_by_net(struct ieee80211_device *ieee, u8 *dest, struct ieee80211_network *net); -+extern int ieee80211_network_init(struct ieee80211_device *ieee, struct ieee80211_probe_response *beacon, struct ieee80211_network *network, struct ieee80211_rx_stats *stats); -+extern struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size, int gfp_mask); -+extern void ieee80211_ext_send_11s_beacon(struct ieee80211_device *ieee); -+extern struct ieee80211_txb *ieee80211_ext_alloc_txb(struct sk_buff *skb, struct net_device *dev, struct ieee80211_hdr_3addr *header, int hdr_len, u8 isQoS, u16 *pQOS_ctl, int isEncrypt, struct ieee80211_crypt_data* crypt); -+extern struct ieee80211_txb *ieee80211_ext_reuse_txb(struct sk_buff *skb, struct net_device *dev, struct ieee80211_hdr_3addr *header, int hdr_len, u8 isQoS, u16 *pQOS_ctl, int isEncrypt, struct ieee80211_crypt_data* crypt); -+extern int ieee_ext_skb_p80211_to_ether(struct sk_buff *skb, int hdrlen, u8 *dst, u8 *src); -+#endif -+ -+/* ieee80211_crypt_ccmp&tkip&wep.c */ -+extern void ieee80211_tkip_null(void); -+extern void ieee80211_wep_null(void); -+extern void ieee80211_ccmp_null(void); -+/* ieee80211_softmac_wx.c */ -+ -+extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *ext); -+ -+extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee, -+ struct iw_request_info *info, -+ union iwreq_data *awrq, -+ char *extra); -+ -+extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b); -+ -+extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra); -+ -+extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra); -+ -+extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a, -+ union iwreq_data *wrqu, char *b); -+ -+extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a, -+ union iwreq_data *wrqu, char *b); -+ -+extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee, -+ struct iw_request_info *a, -+ union iwreq_data *wrqu, char *extra); -+ -+extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a, -+ union iwreq_data *wrqu, char *b); -+ -+extern int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a, -+ union iwreq_data *wrqu, char *b); -+ -+extern int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a, -+ union iwreq_data *wrqu, char *b); -+ -+//extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee); -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) -+extern void ieee80211_wx_sync_scan_wq(struct work_struct *work); -+#else -+ extern void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee); -+#endif -+extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra); -+ -+extern int ieee80211_wx_get_name(struct ieee80211_device *ieee, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra); -+ -+extern int ieee80211_wx_set_power(struct ieee80211_device *ieee, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra); -+ -+extern int ieee80211_wx_get_power(struct ieee80211_device *ieee, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra); -+ -+extern const long ieee80211_wlan_frequencies[]; -+ -+extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee) -+{ -+ ieee->scans++; -+} -+ -+extern inline int ieee80211_get_scans(struct ieee80211_device *ieee) -+{ -+ return ieee->scans; -+} -+ -+static inline const char *escape_essid(const char *essid, u8 essid_len) { -+ static char escaped[IW_ESSID_MAX_SIZE * 2 + 1]; -+ const char *s = essid; -+ char *d = escaped; -+ -+ if (ieee80211_is_empty_essid(essid, essid_len)) { -+ memcpy(escaped, "<hidden>", sizeof("<hidden>")); -+ return escaped; -+ } -+ -+ essid_len = min(essid_len, (u8)IW_ESSID_MAX_SIZE); -+ while (essid_len--) { -+ if (*s == '\0') { -+ *d++ = '\\'; -+ *d++ = '0'; -+ s++; -+ } else { -+ *d++ = *s++; -+ } -+ } -+ *d = '\0'; -+ return escaped; -+} -+#endif /* IEEE80211_H */ -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_module.c linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_module.c ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_module.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_module.c 2010-08-05 21:12:34.403617745 +0200 -@@ -0,0 +1,385 @@ -+/******************************************************************************* -+ -+ Copyright(c) 2004 Intel Corporation. All rights reserved. -+ -+ Portions of this file are based on the WEP enablement code provided by the -+ Host AP project hostap-drivers v0.1.3 -+ Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen -+ <jkmaline@cc.hut.fi> -+ Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> -+ -+ This program is free software; you can redistribute it and/or modify it -+ under the terms of version 2 of the GNU General Public License as -+ published by the Free Software Foundation. -+ -+ This program is distributed in the hope that it will be useful, but WITHOUT -+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -+ more details. -+ -+ You should have received a copy of the GNU General Public License along with -+ this program; if not, write to the Free Software Foundation, Inc., 59 -+ Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+ The full GNU General Public License is included in this distribution in the -+ file called LICENSE. -+ -+ Contact Information: -+ James P. Ketrenos <ipw2100-admin@linux.intel.com> -+ Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 -+ -+*******************************************************************************/ -+ -+#include <linux/compiler.h> -+//#include <linux/config.h> -+#include <linux/errno.h> -+#include <linux/if_arp.h> -+#include <linux/in6.h> -+#include <linux/in.h> -+#include <linux/ip.h> -+#include <linux/kernel.h> -+#include <linux/module.h> -+#include <linux/netdevice.h> -+#include <linux/pci.h> -+#include <linux/proc_fs.h> -+#include <linux/skbuff.h> -+#include <linux/slab.h> -+#include <linux/tcp.h> -+#include <linux/types.h> -+#include <linux/version.h> -+#include <linux/wireless.h> -+#include <linux/etherdevice.h> -+#include <asm/uaccess.h> -+#include <net/arp.h> -+ -+#include "ieee80211.h" -+ -+MODULE_DESCRIPTION("802.11 data/management/control stack"); -+MODULE_AUTHOR("Copyright (C) 2004 Intel Corporation <jketreno@linux.intel.com>"); -+MODULE_LICENSE("GPL"); -+ -+#define DRV_NAME "ieee80211" -+ -+static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee) -+{ -+ if (ieee->networks) -+ return 0; -+ -+ ieee->networks = kmalloc( -+ MAX_NETWORK_COUNT * sizeof(struct ieee80211_network), -+ GFP_KERNEL); -+ if (!ieee->networks) { -+ printk(KERN_WARNING "%s: Out of memory allocating beacons\n", -+ ieee->dev->name); -+ return -ENOMEM; -+ } -+ -+ memset(ieee->networks, 0, -+ MAX_NETWORK_COUNT * sizeof(struct ieee80211_network)); -+ -+ return 0; -+} -+ -+static inline void ieee80211_networks_free(struct ieee80211_device *ieee) -+{ -+ if (!ieee->networks) -+ return; -+ kfree(ieee->networks); -+ ieee->networks = NULL; -+} -+ -+static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee) -+{ -+ int i; -+ -+ INIT_LIST_HEAD(&ieee->network_free_list); -+ INIT_LIST_HEAD(&ieee->network_list); -+ for (i = 0; i < MAX_NETWORK_COUNT; i++) -+ list_add_tail(&ieee->networks[i].list, &ieee->network_free_list); -+} -+ -+ -+struct net_device *alloc_ieee80211(int sizeof_priv) -+{ -+ struct ieee80211_device *ieee; -+ struct net_device *dev; -+ int i,err; -+ -+ IEEE80211_DEBUG_INFO("Initializing...\n"); -+ -+ dev = alloc_etherdev(sizeof(struct ieee80211_device) + sizeof_priv); -+ if (!dev) { -+ IEEE80211_ERROR("Unable to network device.\n"); -+ goto failed; -+ } -+ -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) -+ ieee = netdev_priv(dev); -+#else -+ ieee = (struct ieee80211_device *)dev->priv; -+#endif -+ -+ ieee->dev = dev; -+ -+ err = ieee80211_networks_allocate(ieee); -+ if (err) { -+ IEEE80211_ERROR("Unable to allocate beacon storage: %d\n", -+ err); -+ goto failed; -+ } -+ ieee80211_networks_initialize(ieee); -+ -+ /* Default fragmentation threshold is maximum payload size */ -+ ieee->fts = DEFAULT_FTS; -+ ieee->scan_age = DEFAULT_MAX_SCAN_AGE; -+ ieee->open_wep = 1; -+ -+ /* Default to enabling full open WEP with host based encrypt/decrypt */ -+ ieee->host_encrypt = 1; -+ ieee->host_decrypt = 1; -+ ieee->ieee802_1x = 1; /* Default to supporting 802.1x */ -+ -+ INIT_LIST_HEAD(&ieee->crypt_deinit_list); -+ init_timer(&ieee->crypt_deinit_timer); -+ ieee->crypt_deinit_timer.data = (unsigned long)ieee; -+ ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler; -+ -+ spin_lock_init(&ieee->lock); -+ spin_lock_init(&ieee->wpax_suitlist_lock); -+ -+ ieee->wpax_type_set = 0; -+ ieee->wpa_enabled = 0; -+ ieee->tkip_countermeasures = 0; -+ ieee->drop_unencrypted = 0; -+ ieee->privacy_invoked = 0; -+ ieee->ieee802_1x = 1; -+ ieee->raw_tx = 0; -+#ifdef _RTL8187_EXT_PATCH_ -+ for (i=0; i<MAX_MP; i++) -+ { -+ ieee->cryptlist[i] = (struct ieee80211_crypt_data_list*) kmalloc(sizeof(struct ieee80211_crypt_data_list), GFP_KERNEL); -+ if (NULL == ieee->cryptlist[i]) -+ { -+ printk("error kmalloc cryptlist\n"); -+ goto failed; -+ } -+ memset(ieee->cryptlist[i], 0, sizeof(struct ieee80211_crypt_data_list)); -+ -+ } -+#endif -+ ieee80211_softmac_init(ieee); -+ -+ for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) -+ INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]); -+ -+ for (i = 0; i < IEEE_MESH_MAC_HASH_SIZE; i++) -+ INIT_LIST_HEAD(&ieee->mesh_mac_hash[i]); -+ -+ for (i = 0; i < 17; i++) { -+ ieee->last_rxseq_num[i] = -1; -+ ieee->last_rxfrag_num[i] = -1; -+ ieee->last_packet_time[i] = 0; -+ } -+#if 1 //added these to autoload encryption module. WB -+ ieee80211_tkip_null(); -+ ieee80211_wep_null(); -+ ieee80211_ccmp_null(); -+#endif -+ return dev; -+ -+ failed: -+#ifdef _RTL8187_EXT_PATCH_ -+ for (i=0; i<MAX_MP; i++) -+ { -+ if (ieee->cryptlist[i]==NULL){ -+ continue; -+ } -+ kfree(ieee->cryptlist[i]); -+ ieee->cryptlist[i] = NULL; -+ -+ } -+#endif -+ if (dev) -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) -+ free_netdev(dev); -+#else -+ kfree(dev); -+#endif -+ return NULL; -+} -+ -+ -+void free_ieee80211(struct net_device *dev) -+{ -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) -+ struct ieee80211_device *ieee = netdev_priv(dev); -+#else -+ struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv; -+#endif -+ int i;//,j; -+ struct list_head *p, *q; -+ -+ -+ ieee80211_softmac_free(ieee); -+ del_timer_sync(&ieee->crypt_deinit_timer); -+ ieee80211_crypt_deinit_entries(ieee, 1); -+#if 1 -+ ieee80211_tkip_null(); -+ ieee80211_wep_null(); -+ ieee80211_ccmp_null(); -+#endif -+ for (i = 0; i < WEP_KEYS; i++) { -+#ifdef _RTL8187_EXT_PATCH_ -+{ -+ // int j; -+ for (j=0;j<MAX_MP; j++){ -+ if (ieee->cryptlist[j] == NULL) -+ continue; -+ struct ieee80211_crypt_data *crypt = ieee->cryptlist[j]->crypt[i]; -+#else -+ struct ieee80211_crypt_data *crypt = ieee->crypt[i]; -+#endif -+ if (crypt) { -+ if (crypt->ops) { -+ crypt->ops->deinit(crypt->priv); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) -+ module_put(crypt->ops->owner); -+#else -+ __MOD_DEC_USE_COUNT(crypt->ops->owner); -+#endif -+ } -+ kfree(crypt); -+#ifdef _RTL8187_EXT_PATCH_ -+ ieee->cryptlist[j]->crypt[i] = NULL; -+ //kfree(ieee->cryptlist[j]); -+ //ieee->cryptlist[j] = NULL; -+#else -+ ieee->crypt[i] = NULL; -+#endif -+ } -+#ifdef _RTL8187_EXT_PATCH_ -+ } -+ } -+#endif -+} -+#ifdef _RTL8187_EXT_PATCH_ -+for(j=0;j<MAX_MP;j++) -+ { -+ if (ieee->cryptlist[j]) -+ { -+ kfree(ieee->cryptlist[j]); -+ ieee->cryptlist[j] = NULL; -+ } -+ } -+ -+ for (i = 0; i < IEEE_MESH_MAC_HASH_SIZE; i++) { -+ list_for_each_safe(p, q, &ieee->mesh_mac_hash[i]) { -+ kfree(list_entry(p, struct ieee_mesh_seq, list)); -+ list_del(p); -+ } -+ } -+#endif -+ ieee80211_networks_free(ieee); -+ -+ for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) { -+ list_for_each_safe(p, q, &ieee->ibss_mac_hash[i]) { -+ kfree(list_entry(p, struct ieee_ibss_seq, list)); -+ list_del(p); -+ } -+ } -+ -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) -+ free_netdev(dev); -+#else -+ kfree(dev); -+#endif -+} -+ -+#ifdef CONFIG_IEEE80211_DEBUG -+ -+static int debug = 0; -+u32 ieee80211_debug_level = 0; -+struct proc_dir_entry *ieee80211_proc = NULL; -+ -+static int show_debug_level(char *page, char **start, off_t offset, -+ int count, int *eof, void *data) -+{ -+ return snprintf(page, count, "0x%08X\n", ieee80211_debug_level); -+} -+ -+static int store_debug_level(struct file *file, const char *buffer, -+ unsigned long count, void *data) -+{ -+ char buf[] = "0x00000000"; -+ unsigned long len = min(sizeof(buf) - 1, (u32)count); -+ char *p = (char *)buf; -+ unsigned long val; -+ -+ if (copy_from_user(buf, buffer, len)) -+ return count; -+ buf[len] = 0; -+ if (p[1] == 'x' || p[1] == 'X' || p[0] == 'x' || p[0] == 'X') { -+ p++; -+ if (p[0] == 'x' || p[0] == 'X') -+ p++; -+ val = simple_strtoul(p, &p, 16); -+ } else -+ val = simple_strtoul(p, &p, 10); -+ if (p == buf) -+ printk(KERN_INFO DRV_NAME -+ ": %s is not in hex or decimal form.\n", buf); -+ else -+ ieee80211_debug_level = val; -+ -+ return strnlen(buf, count); -+} -+ -+static int __init ieee80211_init(void) -+{ -+ struct proc_dir_entry *e; -+ -+ ieee80211_debug_level = debug; -+ ieee80211_proc = create_proc_entry(DRV_NAME, S_IFDIR, proc_net); -+ if (ieee80211_proc == NULL) { -+ IEEE80211_ERROR("Unable to create " DRV_NAME -+ " proc directory\n"); -+ return -EIO; -+ } -+ e = create_proc_entry("debug_level", S_IFREG | S_IRUGO | S_IWUSR, -+ ieee80211_proc); -+ if (!e) { -+ remove_proc_entry(DRV_NAME, proc_net); -+ ieee80211_proc = NULL; -+ return -EIO; -+ } -+ e->read_proc = show_debug_level; -+ e->write_proc = store_debug_level; -+ e->data = NULL; -+ -+ return 0; -+} -+ -+static void __exit ieee80211_exit(void) -+{ -+ if (ieee80211_proc) { -+ remove_proc_entry("debug_level", ieee80211_proc); -+ remove_proc_entry(DRV_NAME, proc_net); -+ ieee80211_proc = NULL; -+ } -+} -+ -+#include <linux/moduleparam.h> -+module_param(debug, int, 0444); -+MODULE_PARM_DESC(debug, "debug output mask"); -+ -+ -+module_exit(ieee80211_exit); -+module_init(ieee80211_init); -+#endif -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) -+EXPORT_SYMBOL(alloc_ieee80211); -+EXPORT_SYMBOL(free_ieee80211); -+#else -+EXPORT_SYMBOL_NOVERS(alloc_ieee80211); -+EXPORT_SYMBOL_NOVERS(free_ieee80211); -+#endif -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_rx.c linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_rx.c ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_rx.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_rx.c 2010-08-05 21:12:34.443617689 +0200 -@@ -0,0 +1,2074 @@ -+/* -+ * Original code based Host AP (software wireless LAN access point) driver -+ * for Intersil Prism2/2.5/3 - hostap.o module, common routines -+ * -+ * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen -+ * <jkmaline@cc.hut.fi> -+ * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> -+ * Copyright (c) 2004, Intel Corporation -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. See README and COPYING for -+ * more details. -+ ****************************************************************************** -+ -+ Few modifications for Realtek's Wi-Fi drivers by -+ Andrea Merello <andreamrl@tiscali.it> -+ -+ A special thanks goes to Realtek for their support ! -+ -+******************************************************************************/ -+ -+ -+#include <linux/compiler.h> -+//#include <linux/config.h> -+#include <linux/errno.h> -+#include <linux/if_arp.h> -+#include <linux/in6.h> -+#include <linux/in.h> -+#include <linux/ip.h> -+#include <linux/kernel.h> -+#include <linux/module.h> -+#include <linux/netdevice.h> -+#include <linux/pci.h> -+#include <linux/proc_fs.h> -+#include <linux/skbuff.h> -+#include <linux/slab.h> -+#include <linux/tcp.h> -+#include <linux/types.h> -+#include <linux/version.h> -+#include <linux/wireless.h> -+#include <linux/etherdevice.h> -+#include <asm/uaccess.h> -+#include <linux/ctype.h> -+ -+#include "ieee80211.h" -+#ifdef ENABLE_DOT11D -+#include "dot11d.h" -+#endif -+ -+static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee, -+ struct sk_buff *skb, -+ struct ieee80211_rx_stats *rx_stats) -+{ -+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; -+ u16 fc = le16_to_cpu(hdr->frame_ctl); -+ -+ skb->dev = ieee->dev; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) -+ skb_reset_mac_header(skb); -+#else -+ skb->mac.raw = skb->data; -+#endif -+ -+ //skb->mac.raw = skb->data; -+ skb_pull(skb, ieee80211_get_hdrlen(fc)); -+ skb->pkt_type = PACKET_OTHERHOST; -+ skb->protocol = __constant_htons(ETH_P_80211_RAW); -+ memset(skb->cb, 0, sizeof(skb->cb)); -+ netif_rx(skb); -+} -+ -+ -+/* Called only as a tasklet (software IRQ) */ -+static struct ieee80211_frag_entry * -+ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq, -+ unsigned int frag, u8 tid,u8 *src, u8 *dst) -+{ -+ struct ieee80211_frag_entry *entry; -+ int i; -+ -+ for (i = 0; i < IEEE80211_FRAG_CACHE_LEN; i++) { -+ entry = &ieee->frag_cache[tid][i]; -+ if (entry->skb != NULL && -+ time_after(jiffies, entry->first_frag_time + 2 * HZ)) { -+ IEEE80211_DEBUG_FRAG( -+ "expiring fragment cache entry " -+ "seq=%u last_frag=%u\n", -+ entry->seq, entry->last_frag); -+ dev_kfree_skb_any(entry->skb); -+ entry->skb = NULL; -+ } -+ -+ if (entry->skb != NULL && entry->seq == seq && -+ (entry->last_frag + 1 == frag || frag == -1) && -+ memcmp(entry->src_addr, src, ETH_ALEN) == 0 && -+ memcmp(entry->dst_addr, dst, ETH_ALEN) == 0) -+ return entry; -+ } -+ -+ return NULL; -+} -+ -+/* Called only as a tasklet (software IRQ) */ -+static struct sk_buff * -+ieee80211_frag_cache_get(struct ieee80211_device *ieee, -+ struct ieee80211_hdr *hdr) -+{ -+ struct sk_buff *skb = NULL; -+ u16 fc = le16_to_cpu(hdr->frame_ctl); -+ u16 sc = le16_to_cpu(hdr->seq_ctl); -+ unsigned int frag = WLAN_GET_SEQ_FRAG(sc); -+ unsigned int seq = WLAN_GET_SEQ_SEQ(sc); -+ struct ieee80211_frag_entry *entry; -+ struct ieee80211_hdr_3addr_QOS *hdr_3addr_QoS; -+ struct ieee80211_hdr_QOS *hdr_4addr_QoS; -+ u8 tid; -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ if(ieee->iw_mode == ieee->iw_ext_mode) -+ { -+ tid = (hdr->addr2[ETH_ALEN-2] ^ hdr->addr2[ETH_ALEN-1]) & IEEE80211_QOS_TID; -+ } -+ else -+#endif -+ if (((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS)&&IEEE80211_QOS_HAS_SEQ(fc)) { -+ hdr_4addr_QoS = (struct ieee80211_hdr_QOS *)hdr; -+ tid = le16_to_cpu(hdr_4addr_QoS->QOS_ctl) & IEEE80211_QOS_TID; -+ tid = UP2AC(tid); -+ tid ++; -+ } else if (IEEE80211_QOS_HAS_SEQ(fc)) { -+ hdr_3addr_QoS = (struct ieee80211_hdr_3addr_QOS *)hdr; -+ tid = le16_to_cpu(hdr_3addr_QoS->QOS_ctl) & IEEE80211_QOS_TID; -+ tid = UP2AC(tid); -+ tid ++; -+ } else { -+ tid = 0; -+ } -+ -+ if (frag == 0) { -+ /* Reserve enough space to fit maximum frame length */ -+ skb = dev_alloc_skb(ieee->dev->mtu + -+ sizeof(struct ieee80211_hdr) + -+ 8 /* LLC */ + -+ 2 /* alignment */ + -+ 8 /* WEP */ + -+ ETH_ALEN /* WDS */ + -+ (IEEE80211_QOS_HAS_SEQ(fc)?2:0) /* QOS Control */); -+ if (skb == NULL) -+ return NULL; -+ -+ entry = &ieee->frag_cache[tid][ieee->frag_next_idx[tid]]; -+ ieee->frag_next_idx[tid]++; -+ if (ieee->frag_next_idx[tid] >= IEEE80211_FRAG_CACHE_LEN) -+ ieee->frag_next_idx[tid] = 0; -+ -+ if (entry->skb != NULL) -+ dev_kfree_skb_any(entry->skb); -+ -+ entry->first_frag_time = jiffies; -+ entry->seq = seq; -+ entry->last_frag = frag; -+ entry->skb = skb; -+ memcpy(entry->src_addr, hdr->addr2, ETH_ALEN); -+ memcpy(entry->dst_addr, hdr->addr1, ETH_ALEN); -+ } else { -+ /* received a fragment of a frame for which the head fragment -+ * should have already been received */ -+ entry = ieee80211_frag_cache_find(ieee, seq, frag, tid,hdr->addr2, -+ hdr->addr1); -+ if (entry != NULL) { -+ entry->last_frag = frag; -+ skb = entry->skb; -+ } -+ } -+ -+ return skb; -+} -+ -+ -+/* Called only as a tasklet (software IRQ) */ -+static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee, -+ struct ieee80211_hdr *hdr) -+{ -+ u16 fc = le16_to_cpu(hdr->frame_ctl); -+ u16 sc = le16_to_cpu(hdr->seq_ctl); -+ unsigned int seq = WLAN_GET_SEQ_SEQ(sc); -+ struct ieee80211_frag_entry *entry; -+ struct ieee80211_hdr_3addr_QOS *hdr_3addr_QoS; -+ struct ieee80211_hdr_QOS *hdr_4addr_QoS; -+ u8 tid; -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ if(ieee->iw_mode == ieee->iw_ext_mode) -+ { -+ tid = (hdr->addr2[ETH_ALEN-2] ^ hdr->addr2[ETH_ALEN-1]) & IEEE80211_QOS_TID; -+ } -+ else -+#endif -+ if(((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS)&&IEEE80211_QOS_HAS_SEQ(fc)) { -+ hdr_4addr_QoS = (struct ieee80211_hdr_QOS *)hdr; -+ tid = le16_to_cpu(hdr_4addr_QoS->QOS_ctl) & IEEE80211_QOS_TID; -+ tid = UP2AC(tid); -+ tid ++; -+ } else if (IEEE80211_QOS_HAS_SEQ(fc)) { -+ hdr_3addr_QoS = (struct ieee80211_hdr_3addr_QOS *)hdr; -+ tid = le16_to_cpu(hdr_3addr_QoS->QOS_ctl) & IEEE80211_QOS_TID; -+ tid = UP2AC(tid); -+ tid ++; -+ } else { -+ tid = 0; -+ } -+ -+ entry = ieee80211_frag_cache_find(ieee, seq, -1, tid,hdr->addr2, -+ hdr->addr1); -+ -+ if (entry == NULL) { -+ IEEE80211_DEBUG_FRAG( -+ "could not invalidate fragment cache " -+ "entry (seq=%u)\n", seq); -+ return -1; -+ } -+ -+ entry->skb = NULL; -+ return 0; -+} -+ -+ -+ -+/* ieee80211_rx_frame_mgtmt -+ * -+ * Responsible for handling management control frames -+ * -+ * Called by ieee80211_rx */ -+static inline int -+ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb, -+ struct ieee80211_rx_stats *rx_stats, u16 type, -+ u16 stype) -+{ -+ /* On the struct stats definition there is written that -+ * this is not mandatory.... but seems that the probe -+ * response parser uses it -+ */ -+ struct ieee80211_hdr * hdr = (struct ieee80211_hdr*)skb->data; -+ rx_stats->len = skb->len; -+ ieee80211_rx_mgt(ieee,(struct ieee80211_hdr *)skb->data,rx_stats); -+ -+ if ((ieee->state == IEEE80211_LINKED) && (memcmp(hdr->addr3, ieee->current_network.bssid, ETH_ALEN))) -+ { -+ dev_kfree_skb_any(skb); -+ return 0; -+ } -+ -+ ieee80211_rx_frame_softmac(ieee, skb, rx_stats, type, stype); -+ -+ dev_kfree_skb_any(skb); -+ -+ return 0; -+ -+ #ifdef NOT_YET -+ if (ieee->iw_mode == IW_MODE_MASTER) { -+ printk(KERN_DEBUG "%s: Master mode not yet suppported.\n", -+ ieee->dev->name); -+ return 0; -+/* -+ hostap_update_sta_ps(ieee, (struct hostap_ieee80211_hdr *) -+ skb->data);*/ -+ } -+ -+ if (ieee->hostapd && type == IEEE80211_TYPE_MGMT) { -+ if (stype == WLAN_FC_STYPE_BEACON && -+ ieee->iw_mode == IW_MODE_MASTER) { -+ struct sk_buff *skb2; -+ /* Process beacon frames also in kernel driver to -+ * update STA(AP) table statistics */ -+ skb2 = skb_clone(skb, GFP_ATOMIC); -+ if (skb2) -+ hostap_rx(skb2->dev, skb2, rx_stats); -+ } -+ -+ /* send management frames to the user space daemon for -+ * processing */ -+ ieee->apdevstats.rx_packets++; -+ ieee->apdevstats.rx_bytes += skb->len; -+ prism2_rx_80211(ieee->apdev, skb, rx_stats, PRISM2_RX_MGMT); -+ return 0; -+ } -+ -+ if (ieee->iw_mode == IW_MODE_MASTER) { -+ if (type != WLAN_FC_TYPE_MGMT && type != WLAN_FC_TYPE_CTRL) { -+ printk(KERN_DEBUG "%s: unknown management frame " -+ "(type=0x%02x, stype=0x%02x) dropped\n", -+ skb->dev->name, type, stype); -+ return -1; -+ } -+ -+ hostap_rx(skb->dev, skb, rx_stats); -+ return 0; -+ } -+ -+ printk(KERN_DEBUG "%s: hostap_rx_frame_mgmt: management frame " -+ "received in non-Host AP mode\n", skb->dev->name); -+ return -1; -+ #endif -+} -+ -+ -+ -+/* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ -+/* Ethernet-II snap header (RFC1042 for most EtherTypes) */ -+static unsigned char rfc1042_header[] = -+{ 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; -+/* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */ -+static unsigned char bridge_tunnel_header[] = -+{ 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; -+/* No encapsulation header if EtherType < 0x600 (=length) */ -+ -+/* Called by ieee80211_rx_frame_decrypt */ -+static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee, -+ struct sk_buff *skb, size_t hdrlen) -+{ -+ struct net_device *dev = ieee->dev; -+ u16 fc, ethertype; -+ struct ieee80211_hdr *hdr; -+ u8 *pos; -+ -+ if (skb->len < 24) -+ return 0; -+ -+ hdr = (struct ieee80211_hdr *) skb->data; -+ fc = le16_to_cpu(hdr->frame_ctl); -+ -+ /* check that the frame is unicast frame to us */ -+ if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == -+ IEEE80211_FCTL_TODS && -+ memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0 && -+ memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN) == 0) { -+ /* ToDS frame with own addr BSSID and DA */ -+ } else if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == -+ IEEE80211_FCTL_FROMDS && -+ memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0) { -+ /* FromDS frame with own addr as DA */ -+ } else -+ return 0; -+ -+ if (skb->len < 24 + 8) -+ return 0; -+ -+ /* check for port access entity Ethernet type */ -+// pos = skb->data + 24; -+ pos = skb->data + hdrlen; -+ ethertype = (pos[6] << 8) | pos[7]; -+ if (ethertype == ETH_P_PAE) -+ return 1; -+ -+ return 0; -+} -+ -+/* Called only as a tasklet (software IRQ), by ieee80211_rx */ -+static inline int -+ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb, -+ struct ieee80211_crypt_data *crypt) -+{ -+ struct ieee80211_hdr *hdr; -+ int res, hdrlen; -+ -+ if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) -+ return 0; -+ -+ hdr = (struct ieee80211_hdr *) skb->data; -+#ifdef _RTL8187_EXT_PATCH_ -+ if((ieee->iw_mode == ieee->iw_ext_mode) && (ieee->ext_patch_ieee80211_rx_frame_get_hdrlen)) -+ { -+ hdrlen = ieee->ext_patch_ieee80211_rx_frame_get_hdrlen(ieee, skb); -+ } -+ else -+#endif -+ hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); -+ -+#ifdef CONFIG_IEEE80211_CRYPT_TKIP -+ if (ieee->tkip_countermeasures && -+ strcmp(crypt->ops->name, "TKIP") == 0) { -+ if (net_ratelimit()) { -+ printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " -+ "received packet from " MAC_FMT "\n", -+ ieee->dev->name, MAC_ARG(hdr->addr2)); -+ } -+ return -1; -+ } -+#endif -+ -+ atomic_inc(&crypt->refcnt); -+ res = crypt->ops->decrypt_mpdu(skb, hdrlen, crypt->priv); -+ atomic_dec(&crypt->refcnt); -+ if (res < 0) { -+ IEEE80211_DEBUG_DROP( -+ "decryption failed (SA=" MAC_FMT -+ ") res=%d\n", MAC_ARG(hdr->addr2), res); -+ if (res == -2) -+ IEEE80211_DEBUG_DROP("Decryption failed ICV " -+ "mismatch (key %d)\n", -+ skb->data[hdrlen + 3] >> 6); -+ ieee->ieee_stats.rx_discards_undecryptable++; -+ return -1; -+ } -+ -+ return res; -+} -+ -+ -+/* Called only as a tasklet (software IRQ), by ieee80211_rx */ -+static inline int -+ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *skb, -+ int keyidx, struct ieee80211_crypt_data *crypt) -+{ -+ struct ieee80211_hdr *hdr; -+ int res, hdrlen; -+ -+ if (crypt == NULL || crypt->ops->decrypt_msdu == NULL) -+ return 0; -+ -+ hdr = (struct ieee80211_hdr *) skb->data; -+#ifdef _RTL8187_EXT_PATCH_ -+ if((ieee->iw_mode == ieee->iw_ext_mode) && (ieee->ext_patch_ieee80211_rx_frame_get_hdrlen)) -+ { -+ hdrlen = ieee->ext_patch_ieee80211_rx_frame_get_hdrlen(ieee, skb); -+ } -+ else -+#endif -+ hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); -+ -+ atomic_inc(&crypt->refcnt); -+ res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv); -+ atomic_dec(&crypt->refcnt); -+ if (res < 0) { -+ printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed" -+ " (SA=" MAC_FMT " keyidx=%d)\n", -+ ieee->dev->name, MAC_ARG(hdr->addr2), keyidx); -+ return -1; -+ } -+ -+ return 0; -+} -+ -+ -+/* this function is stolen from ipw2200 driver*/ -+#define IEEE_PACKET_RETRY_TIME (5*HZ) -+static int is_duplicate_packet(struct ieee80211_device *ieee, -+ struct ieee80211_hdr *header) -+{ -+ u16 fc = le16_to_cpu(header->frame_ctl); -+ u16 sc = le16_to_cpu(header->seq_ctl); -+ u16 seq = WLAN_GET_SEQ_SEQ(sc); -+ u16 frag = WLAN_GET_SEQ_FRAG(sc); -+ u16 *last_seq, *last_frag; -+ unsigned long *last_time; -+ struct ieee80211_hdr_3addr_QOS *hdr_3addr_QoS; -+ struct ieee80211_hdr_QOS *hdr_4addr_QoS; -+ u8 tid; -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ if(ieee->iw_mode == ieee->iw_ext_mode) -+ { -+ tid = (header->addr2[ETH_ALEN-2] ^ header->addr2[ETH_ALEN-1]) & IEEE80211_QOS_TID; -+ } -+ else -+#endif -+ //TO2DS and QoS -+ if(((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS)&&IEEE80211_QOS_HAS_SEQ(fc)) { -+ hdr_4addr_QoS = (struct ieee80211_hdr_QOS *)header; -+ tid = le16_to_cpu(hdr_4addr_QoS->QOS_ctl) & IEEE80211_QOS_TID; -+ tid = UP2AC(tid); -+ tid ++; -+ } else if(IEEE80211_QOS_HAS_SEQ(fc)) { //QoS -+ hdr_3addr_QoS = (struct ieee80211_hdr_3addr_QOS*)header; -+ tid = le16_to_cpu(hdr_3addr_QoS->QOS_ctl) & IEEE80211_QOS_TID; -+ tid = UP2AC(tid); -+ tid ++; -+ } else { // no QoS -+ tid = 0; -+ } -+ -+ switch (ieee->iw_mode) { -+ case IW_MODE_ADHOC: -+ { -+ struct list_head *p; -+ struct ieee_ibss_seq *entry = NULL; -+ u8 *mac = header->addr2; -+ int index = mac[5] % IEEE_IBSS_MAC_HASH_SIZE; -+ //for (pos = (head)->next; pos != (head); pos = pos->next) -+ __list_for_each(p, &ieee->ibss_mac_hash[index]) { -+ entry = list_entry(p, struct ieee_ibss_seq, list); -+ if (!memcmp(entry->mac, mac, ETH_ALEN)) -+ break; -+ } -+ // if (memcmp(entry->mac, mac, ETH_ALEN)){ -+ if (p == &ieee->ibss_mac_hash[index]) { -+ entry = kmalloc(sizeof(struct ieee_ibss_seq), GFP_ATOMIC); -+ if (!entry) { -+ printk(KERN_WARNING "Cannot malloc new mac entry\n"); -+ return 0; -+ } -+ memcpy(entry->mac, mac, ETH_ALEN); -+ entry->seq_num[tid] = seq; -+ entry->frag_num[tid] = frag; -+ entry->packet_time[tid] = jiffies; -+ list_add(&entry->list, &ieee->ibss_mac_hash[index]); -+ return 0; -+ } -+ last_seq = &entry->seq_num[tid]; -+ last_frag = &entry->frag_num[tid]; -+ last_time = &entry->packet_time[tid]; -+ break; -+ } -+ -+ case IW_MODE_INFRA: -+ last_seq = &ieee->last_rxseq_num[tid]; -+ last_frag = &ieee->last_rxfrag_num[tid]; -+ last_time = &ieee->last_packet_time[tid]; -+ -+ break; -+ default: -+#ifdef _RTL8187_EXT_PATCH_ -+ if(ieee->iw_mode == ieee->iw_ext_mode) -+ { -+#if 0 -+ printk("==============> tid = %d\n", tid); -+ last_seq = &ieee->last_rxseq_num[tid]; -+ last_frag = &ieee->last_rxfrag_num[tid]; -+ last_time = &ieee->last_packet_time[tid]; -+#else -+ struct list_head *p; -+ struct ieee_mesh_seq *entry = NULL; -+ u8 *mac = header->addr2; -+ int index = mac[5] % IEEE_IBSS_MAC_HASH_SIZE; -+ -+ __list_for_each(p, &ieee->mesh_mac_hash[index]) { -+ entry = list_entry(p, struct ieee_mesh_seq, list); -+ if (!memcmp(entry->mac, mac, ETH_ALEN)) -+ break; -+ } -+ if (p == &ieee->mesh_mac_hash[index]) { -+ entry = kmalloc(sizeof(struct ieee_mesh_seq), GFP_ATOMIC); -+ if (!entry) { -+ printk(KERN_WARNING "Cannot malloc new mac entry for mesh\n"); -+ return 0; -+ } -+ memcpy(entry->mac, mac, ETH_ALEN); -+ entry->seq_num = seq; -+ entry->frag_num = frag; -+ entry->packet_time = jiffies; -+ list_add(&entry->list, &ieee->mesh_mac_hash[index]); -+ return 0; -+ } -+ last_seq = &entry->seq_num; -+ last_frag = &entry->frag_num; -+ last_time = &entry->packet_time; -+#endif -+ break; -+ } -+ else -+#endif -+ return 0; -+ } -+ -+// if(tid != 0) { -+// printk(KERN_WARNING ":)))))))))))%x %x %x, fc(%x)\n", tid, *last_seq, seq, header->frame_ctl); -+// } -+ if ((*last_seq == seq) && -+ time_after(*last_time + IEEE_PACKET_RETRY_TIME, jiffies)) { -+ if (*last_frag == frag){ -+ //printk(KERN_WARNING "[1] go drop!\n"); -+ goto drop; -+ -+ } -+ if (*last_frag + 1 != frag) -+ /* out-of-order fragment */ -+ //printk(KERN_WARNING "[2] go drop!\n"); -+ goto drop; -+ } else -+ *last_seq = seq; -+ -+ *last_frag = frag; -+ *last_time = jiffies; -+ return 0; -+ -+drop: -+// BUG_ON(!(fc & IEEE80211_FCTL_RETRY)); -+// printk("DUP\n"); -+ -+ return 1; -+} -+#ifdef JUST_FOR_87SEMESH -+#define ActionHeadLen 30 -+#define WIFI_MESH_TYPE IEEE80211_FTYPE_DATA -+#define WIFI_11S_MESH_ACTION 0x00A0 -+#endif -+ -+/* All received frames are sent to this function. @skb contains the frame in -+ * IEEE 802.11 format, i.e., in the format it was sent over air. -+ * This function is called only as a tasklet (software IRQ). */ -+int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, -+ struct ieee80211_rx_stats *rx_stats) -+{ -+ struct net_device *dev = ieee->dev; -+ struct ieee80211_hdr *hdr; -+ //struct ieee80211_hdr_3addr_QOS *hdr; -+ -+ size_t hdrlen; -+ u16 fc, type, stype, sc; -+ struct net_device_stats *stats; -+ unsigned int frag; -+ u8 *payload; -+ u16 ethertype; -+#ifdef NOT_YET -+ struct net_device *wds = NULL; -+ struct sk_buff *skb2 = NULL; -+ struct net_device *wds = NULL; -+ int frame_authorized = 0; -+ int from_assoc_ap = 0; -+ void *sta = NULL; -+#endif -+// u16 QOS_ctl = 0; -+ u8 dst[ETH_ALEN]; -+ u8 src[ETH_ALEN]; -+ u8 bssid[ETH_ALEN]; -+ struct ieee80211_crypt_data *crypt = NULL; -+ int keyidx = 0; -+ -+ //Added for mesh by Lawrence. -+ //u8 status; -+ //u32 flags; -+ -+ // cheat the the hdr type -+ hdr = (struct ieee80211_hdr *)skb->data; -+ stats = &ieee->stats; -+ -+ if (skb->len < 10) { -+ printk(KERN_INFO "%s: SKB length < 10\n", -+ dev->name); -+ goto rx_dropped; -+ } -+#if 0 -+//{added by david for filter the packet listed in the filter table -+#ifdef _RTL8187_EXT_PATCH_ -+ if((ieee->iw_mode == ieee->iw_ext_mode) && (ieee->ext_patch_ieee80211_acl_query)) -+ { -+ if(!ieee->ext_patch_ieee80211_acl_query(ieee, hdr->addr2)) -+ goto rx_dropped; -+ } -+#endif -+//} -+#endif -+ fc = le16_to_cpu(hdr->frame_ctl); -+ type = WLAN_FC_GET_TYPE(fc); -+ stype = WLAN_FC_GET_STYPE(fc); -+ -+ //Because 87se's bad feature,do more handle. -+#ifdef JUST_FOR_87SEMESH -+ -+u8 tmphead[ActionHeadLen]; -+ if(type ==WIFI_MESH_TYPE && stype== WIFI_11S_MESH_ACTION ) -+ //head=sizeof(struct ieee80211_hdr)=30 -+ { -+ memset(tmphead,0,ActionHeadLen); -+ memcpy(tmphead,skb->data,ActionHeadLen); -+ -+ skb_pull(skb,ActionHeadLen+2); -+ memcpy(skb_push(skb,ActionHeadLen),tmphead,ActionHeadLen); -+ hdr = (struct ieee80211_hdr *)skb->data; -+ } -+ -+#endif -+ sc = le16_to_cpu(hdr->seq_ctl); -+ -+ frag = WLAN_GET_SEQ_FRAG(sc); -+#ifdef _RTL8187_EXT_PATCH_ -+ if((ieee->iw_mode == ieee->iw_ext_mode) && (ieee->ext_patch_ieee80211_rx_frame_get_hdrlen)) -+ { -+ hdrlen = ieee->ext_patch_ieee80211_rx_frame_get_hdrlen(ieee, skb); -+ if(skb->len < hdrlen) -+ goto rx_dropped; -+ } -+ else -+#endif -+ hdrlen = ieee80211_get_hdrlen(fc); -+ -+#ifdef NOT_YET -+#if WIRELESS_EXT > 15 -+ /* Put this code here so that we avoid duplicating it in all -+ * Rx paths. - Jean II */ -+#ifdef IW_WIRELESS_SPY /* defined in iw_handler.h */ -+ /* If spy monitoring on */ -+ if (iface->spy_data.spy_number > 0) { -+ struct iw_quality wstats; -+ wstats.level = rx_stats->signal; -+ wstats.noise = rx_stats->noise; -+ wstats.updated = 6; /* No qual value */ -+ /* Update spy records */ -+ wireless_spy_update(dev, hdr->addr2, &wstats); -+ } -+#endif /* IW_WIRELESS_SPY */ -+#endif /* WIRELESS_EXT > 15 */ -+ hostap_update_rx_stats(local->ap, hdr, rx_stats); -+#endif -+ -+#if WIRELESS_EXT > 15 -+ if (ieee->iw_mode == IW_MODE_MONITOR) { -+ ieee80211_monitor_rx(ieee, skb, rx_stats); -+ stats->rx_packets++; -+ stats->rx_bytes += skb->len; -+ return 1; -+ } -+#endif -+ if (ieee->host_decrypt) { -+ int idx = 0; -+ if (skb->len >= hdrlen + 3) -+ idx = skb->data[hdrlen + 3] >> 6; -+#ifdef _RTL8187_EXT_PATCH_ -+ -+ crypt = ieee->cryptlist[0]->crypt[idx]; -+#if 0 -+ { -+ int i = ieee80211_find_MP(ieee, ((struct ieee80211_hdr*)skb->data)->addr2); -+ if (i == -1) -+ { -+ printk("error find entry in entry list\n"); -+ goto rx_dropped; -+ } -+ //printk("%s():"MAC_FMT", find in index:%d", __FUNCTION__, MAC_ARG(((struct ieee80211_hdr*)skb->data)->addr2), i); -+ crypt = ieee->cryptlist[i]->crypt[idx]; -+ } -+#endif -+#else -+ crypt = ieee->crypt[idx]; -+#endif -+ -+#ifdef NOT_YET -+ sta = NULL; -+ -+ /* Use station specific key to override default keys if the -+ * receiver address is a unicast address ("individual RA"). If -+ * bcrx_sta_key parameter is set, station specific key is used -+ * even with broad/multicast targets (this is against IEEE -+ * 802.11, but makes it easier to use different keys with -+ * stations that do not support WEP key mapping). */ -+ -+ if (!(hdr->addr1[0] & 0x01) || local->bcrx_sta_key) -+ (void) hostap_handle_sta_crypto(local, hdr, &crypt, -+ &sta); -+#endif -+ -+ /* allow NULL decrypt to indicate an station specific override -+ * for default encryption */ -+ if (crypt && (crypt->ops == NULL || -+ crypt->ops->decrypt_mpdu == NULL)) -+ crypt = NULL; -+ -+ if (!crypt && (fc & IEEE80211_FCTL_WEP)) { -+ /* This seems to be triggered by some (multicast?) -+ * frames from other than current BSS, so just drop the -+ * frames silently instead of filling system log with -+ * these reports. */ -+ IEEE80211_DEBUG_DROP("Decryption failed (not set)" -+ " (SA=" MAC_FMT ")\n", -+ MAC_ARG(hdr->addr2)); -+ ieee->ieee_stats.rx_discards_undecryptable++; -+ goto rx_dropped; -+ } -+ } -+ -+ if (skb->len < IEEE80211_DATA_HDR3_LEN) -+ goto rx_dropped; -+ -+ // if QoS enabled, should check the sequence for each of the AC -+ if (is_duplicate_packet(ieee, hdr)) -+ goto rx_dropped; -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ if( ieee->iw_mode == ieee->iw_ext_mode && ieee->ext_patch_ieee80211_rx_mgt_update_expire ) -+ ieee->ext_patch_ieee80211_rx_mgt_update_expire( ieee, skb ); -+#endif -+ -+ if (type == IEEE80211_FTYPE_MGMT) { -+ -+ #if 0 -+ if ( stype == IEEE80211_STYPE_AUTH && -+ fc & IEEE80211_FCTL_WEP && ieee->host_decrypt && -+ (keyidx = hostap_rx_frame_decrypt(ieee, skb, crypt)) < 0) -+ { -+ printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth " -+ "from " MAC_FMT "\n", dev->name, -+ MAC_ARG(hdr->addr2)); -+ /* TODO: could inform hostapd about this so that it -+ * could send auth failure report */ -+ goto rx_dropped; -+ } -+ #endif -+ -+ -+ if (ieee80211_rx_frame_mgmt(ieee, skb, rx_stats, type, stype)) -+ goto rx_dropped; -+ else -+ goto rx_exit; -+ } -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ if((ieee->iw_mode == ieee->iw_ext_mode) && ieee->ext_patch_ieee80211_rx_on_rx) -+ { -+ if(ieee->ext_patch_ieee80211_rx_on_rx(ieee, skb, rx_stats, type, stype)==0) -+ { -+ goto rx_exit; -+ } -+ } -+#endif -+ -+ /* Data frame - extract src/dst addresses */ -+ switch (fc & (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) { -+ case IEEE80211_FCTL_FROMDS: -+ memcpy(dst, hdr->addr1, ETH_ALEN); -+ memcpy(src, hdr->addr3, ETH_ALEN); -+ memcpy(bssid, hdr->addr2, ETH_ALEN); -+ break; -+ case IEEE80211_FCTL_TODS: -+ memcpy(dst, hdr->addr3, ETH_ALEN); -+ memcpy(src, hdr->addr2, ETH_ALEN); -+ memcpy(bssid, hdr->addr1, ETH_ALEN); -+ break; -+ case IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS: -+ if (skb->len < IEEE80211_DATA_HDR4_LEN) -+ goto rx_dropped; -+ memcpy(dst, hdr->addr3, ETH_ALEN); -+ memcpy(src, hdr->addr4, ETH_ALEN); -+ memcpy(bssid, ieee->current_network.bssid, ETH_ALEN); -+ break; -+ case 0: -+ memcpy(dst, hdr->addr1, ETH_ALEN); -+ memcpy(src, hdr->addr2, ETH_ALEN); -+ memcpy(bssid, hdr->addr3, ETH_ALEN); -+ break; -+ } -+ -+#ifdef NOT_YET -+ if (hostap_rx_frame_wds(ieee, hdr, fc, &wds)) -+ goto rx_dropped; -+ if (wds) { -+ skb->dev = dev = wds; -+ stats = hostap_get_stats(dev); -+ } -+ -+ if (ieee->iw_mode == IW_MODE_MASTER && !wds && -+ (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == IEEE80211_FCTL_FROMDS && -+ ieee->stadev && -+ memcmp(hdr->addr2, ieee->assoc_ap_addr, ETH_ALEN) == 0) { -+ /* Frame from BSSID of the AP for which we are a client */ -+ skb->dev = dev = ieee->stadev; -+ stats = hostap_get_stats(dev); -+ from_assoc_ap = 1; -+ } -+#endif -+ -+ dev->last_rx = jiffies; -+ -+#ifdef NOT_YET -+ if ((ieee->iw_mode == IW_MODE_MASTER || -+ ieee->iw_mode == IW_MODE_REPEAT) && -+ !from_assoc_ap) { -+ switch (hostap_handle_sta_rx(ieee, dev, skb, rx_stats, -+ wds != NULL)) { -+ case AP_RX_CONTINUE_NOT_AUTHORIZED: -+ frame_authorized = 0; -+ break; -+ case AP_RX_CONTINUE: -+ frame_authorized = 1; -+ break; -+ case AP_RX_DROP: -+ goto rx_dropped; -+ case AP_RX_EXIT: -+ goto rx_exit; -+ } -+ } -+#endif -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ if((ieee->iw_mode == ieee->iw_ext_mode) && ieee->ext_patch_ieee80211_rx_is_valid_framectl) -+ { -+ if(ieee->ext_patch_ieee80211_rx_is_valid_framectl(ieee, fc, type, stype)==0) -+ goto rx_dropped; -+ } -+ else -+#endif -+ /* Nullfunc frames may have PS-bit set, so they must be passed to -+ * hostap_handle_sta_rx() before being dropped here. */ -+ if (stype != IEEE80211_STYPE_DATA && -+ stype != IEEE80211_STYPE_DATA_CFACK && -+ stype != IEEE80211_STYPE_DATA_CFPOLL && -+ stype != IEEE80211_STYPE_DATA_CFACKPOLL&& -+ stype != IEEE80211_STYPE_QOS_DATA//add by David,2006.8.4 -+ ) { -+ if (stype != IEEE80211_STYPE_NULLFUNC) -+ IEEE80211_DEBUG_DROP( -+ "RX: dropped data frame " -+ "with no data (type=0x%02x, " -+ "subtype=0x%02x, len=%d)\n", -+ type, stype, skb->len); -+ goto rx_dropped; -+ } -+ -+ if (memcmp(bssid, ieee->current_network.bssid, ETH_ALEN)) -+ goto rx_dropped; -+ -+ /* skb: hdr + (possibly fragmented, possibly encrypted) payload */ -+#ifdef _RTL8187_EXT_PATCH_ -+ if (ieee->host_decrypt && crypt) { -+ int idx = 0; -+ if (skb->len >= hdrlen + 3) -+ idx = skb->data[hdrlen + 3] >> 6; -+ if (ieee->iw_ext_mode == ieee->iw_mode) //if in mesh mode -+ { -+ int i = ieee80211_find_MP(ieee, ((struct ieee80211_hdr*)skb->data)->addr2, 0); -+ if (i == -1) -+ { -+ printk("error find entry in entry list\n"); -+ goto rx_dropped; -+ } -+ // printk("%s():"MAC_FMT", find in index:%d\n", __FUNCTION__, MAC_ARG(((struct ieee80211_hdr*)skb->data)->addr2), i); -+ if (ieee->cryptlist[i]&&ieee->cryptlist[i]->crypt[idx]) -+ crypt = ieee->cryptlist[i]->crypt[idx]; -+ -+ else -+ crypt = NULL; -+ } -+ else -+ crypt = ieee->cryptlist[0]->crypt[idx]; -+ } -+#endif -+ -+ if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) && -+ (keyidx = ieee80211_rx_frame_decrypt(ieee, skb, crypt)) < 0) -+ goto rx_dropped; -+ -+ hdr = (struct ieee80211_hdr *) skb->data; -+ -+ /* skb: hdr + (possibly fragmented) plaintext payload */ -+ // PR: FIXME: hostap has additional conditions in the "if" below: -+ // ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) && -+ if ((frag != 0 || (fc & IEEE80211_FCTL_MOREFRAGS))) { -+ int flen; -+ struct sk_buff *frag_skb = ieee80211_frag_cache_get(ieee, hdr); -+ IEEE80211_DEBUG_FRAG("Rx Fragment received (%u)\n", frag); -+ -+ if (!frag_skb) { -+ IEEE80211_DEBUG(IEEE80211_DL_RX | IEEE80211_DL_FRAG, -+ "Rx cannot get skb from fragment " -+ "cache (morefrag=%d seq=%u frag=%u)\n", -+ (fc & IEEE80211_FCTL_MOREFRAGS) != 0, -+ WLAN_GET_SEQ_SEQ(sc), frag); -+ goto rx_dropped; -+ } -+ flen = skb->len; -+ if (frag != 0) -+ flen -= hdrlen; -+ -+ if (frag_skb->tail + flen > frag_skb->end) { -+ printk(KERN_WARNING "%s: host decrypted and " -+ "reassembled frame did not fit skb\n", -+ dev->name); -+ ieee80211_frag_cache_invalidate(ieee, hdr); -+ goto rx_dropped; -+ } -+ -+ if (frag == 0) { -+ /* copy first fragment (including full headers) into -+ * beginning of the fragment cache skb */ -+ memcpy(skb_put(frag_skb, flen), skb->data, flen); -+ } else { -+ /* append frame payload to the end of the fragment -+ * cache skb */ -+ memcpy(skb_put(frag_skb, flen), skb->data + hdrlen, -+ flen); -+ } -+ dev_kfree_skb_any(skb); -+ skb = NULL; -+ -+ if (fc & IEEE80211_FCTL_MOREFRAGS) { -+ /* more fragments expected - leave the skb in fragment -+ * cache for now; it will be delivered to upper layers -+ * after all fragments have been received */ -+ goto rx_exit; -+ } -+ -+ /* this was the last fragment and the frame will be -+ * delivered, so remove skb from fragment cache */ -+ skb = frag_skb; -+ hdr = (struct ieee80211_hdr *) skb->data; -+ ieee80211_frag_cache_invalidate(ieee, hdr); -+ } -+ -+ /* skb: hdr + (possible reassembled) full MSDU payload; possibly still -+ * encrypted/authenticated */ -+ if (ieee->host_decrypt && (fc & IEEE80211_FCTL_WEP) && -+ ieee80211_rx_frame_decrypt_msdu(ieee, skb, keyidx, crypt)) -+ goto rx_dropped; -+ -+ hdr = (struct ieee80211_hdr *) skb->data; -+ if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep) { -+ if (/*ieee->ieee802_1x &&*/ -+ ieee80211_is_eapol_frame(ieee, skb, hdrlen)) { -+ -+#ifdef CONFIG_IEEE80211_DEBUG -+ /* pass unencrypted EAPOL frames even if encryption is -+ * configured */ -+ struct eapol *eap = (struct eapol *)(skb->data + -+ 24); -+ IEEE80211_DEBUG_EAP("RX: IEEE 802.1X EAPOL frame: %s\n", -+ eap_get_type(eap->type)); -+#endif -+ } else { -+ IEEE80211_DEBUG_DROP( -+ "encryption configured, but RX " -+ "frame not encrypted (SA=" MAC_FMT ")\n", -+ MAC_ARG(hdr->addr2)); -+ goto rx_dropped; -+ } -+ } -+ -+#ifdef CONFIG_IEEE80211_DEBUG -+ if (crypt && !(fc & IEEE80211_FCTL_WEP) && -+ ieee80211_is_eapol_frame(ieee, skb)) { -+ struct eapol *eap = (struct eapol *)(skb->data + -+ 24); -+ IEEE80211_DEBUG_EAP("RX: IEEE 802.1X EAPOL frame: %s\n", -+ eap_get_type(eap->type)); -+ } -+#endif -+ -+ if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep && -+ !ieee80211_is_eapol_frame(ieee, skb, hdrlen)) { -+ IEEE80211_DEBUG_DROP( -+ "dropped unencrypted RX data " -+ "frame from " MAC_FMT -+ " (drop_unencrypted=1)\n", -+ MAC_ARG(hdr->addr2)); -+ goto rx_dropped; -+ } -+/* -+ if(ieee80211_is_eapol_frame(ieee, skb, hdrlen)) { -+ printk(KERN_WARNING "RX: IEEE802.1X EPAOL frame!\n"); -+ } -+*/ -+ /* skb: hdr + (possible reassembled) full plaintext payload */ -+ payload = skb->data + hdrlen; -+ ethertype = (payload[6] << 8) | payload[7]; -+ -+#ifdef NOT_YET -+ /* If IEEE 802.1X is used, check whether the port is authorized to send -+ * the received frame. */ -+ if (ieee->ieee802_1x && ieee->iw_mode == IW_MODE_MASTER) { -+ if (ethertype == ETH_P_PAE) { -+ printk(KERN_DEBUG "%s: RX: IEEE 802.1X frame\n", -+ dev->name); -+ if (ieee->hostapd && ieee->apdev) { -+ /* Send IEEE 802.1X frames to the user -+ * space daemon for processing */ -+ prism2_rx_80211(ieee->apdev, skb, rx_stats, -+ PRISM2_RX_MGMT); -+ ieee->apdevstats.rx_packets++; -+ ieee->apdevstats.rx_bytes += skb->len; -+ goto rx_exit; -+ } -+ } else if (!frame_authorized) { -+ printk(KERN_DEBUG "%s: dropped frame from " -+ "unauthorized port (IEEE 802.1X): " -+ "ethertype=0x%04x\n", -+ dev->name, ethertype); -+ goto rx_dropped; -+ } -+ } -+#endif -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ if((ieee->iw_mode == ieee->iw_ext_mode) && ieee->ext_patch_ieee80211_rx_process_dataframe) -+ { -+ if(ieee->ext_patch_ieee80211_rx_process_dataframe(ieee, skb, rx_stats)) -+ { -+ stats->rx_packets++; -+ stats->rx_bytes += skb->len; -+ goto rx_exit; -+ } -+ else -+ goto rx_dropped; -+ } -+#endif -+ ieee->NumRxDataInPeriod++; -+// ieee->NumRxOkTotal++; -+ /* convert hdr + possible LLC headers into Ethernet header */ -+ if (skb->len - hdrlen >= 8 && -+ ((memcmp(payload, rfc1042_header, SNAP_SIZE) == 0 && -+ ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) || -+ memcmp(payload, bridge_tunnel_header, SNAP_SIZE) == 0)) { -+ /* remove RFC1042 or Bridge-Tunnel encapsulation and -+ * replace EtherType */ -+ skb_pull(skb, hdrlen + SNAP_SIZE); -+ memcpy(skb_push(skb, ETH_ALEN), src, ETH_ALEN); -+ memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN); -+ } else { -+ u16 len; -+ /* Leave Ethernet header part of hdr and full payload */ -+ skb_pull(skb, hdrlen); -+ len = htons(skb->len); -+ memcpy(skb_push(skb, 2), &len, 2); -+ memcpy(skb_push(skb, ETH_ALEN), src, ETH_ALEN); -+ memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN); -+ } -+ -+#ifdef NOT_YET -+ if (wds && ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) == -+ IEEE80211_FCTL_TODS) && -+ skb->len >= ETH_HLEN + ETH_ALEN) { -+ /* Non-standard frame: get addr4 from its bogus location after -+ * the payload */ -+ memcpy(skb->data + ETH_ALEN, -+ skb->data + skb->len - ETH_ALEN, ETH_ALEN); -+ skb_trim(skb, skb->len - ETH_ALEN); -+ } -+#endif -+ -+ stats->rx_packets++; -+ stats->rx_bytes += skb->len; -+ -+#ifdef NOT_YET -+ if (ieee->iw_mode == IW_MODE_MASTER && !wds && -+ ieee->ap->bridge_packets) { -+ if (dst[0] & 0x01) { -+ /* copy multicast frame both to the higher layers and -+ * to the wireless media */ -+ ieee->ap->bridged_multicast++; -+ skb2 = skb_clone(skb, GFP_ATOMIC); -+ if (skb2 == NULL) -+ printk(KERN_DEBUG "%s: skb_clone failed for " -+ "multicast frame\n", dev->name); -+ } else if (hostap_is_sta_assoc(ieee->ap, dst)) { -+ /* send frame directly to the associated STA using -+ * wireless media and not passing to higher layers */ -+ ieee->ap->bridged_unicast++; -+ skb2 = skb; -+ skb = NULL; -+ } -+ } -+ -+ if (skb2 != NULL) { -+ /* send to wireless media */ -+ skb2->protocol = __constant_htons(ETH_P_802_3); -+ skb2->mac.raw = skb2->nh.raw = skb2->data; -+ /* skb2->nh.raw = skb2->data + ETH_HLEN; */ -+ skb2->dev = dev; -+ dev_queue_xmit(skb2); -+ } -+ -+#endif -+ if (skb) { -+ //printk("0skb_len(%d)\n", skb->len); -+ skb->protocol = eth_type_trans(skb, dev); -+ memset(skb->cb, 0, sizeof(skb->cb)); -+ skb->dev = dev; -+ skb->ip_summed = CHECKSUM_NONE; /* 802.11 crc not sufficient */ -+ //skb->ip_summed = CHECKSUM_UNNECESSARY; /* 802.11 crc not sufficient */ -+ ieee->last_rx_ps_time = jiffies; -+ //printk("1skb_len(%d)\n", skb->len); -+ netif_rx(skb); -+ } -+ -+//by lizhaoming for LED_RX 2008.6.23 -+#ifdef LED_SHIN -+// printk("==================>data rcvd\n"); -+ ieee->ieee80211_led_contorl(dev,LED_CTL_RX); -+#endif -+ -+ rx_exit: -+#ifdef NOT_YET -+ if (sta) -+ hostap_handle_sta_release(sta); -+#endif -+ return 1; -+ -+ rx_dropped: -+ stats->rx_dropped++; -+#if 0 -+ int i; -+ printk("======>dropped: %s():addr2:"MAC_FMT",addr1:"MAC_FMT",skb->len:%d, hdrlen:%d\n", __FUNCTION__, MAC_ARG(((struct ieee80211_hdr*)skb->data)->addr2), MAC_ARG(((struct ieee80211_hdr*)skb->data)->addr1), skb->len, hdrlen); -+ for (i = 0; i < skb->len; i++) { -+ if (i % 16 == 0) printk("\n\t"); -+ printk("%2x ", *(skb->data+i)); -+ } -+ -+ printk("\n"); -+#endif -+ /* Returning 0 indicates to caller that we have not handled the SKB-- -+ * so it is still allocated and can be used again by underlying -+ * hardware as a DMA target */ -+ return 0; -+} -+ -+#ifdef _RTL8187_EXT_PATCH_ -+int ieee_ext_skb_p80211_to_ether(struct sk_buff *skb, int hdrlen, u8 *dst, u8 *src) -+{ -+ u8 *payload; -+ u16 ethertype; -+ -+ /* skb: hdr + (possible reassembled) full plaintext payload */ -+ payload = skb->data + hdrlen; -+ ethertype = (payload[6] << 8) | payload[7]; -+ -+ /* convert hdr + possible LLC headers into Ethernet header */ -+ if (skb->len - hdrlen >= 8 && -+ ((memcmp(payload, rfc1042_header, SNAP_SIZE) == 0 && -+ ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) || -+ memcmp(payload, bridge_tunnel_header, SNAP_SIZE) == 0)) { -+ /* remove RFC1042 or Bridge-Tunnel encapsulation and -+ * replace EtherType */ -+ skb_pull(skb, hdrlen + SNAP_SIZE); -+ memcpy(skb_push(skb, ETH_ALEN), src, ETH_ALEN); -+ memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN); -+ } else { -+ u16 len; -+ /* Leave Ethernet header part of hdr and full payload */ -+ skb_pull(skb, hdrlen); -+ len = htons(skb->len); -+ memcpy(skb_push(skb, 2), &len, 2); -+ memcpy(skb_push(skb, ETH_ALEN), src, ETH_ALEN); -+ memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN); -+ } -+ -+ return 1; -+} -+#endif // _RTL8187_EXT_PATCH_ -+ -+ -+#define MGMT_FRAME_FIXED_PART_LENGTH 0x24 -+ -+static inline int ieee80211_is_ofdm_rate(u8 rate) -+{ -+ switch (rate & ~IEEE80211_BASIC_RATE_MASK) { -+ case IEEE80211_OFDM_RATE_6MB: -+ case IEEE80211_OFDM_RATE_9MB: -+ case IEEE80211_OFDM_RATE_12MB: -+ case IEEE80211_OFDM_RATE_18MB: -+ case IEEE80211_OFDM_RATE_24MB: -+ case IEEE80211_OFDM_RATE_36MB: -+ case IEEE80211_OFDM_RATE_48MB: -+ case IEEE80211_OFDM_RATE_54MB: -+ return 1; -+ } -+ return 0; -+} -+ -+ -+// -+// Description: -+// Translate 0-100 signal strength index into dBm. -+// -+int -+TranslateToDbm8187( -+ unsigned char SignalStrengthIndex // 0-100 index. -+ ) -+{ -+ unsigned char SignalPower; // in dBm. -+ -+ // Translate to dBm (x=0.5y-95). -+ //SignalPower = (int)((SignalStrengthIndex + 1) >> 1); -+ SignalPower = (int)SignalStrengthIndex * 7 / 10; -+ SignalPower -= 95; -+// printk("==>SignalPower:%d\n", SignalPower); -+ return SignalPower; -+} -+ -+static inline int ieee80211_SignalStrengthTranslate( -+ int CurrSS -+ ) -+{ -+ int RetSS; -+ -+ // Step 1. Scale mapping. -+ if(CurrSS >= 71 && CurrSS <= 100) -+ { -+ RetSS = 95 + (((CurrSS - 70) / 6 == 5) ? 5 : ((CurrSS - 70) / 6 + 1)); -+ } -+ else if(CurrSS >= 41 && CurrSS <= 70) -+ { -+ RetSS = 83 + ((CurrSS - 40) / 3); -+ } -+ else if(CurrSS >= 31 && CurrSS <= 40) -+ { -+ RetSS = 71 + (CurrSS - 30); -+ } -+ else if(CurrSS >= 21 && CurrSS <= 30) -+ { -+ RetSS = 59 + (CurrSS - 20); -+ } -+ else if(CurrSS >= 5 && CurrSS <= 20) -+ { -+ RetSS = 47 + (((CurrSS - 5) * 2) / 3); -+ } -+ else if(CurrSS == 4) -+ { -+ RetSS = 37; -+ } -+ else if(CurrSS == 3) -+ { -+ RetSS = 27; -+ } -+ else if(CurrSS == 2) -+ { -+ RetSS = 18; -+ } -+ else if(CurrSS == 1) -+ { -+ RetSS = 9; -+ } -+ else -+ { -+ RetSS = CurrSS; -+ } -+ //RT_TRACE(COMP_DBG, DBG_LOUD, ("##### After Mapping: LastSS: %d, CurrSS: %d, RetSS: %d\n", LastSS, CurrSS, RetSS)); -+ -+ // Step 2. Smoothing. -+ -+ //RT_TRACE(COMP_DBG, DBG_LOUD, ("$$$$$ After Smoothing: LastSS: %d, CurrSS: %d, RetSS: %d\n", LastSS, CurrSS, RetSS)); -+ -+ return RetSS; -+} -+ -+#ifdef ENABLE_DOT11D -+static inline void ieee80211_extract_country_ie( -+ struct ieee80211_device *ieee, -+ struct ieee80211_info_element *info_element, -+ struct ieee80211_network *network, -+ u8 * addr2 -+) -+{ -+#if 0 -+ u32 i = 0; -+ u8 * p = (u8*)info_element->data; -+ printk("-----------------------\n"); -+ printk("%s Country IE:", network->ssid); -+ for(i=0; i<info_element->len; i++) -+ printk("\t%2.2x", *(p+i)); -+ printk("\n-----------------------\n"); -+#endif -+ if(IS_DOT11D_ENABLE(ieee)) -+ { -+ if(info_element->len!= 0) -+ { -+ memcpy(network->CountryIeBuf, info_element->data, info_element->len); -+ network->CountryIeLen = info_element->len; -+ -+ if(!IS_COUNTRY_IE_VALID(ieee)) -+ { -+ Dot11d_UpdateCountryIe(ieee, addr2, info_element->len, info_element->data); -+ } -+ } -+ -+ // -+ // 070305, rcnjko: I update country IE watch dog here because -+ // some AP (e.g. Cisco 1242) don't include country IE in their -+ // probe response frame. -+ // -+ if(IS_EQUAL_CIE_SRC(ieee, addr2) ) -+ { -+ UPDATE_CIE_WATCHDOG(ieee); -+ } -+ } -+ -+} -+#endif -+ -+ -+ inline int ieee80211_network_init( -+ struct ieee80211_device *ieee, -+ struct ieee80211_probe_response *beacon, -+ struct ieee80211_network *network, -+ struct ieee80211_rx_stats *stats) -+{ -+#ifdef CONFIG_IEEE80211_DEBUG -+ char rates_str[64]; -+ char *p; -+#endif -+ struct ieee80211_info_element *info_element; -+ u16 left; -+ u8 i; -+ short offset; -+ -+ /* Pull out fixed field data */ -+ memcpy(network->bssid, beacon->header.addr3, ETH_ALEN); -+ network->capability = beacon->capability; -+ network->last_scanned = jiffies; -+ network->time_stamp[0] = beacon->time_stamp[0]; -+ network->time_stamp[1] = beacon->time_stamp[1]; -+ network->beacon_interval = beacon->beacon_interval; -+ /* Where to pull this? beacon->listen_interval;*/ -+ network->listen_interval = 0x0A; -+ network->rates_len = network->rates_ex_len = 0; -+ network->last_associate = 0; -+ network->ssid_len = 0; -+ network->flags = 0; -+ network->atim_window = 0; -+ network->QoS_Enable = 0; -+#ifdef THOMAS_TURBO -+ network->Turbo_Enable = 0; -+#endif -+#ifdef ENABLE_DOT11D -+ network->CountryIeLen = 0; -+ memset(network->CountryIeBuf, 0, MAX_IE_LEN); -+#endif -+ -+ if (stats->freq == IEEE80211_52GHZ_BAND) { -+ /* for A band (No DS info) */ -+ network->channel = stats->received_channel; -+ } else -+ network->flags |= NETWORK_HAS_CCK; -+ -+ network->wpa_ie_len = 0; -+ network->rsn_ie_len = 0; -+ -+ info_element = &beacon->info_element; -+ left = stats->len - ((void *)info_element - (void *)beacon); -+ while (left >= sizeof(struct ieee80211_info_element_hdr)) { -+ if (sizeof(struct ieee80211_info_element_hdr) + info_element->len > left) { -+ IEEE80211_DEBUG_SCAN("SCAN: parse failed: info_element->len + 2 > left : info_element->len+2=%d left=%d.\n", -+ info_element->len + sizeof(struct ieee80211_info_element), -+ left); -+ return 1; -+ } -+ -+ switch (info_element->id) { -+ case MFIE_TYPE_SSID: -+ if (ieee80211_is_empty_essid(info_element->data, -+ info_element->len)) { -+ network->flags |= NETWORK_EMPTY_ESSID; -+ break; -+ } -+ -+ network->ssid_len = min(info_element->len, -+ (u8)IW_ESSID_MAX_SIZE); -+ memcpy(network->ssid, info_element->data, network->ssid_len); -+ if (network->ssid_len < IW_ESSID_MAX_SIZE) -+ memset(network->ssid + network->ssid_len, 0, -+ IW_ESSID_MAX_SIZE - network->ssid_len); -+ -+ IEEE80211_DEBUG_SCAN("MFIE_TYPE_SSID: '%s' len=%d.\n", -+ network->ssid, network->ssid_len); -+ break; -+ -+ case MFIE_TYPE_RATES: -+#ifdef CONFIG_IEEE80211_DEBUG -+ p = rates_str; -+#endif -+ network->rates_len = min(info_element->len, MAX_RATES_LENGTH); -+ for (i = 0; i < network->rates_len; i++) { -+ network->rates[i] = info_element->data[i]; -+#ifdef CONFIG_IEEE80211_DEBUG -+ p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]); -+#endif -+ if (ieee80211_is_ofdm_rate(info_element->data[i])) { -+ network->flags |= NETWORK_HAS_OFDM; -+ if (info_element->data[i] & -+ IEEE80211_BASIC_RATE_MASK) -+ network->flags &= -+ ~NETWORK_HAS_CCK; -+ } -+ } -+ -+ IEEE80211_DEBUG_SCAN("MFIE_TYPE_RATES: '%s' (%d)\n", -+ rates_str, network->rates_len); -+ break; -+ -+ case MFIE_TYPE_RATES_EX: -+#ifdef CONFIG_IEEE80211_DEBUG -+ p = rates_str; -+#endif -+ network->rates_ex_len = min(info_element->len, MAX_RATES_EX_LENGTH); -+ for (i = 0; i < network->rates_ex_len; i++) { -+ network->rates_ex[i] = info_element->data[i]; -+#ifdef CONFIG_IEEE80211_DEBUG -+ p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]); -+#endif -+ if (ieee80211_is_ofdm_rate(info_element->data[i])) { -+ network->flags |= NETWORK_HAS_OFDM; -+ if (info_element->data[i] & -+ IEEE80211_BASIC_RATE_MASK) -+ network->flags &= -+ ~NETWORK_HAS_CCK; -+ } -+ } -+ -+ IEEE80211_DEBUG_SCAN("MFIE_TYPE_RATES_EX: '%s' (%d)\n", -+ rates_str, network->rates_ex_len); -+ break; -+ -+ case MFIE_TYPE_DS_SET: -+ IEEE80211_DEBUG_SCAN("MFIE_TYPE_DS_SET: %d\n", -+ info_element->data[0]); -+ if (stats->freq == IEEE80211_24GHZ_BAND) -+ network->channel = info_element->data[0]; -+ break; -+ -+ case MFIE_TYPE_FH_SET: -+ IEEE80211_DEBUG_SCAN("MFIE_TYPE_FH_SET: ignored\n"); -+ break; -+ -+ case MFIE_TYPE_CF_SET: -+ IEEE80211_DEBUG_SCAN("MFIE_TYPE_CF_SET: ignored\n"); -+ break; -+ -+ case MFIE_TYPE_TIM: -+ -+ if(info_element->len < 4) -+ break; -+ -+ network->dtim_period = info_element->data[1]; -+ -+ if(ieee->state != IEEE80211_LINKED) -+ break; -+ -+ network->last_dtim_sta_time[0] = stats->mac_time[0]; -+ network->last_dtim_sta_time[1] = stats->mac_time[1]; -+ -+ network->dtim_data = IEEE80211_DTIM_VALID; -+ -+ if(info_element->data[0] != 0) -+ break; -+ -+ if(info_element->data[2] & 1) -+ network->dtim_data |= IEEE80211_DTIM_MBCAST; -+ -+ offset = (info_element->data[2] >> 1)*2; -+ -+ //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id); -+ -+ if(ieee->assoc_id < offset || -+ ieee->assoc_id > 8*(offset + info_element->len -3)) -+ -+ break; -+ -+ -+ offset = offset + ieee->assoc_id / 8;// + ((aid % 8)? 0 : 1) ; -+ -+ // printk("offset:%x data:%x, ucast:%d\n", offset, -+ // info_element->data[3+offset] , -+ // info_element->data[3+offset] & (1<<(ieee->assoc_id%8))); -+ -+ if(info_element->data[3+offset] & (1<<(ieee->assoc_id%8))) -+ network->dtim_data |= IEEE80211_DTIM_UCAST; -+ -+ break; -+ -+ case MFIE_TYPE_IBSS_SET: -+ IEEE80211_DEBUG_SCAN("MFIE_TYPE_IBSS_SET: ignored\n"); -+ break; -+ -+ case MFIE_TYPE_CHALLENGE: -+ IEEE80211_DEBUG_SCAN("MFIE_TYPE_CHALLENGE: ignored\n"); -+ break; -+ -+ case MFIE_TYPE_GENERIC: -+ //nic is 87B -+ IEEE80211_DEBUG_SCAN("MFIE_TYPE_GENERIC: %d bytes\n", -+ info_element->len); -+ if (info_element->len >= 4 && -+ info_element->data[0] == 0x00 && -+ info_element->data[1] == 0x50 && -+ info_element->data[2] == 0xf2 && -+ info_element->data[3] == 0x01) { -+ network->wpa_ie_len = min(info_element->len + 2, -+ MAX_WPA_IE_LEN); -+ memcpy(network->wpa_ie, info_element, -+ network->wpa_ie_len); -+ } -+ -+#ifdef THOMAS_TURBO -+ if (info_element->len == 7 && -+ info_element->data[0] == 0x00 && -+ info_element->data[1] == 0xe0 && -+ info_element->data[2] == 0x4c && -+ info_element->data[3] == 0x01 && -+ info_element->data[4] == 0x02) { -+ network->Turbo_Enable = 1; -+ } -+#endif -+ if (1 == stats->nic_type) {//nic 87 -+ break; -+ } -+ -+ if (info_element->len >= 5 && -+ info_element->data[0] == 0x00 && -+ info_element->data[1] == 0x50 && -+ info_element->data[2] == 0xf2 && -+ info_element->data[3] == 0x02 && -+ info_element->data[4] == 0x00) { -+ //printk(KERN_WARNING "wmm info updated: %x\n", info_element->data[6]); -+ //WMM Information Element -+ network->wmm_info = info_element->data[6]; -+ network->QoS_Enable = 1; -+ } -+ -+ if (info_element->len >= 8 && -+ info_element->data[0] == 0x00 && -+ info_element->data[1] == 0x50 && -+ info_element->data[2] == 0xf2 && -+ info_element->data[3] == 0x02 && -+ info_element->data[4] == 0x01) { -+ // Not care about version at present. -+ //WMM Information Element -+ //printk(KERN_WARNING "wmm info¶m updated: %x\n", info_element->data[6]); -+ network->wmm_info = info_element->data[6]; -+ //WMM Parameter Element -+ memcpy(network->wmm_param, (u8 *)(info_element->data + 8),(info_element->len - 8)); -+ network->QoS_Enable = 1; -+ } -+ break; -+ -+ case MFIE_TYPE_RSN: -+ IEEE80211_DEBUG_SCAN("MFIE_TYPE_RSN: %d bytes\n", -+ info_element->len); -+ network->rsn_ie_len = min(info_element->len + 2, -+ MAX_WPA_IE_LEN); -+ memcpy(network->rsn_ie, info_element, -+ network->rsn_ie_len); -+ break; -+ -+#ifdef ENABLE_DOT11D -+ case MFIE_TYPE_COUNTRY: -+ IEEE80211_DEBUG_SCAN("MFIE_TYPE_COUNTRY: %d bytes\n", -+ info_element->len); -+// printk("=====>Receive <%s> Country IE\n",network->ssid); -+ ieee80211_extract_country_ie(ieee, info_element, network, beacon->header.addr2); -+ break; -+#endif -+ -+ default: -+ IEEE80211_DEBUG_SCAN("unsupported IE %d\n", -+ info_element->id); -+ break; -+ } -+ -+ left -= sizeof(struct ieee80211_info_element_hdr) + -+ info_element->len; -+ info_element = (struct ieee80211_info_element *) -+ &info_element->data[info_element->len]; -+ } -+ -+ network->mode = 0; -+ if (stats->freq == IEEE80211_52GHZ_BAND) -+ network->mode = IEEE_A; -+ else { -+ if (network->flags & NETWORK_HAS_OFDM) -+ network->mode |= IEEE_G; -+ if (network->flags & NETWORK_HAS_CCK) -+ network->mode |= IEEE_B; -+ } -+ -+ if (network->mode == 0) { -+ IEEE80211_DEBUG_SCAN("Filtered out '%s (" MAC_FMT ")' " -+ "network.\n", -+ escape_essid(network->ssid, -+ network->ssid_len), -+ MAC_ARG(network->bssid)); -+ return 1; -+ } -+ -+ if (ieee80211_is_empty_essid(network->ssid, network->ssid_len)) -+ network->flags |= NETWORK_EMPTY_ESSID; -+ -+#if 1 -+ //if(strcmp(network->ssid, "linksys_lzm000") == 0) -+ // printk("----signalstrength = %d ", stats->signalstrength); -+ stats->signal = TranslateToDbm8187(stats->signalstrength); -+ //stats->noise = stats->signal - stats->noise; -+ stats->noise = TranslateToDbm8187(100 - stats->signalstrength) - 25; -+#endif -+ memcpy(&network->stats, stats, sizeof(network->stats)); -+ -+ //YJ,test,080611 -+ //if(strcmp(network->ssid, "ZyXEL") == 0) -+ // IEEE_NET_DUMP(network); -+ -+ return 0; -+} -+ -+static inline int is_same_network(struct ieee80211_network *src, -+ struct ieee80211_network *dst, -+ struct ieee80211_device * ieee) -+{ -+ /* A network is only a duplicate if the channel, BSSID, ESSID -+ * and the capability field (in particular IBSS and BSS) all match. -+ * We treat all <hidden> with the same BSSID and channel -+ * as one network */ -+ return (((src->ssid_len == dst->ssid_len) || (ieee->iw_mode == IW_MODE_INFRA)) && //YJ,mod,080819,for hidden ap -+ //((src->ssid_len == dst->ssid_len) && -+ (src->channel == dst->channel) && -+ !memcmp(src->bssid, dst->bssid, ETH_ALEN) && -+ (!memcmp(src->ssid, dst->ssid, src->ssid_len) || (ieee->iw_mode == IW_MODE_INFRA)) && //YJ,mod,080819,for hidden ap -+ //!memcmp(src->ssid, dst->ssid, src->ssid_len) && -+ ((src->capability & WLAN_CAPABILITY_IBSS) == -+ (dst->capability & WLAN_CAPABILITY_IBSS)) && -+ ((src->capability & WLAN_CAPABILITY_BSS) == -+ (dst->capability & WLAN_CAPABILITY_BSS))); -+} -+ -+inline void update_network(struct ieee80211_network *dst, -+ struct ieee80211_network *src) -+{ -+ unsigned char quality = src->stats.signalstrength; -+ unsigned char signal = 0; -+ unsigned char noise = 0; -+ if(dst->stats.signalstrength > 0) { -+ quality = (dst->stats.signalstrength * 5 + src->stats.signalstrength + 5)/6; -+ } -+ signal = TranslateToDbm8187(quality); -+ //noise = signal - src->stats.noise; -+ if(dst->stats.noise > 0) -+ noise = (dst->stats.noise * 5 + src->stats.noise)/6; -+ //if(strcmp(dst->ssid, "linksys_lzm000") == 0) -+// printk("ssid:%s, quality:%d, signal:%d\n", dst->ssid, quality, signal); -+ memcpy(&dst->stats, &src->stats, sizeof(struct ieee80211_rx_stats)); -+ dst->stats.signalstrength = quality; -+ dst->stats.signal = signal; -+ dst->stats.noise = noise; -+ dst->capability = src->capability; -+ memcpy(dst->rates, src->rates, src->rates_len); -+ dst->rates_len = src->rates_len; -+ memcpy(dst->rates_ex, src->rates_ex, src->rates_ex_len); -+ dst->rates_ex_len = src->rates_ex_len; -+ -+ //YJ,add,080819,for hidden ap -+ if(src->ssid_len > 0) -+ { -+ //if(src->ssid_len == 13) -+ // printk("=====================>>>>>>>> Dst ssid: %s Src ssid: %s\n", dst->ssid, src->ssid); -+ memset(dst->ssid, 0, dst->ssid_len); -+ dst->ssid_len = src->ssid_len; -+ memcpy(dst->ssid, src->ssid, src->ssid_len); -+ } -+ //YJ,add,080819,for hidden ap,end -+ dst->channel = src->channel; -+ dst->mode = src->mode; -+ dst->flags = src->flags; -+ dst->time_stamp[0] = src->time_stamp[0]; -+ dst->time_stamp[1] = src->time_stamp[1]; -+ -+ dst->beacon_interval = src->beacon_interval; -+ dst->listen_interval = src->listen_interval; -+ dst->atim_window = src->atim_window; -+ dst->dtim_period = src->dtim_period; -+ dst->dtim_data = src->dtim_data; -+ dst->last_dtim_sta_time[0] = src->last_dtim_sta_time[0]; -+ dst->last_dtim_sta_time[1] = src->last_dtim_sta_time[1]; -+ -+ memcpy(dst->wpa_ie, src->wpa_ie, src->wpa_ie_len); -+ dst->wpa_ie_len = src->wpa_ie_len; -+ memcpy(dst->rsn_ie, src->rsn_ie, src->rsn_ie_len); -+ dst->rsn_ie_len = src->rsn_ie_len; -+ -+ dst->last_scanned = jiffies; -+ /* dst->last_associate is not overwritten */ -+#if 1 -+ dst->wmm_info = src->wmm_info; //sure to exist in beacon or probe response frame. -+/* -+ if((dst->wmm_info^src->wmm_info)&0x0f) {//Param Set Count change, update Parameter -+ memcpy(dst->wmm_param, src->wmm_param, IEEE80211_AC_PRAM_LEN); -+ } -+*/ -+ if(src->wmm_param[0].ac_aci_acm_aifsn|| \ -+ src->wmm_param[1].ac_aci_acm_aifsn|| \ -+ src->wmm_param[2].ac_aci_acm_aifsn|| \ -+ src->wmm_param[1].ac_aci_acm_aifsn) { -+ memcpy(dst->wmm_param, src->wmm_param, WME_AC_PRAM_LEN); -+ } -+ dst->QoS_Enable = src->QoS_Enable; -+#else -+ dst->QoS_Enable = 1;//for Rtl8187 simulation -+#endif -+ dst->SignalStrength = src->SignalStrength; -+#ifdef THOMAS_TURBO -+ dst->Turbo_Enable = src->Turbo_Enable; -+#endif -+#ifdef ENABLE_DOT11D -+ dst->CountryIeLen = src->CountryIeLen; -+ memcpy(dst->CountryIeBuf, src->CountryIeBuf, src->CountryIeLen); -+#endif -+ -+} -+ -+inline void ieee80211_process_probe_response( -+ struct ieee80211_device *ieee, -+ struct ieee80211_probe_response *beacon, -+ struct ieee80211_rx_stats *stats) -+{ -+ struct ieee80211_network network; -+ struct ieee80211_network *target; -+ struct ieee80211_network *oldest = NULL; -+#ifdef CONFIG_IEEE80211_DEBUG -+ struct ieee80211_info_element *info_element = &beacon->info_element; -+#endif -+ unsigned long flags; -+ short renew; -+ u8 wmm_info; -+ u8 is_beacon = (WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == IEEE80211_STYPE_BEACON)? 1:0; -+ -+ memset(&network, 0, sizeof(struct ieee80211_network)); -+//rz -+#ifdef _RTL8187_EXT_PATCH_ -+ if((ieee->iw_mode == ieee->iw_ext_mode) && ieee->ext_patch_ieee80211_process_probe_response_1) { -+ ieee->ext_patch_ieee80211_process_probe_response_1(ieee, beacon, stats); -+ return; -+ } -+#endif -+ IEEE80211_DEBUG_SCAN( -+ "'%s' (" MAC_FMT "): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n", -+ escape_essid(info_element->data, info_element->len), -+ MAC_ARG(beacon->header.addr3), -+ (beacon->capability & (1<<0xf)) ? '1' : '0', -+ (beacon->capability & (1<<0xe)) ? '1' : '0', -+ (beacon->capability & (1<<0xd)) ? '1' : '0', -+ (beacon->capability & (1<<0xc)) ? '1' : '0', -+ (beacon->capability & (1<<0xb)) ? '1' : '0', -+ (beacon->capability & (1<<0xa)) ? '1' : '0', -+ (beacon->capability & (1<<0x9)) ? '1' : '0', -+ (beacon->capability & (1<<0x8)) ? '1' : '0', -+ (beacon->capability & (1<<0x7)) ? '1' : '0', -+ (beacon->capability & (1<<0x6)) ? '1' : '0', -+ (beacon->capability & (1<<0x5)) ? '1' : '0', -+ (beacon->capability & (1<<0x4)) ? '1' : '0', -+ (beacon->capability & (1<<0x3)) ? '1' : '0', -+ (beacon->capability & (1<<0x2)) ? '1' : '0', -+ (beacon->capability & (1<<0x1)) ? '1' : '0', -+ (beacon->capability & (1<<0x0)) ? '1' : '0'); -+ -+ if (ieee80211_network_init(ieee, beacon, &network, stats)) { -+ IEEE80211_DEBUG_SCAN("Dropped '%s' (" MAC_FMT ") via %s.\n", -+ escape_essid(info_element->data, -+ info_element->len), -+ MAC_ARG(beacon->header.addr3), -+ WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == -+ IEEE80211_STYPE_PROBE_RESP ? -+ "PROBE RESPONSE" : "BEACON"); -+ return; -+ } -+ -+#ifdef ENABLE_DOT11D -+ // For Asus EeePc request, -+ // (1) if wireless adapter receive get any 802.11d country code in AP beacon, -+ // wireless adapter should follow the country code. -+ // (2) If there is no any country code in beacon, -+ // then wireless adapter should do active scan from ch1~11 and -+ // passive scan from ch12~14 -+ if(ieee->bGlobalDomain) -+ { -+ if (WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == IEEE80211_STYPE_PROBE_RESP) -+ { -+ // Case 1: Country code -+ if(IS_COUNTRY_IE_VALID(ieee) ) -+ { -+ if( !IsLegalChannel(ieee, network.channel) ) -+ { -+ printk("GetScanInfo(): For Country code, filter probe response at channel(%d).\n", network.channel); -+ return; -+ } -+ } -+ // Case 2: No any country code. -+ else -+ { -+ // Filter over channel ch12~14 -+ if(network.channel > 11) -+ { -+ printk("GetScanInfo(): For Global Domain, filter probe response at channel(%d).\n", network.channel); -+ return; -+ } -+ } -+ } -+ else -+ { -+ // Case 1: Country code -+ if(IS_COUNTRY_IE_VALID(ieee) ) -+ { -+ if( !IsLegalChannel(ieee, network.channel) ) -+ { -+ printk("GetScanInfo(): For Country code, filter beacon at channel(%d).\n",network.channel); -+ return; -+ } -+ } -+ // Case 2: No any country code. -+ else -+ { -+ // Filter over channel ch12~14 -+ if(network.channel > 14) -+ { -+ printk("GetScanInfo(): For Global Domain, filter beacon at channel(%d).\n",network.channel); -+ return; -+ } -+ } -+ } -+ } -+ -+ //lzm add 081205 -+ // for Toshiba request, we use channel_plan COUNTRY_CODE_WORLD_WIDE_13_INDEX, -+ // For Liteon "World Wide 13" Domain name:ch1~11 active scan & ch12~13 passive scan -+ // So we shoud only rcv beacon in 12-13, and filter probe resp in 12-13. -+ if(ieee->MinPassiveChnlNum != MAX_CHANNEL_NUMBER+1) -+ { -+ if (WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == IEEE80211_STYPE_PROBE_RESP) -+ { -+ // Filter over channel ch12~13 -+ if(network.channel >= ieee->MinPassiveChnlNum) -+ { -+ printk("GetScanInfo(): passive scan, filter probe resp at channel(%d).\n", network.channel); -+ return; -+ } -+ } -+ } -+#endif -+ -+ -+ /* The network parsed correctly -- so now we scan our known networks -+ * to see if we can find it in our list. -+ * -+ * NOTE: This search is definitely not optimized. Once its doing -+ * the "right thing" we'll optimize it for efficiency if -+ * necessary */ -+ -+ /* Search for this entry in the list and update it if it is -+ * already there. */ -+ -+ spin_lock_irqsave(&ieee->lock, flags); -+ -+ if(is_same_network(&ieee->current_network, &network, ieee)) { -+ //YJ,add,080819,for hidden ap -+ if(is_beacon == 0) -+ network.flags = (~NETWORK_EMPTY_ESSID & network.flags)|(NETWORK_EMPTY_ESSID & ieee->current_network.flags); -+ if ((ieee->state == IEEE80211_LINKED) && is_beacon) -+ ieee->NumRxBcnInPeriod++; -+ wmm_info = ieee->current_network.wmm_info; -+ update_network(&ieee->current_network, &network); -+ } -+ -+ list_for_each_entry(target, &ieee->network_list, list) { -+ if (is_same_network(target, &network, ieee)) -+ break; -+ if ((oldest == NULL) || -+ (target->last_scanned < oldest->last_scanned)) -+ oldest = target; -+ } -+ -+ /* If we didn't find a match, then get a new network slot to initialize -+ * with this beacon's information */ -+ if (&target->list == &ieee->network_list) { -+ if (list_empty(&ieee->network_free_list)) { -+ /* If there are no more slots, expire the oldest */ -+ list_del(&oldest->list); -+ target = oldest; -+ IEEE80211_DEBUG_SCAN("Expired '%s' (" MAC_FMT ") from " -+ "network list.\n", -+ escape_essid(target->ssid, -+ target->ssid_len), -+ MAC_ARG(target->bssid)); -+ } else { -+ /* Otherwise just pull from the free list */ -+ target = list_entry(ieee->network_free_list.next, -+ struct ieee80211_network, list); -+ list_del(ieee->network_free_list.next); -+ } -+ -+ -+#ifdef CONFIG_IEEE80211_DEBUG -+ IEEE80211_DEBUG_SCAN("Adding '%s' (" MAC_FMT ") via %s.\n", -+ escape_essid(network.ssid, -+ network.ssid_len), -+ MAC_ARG(network.bssid), -+ WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == -+ IEEE80211_STYPE_PROBE_RESP ? -+ "PROBE RESPONSE" : "BEACON"); -+#endif -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ network.ext_entry = target->ext_entry; -+#endif -+ memcpy(target, &network, sizeof(*target)); -+ list_add_tail(&target->list, &ieee->network_list); -+ if(ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) -+ ieee80211_softmac_new_net(ieee,&network); -+ } else { -+ IEEE80211_DEBUG_SCAN("Updating '%s' (" MAC_FMT ") via %s.\n", -+ escape_essid(target->ssid, -+ target->ssid_len), -+ MAC_ARG(target->bssid), -+ WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == -+ IEEE80211_STYPE_PROBE_RESP ? -+ "PROBE RESPONSE" : "BEACON"); -+ -+ /* we have an entry and we are going to update it. But this entry may -+ * be already expired. In this case we do the same as we found a new -+ * net and call the new_net handler -+ */ -+ renew = !time_after(target->last_scanned + ieee->scan_age, jiffies); -+ //YJ,add,080819,for hidden ap -+ if(is_beacon == 0) -+ network.flags = (~NETWORK_EMPTY_ESSID & network.flags)|(NETWORK_EMPTY_ESSID & target->flags); -+ //if(strncmp(network.ssid, "linksys-c",9) == 0) -+ // printk("====>2 network.ssid=%s FLAG=%d target.ssid=%s FLAG=%d\n", network.ssid, network.flags, target->ssid, target->flags); -+ if(((network.flags & NETWORK_EMPTY_ESSID) == NETWORK_EMPTY_ESSID) \ -+ && (((network.ssid_len > 0) && (strncmp(target->ssid, network.ssid, network.ssid_len)))\ -+ ||((ieee->current_network.ssid_len == network.ssid_len)&&(strncmp(ieee->current_network.ssid, network.ssid, network.ssid_len) == 0)&&(ieee->state == IEEE80211_NOLINK)))) -+ renew = 1; -+ //YJ,add,080819,for hidden ap,end -+ update_network(target, &network); -+ if(renew && (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE)) -+ ieee80211_softmac_new_net(ieee,&network); -+ } -+ -+ spin_unlock_irqrestore(&ieee->lock, flags); -+} -+ -+void ieee80211_rx_mgt(struct ieee80211_device *ieee, -+ struct ieee80211_hdr *header, -+ struct ieee80211_rx_stats *stats) -+{ -+ switch (WLAN_FC_GET_STYPE(header->frame_ctl)) { -+ -+ case IEEE80211_STYPE_BEACON: -+ IEEE80211_DEBUG_MGMT("received BEACON (%d)\n", -+ WLAN_FC_GET_STYPE(header->frame_ctl)); -+ IEEE80211_DEBUG_SCAN("Beacon\n"); -+ ieee80211_process_probe_response( -+ ieee, (struct ieee80211_probe_response *)header, stats); -+ break; -+ -+ case IEEE80211_STYPE_PROBE_RESP: -+ IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n", -+ WLAN_FC_GET_STYPE(header->frame_ctl)); -+ IEEE80211_DEBUG_SCAN("Probe response\n"); -+ ieee80211_process_probe_response( -+ ieee, (struct ieee80211_probe_response *)header, stats); -+ break; -+//rz -+#ifdef _RTL8187_EXT_PATCH_ -+ case IEEE80211_STYPE_PROBE_REQ: -+ IEEE80211_DEBUG_MGMT("received PROBE REQUEST (%d)\n", -+ WLAN_FC_GET_STYPE(header->frame_ctl)); -+ IEEE80211_DEBUG_SCAN("Probe request\n"); -+ /// -+ //printk("Probe request\n"); -+ if( ieee->iw_mode == ieee->iw_ext_mode && ieee->ext_patch_ieee80211_rx_mgt_on_probe_req ) -+ ieee->ext_patch_ieee80211_rx_mgt_on_probe_req( ieee, (struct ieee80211_probe_request *)header, stats); -+ break; -+#endif // _RTL8187_EXT_PATCH_ -+ -+ } -+} -+ -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) -+EXPORT_SYMBOL(ieee80211_rx_mgt); -+EXPORT_SYMBOL(ieee80211_rx); -+EXPORT_SYMBOL(ieee80211_network_init); -+#ifdef _RTL8187_EXT_PATCH_ -+EXPORT_SYMBOL(ieee_ext_skb_p80211_to_ether); -+#endif -+#else -+EXPORT_SYMBOL_NOVERS(ieee80211_rx_mgt); -+EXPORT_SYMBOL_NOVERS(ieee80211_rx); -+EXPORT_SYMBOL_NOVERS(ieee80211_network_init); -+#ifdef _RTL8187_EXT_PATCH_ -+EXPORT_SYMBOL_NOVERS(ieee_ext_skb_p80211_to_ether); -+#endif -+#endif -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_softmac.c linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_softmac.c ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_softmac.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_softmac.c 2010-08-05 21:12:34.483617738 +0200 -@@ -0,0 +1,4083 @@ -+/* IEEE 802.11 SoftMAC layer -+ * Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it> -+ * -+ * Mostly extracted from the rtl8180-sa2400 driver for the -+ * in-kernel generic ieee802.11 stack. -+ * -+ * Few lines might be stolen from other part of the ieee80211 -+ * stack. Copyright who own it's copyright -+ * -+ * WPA code stolen from the ipw2200 driver. -+ * Copyright who own it's copyright. -+ * -+ * released under the GPL -+ */ -+ -+ -+#include "ieee80211.h" -+ -+#include <linux/random.h> -+#include <linux/delay.h> -+#include <linux/version.h> -+#include <asm/uaccess.h> -+ -+#ifdef ENABLE_DOT11D -+#include "dot11d.h" -+#endif -+ -+ -+u8 rsn_authen_cipher_suite[16][4] = { -+ {0x00,0x0F,0xAC,0x00}, //Use group key, //Reserved -+ {0x00,0x0F,0xAC,0x01}, //WEP-40 //RSNA default -+ {0x00,0x0F,0xAC,0x02}, //TKIP //NONE //{used just as default} -+ {0x00,0x0F,0xAC,0x03}, //WRAP-historical -+ {0x00,0x0F,0xAC,0x04}, //CCMP -+ {0x00,0x0F,0xAC,0x05}, //WEP-104 -+}; -+ -+short ieee80211_is_54g(struct ieee80211_network net) -+{ -+ return ((net.rates_ex_len > 0) || (net.rates_len > 4)); -+} -+ -+short ieee80211_is_shortslot(struct ieee80211_network net) -+{ -+ return (net.capability & WLAN_CAPABILITY_SHORT_SLOT); -+} -+ -+/* returns the total length needed for pleacing the RATE MFIE -+ * tag and the EXTENDED RATE MFIE tag if needed. -+ * It encludes two bytes per tag for the tag itself and its len -+ */ -+unsigned int ieee80211_MFIE_rate_len(struct ieee80211_device *ieee) -+{ -+ unsigned int rate_len = 0; -+ -+ if (ieee->modulation & IEEE80211_CCK_MODULATION) -+ rate_len = IEEE80211_CCK_RATE_LEN + 2; -+ -+ if (ieee->modulation & IEEE80211_OFDM_MODULATION) -+ -+ rate_len += IEEE80211_OFDM_RATE_LEN + 2; -+ -+ return rate_len; -+} -+ -+/* pleace the MFIE rate, tag to the memory (double) poined. -+ * Then it updates the pointer so that -+ * it points after the new MFIE tag added. -+ */ -+void ieee80211_MFIE_Brate(struct ieee80211_device *ieee, u8 **tag_p) -+{ -+ u8 *tag = *tag_p; -+ -+ if (ieee->modulation & IEEE80211_CCK_MODULATION){ -+ *tag++ = MFIE_TYPE_RATES; -+ *tag++ = 7; -+ *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB; -+ *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB; -+ *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB; -+ *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB; -+ //added for basic rate set -+ *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB; -+ *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_12MB; -+ *tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_24MB; -+ } -+ -+ /* We may add an option for custom rates that specific HW might support */ -+ *tag_p = tag; -+} -+ -+void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p) -+{ -+ u8 *tag = *tag_p; -+ -+ if (ieee->modulation & IEEE80211_OFDM_MODULATION){ -+ -+ *tag++ = MFIE_TYPE_RATES_EX; -+ *tag++ = 5; -+ *tag++ = IEEE80211_OFDM_RATE_9MB; -+ *tag++ = IEEE80211_OFDM_RATE_18MB; -+ *tag++ = IEEE80211_OFDM_RATE_36MB; -+ *tag++ = IEEE80211_OFDM_RATE_48MB; -+ *tag++ = IEEE80211_OFDM_RATE_54MB; -+ -+ } -+ -+ /* We may add an option for custom rates that specific HW might support */ -+ *tag_p = tag; -+} -+ -+ -+void ieee80211_WMM_Info(struct ieee80211_device *ieee, u8 **tag_p) { -+ u8 *tag = *tag_p; -+ -+ *tag++ = MFIE_TYPE_GENERIC; //0 -+ *tag++ = 7; -+ *tag++ = 0x00; -+ *tag++ = 0x50; -+ *tag++ = 0xf2; -+ *tag++ = 0x02;//5 -+ *tag++ = 0x00; -+ *tag++ = 0x01; -+#ifdef SUPPORT_USPD -+ if(ieee->current_network.wmm_info & 0x80) { -+ *tag++ = 0x0f|MAX_SP_Len; -+ } else { -+ *tag++ = MAX_SP_Len; -+ } -+#else -+ *tag++ = MAX_SP_Len; -+#endif -+ *tag_p = tag; -+} -+ -+#ifdef THOMAS_TURBO -+void ieee80211_TURBO_Info(struct ieee80211_device *ieee, u8 **tag_p) { -+ u8 *tag = *tag_p; -+ -+ *tag++ = MFIE_TYPE_GENERIC; //0 -+ *tag++ = 7; -+ *tag++ = 0x00; -+ *tag++ = 0xe0; -+ *tag++ = 0x4c; -+ *tag++ = 0x01;//5 -+ *tag++ = 0x02; -+ *tag++ = 0x11; -+ *tag++ = 0x00; -+ -+ *tag_p = tag; -+ printk(KERN_ALERT "This is enable turbo mode IE process\n"); -+} -+#endif -+ -+void enqueue_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb) -+{ -+ int nh; -+ nh = (ieee->mgmt_queue_head +1) % MGMT_QUEUE_NUM; -+ -+/* -+ * if the queue is full but we have newer frames then -+ * just overwrites the oldest. -+ * -+ * if (nh == ieee->mgmt_queue_tail) -+ * return -1; -+ */ -+ ieee->mgmt_queue_head = nh; -+ ieee->mgmt_queue_ring[nh] = skb; -+ -+ //return 0; -+} -+ -+struct sk_buff *dequeue_mgmt(struct ieee80211_device *ieee) -+{ -+ struct sk_buff *ret; -+ -+ if(ieee->mgmt_queue_tail == ieee->mgmt_queue_head) -+ return NULL; -+ -+ ret = ieee->mgmt_queue_ring[ieee->mgmt_queue_tail]; -+ -+ ieee->mgmt_queue_tail = -+ (ieee->mgmt_queue_tail+1) % MGMT_QUEUE_NUM; -+ -+ return ret; -+} -+ -+void init_mgmt_queue(struct ieee80211_device *ieee) -+{ -+ ieee->mgmt_queue_tail = ieee->mgmt_queue_head = 0; -+} -+ -+ -+void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl); -+ -+inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee) -+{ -+ unsigned long flags; -+ short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE; -+ struct ieee80211_hdr_3addr *header= -+ (struct ieee80211_hdr_3addr *) skb->data; -+ -+ -+ spin_lock_irqsave(&ieee->lock, flags); -+ -+ /* called with 2nd param 0, no mgmt lock required */ -+ ieee80211_sta_wakeup(ieee,0); -+ -+ if(single){ -+ if(ieee->queue_stop){ -+ -+ enqueue_mgmt(ieee,skb); -+ }else{ -+ header->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0]<<4); -+ -+ if (ieee->seq_ctrl[0] == 0xFFF) -+ ieee->seq_ctrl[0] = 0; -+ else -+ ieee->seq_ctrl[0]++; -+ -+ /* avoid watchdog triggers */ -+ ieee->dev->trans_start = jiffies; -+ ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate); -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) -+// dev_kfree_skb_any(skb);//edit by thomas //'cause this function will cause Oops called in interrupt context in old version 101907 -+#endif -+ } -+ -+ spin_unlock_irqrestore(&ieee->lock, flags); -+ }else{ -+ spin_unlock_irqrestore(&ieee->lock, flags); -+ spin_lock_irqsave(&ieee->mgmt_tx_lock, flags); -+ -+ header->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0] << 4); -+ -+ if (ieee->seq_ctrl[0] == 0xFFF) -+ ieee->seq_ctrl[0] = 0; -+ else -+ ieee->seq_ctrl[0]++; -+ -+ ieee->softmac_hard_start_xmit(skb,ieee->dev); -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) -+// dev_kfree_skb_any(skb);//edit by thomas -+#endif -+ spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags); -+ } -+} -+ -+ -+inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee) -+{ -+ -+ short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE; -+ struct ieee80211_hdr_3addr *header = -+ (struct ieee80211_hdr_3addr *) skb->data; -+ -+ -+ if(single){ -+ -+ header->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0] << 4); -+ -+ if (ieee->seq_ctrl[0] == 0xFFF) -+ ieee->seq_ctrl[0] = 0; -+ else -+ ieee->seq_ctrl[0]++; -+ -+ /* avoid watchdog triggers */ -+ ieee->dev->trans_start = jiffies; -+ ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate); -+ -+ }else{ -+ -+ header->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0] << 4); -+ -+ if (ieee->seq_ctrl[0] == 0xFFF) -+ ieee->seq_ctrl[0] = 0; -+ else -+ ieee->seq_ctrl[0]++; -+ -+ ieee->softmac_hard_start_xmit(skb,ieee->dev); -+ -+ } -+ dev_kfree_skb_any(skb);//edit by thomas -+} -+ -+inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee) -+{ -+ unsigned int len,rate_len; -+ u8 *tag; -+ struct sk_buff *skb; -+ struct ieee80211_probe_request *req; -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ short extMore = 0; -+ if(ieee->ext_patch_ieee80211_probe_req_1) -+ extMore = ieee->ext_patch_ieee80211_probe_req_1(ieee); -+#endif -+ -+ len = ieee->current_network.ssid_len; -+ -+ rate_len = ieee80211_MFIE_rate_len(ieee); -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ if(!extMore) -+#endif -+ skb = dev_alloc_skb(sizeof(struct ieee80211_probe_request) + -+ 2 + len + rate_len); -+#ifdef _RTL8187_EXT_PATCH_ -+ else -+ skb = dev_alloc_skb(sizeof(struct ieee80211_probe_request) + -+ 2 + len + rate_len+128); // MESHID + CAP -+#endif -+ -+ if (!skb) -+ return NULL; -+ -+ req = (struct ieee80211_probe_request *) skb_put(skb,sizeof(struct ieee80211_probe_request)); -+ req->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); -+ req->header.duration_id = 0; //FIXME: is this OK ? -+ -+ memset(req->header.addr1, 0xff, ETH_ALEN); -+ memcpy(req->header.addr2, ieee->dev->dev_addr, ETH_ALEN); -+ memset(req->header.addr3, 0xff, ETH_ALEN); -+ -+ tag = (u8 *) skb_put(skb,len+2+rate_len); -+ -+ *tag++ = MFIE_TYPE_SSID; -+ *tag++ = len; -+ memcpy(tag, ieee->current_network.ssid, len); -+ tag += len; -+ -+ ieee80211_MFIE_Brate(ieee,&tag); -+ ieee80211_MFIE_Grate(ieee,&tag); -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ if(extMore) -+ ieee->ext_patch_ieee80211_probe_req_2(ieee, skb, tag); -+#endif -+ return skb; -+} -+ -+struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee); -+ -+#ifdef _RTL8187_EXT_PATCH_ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) -+void ext_ieee80211_send_beacon_wq(struct work_struct *work) -+{ -+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, ext_send_beacon_wq); -+#else -+void ext_ieee80211_send_beacon_wq(struct ieee80211_device *ieee) -+{ -+#endif -+ -+ struct sk_buff *skb; -+ -+ //unsigned long flags; -+// printk("=========>%s()\n", __FUNCTION__); -+ skb = ieee80211_get_beacon_(ieee); -+ -+ if (skb){ -+ softmac_mgmt_xmit(skb, ieee); -+ ieee->softmac_stats.tx_beacons++; -+ dev_kfree_skb_any(skb);//edit by thomas -+ } -+ -+ -+ //printk(KERN_WARNING "[1] beacon sending!\n"); -+// ieee->beacon_timer.expires = jiffies + -+// (MSECS( ieee->current_network.beacon_interval -5)); -+ -+ //spin_lock_irqsave(&ieee->beacon_lock,flags); -+// if(ieee->beacon_txing) -+// add_timer(&ieee->beacon_timer); -+ //spin_unlock_irqrestore(&ieee->beacon_lock,flags); -+} -+#endif -+ -+void ieee80211_send_beacon(struct ieee80211_device *ieee) -+{ -+ struct sk_buff *skb; -+ -+ //unsigned long flags; -+// printk("=========>%s()\n", __FUNCTION__); -+ skb = ieee80211_get_beacon_(ieee); -+ -+ if (skb){ -+ softmac_mgmt_xmit(skb, ieee); -+ ieee->softmac_stats.tx_beacons++; -+ dev_kfree_skb_any(skb);//edit by thomas -+ } -+ -+ -+ //printk(KERN_WARNING "[1] beacon sending!\n"); -+ ieee->beacon_timer.expires = jiffies + -+ (MSECS( ieee->current_network.beacon_interval -5)); -+ -+ //spin_lock_irqsave(&ieee->beacon_lock,flags); -+ if(ieee->beacon_txing) -+ add_timer(&ieee->beacon_timer); -+ //spin_unlock_irqrestore(&ieee->beacon_lock,flags); -+} -+ -+ -+void ieee80211_send_beacon_cb(unsigned long _ieee) -+{ -+ struct ieee80211_device *ieee = -+ (struct ieee80211_device *) _ieee; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&ieee->beacon_lock, flags); -+ ieee80211_send_beacon(ieee); -+ spin_unlock_irqrestore(&ieee->beacon_lock, flags); -+} -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ -+inline struct sk_buff *ieee80211_probe_req_with_SSID(struct ieee80211_device *ieee, char *ssid, int len_ssid) -+{ -+ unsigned int len,rate_len; -+ u8 *tag; -+ struct sk_buff *skb; -+ struct ieee80211_probe_request *req; -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ short extMore = 0; -+ if(ieee->ext_patch_ieee80211_probe_req_1) -+ extMore = ieee->ext_patch_ieee80211_probe_req_1(ieee); -+#endif -+ -+ len = len_ssid; -+ -+ rate_len = ieee80211_MFIE_rate_len(ieee); -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ if(!extMore) -+#endif -+ skb = dev_alloc_skb(sizeof(struct ieee80211_probe_request) + -+ 2 + len + rate_len); -+#ifdef _RTL8187_EXT_PATCH_ -+ else -+ skb = dev_alloc_skb(sizeof(struct ieee80211_probe_request) + -+ 2 + len + rate_len+128); // MESHID + CAP -+#endif -+ -+ if (!skb) -+ return NULL; -+ -+ req = (struct ieee80211_probe_request *) skb_put(skb,sizeof(struct ieee80211_probe_request)); -+ req->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); -+ req->header.duration_id = 0; //FIXME: is this OK ? -+ -+ memset(req->header.addr1, 0xff, ETH_ALEN); -+ memcpy(req->header.addr2, ieee->dev->dev_addr, ETH_ALEN); -+ memset(req->header.addr3, 0xff, ETH_ALEN); -+ -+ tag = (u8 *) skb_put(skb,len+2+rate_len); -+ -+ *tag++ = MFIE_TYPE_SSID; -+ *tag++ = len; -+ if(len) -+ { -+ memcpy(tag, ssid, len); -+ tag += len; -+ } -+ -+ ieee80211_MFIE_Brate(ieee,&tag); -+ ieee80211_MFIE_Grate(ieee,&tag); -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ if(extMore) -+ ieee->ext_patch_ieee80211_probe_req_2(ieee, skb, tag); -+#endif -+ return skb; -+} -+ -+#endif // _RTL8187_EXT_PATCH_ -+ -+ -+void ieee80211_send_probe(struct ieee80211_device *ieee) -+{ -+ struct sk_buff *skb; -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ if(ieee->iw_mode == ieee->iw_ext_mode) -+ skb = ieee80211_probe_req_with_SSID(ieee, NULL, 0); -+ else -+#endif -+ skb = ieee80211_probe_req(ieee); -+ if (skb){ -+ softmac_mgmt_xmit(skb, ieee); -+ ieee->softmac_stats.tx_probe_rq++; -+ dev_kfree_skb_any(skb);//edit by thomas -+ } -+} -+ -+void ieee80211_send_probe_requests(struct ieee80211_device *ieee) -+{ -+ if (ieee->active_scan && (ieee->softmac_features & IEEE_SOFTMAC_PROBERQ)){ -+ ieee80211_send_probe(ieee); -+ ieee80211_send_probe(ieee); -+ } -+} -+ -+/* this performs syncro scan blocking the caller until all channels -+ * in the allowed channel map has been checked. -+ */ -+void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee) -+{ -+ short ch = 0; -+#ifdef ENABLE_DOT11D -+ u8 channel_map[MAX_CHANNEL_NUMBER+1]; -+ memcpy(channel_map, GET_DOT11D_INFO(ieee)->channel_map, MAX_CHANNEL_NUMBER+1); -+#endif -+ -+ -+ down(&ieee->scan_sem); -+ -+ while(1) -+ { -+ -+ do{ -+ ch++; -+ if (ch > MAX_CHANNEL_NUMBER) -+ goto out; /* scan completed */ -+ -+#ifdef ENABLE_DOT11D -+ }while(!channel_map[ch]); -+#else -+ }while(!ieee->channel_map[ch]); -+#endif -+ -+ //printk("=>current channel is %d\n",ch); -+ -+ /* this fuction can be called in two situations -+ * 1- We have switched to ad-hoc mode and we are -+ * performing a complete syncro scan before conclude -+ * there are no interesting cell and to create a -+ * new one. In this case the link state is -+ * IEEE80211_NOLINK until we found an interesting cell. -+ * If so the ieee8021_new_net, called by the RX path -+ * will set the state to IEEE80211_LINKED, so we stop -+ * scanning -+ * 2- We are linked and the root uses run iwlist scan. -+ * So we switch to IEEE80211_LINKED_SCANNING to remember -+ * that we are still logically linked (not interested in -+ * new network events, despite for updating the net list, -+ * but we are temporarly 'unlinked' as the driver shall -+ * not filter RX frames and the channel is changing. -+ * So the only situation in witch are interested is to check -+ * if the state become LINKED because of the #1 situation -+ */ -+ -+ if (ieee->state == IEEE80211_LINKED) -+ goto out; -+ -+ //printk("---->%s: chan %d\n", __func__, ch); -+ ieee->set_chan(ieee->dev, ch); -+#ifdef ENABLE_DOT11D -+ if(channel_map[ch] == 1) -+#endif -+ { -+ ieee80211_send_probe_requests(ieee); -+ } -+ -+ /* this prevent excessive time wait when we -+ * need to wait for a syncro scan to end.. -+ */ -+ if (ieee->sync_scan_hurryup) -+ goto out; -+ -+ -+ msleep_interruptible_rtl(IEEE80211_SOFTMAC_SCAN_TIME); -+ -+ } -+out: -+ ieee->sync_scan_hurryup = 0; -+ up(&ieee->scan_sem); -+#ifdef ENABLE_DOT11D -+ if(IS_DOT11D_ENABLE(ieee)) -+ DOT11D_ScanComplete(ieee); -+#endif -+ -+} -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) -+/* called both by wq with ieee->lock held */ -+void ieee80211_softmac_scan(struct ieee80211_device *ieee) -+{ -+#if 0 -+ short watchdog = 0; -+ do{ -+ ieee->current_network.channel = -+ (ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER; -+ if (watchdog++ > MAX_CHANNEL_NUMBER) -+ return; /* no good chans */ -+ -+ }while(!ieee->channel_map[ieee->current_network.channel]); -+#endif -+ -+ schedule_task(&ieee->softmac_scan_wq); -+} -+#endif -+ -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) -+void ieee80211_softmac_scan_wq(struct work_struct *work) -+{ -+ struct delayed_work *dwork = container_of(work, struct delayed_work, work); -+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq); -+#else -+void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee) -+{ -+#endif -+ //static short watchdog = 0; -+ //short watchdog = 0;//lzm move into ieee->scan_watchdog 081215 for roaming -+ u8 channel_bak = ieee->current_network.channel;//lzm for channel+1 -+#ifdef ENABLE_DOT11D -+ u8 channel_map[MAX_CHANNEL_NUMBER+1]; -+ memcpy(channel_map, GET_DOT11D_INFO(ieee)->channel_map, MAX_CHANNEL_NUMBER+1); -+#endif -+ down(&ieee->scan_sem); -+ -+ do{ -+ ieee->current_network.channel = -+ (ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER; -+ if (ieee->scan_watchdog++ > MAX_CHANNEL_NUMBER) -+ goto out; /* no good chans */ -+#ifdef ENABLE_DOT11D -+ }while(!channel_map[ieee->current_network.channel]); -+#else -+ }while(!ieee->channel_map[ieee->current_network.channel]); -+#endif -+ -+ if (ieee->scanning == 0 ) -+ goto out; -+ -+ //printk("current channel is %d\n",ieee->current_network.channel); -+ ieee->set_chan(ieee->dev, ieee->current_network.channel); -+#ifdef ENABLE_DOT11D -+ if(channel_map[ieee->current_network.channel] == 1) -+#endif -+ { -+ ieee80211_send_probe_requests(ieee); -+ } -+ -+ -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+ queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME); -+#else -+ ieee->scan_timer.expires = jiffies + (IEEE80211_SOFTMAC_SCAN_TIME); -+ if (ieee->scanning == 1) -+ add_timer(&ieee->scan_timer); -+#endif -+ -+ up(&ieee->scan_sem); -+ return; -+out: -+ //printk("%s():Stop scan now\n",__FUNCTION__); -+ ieee->actscanning = false; -+ ieee->scan_watchdog = 0; -+ ieee->scanning = 0; -+ ieee->current_network.channel = channel_bak; -+ up(&ieee->scan_sem); -+#ifdef ENABLE_DOT11D -+ if(IS_DOT11D_ENABLE(ieee)) -+ DOT11D_ScanComplete(ieee); -+#endif -+ -+ return; -+} -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) -+void ieee80211_softmac_scan_cb(unsigned long _dev) -+{ -+ unsigned long flags; -+ struct ieee80211_device *ieee = (struct ieee80211_device *)_dev; -+ -+ spin_lock_irqsave(&ieee->lock, flags); -+ ieee80211_softmac_scan(ieee); -+ spin_unlock_irqrestore(&ieee->lock, flags); -+} -+#endif -+ -+ -+void ieee80211_beacons_start(struct ieee80211_device *ieee) -+{ -+ unsigned long flags; -+ -+ spin_lock_irqsave(&ieee->beacon_lock,flags); -+ -+ ieee->beacon_txing = 1; -+ ieee80211_send_beacon(ieee); -+ -+ spin_unlock_irqrestore(&ieee->beacon_lock,flags); -+} -+ -+void ieee80211_beacons_stop(struct ieee80211_device *ieee) -+{ -+ unsigned long flags; -+ -+ spin_lock_irqsave(&ieee->beacon_lock,flags); -+ -+ ieee->beacon_txing = 0; -+ del_timer_sync(&ieee->beacon_timer); -+ -+ spin_unlock_irqrestore(&ieee->beacon_lock,flags); -+ -+} -+ -+ -+void ieee80211_stop_send_beacons(struct ieee80211_device *ieee) -+{ -+ if(ieee->stop_send_beacons) -+ ieee->stop_send_beacons(ieee->dev); -+ if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS) -+ ieee80211_beacons_stop(ieee); -+} -+ -+ -+void ieee80211_start_send_beacons(struct ieee80211_device *ieee) -+{ -+ if(ieee->start_send_beacons) -+ ieee->start_send_beacons(ieee->dev); -+ if(ieee->softmac_features & IEEE_SOFTMAC_BEACONS) -+ ieee80211_beacons_start(ieee); -+} -+ -+ -+void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee) -+{ -+// unsigned long flags; -+ -+ ieee->sync_scan_hurryup = 1; -+ -+ down(&ieee->scan_sem); -+// spin_lock_irqsave(&ieee->lock, flags); -+ -+ if (ieee->scanning == 1){ -+ //printk("%s():Stop scan now\n",__FUNCTION__); -+ ieee->scanning = 0; -+ //lzm add for softmac_scan_wq can't return from out -+ //example: rcv probe_response -+ ieee->scan_watchdog = 0;//lzm add 081215 for roaming -+ ieee->actscanning = false; -+ -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+ cancel_delayed_work(&ieee->softmac_scan_wq); -+#else -+ del_timer_sync(&ieee->scan_timer); -+#endif -+ } -+ -+// spin_unlock_irqrestore(&ieee->lock, flags); -+ up(&ieee->scan_sem); -+} -+ -+void ieee80211_stop_scan(struct ieee80211_device *ieee) -+{ -+ if (ieee->softmac_features & IEEE_SOFTMAC_SCAN) -+ ieee80211_softmac_stop_scan(ieee); -+ else -+ ieee->stop_scan(ieee->dev); -+} -+ -+/* called with ieee->lock held */ -+void ieee80211_start_scan(struct ieee80211_device *ieee) -+{ -+ ieee->actscanning = true; -+#ifdef CONFIG_IPS -+ ieee->ieee80211_ips_leave(ieee->dev); -+#endif -+ -+#ifdef ENABLE_DOT11D -+ if(IS_DOT11D_ENABLE(ieee) ) -+ { -+ if(IS_COUNTRY_IE_VALID(ieee)) -+ { -+ RESET_CIE_WATCHDOG(ieee); -+ } -+ } -+#endif -+ -+ if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){ -+ if (ieee->scanning == 0){ -+ ieee->scanning = 1; -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+ queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq,0); -+#else -+ ieee80211_softmac_scan(ieee); -+#endif -+ } -+ }else -+ ieee->start_scan(ieee->dev); -+ -+} -+ -+/* called with wx_sem held */ -+void ieee80211_start_scan_syncro(struct ieee80211_device *ieee) -+{ -+ //printk("====>%s()\n", __func__); -+#ifdef CONFIG_IPS -+ ieee->ieee80211_ips_leave(ieee->dev); -+#endif -+ ieee->actscanning = true; -+ -+#ifdef ENABLE_DOT11D -+ if(IS_DOT11D_ENABLE(ieee) ) -+ { -+ if(IS_COUNTRY_IE_VALID(ieee)) -+ { -+ RESET_CIE_WATCHDOG(ieee); -+ } -+ } -+#endif -+ -+ ieee->sync_scan_hurryup = 0; -+ -+ if (ieee->softmac_features & IEEE_SOFTMAC_SCAN) -+ ieee80211_softmac_scan_syncro(ieee); -+ else -+ ieee->scan_syncro(ieee->dev); -+ -+ ieee->actscanning = false; -+ //printk("<====%s()\n", __func__); -+} -+ -+inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *beacon, -+ struct ieee80211_device *ieee, int challengelen) -+{ -+ struct sk_buff *skb; -+ struct ieee80211_authentication *auth; -+ -+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication) + challengelen); -+ -+ if (!skb) return NULL; -+ -+ auth = (struct ieee80211_authentication *) -+ skb_put(skb, sizeof(struct ieee80211_authentication)); -+ -+ auth->header.frame_ctl = IEEE80211_STYPE_AUTH; -+ if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP; -+ -+ auth->header.duration_id = 0x013a; //FIXME -+ -+ memcpy(auth->header.addr1, beacon->bssid, ETH_ALEN); -+ memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN); -+ memcpy(auth->header.addr3, beacon->bssid, ETH_ALEN); -+ -+ auth->algorithm = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY; -+ -+ auth->transaction = cpu_to_le16(ieee->associate_seq); -+ ieee->associate_seq++; -+ -+ auth->status = cpu_to_le16(WLAN_STATUS_SUCCESS); -+ -+ return skb; -+ -+} -+ -+u8 WPA_OUI[3] = {0x00, 0x50, 0xf2}; -+ -+static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *dest) -+{ -+ u8 *tag; -+ int beacon_size; -+ struct ieee80211_probe_response *beacon_buf; -+ struct sk_buff *skb; -+ int encrypt; -+ int atim_len,erp_len; -+ struct ieee80211_crypt_data* crypt; -+ -+ char *ssid = ieee->current_network.ssid; -+ int ssid_len = ieee->current_network.ssid_len; -+ int rate_len = ieee->current_network.rates_len+2; -+ int rate_ex_len = ieee->current_network.rates_ex_len; -+ -+ int wpa_ie_len = 0, wpa_type=0; -+ if(rate_ex_len > 0) rate_ex_len+=2; -+ -+ if(ieee->current_network.capability & WLAN_CAPABILITY_IBSS) -+ atim_len = 4; -+ else -+ atim_len = 0; -+ -+ if(ieee80211_is_54g(ieee->current_network)) -+ erp_len = 3; -+ else -+ erp_len = 0; -+ if (ieee->wpa_enabled) -+ { -+ // printk("hoho wpa_enalbe\n"); -+ wpa_ie_len = ieee->wpa_ie_len; //24-2 -+ } -+ beacon_size = sizeof(struct ieee80211_probe_response)+ -+ ssid_len -+ +3 //channel -+ +rate_len -+ +rate_ex_len -+ +atim_len -+ +erp_len -+ +wpa_ie_len; -+ -+ skb = dev_alloc_skb(beacon_size); -+ -+ if (!skb) -+ return NULL; -+ -+ beacon_buf = (struct ieee80211_probe_response*) skb_put(skb, beacon_size); -+ -+ memcpy (beacon_buf->header.addr1, dest,ETH_ALEN); -+ memcpy (beacon_buf->header.addr2, ieee->dev->dev_addr, ETH_ALEN); -+ memcpy (beacon_buf->header.addr3, ieee->current_network.bssid, ETH_ALEN); -+ -+ beacon_buf->header.duration_id = 0; //FIXME -+ beacon_buf->beacon_interval = -+ cpu_to_le16(ieee->current_network.beacon_interval); -+ beacon_buf->capability = -+ cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_IBSS); -+ -+ if(ieee->short_slot && (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_SLOT)) -+ cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT)); -+#ifdef _RTL8187_EXT_PATCH_ -+{ -+/* struct ieee80211_crypt_data_list* cryptlist = ieee->cryptlist[1]; -+ u8 i = cryptlist->used; -+ crypt = cryptlist ->crypt[ieee->tx_keyidx]; -+*/ -+ crypt = ieee->cryptlist[0]->crypt[ieee->tx_keyidx]; -+} -+#else -+ -+ crypt = ieee->crypt[ieee->tx_keyidx]; -+#endif -+ if (crypt) -+ wpa_type = strcmp(crypt->ops->name, "TKIP"); -+ -+ -+ encrypt = ieee->host_encrypt && crypt && crypt->ops && -+ ((0 == strcmp(crypt->ops->name, "WEP")||wpa_ie_len)); -+ -+ if (encrypt) -+ beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); -+ -+ -+ beacon_buf->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_RESP); -+ -+ beacon_buf->info_element.id = MFIE_TYPE_SSID; -+ beacon_buf->info_element.len = ssid_len; -+ -+ tag = (u8*) beacon_buf->info_element.data; -+ -+ memcpy(tag, ssid, ssid_len); -+ -+ tag += ssid_len; -+ -+ *(tag++) = MFIE_TYPE_RATES; -+ *(tag++) = rate_len-2; -+ memcpy(tag,ieee->current_network.rates,rate_len-2); -+ tag+=rate_len-2; -+ -+ *(tag++) = MFIE_TYPE_DS_SET; -+ *(tag++) = 1; -+ *(tag++) = ieee->current_network.channel; -+ -+ if(atim_len){ -+ u16 val16; -+ *(tag++) = MFIE_TYPE_IBSS_SET; -+ *(tag++) = 2; -+ val16 = cpu_to_le16(ieee->current_network.atim_window); -+ //*((u16*)(tag)) = cpu_to_le16(ieee->current_network.atim_window); -+ memcpy((u8 *)tag,(u8 *)&val16,2); -+ tag+=2; -+ } -+ -+ if(erp_len){ -+ *(tag++) = MFIE_TYPE_ERP; -+ *(tag++) = 1; -+ *(tag++) = 0; -+ } -+ -+ if(rate_ex_len){ -+ *(tag++) = MFIE_TYPE_RATES_EX; -+ *(tag++) = rate_ex_len-2; -+ memcpy(tag,ieee->current_network.rates_ex,rate_ex_len-2); -+ tag+=rate_ex_len-2; -+ } -+ if (wpa_ie_len) -+ { -+#if 0 -+ *(tag++) = 0xdd; -+ *(tag++) = wpa_ie_len-2; -+ memcpy(tag, WPA_OUI, 3); -+ tag += 3; -+ *(tag++) = 1; -+ *(tag++) = 1; -+ *(tag++) = 0; -+ -+ memcpy(tag, WPA_OUI, 3); -+ tag += 3; -+ *(tag++) = wpa_type ? 4:2; -+ *(tag++) = 1; -+ *(tag++) = 0; -+ -+ -+ memcpy(tag, WPA_OUI, 3); -+ tag += 3; -+ *(tag++) = wpa_type ? 4:0; -+ *(tag++) = 1; -+ *(tag++) = 0; -+ -+ memcpy(tag, WPA_OUI, 3); -+ tag += 3; -+ *(tag++) = 0; -+#else -+ if (ieee->iw_mode == IW_MODE_ADHOC) -+ {//as Windows will set pairwise key same as the group key which is not allowed in Linux, so set this for IOT issue. WB 2008.07.07 -+ memcpy(&ieee->wpa_ie[14], &ieee->wpa_ie[8], 4); -+ } -+ -+ memcpy(tag, ieee->wpa_ie, ieee->wpa_ie_len); -+ -+#endif -+ } -+ -+ -+ skb->dev = ieee->dev; -+ return skb; -+} -+ -+ -+#ifdef _RTL8187_EXT_PATCH_ -+struct sk_buff* ieee80211_ext_probe_resp_by_net(struct ieee80211_device *ieee, u8 *dest, struct ieee80211_network *net) -+{ -+ u8 *tag; -+ int beacon_size; -+ struct ieee80211_probe_response *beacon_buf; -+ struct sk_buff *skb; -+ int encrypt; -+ int atim_len,erp_len; -+ struct ieee80211_crypt_data* crypt; -+ u8 broadcast_addr[] = {0xff,0xff,0xff,0xff,0xff,0xff}; -+ -+ char *ssid = net->ssid; -+ int ssid_len = net->ssid_len; -+ -+ int rate_len = ieee->current_network.rates_len+2; -+ int rate_ex_len = ieee->current_network.rates_ex_len; -+ int wpa_ie_len = 0, wpa_type=0; -+ if(rate_ex_len > 0) rate_ex_len+=2; -+ -+ if( ieee->meshScanMode&4) -+ ieee->current_network.channel = ieee->ext_patch_ieee80211_ext_stop_scan_wq_set_channel(ieee); -+ if( ieee->meshScanMode&6) -+ { -+ -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+ queue_work(ieee->wq, &ieee->ext_stop_scan_wq); -+#else -+ schedule_task(&ieee->ext_stop_scan_wq); -+#endif -+ } -+ if(ieee->current_network.capability & WLAN_CAPABILITY_IBSS) // use current_network here -+ atim_len = 4; -+ else -+ atim_len = 0; -+ -+ if(ieee80211_is_54g(*net)) -+ erp_len = 3; -+ else -+ erp_len = 0; -+ -+ if (ieee->wpa_enabled &&(ieee->iw_ext_mode==ieee->iw_mode)) -+ { -+// printk("hoho wpa_enalbe\n"); -+ wpa_ie_len = ieee->wpa_ie_len; //24-2 -+ } -+ -+ beacon_size = sizeof(struct ieee80211_probe_response)+ -+ ssid_len -+ +3 //channel -+ +rate_len -+ +rate_ex_len -+ +atim_len -+ +erp_len -+ +wpa_ie_len; -+//b -+ skb = dev_alloc_skb(beacon_size+196); -+ -+ if (!skb) -+ return NULL; -+ -+ beacon_buf = (struct ieee80211_probe_response*) skb_put(skb, beacon_size); -+ -+ memcpy (beacon_buf->header.addr1, dest,ETH_ALEN); -+ memcpy (beacon_buf->header.addr2, ieee->dev->dev_addr, ETH_ALEN); -+ memcpy (beacon_buf->header.addr3, ieee->current_network.bssid, ETH_ALEN); -+ -+ beacon_buf->header.duration_id = 0; //FIXME -+ -+ beacon_buf->beacon_interval = -+ cpu_to_le16(ieee->current_network.beacon_interval); // use current_network here -+ beacon_buf->capability = -+ cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_IBSS); -+ -+ if(ieee->short_slot && (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_SLOT)) -+ cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT)); -+#ifdef _RTL8187_EXT_PATCH_ -+ -+ crypt = ieee->cryptlist[0]->crypt[ieee->tx_keyidx]; -+#else -+ -+ crypt = ieee->crypt[ieee->tx_keyidx]; -+#endif -+ -+// crypt = ieee->crypt[ieee->tx_keyidx]; -+ if (crypt) -+ wpa_type = strcmp(crypt->ops->name, "TKIP"); -+ -+ encrypt = ieee->host_encrypt && crypt && crypt->ops && -+ ((0 == strcmp(crypt->ops->name, "WEP")||wpa_ie_len)); -+ -+ if (encrypt) -+ beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); -+ -+ -+ beacon_buf->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_RESP); -+ -+ beacon_buf->info_element.id = MFIE_TYPE_SSID; -+ beacon_buf->info_element.len = ssid_len; -+ -+ tag = (u8*) beacon_buf->info_element.data; -+ -+ // brocad cast / probe rsp -+ if(memcmp(dest, broadcast_addr, ETH_ALEN )) -+ memcpy(tag, ssid, ssid_len); -+ else -+ ssid_len=0; -+ -+ tag += ssid_len; -+ -+//get_bssrate_set(priv, _SUPPORTEDRATES_IE_, &pbssrate, &bssrate_len); -+//pbuf = set_ie(pbuf, _SUPPORTEDRATES_IE_, bssrate_len, pbssrate, &frlen); -+ -+ *(tag++) = MFIE_TYPE_RATES; -+ *(tag++) = rate_len-2; -+ memcpy(tag,ieee->current_network.rates,rate_len-2); -+ tag+=rate_len-2; -+ -+ *(tag++) = MFIE_TYPE_DS_SET; -+ *(tag++) = 1; -+ *(tag++) = ieee->current_network.channel; // use current_network here -+ -+ -+ if(atim_len){ -+ *(tag++) = MFIE_TYPE_IBSS_SET; -+ *(tag++) = 2; -+ *((u16*)(tag)) = cpu_to_le16(ieee->current_network.atim_window); // use current_network here -+ tag+=2; -+ } -+ -+ if(erp_len){ -+ *(tag++) = MFIE_TYPE_ERP; -+ *(tag++) = 1; -+ *(tag++) = 0; -+ } -+ -+ if(rate_ex_len){ -+ *(tag++) = MFIE_TYPE_RATES_EX; -+ *(tag++) = rate_ex_len-2; -+ memcpy(tag,ieee->current_network.rates_ex,rate_ex_len-2); -+ tag+=rate_ex_len-2; -+ } -+ -+ if (wpa_ie_len) -+ { -+#if 0 -+ *(tag++) = 0xdd; -+ *(tag++) = wpa_ie_len-2; -+ memcpy(tag, WPA_OUI, 3); -+ tag += 3; -+ *(tag++) = 1; -+ *(tag++) = 1; -+ *(tag++) = 0; -+ -+ memcpy(tag, WPA_OUI, 3); -+ tag += 3; -+ *(tag++) = wpa_type ? 4:2; -+ *(tag++) = 1; -+ *(tag++) = 0; -+ -+ -+ memcpy(tag, WPA_OUI, 3); -+ tag += 3; -+ *(tag++) = wpa_type ? 4:0; -+ *(tag++) = 1; -+ *(tag++) = 0; -+ -+ memcpy(tag, WPA_OUI, 3); -+ tag += 3; -+ *(tag++) = 0; -+#else -+ memcpy(tag, ieee->wpa_ie, ieee->wpa_ie_len); -+#endif -+ } -+ -+ -+ skb->dev = ieee->dev; -+ return skb; -+} -+#endif // _RTL8187_EXT_PATCH_ -+ -+ -+struct sk_buff* ieee80211_assoc_resp(struct ieee80211_device *ieee, u8 *dest) -+{ -+ struct sk_buff *skb; -+ u8* tag; -+ -+ struct ieee80211_crypt_data* crypt; -+ struct ieee80211_assoc_response_frame *assoc; -+ short encrypt; -+ -+ unsigned int rate_len = ieee80211_MFIE_rate_len(ieee); -+ int len = sizeof(struct ieee80211_assoc_response_frame) + rate_len; -+ -+ skb = dev_alloc_skb(len); -+ -+ if (!skb) -+ return NULL; -+ -+ assoc = (struct ieee80211_assoc_response_frame *) -+ skb_put(skb,sizeof(struct ieee80211_assoc_response_frame)); -+ -+ assoc->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP); -+ memcpy(assoc->header.addr1, dest,ETH_ALEN); -+ memcpy(assoc->header.addr3, ieee->dev->dev_addr, ETH_ALEN); -+ memcpy(assoc->header.addr2, ieee->dev->dev_addr, ETH_ALEN); -+ assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ? -+ WLAN_CAPABILITY_BSS : WLAN_CAPABILITY_IBSS); -+ -+ -+ if(ieee->short_slot) -+ assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT); -+ -+ if (ieee->host_encrypt){ -+#ifdef _RTL8187_EXT_PATCH_ -+ crypt = ieee->cryptlist[0]->crypt[ieee->tx_keyidx]; -+#else -+ crypt = ieee->crypt[ieee->tx_keyidx]; -+#endif -+ } -+ else crypt = NULL; -+ -+ encrypt = ( crypt && crypt->ops); -+ -+ if (encrypt) -+ assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); -+ -+ assoc->status = 0; -+ assoc->aid = cpu_to_le16(ieee->assoc_id); -+ if (ieee->assoc_id == 0x2007) ieee->assoc_id=0; -+ else ieee->assoc_id++; -+ -+ tag = (u8*) skb_put(skb, rate_len); -+ -+ ieee80211_MFIE_Brate(ieee, &tag); -+ ieee80211_MFIE_Grate(ieee, &tag); -+ -+ return skb; -+} -+ -+struct sk_buff* ieee80211_auth_resp(struct ieee80211_device *ieee,int status, u8 *dest) -+{ -+ struct sk_buff *skb; -+ struct ieee80211_authentication *auth; -+ -+ skb = dev_alloc_skb(sizeof(struct ieee80211_authentication)+1); -+ -+ if (!skb) -+ return NULL; -+ -+ skb->len = sizeof(struct ieee80211_authentication); -+ -+ auth = (struct ieee80211_authentication *)skb->data; -+ -+ auth->status = cpu_to_le16(status); -+ auth->transaction = cpu_to_le16(2); -+ auth->algorithm = cpu_to_le16(WLAN_AUTH_OPEN); -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ if(ieee->iw_mode == ieee->iw_ext_mode) -+ memcpy(auth->header.addr3, dest, ETH_ALEN); -+#else -+ memcpy(auth->header.addr3, ieee->dev->dev_addr, ETH_ALEN); -+#endif -+ memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN); -+ memcpy(auth->header.addr1, dest, ETH_ALEN); -+ auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH); -+ return skb; -+ -+ -+} -+ -+struct sk_buff* ieee80211_null_func(struct ieee80211_device *ieee,short pwr) -+{ -+ struct sk_buff *skb; -+ struct ieee80211_hdr_3addr* hdr; -+ -+ skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr)); -+ -+ if (!skb) -+ return NULL; -+ -+ hdr = (struct ieee80211_hdr_3addr*)skb_put(skb,sizeof(struct ieee80211_hdr_3addr)); -+ -+ memcpy(hdr->addr1, ieee->current_network.bssid, ETH_ALEN); -+ memcpy(hdr->addr2, ieee->dev->dev_addr, ETH_ALEN); -+ memcpy(hdr->addr3, ieee->current_network.bssid, ETH_ALEN); -+ -+ hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA | -+ IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS | -+ (pwr ? IEEE80211_FCTL_PM:0)); -+ -+ return skb; -+ -+ -+} -+ -+ -+void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8* dest) -+{ -+ struct sk_buff *buf = ieee80211_assoc_resp(ieee, dest); -+ -+ if (buf){ -+ softmac_mgmt_xmit(buf, ieee); -+ dev_kfree_skb_any(buf);//edit by thomas -+ } -+} -+ -+ -+void ieee80211_resp_to_auth(struct ieee80211_device *ieee, int s, u8* dest) -+{ -+ struct sk_buff *buf = ieee80211_auth_resp(ieee, s, dest); -+ -+ if (buf){ -+ softmac_mgmt_xmit(buf, ieee); -+ dev_kfree_skb_any(buf);//edit by thomas -+ } -+} -+ -+ -+void ieee80211_resp_to_probe(struct ieee80211_device *ieee, u8 *dest) -+{ -+ -+ struct sk_buff *buf = ieee80211_probe_resp(ieee, dest); -+ -+ if (buf) { -+ softmac_mgmt_xmit(buf, ieee); -+ dev_kfree_skb_any(buf);//edit by thomas -+ } -+} -+ -+ -+inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beacon,struct ieee80211_device *ieee) -+{ -+ struct sk_buff *skb; -+ -+ struct ieee80211_assoc_request_frame *hdr; -+ u8 *tag; -+ //int i; -+ unsigned int wpa_len = beacon->wpa_ie_len; -+#if 1 -+ // for testing purpose -+ unsigned int rsn_len = beacon->rsn_ie_len; -+#else -+ unsigned int rsn_len = beacon->rsn_ie_len - 4; -+#endif -+ unsigned int rate_len = ieee80211_MFIE_rate_len(ieee); -+ unsigned int wmm_info_len = beacon->QoS_Enable?9:0; -+#ifdef THOMAS_TURBO -+ unsigned int turbo_info_len = beacon->Turbo_Enable?9:0; -+#endif -+ -+ u8 encry_proto = ieee->wpax_type_notify & 0xff; -+ -+ -+ int len = 0; -+ -+ //[0] Notify type of encryption: WPA/WPA2 -+ //[1] pair wise type -+ //[2] authen type -+ if(ieee->wpax_type_set) { -+ if (IEEE_PROTO_WPA == encry_proto) { -+ rsn_len = 0; -+ } else if (IEEE_PROTO_RSN == encry_proto) { -+ wpa_len = 0; -+ } -+ } -+#ifdef THOMAS_TURBO -+ len = sizeof(struct ieee80211_assoc_request_frame)+ -+ + beacon->ssid_len//essid tagged val -+ + rate_len//rates tagged val -+ + wpa_len -+ + rsn_len -+ + wmm_info_len -+ + turbo_info_len; -+#else -+ len = sizeof(struct ieee80211_assoc_request_frame)+ -+ + beacon->ssid_len//essid tagged val -+ + rate_len//rates tagged val -+ + wpa_len -+ + rsn_len -+ + wmm_info_len; -+#endif -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ if(ieee->iw_mode == ieee->iw_ext_mode) -+ skb = dev_alloc_skb(len+256); // stanley -+ else -+#endif -+ skb = dev_alloc_skb(len); -+ -+ if (!skb) -+ return NULL; -+ -+ hdr = (struct ieee80211_assoc_request_frame *) -+ skb_put(skb, sizeof(struct ieee80211_assoc_request_frame)); -+ -+ -+ hdr->header.frame_ctl = IEEE80211_STYPE_ASSOC_REQ; -+ hdr->header.duration_id= 37; //FIXME -+ memcpy(hdr->header.addr1, beacon->bssid, ETH_ALEN); -+ memcpy(hdr->header.addr2, ieee->dev->dev_addr, ETH_ALEN); -+ memcpy(hdr->header.addr3, beacon->bssid, ETH_ALEN); -+ memcpy(ieee->ap_mac_addr, beacon->bssid, ETH_ALEN);//for HW security, John -+ -+ hdr->capability = cpu_to_le16(WLAN_CAPABILITY_BSS); -+ if (beacon->capability & WLAN_CAPABILITY_PRIVACY ) -+ hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); -+ -+ if (beacon->capability & WLAN_CAPABILITY_SHORT_PREAMBLE ) -+ hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_PREAMBLE); -+ -+ if(ieee->short_slot) -+ hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT); -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ if((ieee->iw_mode == ieee->iw_ext_mode) && ieee->ext_patch_ieee80211_association_req_1) -+ ieee->ext_patch_ieee80211_association_req_1(hdr); -+#endif -+ -+ hdr->listen_interval = 0xa; //FIXME -+ -+ hdr->info_element.id = MFIE_TYPE_SSID; -+ -+ hdr->info_element.len = beacon->ssid_len; -+ tag = skb_put(skb, beacon->ssid_len); -+ memcpy(tag, beacon->ssid, beacon->ssid_len); -+ -+ tag = skb_put(skb, rate_len); -+ -+ ieee80211_MFIE_Brate(ieee, &tag); -+ ieee80211_MFIE_Grate(ieee, &tag); -+ -+ //add rsn==0 condition for ap's mix security mode(wpa+wpa2), john2007.8.9 -+ //choose AES encryption as default algorithm while using mixed mode -+#if 0 -+ if(rsn_len == 0){ -+ -+ tag = skb_put(skb,wpa_len); -+ -+ if(wpa_len) { -+ -+ -+ //{add by david. 2006.8.31 -+ //fix linksys compatibility bug -+ //} -+ if(wpa_len > 24) {//22+2, mean include the capability -+ beacon->wpa_ie[wpa_len - 2] = 0; -+ } -+ //multicast cipher OUI -+ if( beacon->wpa_ie[11]==0x2 ){ //0x0050f202 is the oui of tkip -+ ieee->broadcast_key_type = KEY_TYPE_TKIP; -+ } -+ else if( beacon->wpa_ie[11]==0x4 ){//0x0050f204 is the oui of ccmp -+ ieee->broadcast_key_type = KEY_TYPE_CCMP; -+ } -+ //unicast cipher OUI -+ if( beacon->wpa_ie[14]==0 -+ && beacon->wpa_ie[15]==0x50 -+ && beacon->wpa_ie[16]==0xf2 -+ && beacon->wpa_ie[17]==0x2 ){ //0x0050f202 is the oui of tkip -+ ieee->pairwise_key_type = KEY_TYPE_TKIP; -+ } -+ -+ else if( beacon->wpa_ie[14]==0 -+ && beacon->wpa_ie[15]==0x50 -+ && beacon->wpa_ie[16]==0xf2 -+ && beacon->wpa_ie[17]==0x4 ){//0x0050f204 is the oui of ccmp -+ ieee->pairwise_key_type = KEY_TYPE_CCMP; -+ } -+ //indicate the wpa_ie content to WPA_SUPPLICANT -+ buff = kmalloc(IW_CUSTOM_MAX, GFP_ATOMIC); -+ memset(buff, 0, IW_CUSTOM_MAX); -+ p=buff; -+ p += sprintf(p, "ASSOCINFO(ReqIEs="); -+ for(i=0;i<wpa_len;i++){ -+ p += sprintf(p, "%02x", beacon->wpa_ie[i]); -+ } -+ p += sprintf(p, ")"); -+ memset(&wrqu, 0, sizeof(wrqu) ); -+ wrqu.data.length = p - buff; -+ -+ wireless_send_event(dev, IWEVCUSTOM, &wrqu, buff); -+ memcpy(tag,beacon->wpa_ie,wpa_len); -+ } -+ -+ } -+ -+ if(rsn_len > 22) { -+ -+ if( beacon->rsn_ie[4]==0x0 && -+ beacon->rsn_ie[5]==0xf && -+ beacon->rsn_ie[6]==0xac){ -+ -+ switch(beacon->rsn_ie[7]){ -+ case 0x1: -+ ieee->broadcast_key_type = KEY_TYPE_WEP40; -+ break; -+ case 0x2: -+ ieee->broadcast_key_type = KEY_TYPE_TKIP; -+ break; -+ case 0x4: -+ ieee->broadcast_key_type = KEY_TYPE_CCMP; -+ break; -+ case 0x5: -+ ieee->broadcast_key_type = KEY_TYPE_WEP104; -+ break; -+ default: -+ printk("fault suite type in RSN broadcast key\n"); -+ break; -+ } -+ } -+ -+ if( beacon->rsn_ie[10]==0x0 && -+ beacon->rsn_ie[11]==0xf && -+ beacon->rsn_ie[12]==0xac){ -+ if(beacon->rsn_ie[8]==1){//not mixed mode -+ switch(beacon->rsn_ie[13]){ -+ case 0x2: -+ ieee->pairwise_key_type = KEY_TYPE_TKIP; -+ break; -+ case 0x4: -+ ieee->pairwise_key_type = KEY_TYPE_CCMP; -+ break; -+ default: -+ printk("fault suite type in RSN pairwise key\n"); -+ break; -+ } -+ } -+ else if(beacon->rsn_ie[8]==2){//mixed mode -+ ieee->pairwise_key_type = KEY_TYPE_CCMP; -+ } -+ } -+ -+ -+ -+ tag = skb_put(skb,22); -+ memcpy(tag,(beacon->rsn_ie + info_addr),8); -+ tag[1] = 20; -+ tag += 8; -+ info_addr += 8; -+ -+ spin_lock_irqsave(&ieee->wpax_suitlist_lock,flags); -+ for (i = 0; i < 2; i++) { -+ tag[0] = 1; -+ tag[1] = 0; -+ tag += 2; -+ suite_count = beacon->rsn_ie[info_addr] + \ -+ (beacon->rsn_ie[info_addr + 1] << 8); -+ info_addr += 2; -+ if(1 == suite_count) { -+ memcpy(tag,(beacon->rsn_ie + info_addr),4); -+ info_addr += 4; -+ } else { -+ // if the wpax_type_notify has been set by the application, -+ // just use it, otherwise just use the default one. -+ if(ieee->wpax_type_set) { -+ suit_select = ((0 == i) ? pairwise_type:authen_type)&0x0f ; -+ memcpy(tag,rsn_authen_cipher_suite[suit_select],4); -+ } else { -+ //default set as ccmp, or none authentication -+ if(i == 0) { -+ memcpy(tag,rsn_authen_cipher_suite[4],4); -+ } else { -+ memcpy(tag,rsn_authen_cipher_suite[2],4); -+ } -+ -+ } -+ -+ info_addr += (suite_count * 4); -+ } -+ tag += 4; -+ } -+ spin_unlock_irqrestore(&ieee->wpax_suitlist_lock,flags); -+ -+ tag[0] = 0; -+ tag[1] = beacon->rsn_ie[info_addr+1]; -+ -+ -+ -+ } else { -+ tag = skb_put(skb,rsn_len); -+ if(rsn_len) { -+ -+ -+ if( beacon->rsn_ie[4]==0x0 && -+ beacon->rsn_ie[5]==0xf && -+ beacon->rsn_ie[6]==0xac){ -+ switch(beacon->rsn_ie[7]){ -+ case 0x1: -+ ieee->broadcast_key_type = KEY_TYPE_WEP40; -+ break; -+ case 0x2: -+ ieee->broadcast_key_type = KEY_TYPE_TKIP; -+ break; -+ case 0x4: -+ ieee->broadcast_key_type = KEY_TYPE_CCMP; -+ break; -+ case 0x5: -+ ieee->broadcast_key_type = KEY_TYPE_WEP104; -+ break; -+ default: -+ printk("fault suite type in RSN broadcast key\n"); -+ break; -+ } -+ } -+ if( beacon->rsn_ie[10]==0x0 && -+ beacon->rsn_ie[11]==0xf && -+ beacon->rsn_ie[12]==0xac){ -+ if(beacon->rsn_ie[8]==1){//not mixed mode -+ switch(beacon->rsn_ie[13]){ -+ case 0x2: -+ ieee->pairwise_key_type = KEY_TYPE_TKIP; -+ break; -+ case 0x4: -+ ieee->pairwise_key_type = KEY_TYPE_CCMP; -+ break; -+ default: -+ printk("fault suite type in RSN pairwise key\n"); -+ break; -+ } -+ -+ } -+ else if(beacon->rsn_ie[8]==2){//mixed mode -+ ieee->pairwise_key_type = KEY_TYPE_CCMP; -+ } -+ } -+ -+ -+ beacon->rsn_ie[rsn_len - 2] = 0; -+ memcpy(tag,beacon->rsn_ie,rsn_len); -+ } -+ } -+#else -+ if (ieee->wpa_ie){ -+ tag = skb_put(skb,ieee->wpa_ie_len); -+ memcpy(tag,ieee->wpa_ie,ieee->wpa_ie_len); -+ } -+#endif -+ tag = skb_put(skb,wmm_info_len); -+ if(wmm_info_len) { -+ ieee80211_WMM_Info(ieee, &tag); -+ } -+#ifdef THOMAS_TURBO -+ tag = skb_put(skb,turbo_info_len); -+ if(turbo_info_len) { -+ ieee80211_TURBO_Info(ieee, &tag); -+ } -+#endif -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ if((ieee->iw_mode == ieee->iw_ext_mode) && ieee->ext_patch_ieee80211_association_req_2) -+ ieee->ext_patch_ieee80211_association_req_2(ieee, beacon, skb); -+#endif -+ -+ return skb; -+} -+ -+void ieee80211_associate_abort(struct ieee80211_device *ieee) -+{ -+ -+ unsigned long flags; -+ spin_lock_irqsave(&ieee->lock, flags); -+ -+ ieee->associate_seq++; -+ -+ /* don't scan, and avoid to have the RX path possibily -+ * try again to associate. Even do not react to AUTH or -+ * ASSOC response. Just wait for the retry wq to be scheduled. -+ * Here we will check if there are good nets to associate -+ * with, so we retry or just get back to NO_LINK and scanning -+ */ -+ if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING){ -+ IEEE80211_DEBUG_MGMT("Authentication failed\n"); -+ ieee->softmac_stats.no_auth_rs++; -+ }else{ -+ IEEE80211_DEBUG_MGMT("Association failed\n"); -+ ieee->softmac_stats.no_ass_rs++; -+ } -+ -+ ieee->state = IEEE80211_ASSOCIATING_RETRY; -+ -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+ queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, \ -+ IEEE80211_SOFTMAC_ASSOC_RETRY_TIME); -+#else -+ schedule_task(&ieee->associate_retry_wq); -+#endif -+ -+ spin_unlock_irqrestore(&ieee->lock, flags); -+} -+ -+void ieee80211_associate_abort_cb(unsigned long dev) -+{ -+ ieee80211_associate_abort((struct ieee80211_device *) dev); -+} -+ -+ -+void ieee80211_associate_step1(struct ieee80211_device *ieee) -+{ -+ struct ieee80211_network *beacon = &ieee->current_network; -+ struct sk_buff *skb; -+ -+ IEEE80211_DEBUG_MGMT("Stopping scan\n"); -+ -+ ieee->softmac_stats.tx_auth_rq++; -+ skb=ieee80211_authentication_req(beacon, ieee, 0); -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ if(ieee->iw_mode == ieee->iw_ext_mode ) { -+ if(skb) -+ softmac_mgmt_xmit(skb, ieee); -+ return; -+ }else -+#endif -+ if (!skb) -+ ieee80211_associate_abort(ieee); -+ else{ -+ ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING ; -+ IEEE80211_DEBUG_MGMT("Sending authentication request\n"); -+ //printk(KERN_WARNING "Sending authentication request\n"); -+ softmac_mgmt_xmit(skb, ieee); -+ //BUGON when you try to add_timer twice, using mod_timer may be better, john0709 -+ if(!timer_pending(&ieee->associate_timer)){ -+ ieee->associate_timer.expires = jiffies + (HZ / 2); -+ add_timer(&ieee->associate_timer); -+ } -+ dev_kfree_skb_any(skb);//edit by thomas -+ } -+} -+ -+void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen) -+{ -+ u8 *c; -+ struct sk_buff *skb; -+ struct ieee80211_network *beacon = &ieee->current_network; -+// int hlen = sizeof(struct ieee80211_authentication); -+ -+ ieee->associate_seq++; -+ ieee->softmac_stats.tx_auth_rq++; -+ -+ skb = ieee80211_authentication_req(beacon, ieee, chlen+2); -+ if (!skb) -+ ieee80211_associate_abort(ieee); -+ else{ -+ c = skb_put(skb, chlen+2); -+ *(c++) = MFIE_TYPE_CHALLENGE; -+ *(c++) = chlen; -+ memcpy(c, challenge, chlen); -+ -+ IEEE80211_DEBUG_MGMT("Sending authentication challenge response\n"); -+ -+ ieee80211_encrypt_fragment(ieee, skb, sizeof(struct ieee80211_hdr_3addr )); -+ -+ softmac_mgmt_xmit(skb, ieee); -+ -+ if(!timer_pending(&ieee->associate_timer)){ -+ ieee->associate_timer.expires = jiffies + (HZ / 2); -+ add_timer(&ieee->associate_timer); -+ } -+ dev_kfree_skb_any(skb);//edit by thomas -+ } -+ kfree(challenge); -+} -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ -+// based on ieee80211_assoc_resp -+struct sk_buff* ieee80211_assoc_resp_by_net(struct ieee80211_device *ieee, u8 *dest, unsigned short status, struct ieee80211_network *pstat, int pkt_type) -+{ -+ struct sk_buff *skb; -+ u8* tag; -+ -+ struct ieee80211_crypt_data* crypt; -+ struct ieee80211_assoc_response_frame *assoc; -+ short encrypt; -+ -+ unsigned int rate_len = ieee80211_MFIE_rate_len(ieee); -+ int len = sizeof(struct ieee80211_assoc_response_frame) + rate_len; -+ -+ if(ieee->iw_mode == ieee->iw_ext_mode) -+ skb = dev_alloc_skb(len+256); // stanley -+ else -+ skb = dev_alloc_skb(len); -+ -+ if (!skb) -+ return NULL; -+ -+ assoc = (struct ieee80211_assoc_response_frame *) -+ skb_put(skb,sizeof(struct ieee80211_assoc_response_frame)); -+ -+ assoc->header.frame_ctl = cpu_to_le16(pkt_type); -+ -+ memcpy(assoc->header.addr1, dest,ETH_ALEN); -+ memcpy(assoc->header.addr3, ieee->dev->dev_addr, ETH_ALEN); -+ memcpy(assoc->header.addr2, ieee->dev->dev_addr, ETH_ALEN); -+ assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ? -+ WLAN_CAPABILITY_BSS : WLAN_CAPABILITY_IBSS); -+ -+ if((ieee->iw_mode == ieee->iw_ext_mode) && ieee->ext_patch_ieee80211_assoc_resp_by_net_1) -+ ieee->ext_patch_ieee80211_assoc_resp_by_net_1(assoc); -+ -+ if(ieee->short_slot) -+ assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT); -+ -+ if (ieee->host_encrypt) -+#ifdef _RTL8187_EXT_PATCH_ -+ crypt = ieee->cryptlist[0]->crypt[ieee->tx_keyidx]; -+#else -+ crypt = ieee->crypt[ieee->tx_keyidx]; -+#endif -+ -+ else crypt = NULL; -+ -+ encrypt = ( crypt && crypt->ops); -+ -+ if (encrypt) -+ assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); -+ -+ assoc->status = 0; -+ assoc->aid = cpu_to_le16(ieee->assoc_id); -+ if (ieee->assoc_id == 0x2007) ieee->assoc_id=0; -+ else ieee->assoc_id++; -+ -+ assoc->info_element.id = 230; // Stanley, an unused id (just a hot fix) -+ assoc->info_element.len = 0; -+ -+ tag = (u8*) skb_put(skb, rate_len); -+ -+ ieee80211_MFIE_Brate(ieee, &tag); -+ ieee80211_MFIE_Grate(ieee, &tag); -+ -+ if((ieee->iw_mode == ieee->iw_ext_mode) && ieee->ext_patch_ieee80211_assoc_resp_by_net_2) -+ ieee->ext_patch_ieee80211_assoc_resp_by_net_2(ieee, pstat, pkt_type, skb); -+ -+ return skb; -+} -+ -+// based on ieee80211_resp_to_assoc_rq -+void ieee80211_ext_issue_assoc_rsp(struct ieee80211_device *ieee, u8 *dest, unsigned short status, struct ieee80211_network *pstat, int pkt_type) -+{ -+ struct sk_buff *buf = ieee80211_assoc_resp_by_net(ieee, dest, status, pstat, pkt_type); -+ -+ if (buf) -+ softmac_mgmt_xmit(buf, ieee); -+} -+ -+// based on ieee80211_associate_step2 -+void ieee80211_ext_issue_assoc_req(struct ieee80211_device *ieee, struct ieee80211_network *pstat) -+{ -+ -+ struct sk_buff* skb; -+ -+ // printk("@@@@@ ieee80211_ext_issue_assoc_req on channel: %d\n", ieee->current_network.channel); -+ -+ ieee->softmac_stats.tx_ass_rq++; -+ skb=ieee80211_association_req(pstat, ieee); -+ if (skb) -+ softmac_mgmt_xmit(skb, ieee); -+} -+ -+void ieee80211_ext_issue_disassoc(struct ieee80211_device *ieee, struct ieee80211_network *pstat, int reason, unsigned char extReason) -+{ -+ // do nothing -+ // printk("@@@@@ ieee80211_ext_issue_disassoc\n"); -+ return; -+} -+#endif // _RTL8187_EXT_PATCH_ -+ -+void ieee80211_associate_step2(struct ieee80211_device *ieee) -+{ -+ struct sk_buff* skb; -+ struct ieee80211_network *beacon = &ieee->current_network; -+ -+// del_timer_sync(&ieee->associate_timer); -+ -+ IEEE80211_DEBUG_MGMT("Sending association request\n"); -+ -+ ieee->softmac_stats.tx_ass_rq++; -+ skb=ieee80211_association_req(beacon, ieee); -+ if (!skb) -+ ieee80211_associate_abort(ieee); -+ else{ -+ softmac_mgmt_xmit(skb, ieee); -+ if(!timer_pending(&ieee->associate_timer)){ -+ ieee->associate_timer.expires = jiffies + (HZ / 2); -+ add_timer(&ieee->associate_timer); -+ } -+ dev_kfree_skb_any(skb);//edit by thomas -+ } -+} -+ -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) -+void ieee80211_associate_complete_wq(struct work_struct *work) -+{ -+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq); -+#else -+void ieee80211_associate_complete_wq(struct ieee80211_device *ieee) -+{ -+#endif -+ printk(KERN_INFO "Associated successfully\n"); -+ if(ieee80211_is_54g(ieee->current_network) && -+ (ieee->modulation & IEEE80211_OFDM_MODULATION)){ -+ -+ ieee->rate = 540; -+ printk(KERN_INFO"Using G rates\n"); -+ }else{ -+ ieee->rate = 110; -+ printk(KERN_INFO"Using B rates\n"); -+ } -+ -+//by lizhaoming for LED LINK -+#ifdef LED_SHIN -+ { -+ struct net_device *dev = ieee->dev; -+ ieee->ieee80211_led_contorl(dev, LED_CTL_LINK); -+ } -+#endif -+ -+ ieee->link_change(ieee->dev); -+ notify_wx_assoc_event(ieee); -+ if (ieee->data_hard_resume) -+ ieee->data_hard_resume(ieee->dev); -+ netif_carrier_on(ieee->dev); -+} -+ -+void ieee80211_associate_complete(struct ieee80211_device *ieee) -+{ -+ int i; -+// struct net_device *dev = ieee->dev; -+ del_timer_sync(&ieee->associate_timer); -+ -+ for(i = 0; i < 6; i++) { -+// ieee->seq_ctrl[i] = 0; -+ } -+ ieee->state = IEEE80211_LINKED; -+ IEEE80211_DEBUG_MGMT("Successfully associated\n"); -+ -+ //by lizhaoming for LED LINK -+ //ieee->ieee80211_led_contorl(dev, LED_CTL_LINK); -+ -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+ queue_work(ieee->wq, &ieee->associate_complete_wq); -+#else -+ schedule_task(&ieee->associate_complete_wq); -+#endif -+} -+ -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) -+void ieee80211_associate_procedure_wq(struct work_struct *work) -+{ -+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq); -+#else -+void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee) -+{ -+#endif -+ ieee->sync_scan_hurryup = 1; -+ down(&ieee->wx_sem); -+ -+ if (ieee->data_hard_stop) -+ ieee->data_hard_stop(ieee->dev); -+ -+ ieee80211_stop_scan(ieee); -+ //printk("=======>%s set chan:%d\n", __func__, ieee->current_network.channel); -+ ieee->set_chan(ieee->dev, ieee->current_network.channel); -+ -+ ieee->associate_seq = 1; -+ ieee80211_associate_step1(ieee); -+ -+ up(&ieee->wx_sem); -+} -+#ifdef _RTL8187_EXT_PATCH_ -+// based on ieee80211_associate_procedure_wq -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) -+void ieee80211_ext_stop_scan_wq(struct work_struct *work) -+{ -+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, ext_stop_scan_wq); -+#else -+void ieee80211_ext_stop_scan_wq(struct ieee80211_device *ieee) -+{ -+#endif -+/* -+ if (ieee->scanning == 0) -+ { -+ if((ieee->iw_mode == ieee->iw_ext_mode) && ieee->ext_patch_ieee80211_ext_stop_scan_wq_set_channel -+ && ( ieee->current_network.channel == ieee->ext_patch_ieee80211_ext_stop_scan_wq_set_channel(ieee) ) ) -+ return; -+ } -+*/ -+ ieee->sync_scan_hurryup = 1; -+ -+ down(&ieee->wx_sem); -+ -+ // printk("@@@@@@@@@@ ieee80211_ext_stop_scan_wq\n"); -+ if (ieee->data_hard_stop) -+ ieee->data_hard_stop(ieee->dev); -+ -+ ieee80211_stop_scan(ieee); -+ -+ // set channel -+ if((ieee->iw_mode == ieee->iw_ext_mode) && ieee->ext_patch_ieee80211_ext_stop_scan_wq_set_channel) -+ { -+ int ch = ieee->ext_patch_ieee80211_ext_stop_scan_wq_set_channel(ieee); -+ ieee->current_network.channel = ch; -+ ieee->set_chan(ieee->dev, ch); -+ } -+ else -+ { -+ ieee->set_chan(ieee->dev, ieee->current_network.channel); -+ } -+ // -+ up(&ieee->wx_sem); -+} -+ -+ -+void ieee80211_ext_send_11s_beacon(struct ieee80211_device *ieee) -+{ -+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+ queue_work(ieee->wq, &ieee->ext_send_beacon_wq); -+ #else -+ schedule_task(&ieee->ext_send_beacon_wq); -+ #endif -+ -+} -+ -+#endif // _RTL8187_EXT_PATCH_ -+ -+inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee80211_network *net) -+{ -+ u8 tmp_ssid[IW_ESSID_MAX_SIZE+1]; -+ int tmp_ssid_len = 0; -+ -+ short apset,ssidset,ssidbroad,apmatch,ssidmatch; -+// printk("===============>%s()\n",__FUNCTION__); -+ /* we are interested in new new only if we are not associated -+ * and we are not associating / authenticating -+ */ -+ if (ieee->state != IEEE80211_NOLINK) -+ return; -+ -+ if ((ieee->iw_mode == IW_MODE_INFRA) && !(net->capability & WLAN_CAPABILITY_BSS)) -+ return; -+ -+ if ((ieee->iw_mode == IW_MODE_ADHOC) && !(net->capability & WLAN_CAPABILITY_IBSS)) -+ return; -+ -+ -+ if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC){ -+ /* if the user specified the AP MAC, we need also the essid -+ * This could be obtained by beacons or, if the network does not -+ * broadcast it, it can be put manually. -+ */ -+ apset = ieee->wap_set;//(memcmp(ieee->current_network.bssid, zero,ETH_ALEN)!=0 ); -+ ssidset = ieee->ssid_set;//ieee->current_network.ssid[0] != '\0'; -+ ssidbroad = !(net->ssid_len == 0 || net->ssid[0]== '\0'); -+ apmatch = (memcmp(ieee->current_network.bssid, net->bssid, ETH_ALEN)==0); -+ if(ieee->current_network.ssid_len != net->ssid_len) -+ ssidmatch = 0; -+ else -+ ssidmatch = (0==strncmp(ieee->current_network.ssid, net->ssid, net->ssid_len)); -+ -+ -+ -+ if ( /* if the user set the AP check if match. -+ * if the network does not broadcast essid we check the user supplyed ANY essid -+ * if the network does broadcast and the user does not set essid it is OK -+ * if the network does broadcast and the user did set essid chech if essid match -+ */ -+ ( apset && apmatch && -+ //((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) || -+ ((ssidset && ssidbroad && ssidmatch) || (!ssidbroad && ssidset)) ) || -+ /* if the ap is not set, check that the user set the bssid -+ * and the network does bradcast and that those two bssid matches -+ */ -+ (!apset && ssidset && ssidbroad && ssidmatch) -+ ){ -+ /* if the essid is hidden replace it with the -+ * essid provided by the user. -+ */ -+ if (!ssidbroad){ -+ strncpy(tmp_ssid, ieee->current_network.ssid, IW_ESSID_MAX_SIZE); -+ tmp_ssid_len = ieee->current_network.ssid_len; -+ } -+ memcpy(&ieee->current_network, net, sizeof(struct ieee80211_network)); -+ -+ if (!ssidbroad){ -+ strncpy(ieee->current_network.ssid, tmp_ssid, IW_ESSID_MAX_SIZE); -+ ieee->current_network.ssid_len = tmp_ssid_len; -+ } -+ printk(KERN_INFO"Linking with %s, channel:%d\n",ieee->current_network.ssid, ieee->current_network.channel); -+ -+#ifdef CONFIG_IPS -+ ieee->ieee80211_ips_leave(ieee->dev); -+#endif -+ -+ if (ieee->iw_mode == IW_MODE_INFRA){ -+ ieee->state = IEEE80211_ASSOCIATING; -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+ queue_work(ieee->wq, &ieee->associate_procedure_wq); -+#else -+ schedule_task(&ieee->associate_procedure_wq); -+#endif -+ }else{ -+ ieee->state = IEEE80211_LINKED; -+ if(ieee80211_is_54g(ieee->current_network) && -+ (ieee->modulation & IEEE80211_OFDM_MODULATION)){ -+ ieee->rate = 540; -+ printk(KERN_INFO"Using G rates\n"); -+ }else{ -+ ieee->rate = 110; -+ printk(KERN_INFO"Using B rates\n"); -+ } -+ } -+ -+ } -+ } -+ -+} -+ -+void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee) -+{ -+ unsigned long flags; -+ struct ieee80211_network *target; -+ -+ spin_lock_irqsave(&ieee->lock, flags); -+#if 0 -+ list_for_each_entry(target, &ieee->network_list, list) { -+ printk(KERN_INFO"check network list SSID: %s, channel: %d\n",target->ssid,target->channel); -+ } -+#endif -+ list_for_each_entry(target, &ieee->network_list, list) { -+ -+ /* if the state become different that NOLINK means -+ * we had found what we are searching for -+ */ -+ -+ if (ieee->state != IEEE80211_NOLINK) -+ break; -+ -+ if (ieee->scan_age == 0 || time_after(target->last_scanned + ieee->scan_age, jiffies)) -+ ieee80211_softmac_new_net(ieee, target); -+ } -+ -+ spin_unlock_irqrestore(&ieee->lock, flags); -+ -+ //printk("<=====%s\n", __func__); -+} -+ -+ -+static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen) -+{ -+ struct ieee80211_authentication *a; -+ u8 *t; -+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){ -+ IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n",skb->len); -+ return 0xcafe; -+ } -+ *challenge = NULL; -+ a = (struct ieee80211_authentication*) skb->data; -+ if(skb->len > (sizeof(struct ieee80211_authentication) +3)){ -+ t = skb->data + sizeof(struct ieee80211_authentication); -+ -+ if(*(t++) == MFIE_TYPE_CHALLENGE){ -+ *chlen = *(t++); -+ *challenge = (u8*)kmalloc(*chlen, GFP_ATOMIC); -+ memcpy(*challenge, t, *chlen); -+ } -+ } -+ -+ return cpu_to_le16(a->status); -+ -+} -+ -+ -+int auth_rq_parse(struct sk_buff *skb,u8* dest) -+{ -+ struct ieee80211_authentication *a; -+ -+ if (skb->len < (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){ -+ IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len); -+ return -1; -+ } -+ a = (struct ieee80211_authentication*) skb->data; -+ -+ memcpy(dest,a->header.addr2, ETH_ALEN); -+ -+ if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN) -+ return WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG; -+ -+ return WLAN_STATUS_SUCCESS; -+} -+ -+static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *src) -+{ -+ u8 *tag; -+ u8 *skbend; -+ u8 *ssid=NULL; -+ u8 ssidlen = 0; -+ -+ struct ieee80211_hdr_3addr *header = -+ (struct ieee80211_hdr_3addr *) skb->data; -+ -+ if (skb->len < sizeof (struct ieee80211_hdr_3addr )) -+ return -1; /* corrupted */ -+ -+ memcpy(src,header->addr2, ETH_ALEN); -+ -+ skbend = (u8*)skb->data + skb->len; -+ -+ tag = skb->data + sizeof (struct ieee80211_hdr_3addr ); -+ -+ while (tag+1 < skbend){ -+ if (*tag == 0){ -+ ssid = tag+2; -+ ssidlen = *(tag+1); -+ break; -+ } -+ tag++; /* point to the len field */ -+ tag = tag + *(tag); /* point to the last data byte of the tag */ -+ tag++; /* point to the next tag */ -+ } -+ -+ //IEEE80211DMESG("Card MAC address is "MACSTR, MAC2STR(src)); -+ if (ssidlen == 0) return 1; -+ -+ if (!ssid) return 1; /* ssid not found in tagged param */ -+ return (!strncmp(ssid, ieee->current_network.ssid, ssidlen)); -+ -+} -+ -+int assoc_rq_parse(struct sk_buff *skb,u8* dest) -+{ -+ struct ieee80211_assoc_request_frame *a; -+ -+ if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) - -+ sizeof(struct ieee80211_info_element))) { -+ -+ IEEE80211_DEBUG_MGMT("invalid len in auth request:%d \n", skb->len); -+ return -1; -+ } -+ -+ a = (struct ieee80211_assoc_request_frame*) skb->data; -+ -+ memcpy(dest,a->header.addr2,ETH_ALEN); -+ -+ return 0; -+} -+ -+static inline u16 assoc_parse(struct sk_buff *skb, int *aid) -+{ -+ struct ieee80211_assoc_response_frame *a; -+ if (skb->len < sizeof(struct ieee80211_assoc_response_frame)){ -+ IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n", skb->len); -+ return 0xcafe; -+ } -+ -+ a = (struct ieee80211_assoc_response_frame*) skb->data; -+ *aid = le16_to_cpu(a->aid) & 0x3fff; -+ return le16_to_cpu(a->status); -+} -+ -+static inline void -+ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb) -+{ -+ u8 dest[ETH_ALEN]; -+ -+ //IEEE80211DMESG("Rx probe"); -+ ieee->softmac_stats.rx_probe_rq++; -+ //DMESG("Dest is "MACSTR, MAC2STR(dest)); -+ if (probe_rq_parse(ieee, skb, dest)){ -+ //IEEE80211DMESG("Was for me!"); -+ ieee->softmac_stats.tx_probe_rs++; -+ ieee80211_resp_to_probe(ieee, dest); -+ } -+} -+ -+//static inline void -+inline void ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb) -+{ -+ u8 dest[ETH_ALEN]; -+ int status; -+ //IEEE80211DMESG("Rx probe"); -+ ieee->softmac_stats.rx_auth_rq++; -+ -+ if ((status = auth_rq_parse(skb, dest))!= -1){ -+ ieee80211_resp_to_auth(ieee, status, dest); -+ } -+ //DMESG("Dest is "MACSTR, MAC2STR(dest)); -+ -+} -+ -+//static inline void -+inline void -+ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb) -+{ -+ -+ u8 dest[ETH_ALEN]; -+ //unsigned long flags; -+ -+ ieee->softmac_stats.rx_ass_rq++; -+ if (assoc_rq_parse(skb,dest) != -1){ -+ ieee80211_resp_to_assoc_rq(ieee, dest); -+ } -+ -+ printk(KERN_INFO"New client associated: "MAC_FMT"\n", MAC_ARG(dest)); -+ //FIXME -+ #if 0 -+ spin_lock_irqsave(&ieee->lock,flags); -+ add_associate(ieee,dest); -+ spin_unlock_irqrestore(&ieee->lock,flags); -+ #endif -+} -+ -+ -+ -+void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr) -+{ -+ -+ struct sk_buff *buf = ieee80211_null_func(ieee, pwr); -+ -+ printk(KERN_ALERT "ieee80211_sta_ps_send_null_frame \n"); -+ if (buf) -+ softmac_ps_mgmt_xmit(buf, ieee); -+ -+} -+ -+ -+short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l) -+{ -+ int timeout = ieee->ps_timeout; -+ u8 dtim; -+ /*if(ieee->ps == IEEE80211_PS_DISABLED || -+ ieee->iw_mode != IW_MODE_INFRA || -+ ieee->state != IEEE80211_LINKED) -+ -+ return 0; -+ */ -+ dtim = ieee->current_network.dtim_data; -+ //printk("DTIM\n"); -+ if(!(dtim & IEEE80211_DTIM_VALID)) -+ return 0; -+ //printk("VALID\n"); -+ ieee->current_network.dtim_data = IEEE80211_DTIM_INVALID; -+ -+ if(dtim & ((IEEE80211_DTIM_UCAST | IEEE80211_DTIM_MBCAST)& ieee->ps)) -+ return 2; -+ -+ if(!time_after(jiffies, ieee->dev->trans_start + MSECS(timeout))) -+ return 0; -+ -+ if(!time_after(jiffies, ieee->last_rx_ps_time + MSECS(timeout))) -+ return 0; -+ -+ if((ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE ) && -+ (ieee->mgmt_queue_tail != ieee->mgmt_queue_head)) -+ return 0; -+ -+ if(time_l){ -+ *time_l = ieee->current_network.last_dtim_sta_time[0] -+ + (ieee->current_network.beacon_interval -+ * ieee->current_network.dtim_period) * 1000; -+ } -+ -+ if(time_h){ -+ *time_h = ieee->current_network.last_dtim_sta_time[1]; -+ if(time_l && *time_l < ieee->current_network.last_dtim_sta_time[0]) -+ *time_h += 1; -+ } -+ -+ return 1; -+ -+ -+} -+ -+inline void ieee80211_sta_ps(struct ieee80211_device *ieee) -+{ -+ -+ u32 th,tl; -+ short sleep; -+ -+ unsigned long flags,flags2; -+ -+ spin_lock_irqsave(&ieee->lock, flags); -+ -+ if((ieee->ps == IEEE80211_PS_DISABLED || -+ ieee->iw_mode != IW_MODE_INFRA || -+ ieee->state != IEEE80211_LINKED)){ -+ -+ // #warning CHECK_LOCK_HERE -+ spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2); -+ -+ ieee80211_sta_wakeup(ieee, 1); -+ -+ spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2); -+ } -+ -+ sleep = ieee80211_sta_ps_sleep(ieee,&th, &tl); -+ /* 2 wake, 1 sleep, 0 do nothing */ -+ if(sleep == 0) -+ goto out; -+ -+ if(sleep == 1){ -+ -+ if(ieee->sta_sleep == 1) -+ ieee->enter_sleep_state(ieee->dev,th,tl); -+ -+ else if(ieee->sta_sleep == 0){ -+ // printk("send null 1\n"); -+ spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2); -+ -+ if(ieee->ps_is_queue_empty(ieee->dev)){ -+ -+ -+ ieee->sta_sleep = 2; -+ -+ ieee->ps_request_tx_ack(ieee->dev); -+ -+ ieee80211_sta_ps_send_null_frame(ieee,1); -+ -+ ieee->ps_th = th; -+ ieee->ps_tl = tl; -+ } -+ spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2); -+ -+ } -+ -+ -+ }else if(sleep == 2){ -+//#warning CHECK_LOCK_HERE -+ spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2); -+ -+ ieee80211_sta_wakeup(ieee,1); -+ -+ spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2); -+ } -+ -+out: -+ spin_unlock_irqrestore(&ieee->lock, flags); -+ -+} -+ -+void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl) -+{ -+ if(ieee->sta_sleep == 0){ -+ if(nl){ -+ printk("Warning: driver is probably failing to report TX ps error\n"); -+ ieee->ps_request_tx_ack(ieee->dev); -+ ieee80211_sta_ps_send_null_frame(ieee, 0); -+ } -+ return; -+ -+ } -+ -+ if(ieee->sta_sleep == 1) -+ ieee->sta_wake_up(ieee->dev); -+ -+ ieee->sta_sleep = 0; -+ -+ if(nl){ -+ ieee->ps_request_tx_ack(ieee->dev); -+ ieee80211_sta_ps_send_null_frame(ieee, 0); -+ } -+} -+ -+void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success) -+{ -+ unsigned long flags,flags2; -+ -+ spin_lock_irqsave(&ieee->lock, flags); -+ -+ if(ieee->sta_sleep == 2){ -+ /* Null frame with PS bit set */ -+ if(success){ -+ ieee->sta_sleep = 1; -+ ieee->enter_sleep_state(ieee->dev,ieee->ps_th,ieee->ps_tl); -+ } -+ /* if the card report not success we can't be sure the AP -+ * has not RXed so we can't assume the AP believe us awake -+ */ -+ } -+ /* 21112005 - tx again null without PS bit if lost */ -+ else { -+ -+ if((ieee->sta_sleep == 0) && !success){ -+ spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2); -+ ieee80211_sta_ps_send_null_frame(ieee, 0); -+ spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2); -+ } -+ } -+ spin_unlock_irqrestore(&ieee->lock, flags); -+} -+ -+inline int -+ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, -+ struct ieee80211_rx_stats *rx_stats, u16 type, -+ u16 stype) -+{ -+ struct ieee80211_hdr_3addr *header = (struct ieee80211_hdr_3addr *) skb->data; -+ u16 errcode; -+ u8* challenge=NULL; -+ int chlen=0; -+ int aid=0; -+ struct ieee80211_assoc_response_frame *assoc_resp; -+ struct ieee80211_info_element *info_element; -+ -+ if(!ieee->proto_started) -+ return 0; -+ -+ if(ieee->sta_sleep || (ieee->ps != IEEE80211_PS_DISABLED && -+ ieee->iw_mode == IW_MODE_INFRA && -+ ieee->state == IEEE80211_LINKED)) -+ -+ tasklet_schedule(&ieee->ps_task); -+ -+ if(WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_PROBE_RESP && -+ WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_BEACON) -+ ieee->last_rx_ps_time = jiffies; -+ -+ switch (WLAN_FC_GET_STYPE(header->frame_ctl)) { -+ case IEEE80211_STYPE_ASSOC_RESP: -+ case IEEE80211_STYPE_REASSOC_RESP: -+ -+ IEEE80211_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n", -+ WLAN_FC_GET_STYPE(header->frame_ctl)); -+ //printk(KERN_WARNING "Received association response\n"); -+ if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && -+ ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED && -+ ieee->iw_mode == IW_MODE_INFRA){ -+ if (0 == (errcode=assoc_parse(skb, &aid))){ -+ u16 left; -+ -+ ieee->state=IEEE80211_LINKED; -+ ieee->assoc_id = aid; -+ ieee->softmac_stats.rx_ass_ok++; -+ -+ //printk(KERN_WARNING "nic_type = %s", (rx_stats->nic_type == 1)?"rtl8187":"rtl8187B"); -+ if(1 == rx_stats->nic_type) //card type is 8187 -+ { -+ goto associate_complete; -+ } -+ assoc_resp = (struct ieee80211_assoc_response_frame*)skb->data; -+ info_element = &assoc_resp->info_element; -+ left = skb->len - ((void*)info_element - (void*)assoc_resp); -+ -+ while (left >= sizeof(struct ieee80211_info_element_hdr)) { -+ if (sizeof(struct ieee80211_info_element_hdr) + info_element->len > left) { -+ printk(KERN_WARNING "[re]associate reeponse error!"); -+ return 1; -+ } -+ switch (info_element->id) { -+ case MFIE_TYPE_GENERIC: -+ IEEE80211_DEBUG_SCAN("MFIE_TYPE_GENERIC: %d bytes\n", info_element->len); -+ if (info_element->len >= 8 && -+ info_element->data[0] == 0x00 && -+ info_element->data[1] == 0x50 && -+ info_element->data[2] == 0xf2 && -+ info_element->data[3] == 0x02 && -+ info_element->data[4] == 0x01) { -+ // Not care about version at present. -+ //WMM Parameter Element -+ memcpy(ieee->current_network.wmm_param,(u8*)(info_element->data\ -+ + 8),(info_element->len - 8)); -+ -+ if (((ieee->current_network.wmm_info^info_element->data[6])& \ -+ 0x0f)||(!ieee->init_wmmparam_flag)) { -+ //refresh paramete element for current network -+ // update the register parameter for hardware -+ ieee->init_wmmparam_flag = 1; -+ //ieee->wmm_param_update(ieee); -+ //schedule_work(&ieee->wmm_param_update_wq); -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+ queue_work(ieee->wq, &ieee->wmm_param_update_wq); -+#else -+ schedule_task(&ieee->wmm_param_update_wq); -+#endif -+ -+ } -+ //update info_element for current network -+ ieee->current_network.wmm_info = info_element->data[6]; -+ } -+ break; -+ default: -+ //nothing to do at present!!! -+ break; -+ } -+ -+ left -= sizeof(struct ieee80211_info_element_hdr) + -+ info_element->len; -+ info_element = (struct ieee80211_info_element *) -+ &info_element->data[info_element->len]; -+ } -+ if(!ieee->init_wmmparam_flag) //legacy AP, reset the AC_xx_param register -+ { -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+ queue_work(ieee->wq,&ieee->wmm_param_update_wq); -+#else -+ schedule_task(&ieee->wmm_param_update_wq); -+#endif -+ ieee->init_wmmparam_flag = 1;//indicate AC_xx_param upated since last associate -+ } -+associate_complete: -+ ieee80211_associate_complete(ieee); -+ }else{ -+ ieee->softmac_stats.rx_ass_err++; -+ IEEE80211_DEBUG_MGMT( -+ "Association response status code 0x%x\n", -+ errcode); -+ printk(KERN_WARNING "Association response status code 0x%x\n", -+ errcode); -+ ieee80211_associate_abort(ieee); -+ } -+ } -+#ifdef _RTL8187_EXT_PATCH_ -+ else if ((ieee->iw_mode == ieee->iw_ext_mode) && ieee->ext_patch_ieee80211_rx_frame_softmac_on_assoc_rsp) -+ { -+ ieee->ext_patch_ieee80211_rx_frame_softmac_on_assoc_rsp(ieee, skb); -+ } -+#endif -+ break; -+ -+ case IEEE80211_STYPE_ASSOC_REQ: -+ case IEEE80211_STYPE_REASSOC_REQ: -+ //printk("Received IEEE80211_STYPE_ASSOC_REQ\n"); -+ -+ if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && -+ ieee->iw_mode == IW_MODE_MASTER) -+ -+ ieee80211_rx_assoc_rq(ieee, skb); -+#ifdef _RTL8187_EXT_PATCH_ -+ else if ((ieee->iw_mode == ieee->iw_ext_mode) && ieee->ext_patch_ieee80211_rx_frame_softmac_on_assoc_req) -+ { -+ ieee->ext_patch_ieee80211_rx_frame_softmac_on_assoc_req(ieee, skb); -+ } -+#endif -+ break; -+ -+ case IEEE80211_STYPE_AUTH: -+ //printk("Received authentication response\n"); -+ -+#ifdef _RTL8187_EXT_PATCH_ -+//printk("IEEE80211_STYPE_AUTH\n"); -+ if((ieee->iw_mode == ieee->iw_ext_mode) && ieee->ext_patch_ieee80211_rx_frame_softmac_on_auth) -+ if( ieee->ext_patch_ieee80211_rx_frame_softmac_on_auth(ieee, skb, rx_stats) ); -+#endif -+ if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE){ -+ if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING && -+ ieee->iw_mode == IW_MODE_INFRA){ -+ -+ IEEE80211_DEBUG_MGMT("Received authentication response"); -+ -+ if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){ -+ if(ieee->open_wep || !challenge){ -+ ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED; -+ ieee->softmac_stats.rx_auth_rs_ok++; -+ -+ ieee80211_associate_step2(ieee); -+ }else{ -+ ieee80211_auth_challenge(ieee, challenge, chlen); -+ } -+ }else{ -+ ieee->softmac_stats.rx_auth_rs_err++; -+ IEEE80211_DEBUG_MGMT("Authentication respose status code 0x%x",errcode); -+ ieee80211_associate_abort(ieee); -+ } -+ -+ }else if (ieee->iw_mode == IW_MODE_MASTER){ -+ ieee80211_rx_auth_rq(ieee, skb); -+ } -+ } -+ break; -+ -+ case IEEE80211_STYPE_PROBE_REQ: -+ //printk("Received IEEE80211_STYPE_PROBE_REQ\n"); -+ -+ if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) && -+ ((ieee->iw_mode == IW_MODE_ADHOC || -+ ieee->iw_mode == IW_MODE_MASTER) && -+ ieee->state == IEEE80211_LINKED)) -+ -+ ieee80211_rx_probe_rq(ieee, skb); -+ break; -+ -+ case IEEE80211_STYPE_DISASSOC: -+ case IEEE80211_STYPE_DEAUTH: -+ //printk("Received IEEE80211_STYPE_DISASSOC\n"); -+#ifdef _RTL8187_EXT_PATCH_ -+//printk("IEEE80211_STYPE_DEAUTH\n"); -+ if((ieee->iw_mode == ieee->iw_ext_mode) && ieee->ext_patch_ieee80211_rx_frame_softmac_on_deauth) -+ if( ieee->ext_patch_ieee80211_rx_frame_softmac_on_deauth(ieee, skb, rx_stats) ) ; -+#endif -+ /* FIXME for now repeat all the association procedure -+ * both for disassociation and deauthentication -+ */ -+ if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) && -+ ieee->state == IEEE80211_LINKED && -+ ieee->iw_mode == IW_MODE_INFRA){ -+ -+ ieee->state = IEEE80211_ASSOCIATING; -+ ieee->softmac_stats.reassoc++; -+ -+ notify_wx_assoc_event(ieee); -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+ queue_work(ieee->wq, &ieee->associate_procedure_wq); -+#else -+ schedule_task(&ieee->associate_procedure_wq); -+#endif -+ } -+ -+ break; -+ -+ default: -+ return -1; -+ break; -+ } -+ -+ //dev_kfree_skb_any(skb); -+ return 0; -+} -+ -+ -+ -+/* following are for a simplier TX queue management. -+ * Instead of using netif_[stop/wake]_queue the driver -+ * will uses these two function (plus a reset one), that -+ * will internally uses the kernel netif_* and takes -+ * care of the ieee802.11 fragmentation. -+ * So the driver receives a fragment per time and might -+ * call the stop function when it want without take care -+ * to have enought room to TX an entire packet. -+ * This might be useful if each fragment need it's own -+ * descriptor, thus just keep a total free memory > than -+ * the max fragmentation treshold is not enought.. If the -+ * ieee802.11 stack passed a TXB struct then you needed -+ * to keep N free descriptors where -+ * N = MAX_PACKET_SIZE / MIN_FRAG_TRESHOLD -+ * In this way you need just one and the 802.11 stack -+ * will take care of buffering fragments and pass them to -+ * to the driver later, when it wakes the queue. -+ */ -+ -+void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee) -+{ -+ -+ -+ unsigned long flags; -+ int i; -+#ifdef _RTL8187_EXT_PATCH_ -+ int rate = ieee->rate; -+#endif -+ -+ spin_lock_irqsave(&ieee->lock,flags); -+ #if 0 -+ if(ieee->queue_stop){ -+ IEEE80211DMESG("EE: IEEE hard_start_xmit invoked when kernel queue should be stopped"); -+ netif_stop_queue(ieee->dev); -+ ieee->ieee_stats.swtxstop++; -+ //dev_kfree_skb_any(skb); -+ err = 1; -+ goto exit; -+ } -+ -+ ieee->stats.tx_bytes+=skb->len; -+ -+ -+ txb=ieee80211_skb_to_txb(ieee,skb); -+ -+ -+ if(txb==NULL){ -+ IEEE80211DMESG("WW: IEEE stack failed to provide txb"); -+ //dev_kfree_skb_any(skb); -+ err = 1; -+ goto exit; -+ } -+ #endif -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ if((ieee->iw_mode == ieee->iw_ext_mode) && ieee->ext_patch_ieee80211_softmac_xmit_get_rate && txb->nr_frags) -+ { -+ rate = ieee->ext_patch_ieee80211_softmac_xmit_get_rate(ieee, txb->fragments[0]); -+ } -+#endif -+ /* called with 2nd parm 0, no tx mgmt lock required */ -+ ieee80211_sta_wakeup(ieee,0); -+ -+ for(i = 0; i < txb->nr_frags; i++) { -+ -+ if (ieee->queue_stop){ -+ ieee->tx_pending.txb = txb; -+ ieee->tx_pending.frag = i; -+ goto exit; -+ }else{ -+ ieee->softmac_data_hard_start_xmit( -+ txb->fragments[i], -+#ifdef _RTL8187_EXT_PATCH_ -+ ieee->dev, rate); -+#else -+ ieee->dev,ieee->rate); -+#endif -+ //(i+1)<txb->nr_frags); -+ ieee->stats.tx_packets++; -+ ieee->stats.tx_bytes += txb->fragments[i]->len; -+ ieee->dev->trans_start = jiffies; -+ } -+ } -+ -+ ieee80211_txb_free(txb); -+ -+ exit: -+ spin_unlock_irqrestore(&ieee->lock,flags); -+ -+} -+ -+/* called with ieee->lock acquired */ -+void ieee80211_resume_tx(struct ieee80211_device *ieee) -+{ -+ int i; -+ for(i = ieee->tx_pending.frag; i < ieee->tx_pending.txb->nr_frags; i++) { -+ -+ if (ieee->queue_stop){ -+ ieee->tx_pending.frag = i; -+ return; -+ }else{ -+ -+ ieee->softmac_data_hard_start_xmit( -+ ieee->tx_pending.txb->fragments[i], -+ ieee->dev,ieee->rate); -+ //(i+1)<ieee->tx_pending.txb->nr_frags); -+ ieee->stats.tx_packets++; -+ ieee->dev->trans_start = jiffies; -+ } -+ } -+ -+ -+ ieee80211_txb_free(ieee->tx_pending.txb); -+ ieee->tx_pending.txb = NULL; -+} -+ -+ -+void ieee80211_reset_queue(struct ieee80211_device *ieee) -+{ -+ unsigned long flags; -+ -+ spin_lock_irqsave(&ieee->lock,flags); -+ init_mgmt_queue(ieee); -+ if (ieee->tx_pending.txb){ -+ ieee80211_txb_free(ieee->tx_pending.txb); -+ ieee->tx_pending.txb = NULL; -+ } -+ ieee->queue_stop = 0; -+ spin_unlock_irqrestore(&ieee->lock,flags); -+ -+} -+ -+void ieee80211_wake_queue(struct ieee80211_device *ieee) -+{ -+ -+ unsigned long flags; -+ struct sk_buff *skb; -+ struct ieee80211_hdr_3addr *header; -+ -+ spin_lock_irqsave(&ieee->lock,flags); -+ if (! ieee->queue_stop) goto exit; -+ -+ ieee->queue_stop = 0; -+ -+ if(ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE){ -+ while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))){ -+ -+ header = (struct ieee80211_hdr_3addr *) skb->data; -+ -+ header->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0] << 4); -+ -+ if (ieee->seq_ctrl[0] == 0xFFF) -+ ieee->seq_ctrl[0] = 0; -+ else -+ ieee->seq_ctrl[0]++; -+ -+ printk(KERN_ALERT "ieee80211_wake_queue \n"); -+ ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate); -+ dev_kfree_skb_any(skb);//edit by thomas -+ } -+ } -+ if (!ieee->queue_stop && ieee->tx_pending.txb) -+ ieee80211_resume_tx(ieee); -+ -+ if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)){ -+ ieee->softmac_stats.swtxawake++; -+ netif_wake_queue(ieee->dev); -+ } -+ -+exit : -+ spin_unlock_irqrestore(&ieee->lock,flags); -+} -+ -+ -+void ieee80211_stop_queue(struct ieee80211_device *ieee) -+{ -+ //unsigned long flags; -+ //spin_lock_irqsave(&ieee->lock,flags); -+ -+ if (! netif_queue_stopped(ieee->dev)){ -+ netif_stop_queue(ieee->dev); -+ ieee->softmac_stats.swtxstop++; -+ } -+ ieee->queue_stop = 1; -+ //spin_unlock_irqrestore(&ieee->lock,flags); -+ -+} -+ -+ -+inline void ieee80211_randomize_cell(struct ieee80211_device *ieee) -+{ -+ -+ get_random_bytes(ieee->current_network.bssid, ETH_ALEN); -+ -+ /* an IBSS cell address must have the two less significant -+ * bits of the first byte = 2 -+ */ -+ ieee->current_network.bssid[0] &= ~0x01; -+ ieee->current_network.bssid[0] |= 0x02; -+} -+ -+/* called in user context only */ -+void ieee80211_start_master_bss(struct ieee80211_device *ieee) -+{ -+ ieee->assoc_id = 1; -+ -+ if (ieee->current_network.ssid_len == 0){ -+ strncpy(ieee->current_network.ssid, -+ IEEE80211_DEFAULT_TX_ESSID, -+ IW_ESSID_MAX_SIZE); -+ -+ ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID); -+ ieee->ssid_set = 1; -+ } -+ -+ memcpy(ieee->current_network.bssid, ieee->dev->dev_addr, ETH_ALEN); -+ -+ ieee->set_chan(ieee->dev, ieee->current_network.channel); -+ ieee->state = IEEE80211_LINKED; -+ -+//by lizhaoming for LED LINK -+#ifdef LED_SHIN -+ { -+ struct net_device *dev = ieee->dev; -+ ieee->ieee80211_led_contorl(dev, LED_CTL_LINK); -+ } -+#endif -+ ieee->link_change(ieee->dev); -+ notify_wx_assoc_event(ieee); -+ -+ if (ieee->data_hard_resume) -+ ieee->data_hard_resume(ieee->dev); -+ -+ netif_carrier_on(ieee->dev); -+} -+ -+void ieee80211_start_monitor_mode(struct ieee80211_device *ieee) -+{ -+ if(ieee->raw_tx){ -+ -+ if (ieee->data_hard_resume) -+ ieee->data_hard_resume(ieee->dev); -+ -+ netif_carrier_on(ieee->dev); -+ } -+} -+ -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) -+void ieee80211_start_ibss_wq(struct work_struct *work) -+{ -+ struct delayed_work *dwork = container_of(work, struct delayed_work, work); -+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, start_ibss_wq); -+#else -+void ieee80211_start_ibss_wq(struct ieee80211_device *ieee) -+{ -+#endif -+ -+ /* iwconfig mode ad-hoc will schedule this and return -+ * on the other hand this will block further iwconfig SET -+ * operations because of the wx_sem hold. -+ * Anyway some most set operations set a flag to speed-up -+ * (abort) this wq (when syncro scanning) before sleeping -+ * on the semaphore -+ */ -+ -+ down(&ieee->wx_sem); -+ -+ if (ieee->current_network.ssid_len == 0){ -+ strcpy(ieee->current_network.ssid,IEEE80211_DEFAULT_TX_ESSID); -+ ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID); -+ ieee->ssid_set = 1; -+ } -+ -+//by lizhaoming for LED BLINK 2008.6.23 -+#ifdef LED_SHIN -+ { -+ struct net_device *dev = ieee->dev; -+ ieee->ieee80211_led_contorl(dev, LED_CTL_SITE_SURVEY); -+ } -+#endif -+ -+ /* check if we have this cell in our network list */ -+ ieee80211_softmac_check_all_nets(ieee); -+ -+#ifdef ENABLE_DOT11D -+ //[World wide 13]: -+ // Adhoc: -+ // (1) active scan from ch1~11 and passive scan from ch12~13 -+ // (2) IBSS can join ch1~13 adhoc, but only start at ch10. -+ if(ieee->state == IEEE80211_NOLINK) -+ if(ieee->IbssStartChnl != 0) -+ ieee->current_network.channel = ieee->IbssStartChnl;//chan 10 -+#endif -+ -+ /* if not then the state is not linked. Maybe the user swithced to -+ * ad-hoc mode just after being in monitor mode, or just after -+ * being very few time in managed mode (so the card have had no -+ * time to scan all the chans..) or we have just run up the iface -+ * after setting ad-hoc mode. So we have to give another try.. -+ * Here, in ibss mode, should be safe to do this without extra care -+ * (in bss mode we had to make sure no-one tryed to associate when -+ * we had just checked the ieee->state and we was going to start the -+ * scan) beacause in ibss mode the ieee80211_new_net function, when -+ * finds a good net, just set the ieee->state to IEEE80211_LINKED, -+ * so, at worst, we waste a bit of time to initiate an unneeded syncro -+ * scan, that will stop at the first round because it sees the state -+ * associated. -+ */ -+ if (ieee->state == IEEE80211_NOLINK){ -+ ieee80211_start_scan_syncro(ieee); -+ } -+ -+ /* the network definitively is not here.. create a new cell */ -+ if (ieee->state == IEEE80211_NOLINK){ -+ printk("creating new IBSS cell\n"); -+ ieee->state = IEEE80211_LINKED; -+ if(!ieee->wap_set) -+ ieee80211_randomize_cell(ieee); -+ -+ if(ieee->modulation & IEEE80211_CCK_MODULATION){ -+ -+ ieee->current_network.rates_len = 4; -+ -+ ieee->current_network.rates[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB; -+ ieee->current_network.rates[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB; -+ ieee->current_network.rates[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB; -+ ieee->current_network.rates[3] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB; -+ -+ }else -+ ieee->current_network.rates_len = 0; -+ -+ if(ieee->modulation & IEEE80211_OFDM_MODULATION){ -+ ieee->current_network.rates_ex_len = 8; -+ -+ ieee->current_network.rates_ex[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB; -+ ieee->current_network.rates_ex[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_9MB; -+ ieee->current_network.rates_ex[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_12MB; -+ ieee->current_network.rates_ex[3] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_18MB; -+ ieee->current_network.rates_ex[4] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_24MB; -+ ieee->current_network.rates_ex[5] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB; -+ ieee->current_network.rates_ex[6] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB; -+ ieee->current_network.rates_ex[7] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB; -+ -+ ieee->rate = 540; -+ }else{ -+ ieee->current_network.rates_ex_len = 0; -+ ieee->rate = 110; -+ } -+ -+ // By default, WMM function will be disabled in IBSS mode -+ ieee->current_network.QoS_Enable = 0; -+ -+ ieee->current_network.atim_window = 0; -+ ieee->current_network.capability = WLAN_CAPABILITY_IBSS; -+ if(ieee->short_slot) -+ ieee->current_network.capability |= WLAN_CAPABILITY_SHORT_SLOT; -+ -+ } -+ -+ ieee->state = IEEE80211_LINKED; -+ -+//by lizhaoming for LED LINK -+#ifdef LED_SHIN -+ { -+ struct net_device *dev = ieee->dev; -+ ieee->ieee80211_led_contorl(dev, LED_CTL_LINK); -+ } -+#endif -+ -+ ieee->set_chan(ieee->dev, ieee->current_network.channel); -+ ieee->link_change(ieee->dev); -+ -+ notify_wx_assoc_event(ieee); -+ -+ ieee80211_start_send_beacons(ieee); -+ printk(KERN_WARNING "after sending beacon packet!\n"); -+ -+ if (ieee->data_hard_resume) -+ ieee->data_hard_resume(ieee->dev); -+ -+ netif_carrier_on(ieee->dev); -+ -+ up(&ieee->wx_sem); -+} -+ -+inline void ieee80211_start_ibss(struct ieee80211_device *ieee) -+{ -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+ queue_delayed_work(ieee->wq, &ieee->start_ibss_wq, 150); //change to delayed work, delayed time is need to check -+#else -+ schedule_task(&ieee->start_ibss_wq); -+#endif -+} -+ -+/* this is called only in user context, with wx_sem held */ -+void ieee80211_start_bss(struct ieee80211_device *ieee) -+{ -+ unsigned long flags; -+ /* check if we have already found the net we -+ * are interested in (if any). -+ * if not (we are disassociated and we are not -+ * in associating / authenticating phase) start the background scanning. -+ */ -+ -+//by lizhaoming for LED BLINK 2008.6.23 -+#ifdef LED_SHIN -+ { -+ struct net_device *dev = ieee->dev; -+ ieee->ieee80211_led_contorl(dev, LED_CTL_SITE_SURVEY); -+ } -+#endif -+ -+#ifdef ENABLE_DOT11D -+ // -+ // Ref: 802.11d 11.1.3.3 -+ // STA shall not start a BSS unless properly formed Beacon frame including a Country IE. -+ // -+ if(IS_DOT11D_ENABLE(ieee) && !IS_COUNTRY_IE_VALID(ieee)) -+ { -+ if(! ieee->bGlobalDomain) -+ { -+ return; -+ } -+ } -+#endif -+ //printk("======>%s()\n",__FUNCTION__); -+ ieee80211_softmac_check_all_nets(ieee); -+ -+ /* ensure no-one start an associating process (thus setting -+ * the ieee->state to ieee80211_ASSOCIATING) while we -+ * have just cheked it and we are going to enable scan. -+ * The ieee80211_new_net function is always called with -+ * lock held (from both ieee80211_softmac_check_all_nets and -+ * the rx path), so we cannot be in the middle of such function -+ */ -+ -+ spin_lock_irqsave(&ieee->lock, flags); -+ if (ieee->state == IEEE80211_NOLINK){ -+ //printk("Not find SSID in network list scan now\n"); -+ ieee80211_start_scan(ieee); -+ } -+ spin_unlock_irqrestore(&ieee->lock, flags); -+ -+} -+ -+/* called only in userspace context */ -+void ieee80211_disassociate(struct ieee80211_device *ieee) -+{ -+ netif_carrier_off(ieee->dev); -+ -+ if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE) -+ ieee80211_reset_queue(ieee); -+ -+ if (ieee->data_hard_stop) -+ ieee->data_hard_stop(ieee->dev); -+ -+#ifdef ENABLE_DOT11D -+ if(IS_DOT11D_ENABLE(ieee)) -+ Dot11d_Reset(ieee); -+#endif -+ -+ ieee->state = IEEE80211_NOLINK; -+ ieee->link_change(ieee->dev); -+ notify_wx_assoc_event(ieee); -+ -+} -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) -+void ieee80211_associate_retry_wq(struct work_struct *work) -+{ -+ struct delayed_work *dwork = container_of(work, struct delayed_work, work); -+ struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq); -+#else -+void ieee80211_associate_retry_wq(struct ieee80211_device *ieee) -+{ -+#endif -+ unsigned long flags; -+ -+ down(&ieee->wx_sem); -+ if(!ieee->proto_started) -+ goto exit; -+ -+ if(ieee->state != IEEE80211_ASSOCIATING_RETRY) -+ goto exit; -+ -+ /* until we do not set the state to IEEE80211_NOLINK -+ * there are no possibility to have someone else trying -+ * to start an association procdure (we get here with -+ * ieee->state = IEEE80211_ASSOCIATING). -+ * When we set the state to IEEE80211_NOLINK it is possible -+ * that the RX path run an attempt to associate, but -+ * both ieee80211_softmac_check_all_nets and the -+ * RX path works with ieee->lock held so there are no -+ * problems. If we are still disassociated then start a scan. -+ * the lock here is necessary to ensure no one try to start -+ * an association procedure when we have just checked the -+ * state and we are going to start the scan. -+ */ -+ ieee->state = IEEE80211_NOLINK; -+ -+ ieee80211_softmac_check_all_nets(ieee); -+ -+ spin_lock_irqsave(&ieee->lock, flags); -+ if(ieee->state == IEEE80211_NOLINK) -+ { -+ printk("%s():Not find SSID:%s[ch=%d, mode=%s] in network list scan now\n", __FUNCTION__, -+ ieee->current_network.ssid,ieee->current_network.channel, -+ (ieee->iw_mode == IW_MODE_INFRA) ? "BSS" : "IBSS"); -+ -+ ieee80211_start_scan(ieee); -+ } -+ -+ spin_unlock_irqrestore(&ieee->lock, flags); -+ -+exit: -+ up(&ieee->wx_sem); -+} -+ -+struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee) -+{ -+ u8 broadcast_addr[] = {0xff,0xff,0xff,0xff,0xff,0xff}; -+ -+ struct sk_buff *skb = NULL; -+ struct ieee80211_probe_response *b; -+ -+//rz -+#ifdef _RTL8187_EXT_PATCH_ -+ if((ieee->iw_mode == ieee->iw_ext_mode) && ieee->ext_patch_get_beacon_get_probersp ) -+ skb = ieee->ext_patch_get_beacon_get_probersp(ieee, broadcast_addr, &(ieee->current_network)); -+ else -+ skb = ieee80211_probe_resp(ieee, broadcast_addr); -+#else -+ skb = ieee80211_probe_resp(ieee, broadcast_addr); -+#endif -+// -+ if (!skb) -+ return NULL; -+ -+ b = (struct ieee80211_probe_response *) skb->data; -+ b->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_BEACON); -+ -+ return skb; -+ -+} -+ -+struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee) -+{ -+ struct sk_buff *skb; -+ struct ieee80211_probe_response *b; -+// printk("=========>%s()\n", __FUNCTION__); -+ skb = ieee80211_get_beacon_(ieee); -+ if(!skb) -+ return NULL; -+ -+ b = (struct ieee80211_probe_response *) skb->data; -+ b->header.seq_ctrl = cpu_to_le16(ieee->seq_ctrl[0] << 4); -+ -+ if (ieee->seq_ctrl[0] == 0xFFF) -+ ieee->seq_ctrl[0] = 0; -+ else -+ ieee->seq_ctrl[0]++; -+ -+ return skb; -+} -+ -+void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee) -+{ -+ ieee->sync_scan_hurryup = 1; -+ down(&ieee->wx_sem); -+ ieee80211_stop_protocol(ieee); -+ up(&ieee->wx_sem); -+} -+ -+ -+void ieee80211_stop_protocol(struct ieee80211_device *ieee) -+{ -+ if (!ieee->proto_started) -+ return; -+ -+ ieee->proto_started = 0; -+ //printk("=====>%s\n", __func__); -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ if(ieee->ext_patch_ieee80211_stop_protocol) -+ ieee->ext_patch_ieee80211_stop_protocol(ieee); -+//if call queue_delayed_work,can call this,or do nothing.. -+//edit by lawrence,20071118 -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+// cancel_delayed_work(&ieee->ext_stop_scan_wq); -+// cancel_delayed_work(&ieee->ext_send_beacon_wq); -+#endif -+#endif // _RTL8187_EXT_PATCH_ -+ -+ ieee80211_stop_send_beacons(ieee); -+ -+ del_timer_sync(&ieee->associate_timer); -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+ cancel_delayed_work(&ieee->associate_retry_wq); -+ cancel_delayed_work(&ieee->start_ibss_wq); //cancel ibss start workqueue when stop protocol -+#endif -+ ieee80211_stop_scan(ieee); -+ -+ ieee80211_disassociate(ieee); -+ //printk("<=====%s\n", __func__); -+ -+} -+ -+void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee) -+{ -+ ieee->sync_scan_hurryup = 0; -+ down(&ieee->wx_sem); -+ ieee80211_start_protocol(ieee); -+ up(&ieee->wx_sem); -+} -+ -+void ieee80211_start_protocol(struct ieee80211_device *ieee) -+{ -+ short ch = 0; -+ int i = 0; -+ -+ if (ieee->proto_started) -+ return; -+ -+ //printk("=====>%s\n", __func__); -+ -+ ieee->proto_started = 1; -+ -+ if (ieee->current_network.channel == 0){ -+ do{ -+ ch++; -+ if (ch > MAX_CHANNEL_NUMBER) -+ return; /* no channel found */ -+#ifdef ENABLE_DOT11D -+ }while(!GET_DOT11D_INFO(ieee)->channel_map[ch]); -+#else -+ }while(!ieee->channel_map[ch]); -+#endif -+ ieee->current_network.channel = ch; -+ } -+ -+ if (ieee->current_network.beacon_interval == 0) -+ ieee->current_network.beacon_interval = 100; -+ -+ ieee->set_chan(ieee->dev,ieee->current_network.channel); -+ mdelay(10);//must or link change will fail lzm -+ -+ for(i = 0; i < 17; i++) { -+ ieee->last_rxseq_num[i] = -1; -+ ieee->last_rxfrag_num[i] = -1; -+ ieee->last_packet_time[i] = 0; -+ } -+ -+ ieee->init_wmmparam_flag = 0;//reinitialize AC_xx_PARAM registers. -+ -+ -+ /* if the user set the MAC of the ad-hoc cell and then -+ * switch to managed mode, shall we make sure that association -+ * attempts does not fail just because the user provide the essid -+ * and the nic is still checking for the AP MAC ?? -+ */ -+ -+ if (ieee->iw_mode == IW_MODE_INFRA){ -+ ieee80211_start_bss(ieee); -+ // printk("==========> IW_MODE_INFRA\n"); -+ } -+ else if (ieee->iw_mode == IW_MODE_ADHOC){ -+ // printk("==========> IW_MODE_ADHOC\n"); -+ ieee80211_start_ibss(ieee); -+ } -+ else if (ieee->iw_mode == IW_MODE_MASTER){ -+ ieee80211_start_master_bss(ieee); -+// printk("==========> IW_MODE_MASTER\n"); -+ } -+ else if(ieee->iw_mode == IW_MODE_MONITOR){ -+ ieee80211_start_monitor_mode(ieee); -+// printk("==========> IW_MODE_MONITOR\n"); -+ } -+ -+#ifdef _RTL8187_EXT_PATCH_ -+// else if((ieee->iw_mode == ieee->iw_ext_mode) && ieee->ext_patch_ieee80211_start_protocol && ieee->ext_patch_ieee80211_start_protocol(ieee)) -+ else if((ieee->iw_mode == ieee->iw_ext_mode) && ieee->ext_patch_ieee80211_start_protocol) -+ { -+ ieee->ext_patch_ieee80211_start_mesh(ieee); -+ } -+#endif -+} -+ -+ -+#define DRV_NAME "Ieee80211" -+void ieee80211_softmac_init(struct ieee80211_device *ieee) -+{ -+ int i; -+ memset(&ieee->current_network, 0, sizeof(struct ieee80211_network)); -+ -+ ieee->state = IEEE80211_NOLINK; -+ ieee->sync_scan_hurryup = 0; -+ for(i = 0; i < 5; i++) { -+ ieee->seq_ctrl[i] = 0; -+ } -+ -+ ieee->assoc_id = 0; -+ ieee->queue_stop = 0; -+ ieee->scanning = 0; -+ ieee->scan_watchdog = 0;//lzm add 081215 for roaming -+ ieee->softmac_features = 0; //so IEEE2100-like driver are happy -+ ieee->wap_set = 0; -+ ieee->ssid_set = 0; -+ ieee->proto_started = 0; -+ ieee->basic_rate = IEEE80211_DEFAULT_BASIC_RATE; -+ ieee->rate = 3; -+ ieee->ps = IEEE80211_PS_DISABLED; -+ ieee->sta_sleep = 0; -+//by amy -+ ieee->bInactivePs = false; -+ ieee->actscanning = false; -+ ieee->ListenInterval = 2; -+ ieee->NumRxData = 0; -+ ieee->NumRxDataInPeriod = 0; //YJ,add,080828 -+ ieee->NumRxBcnInPeriod = 0; //YJ,add,080828 -+ ieee->bHwRadioOff = false;//by lizhaoming -+//by amy -+#ifdef _RTL8187_EXT_PATCH_ -+ ieee->iw_ext_mode = 999; -+#endif -+ -+ init_mgmt_queue(ieee); -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) -+ init_timer(&ieee->scan_timer); -+ ieee->scan_timer.data = (unsigned long)ieee; -+ ieee->scan_timer.function = ieee80211_softmac_scan_cb; -+#endif -+ ieee->tx_pending.txb = NULL; -+ -+ init_timer(&ieee->associate_timer); -+ ieee->associate_timer.data = (unsigned long)ieee; -+ ieee->associate_timer.function = ieee80211_associate_abort_cb; -+ -+ init_timer(&ieee->beacon_timer); -+ ieee->beacon_timer.data = (unsigned long) ieee; -+ ieee->beacon_timer.function = ieee80211_send_beacon_cb; -+ -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+#ifdef PF_SYNCTHREAD -+ ieee->wq = create_workqueue(DRV_NAME,0); -+#else -+ ieee->wq = create_workqueue(DRV_NAME); -+#endif -+#endif -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)//added by lawrence,070702 -+ INIT_DELAYED_WORK(&ieee->start_ibss_wq, ieee80211_start_ibss_wq); -+ INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq); -+ INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq); -+ INIT_DELAYED_WORK(&ieee->softmac_scan_wq, ieee80211_softmac_scan_wq); -+ INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq); -+ INIT_WORK(&ieee->wx_sync_scan_wq, ieee80211_wx_sync_scan_wq); -+//added by lawrence,20071118 -+#ifdef _RTL8187_EXT_PATCH_ -+ INIT_WORK(&ieee->ext_stop_scan_wq, ieee80211_ext_stop_scan_wq); -+ //INIT_WORK(&ieee->ext_send_beacon_wq, ieee80211_beacons_start,ieee); -+ INIT_WORK(&ieee->ext_send_beacon_wq, ext_ieee80211_send_beacon_wq); -+#endif //_RTL8187_EXT_PATCH_ -+#else -+ INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee); -+ INIT_WORK(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee); -+ INIT_WORK(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee); -+ INIT_WORK(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee); -+ INIT_WORK(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee); -+ INIT_WORK(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee); -+#ifdef _RTL8187_EXT_PATCH_ -+ INIT_WORK(&ieee->ext_stop_scan_wq,(void(*)(void*)) ieee80211_ext_stop_scan_wq,ieee); -+ //INIT_WORK(&ieee->ext_send_beacon_wq,(void(*)(void*)) ieee80211_beacons_start,ieee); -+ INIT_WORK(&ieee->ext_send_beacon_wq,(void(*)(void*)) ext_ieee80211_send_beacon_wq,ieee); -+#endif -+#endif -+#else -+ tq_init(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee); -+ tq_init(&ieee->associate_retry_wq,(void(*)(void*)) ieee80211_associate_retry_wq,ieee); -+ tq_init(&ieee->associate_complete_wq,(void(*)(void*)) ieee80211_associate_complete_wq,ieee); -+ tq_init(&ieee->associate_procedure_wq,(void(*)(void*)) ieee80211_associate_procedure_wq,ieee); -+ tq_init(&ieee->softmac_scan_wq,(void(*)(void*)) ieee80211_softmac_scan_wq,ieee); -+ tq_init(&ieee->wx_sync_scan_wq,(void(*)(void*)) ieee80211_wx_sync_scan_wq,ieee); -+#ifdef _RTL8187_EXT_PATCH_ -+ tq_init(&ieee->ext_stop_scan_wq,(void(*)(void*)) ieee80211_ext_stop_scan_wq,ieee); -+ //tq_init(&ieee->ext_send_beacon_wq,(void(*)(void*)) ieee80211_beacons_start,ieee); -+ tq_init(&ieee->ext_send_beacon_wq,(void(*)(void*)) ext_ieee80211_send_beacon_wq,ieee); -+#endif -+#endif -+ sema_init(&ieee->wx_sem, 1); -+ sema_init(&ieee->scan_sem, 1); -+ sema_init(&ieee->ips_sem,1); -+ spin_lock_init(&ieee->mgmt_tx_lock); -+ spin_lock_init(&ieee->beacon_lock); -+ spin_lock_init(&ieee->beaconflag_lock); -+ tasklet_init(&ieee->ps_task, -+ (void(*)(unsigned long)) ieee80211_sta_ps, -+ (unsigned long)ieee); -+#ifdef ENABLE_DOT11D -+ ieee->pDot11dInfo = kmalloc(sizeof(RT_DOT11D_INFO), GFP_ATOMIC); -+#endif -+ -+} -+ -+void ieee80211_softmac_free(struct ieee80211_device *ieee) -+{ -+ down(&ieee->wx_sem); -+ -+ del_timer_sync(&ieee->associate_timer); -+ -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+ cancel_delayed_work(&ieee->associate_retry_wq); -+ -+ -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ //When kernel>2.6.20,crash.... -+// cancel_delayed_work(&ieee->ext_stop_scan_wq); -+// cancel_delayed_work(&ieee->ext_send_beacon_wq); -+#endif -+ destroy_workqueue(ieee->wq); -+#endif -+ -+#ifdef ENABLE_DOT11D -+ if(NULL != ieee->pDot11dInfo) -+ kfree(ieee->pDot11dInfo); -+#endif -+ -+ up(&ieee->wx_sem); -+} -+ -+/******************************************************** -+ * Start of WPA code. * -+ * this is stolen from the ipw2200 driver * -+ ********************************************************/ -+ -+ -+static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value) -+{ -+ /* This is called when wpa_supplicant loads and closes the driver -+ * interface. */ -+ printk("%s WPA\n",value ? "enabling" : "disabling"); -+ ieee->wpa_enabled = value; -+ return 0; -+} -+ -+ -+void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len) -+{ -+ /* make sure WPA is enabled */ -+ ieee80211_wpa_enable(ieee, 1); -+ -+ ieee80211_disassociate(ieee); -+} -+ -+ -+static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, int reason) -+{ -+ -+ int ret = 0; -+ -+ switch (command) { -+ case IEEE_MLME_STA_DEAUTH: -+ // silently ignore -+ break; -+ -+ case IEEE_MLME_STA_DISASSOC: -+ ieee80211_disassociate(ieee); -+ break; -+ -+ default: -+ printk("Unknown MLME request: %d\n", command); -+ ret = -EOPNOTSUPP; -+ } -+ -+ return ret; -+} -+ -+ -+static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee, -+ struct ieee_param *param, int plen) -+{ -+ u8 *buf; -+ -+ if (param->u.wpa_ie.len > MAX_WPA_IE_LEN || -+ (param->u.wpa_ie.len && param->u.wpa_ie.data == NULL)) -+ return -EINVAL; -+ -+ if (param->u.wpa_ie.len) { -+ buf = kmalloc(param->u.wpa_ie.len, GFP_KERNEL); -+ if (buf == NULL) -+ return -ENOMEM; -+ -+ memcpy(buf, param->u.wpa_ie.data, param->u.wpa_ie.len); -+ kfree(ieee->wpa_ie); -+ ieee->wpa_ie = buf; -+ ieee->wpa_ie_len = param->u.wpa_ie.len; -+ } else { -+ kfree(ieee->wpa_ie); -+ ieee->wpa_ie = NULL; -+ ieee->wpa_ie_len = 0; -+ } -+ -+ ieee80211_wpa_assoc_frame(ieee, ieee->wpa_ie, ieee->wpa_ie_len); -+ return 0; -+} -+ -+#define AUTH_ALG_OPEN_SYSTEM 0x1 -+#define AUTH_ALG_SHARED_KEY 0x2 -+ -+static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value) -+{ -+ -+ struct ieee80211_security sec = { -+ .flags = SEC_AUTH_MODE, -+ }; -+ int ret = 0; -+ -+ if (value & AUTH_ALG_SHARED_KEY) { -+ sec.auth_mode = WLAN_AUTH_SHARED_KEY; -+ ieee->open_wep = 0; -+ } else { -+ sec.auth_mode = WLAN_AUTH_OPEN; -+ ieee->open_wep = 1; -+ } -+ -+ if (ieee->set_security) -+ ieee->set_security(ieee->dev, &sec); -+ else -+ ret = -EOPNOTSUPP; -+ -+ return ret; -+} -+ -+static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 value) -+{ -+ int ret=0; -+ unsigned long flags; -+ -+ switch (name) { -+ case IEEE_PARAM_WPA_ENABLED: -+ ret = ieee80211_wpa_enable(ieee, value); -+ break; -+ -+ case IEEE_PARAM_TKIP_COUNTERMEASURES: -+ ieee->tkip_countermeasures=value; -+ break; -+ -+ case IEEE_PARAM_DROP_UNENCRYPTED: { -+ /* HACK: -+ * -+ * wpa_supplicant calls set_wpa_enabled when the driver -+ * is loaded and unloaded, regardless of if WPA is being -+ * used. No other calls are made which can be used to -+ * determine if encryption will be used or not prior to -+ * association being expected. If encryption is not being -+ * used, drop_unencrypted is set to false, else true -- we -+ * can use this to determine if the CAP_PRIVACY_ON bit should -+ * be set. -+ */ -+ struct ieee80211_security sec = { -+ .flags = SEC_ENABLED, -+ .enabled = value, -+ }; -+ ieee->drop_unencrypted = value; -+ /* We only change SEC_LEVEL for open mode. Others -+ * are set by ipw_wpa_set_encryption. -+ */ -+ if (!value) { -+ sec.flags |= SEC_LEVEL; -+ sec.level = SEC_LEVEL_0; -+ } -+ else { -+ sec.flags |= SEC_LEVEL; -+ sec.level = SEC_LEVEL_1; -+ } -+ if (ieee->set_security) -+ ieee->set_security(ieee->dev, &sec); -+ break; -+ } -+ -+ case IEEE_PARAM_PRIVACY_INVOKED: -+ ieee->privacy_invoked=value; -+ break; -+ -+ case IEEE_PARAM_AUTH_ALGS: -+ ret = ieee80211_wpa_set_auth_algs(ieee, value); -+ break; -+ -+ case IEEE_PARAM_IEEE_802_1X: -+ ieee->ieee802_1x=value; -+ break; -+ case IEEE_PARAM_WPAX_SELECT: -+ // added for WPA2 mixed mode -+ //printk(KERN_WARNING "------------------------>wpax value = %x\n", value); -+ spin_lock_irqsave(&ieee->wpax_suitlist_lock,flags); -+ ieee->wpax_type_set = 1; -+ ieee->wpax_type_notify = value; -+ spin_unlock_irqrestore(&ieee->wpax_suitlist_lock,flags); -+ break; -+ -+ default: -+ printk("Unknown WPA param: %d\n",name); -+ ret = -EOPNOTSUPP; -+ } -+ -+ return ret; -+} -+ -+/* implementation borrowed from hostap driver */ -+ -+static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee, -+ struct ieee_param *param, int param_len) -+{ -+ int ret = 0; -+ -+ struct ieee80211_crypto_ops *ops; -+ struct ieee80211_crypt_data **crypt; -+ -+ struct ieee80211_security sec = { -+ .flags = 0, -+ }; -+ -+ param->u.crypt.err = 0; -+ param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0'; -+ -+ if (param_len != -+ (int) ((char *) param->u.crypt.key - (char *) param) + -+ param->u.crypt.key_len) { -+ printk("Len mismatch %d, %d\n", param_len, -+ param->u.crypt.key_len); -+ return -EINVAL; -+ } -+ if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && -+ param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && -+ param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { -+ if (param->u.crypt.idx >= WEP_KEYS) -+ return -EINVAL; -+#ifdef _RTL8187_EXT_PATCH_ -+ crypt = &ieee->cryptlist[0]->crypt[param->u.crypt.idx]; -+#else -+ crypt = &ieee->crypt[param->u.crypt.idx]; -+#endif -+ -+ } else { -+ return -EINVAL; -+ } -+ -+ if (strcmp(param->u.crypt.alg, "none") == 0) { -+ if (crypt) { -+ sec.enabled = 0; -+ // FIXME FIXME -+ //sec.encrypt = 0; -+ sec.level = SEC_LEVEL_0; -+ sec.flags |= SEC_ENABLED | SEC_LEVEL; -+ ieee80211_crypt_delayed_deinit(ieee, crypt); -+ } -+ goto done; -+ } -+ sec.enabled = 1; -+// FIXME FIXME -+// sec.encrypt = 1; -+ sec.flags |= SEC_ENABLED; -+ -+ /* IPW HW cannot build TKIP MIC, host decryption still needed. */ -+ if (!(ieee->host_encrypt || ieee->host_decrypt) && -+ strcmp(param->u.crypt.alg, "TKIP")) -+ goto skip_host_crypt; -+ -+ ops = ieee80211_get_crypto_ops(param->u.crypt.alg); -+ if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) { -+ request_module("ieee80211_crypt_wep"); -+ ops = ieee80211_get_crypto_ops(param->u.crypt.alg); -+ } else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) { -+ request_module("ieee80211_crypt_tkip"); -+ ops = ieee80211_get_crypto_ops(param->u.crypt.alg); -+ } else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) { -+ request_module("ieee80211_crypt_ccmp"); -+ ops = ieee80211_get_crypto_ops(param->u.crypt.alg); -+ } -+ if (ops == NULL) { -+ printk("unknown crypto alg '%s'\n", param->u.crypt.alg); -+ param->u.crypt.err = IEEE_CRYPT_ERR_UNKNOWN_ALG; -+ ret = -EINVAL; -+ goto done; -+ } -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ u8 i; -+ for (i=0; i<MAX_MP; i++){ -+ crypt = &ieee->cryptlist[i]->crypt[param->u.crypt.idx]; -+// if (crypt != NULL) printk("crypt not null\n", crypt); -+ -+ *crypt = ieee->cryptlist[i]->crypt[param->u.crypt.idx]; -+#endif -+ if (*crypt == NULL || (*crypt)->ops != ops) { -+ struct ieee80211_crypt_data *new_crypt; -+ -+ ieee80211_crypt_delayed_deinit(ieee, crypt); -+ -+ new_crypt = (struct ieee80211_crypt_data *) -+ kmalloc(sizeof(*new_crypt), GFP_KERNEL); -+ if (new_crypt == NULL) { -+ ret = -ENOMEM; -+ goto done; -+ } -+ memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); -+ new_crypt->ops = ops; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) -+ if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) -+#else -+ if (new_crypt->ops && try_inc_mod_count(new_crypt->ops->owner)) -+#endif -+ new_crypt->priv = -+ new_crypt->ops->init(param->u.crypt.idx); -+ -+ if (new_crypt->priv == NULL) { -+ kfree(new_crypt); -+ param->u.crypt.err = IEEE_CRYPT_ERR_CRYPT_INIT_FAILED; -+ ret = -EINVAL; -+ goto done; -+ } -+ -+ *crypt = new_crypt; -+ } -+ -+ if (param->u.crypt.key_len > 0 && (*crypt)->ops->set_key && -+ (*crypt)->ops->set_key(param->u.crypt.key, -+ param->u.crypt.key_len, param->u.crypt.seq, -+ (*crypt)->priv) < 0) { -+ printk("key setting failed\n"); -+ param->u.crypt.err = IEEE_CRYPT_ERR_KEY_SET_FAILED; -+ ret = -EINVAL; -+ goto done; -+ } -+#ifdef _RTL8187_EXT_PATCH_ -+ } -+#endif -+ skip_host_crypt: -+ if (param->u.crypt.set_tx) { -+ ieee->tx_keyidx = param->u.crypt.idx; -+ sec.active_key = param->u.crypt.idx; -+ sec.flags |= SEC_ACTIVE_KEY; -+ } else -+ sec.flags &= ~SEC_ACTIVE_KEY; -+ -+ if (param->u.crypt.alg != NULL) { -+ memcpy(sec.keys[param->u.crypt.idx], -+ param->u.crypt.key, -+ param->u.crypt.key_len); -+ sec.key_sizes[param->u.crypt.idx] = param->u.crypt.key_len; -+ sec.flags |= (1 << param->u.crypt.idx); -+ -+ if (strcmp(param->u.crypt.alg, "WEP") == 0) { -+ sec.flags |= SEC_LEVEL; -+ sec.level = SEC_LEVEL_1; -+ } else if (strcmp(param->u.crypt.alg, "TKIP") == 0) { -+ sec.flags |= SEC_LEVEL; -+ sec.level = SEC_LEVEL_2; -+ } else if (strcmp(param->u.crypt.alg, "CCMP") == 0) { -+ sec.flags |= SEC_LEVEL; -+ sec.level = SEC_LEVEL_3; -+ } -+ } -+ done: -+ if (ieee->set_security) -+ ieee->set_security(ieee->dev, &sec); -+#if 1 -+#ifdef _RTL8187_EXT_PATCH_ -+ if (ret != 0)//error out -+ { -+ for (i=0; i<MAX_MP; i++) -+ { -+ if (ieee->cryptlist[i]->crypt[param->u.crypt.idx]==NULL){ -+ break; -+ } -+ else{ -+ //if (ieee->cryptlist[i]->crypt[param->u.crypt.idx] != NULL) -+ // { -+ kfree(ieee->cryptlist[i]->crypt[param->u.crypt.idx]); -+ ieee->cryptlist[i]->crypt[param->u.crypt.idx] = NULL; -+ // } -+ // kfree(ieee->cryptlist[i]); -+ // ieee->cryptlist[i] = NULL; -+ } -+ } -+ } -+#endif -+#endif -+ /* Do not reset port if card is in Managed mode since resetting will -+ * generate new IEEE 802.11 authentication which may end up in looping -+ * with IEEE 802.1X. If your hardware requires a reset after WEP -+ * configuration (for example... Prism2), implement the reset_port in -+ * the callbacks structures used to initialize the 802.11 stack. */ -+ if (ieee->reset_on_keychange && -+ ieee->iw_mode != IW_MODE_INFRA && -+ ieee->reset_port && -+ ieee->reset_port(ieee->dev)) { -+ printk("reset_port failed\n"); -+ param->u.crypt.err = IEEE_CRYPT_ERR_CARD_CONF_FAILED; -+ return -EINVAL; -+ } -+ -+ return ret; -+} -+ -+int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_point *p) -+{ -+ struct ieee_param *param; -+ int ret=0; -+ -+ down(&ieee->wx_sem); -+ //IEEE_DEBUG_INFO("wpa_supplicant: len=%d\n", p->length); -+ -+ if (p->length < sizeof(struct ieee_param) || !p->pointer){ -+ ret = -EINVAL; -+ goto out; -+ } -+ -+ param = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL); -+ if (param == NULL){ -+ ret = -ENOMEM; -+ goto out; -+ } -+ if (copy_from_user(param, p->pointer, p->length)) { -+ kfree(param); -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ switch (param->cmd) { -+ -+ case IEEE_CMD_SET_WPA_PARAM: -+ ret = ieee80211_wpa_set_param(ieee, param->u.wpa_param.name, -+ param->u.wpa_param.value); -+ break; -+ -+ case IEEE_CMD_SET_WPA_IE: -+ ret = ieee80211_wpa_set_wpa_ie(ieee, param, p->length); -+ break; -+ -+ case IEEE_CMD_SET_ENCRYPTION: -+ ret = ieee80211_wpa_set_encryption(ieee, param, p->length); -+ break; -+ -+ case IEEE_CMD_MLME: -+ ret = ieee80211_wpa_mlme(ieee, param->u.mlme.command, -+ param->u.mlme.reason_code); -+ break; -+ -+ default: -+ printk("Unknown WPA supplicant request: %d\n",param->cmd); -+ ret = -EOPNOTSUPP; -+ break; -+ } -+ -+ if (ret == 0 && copy_to_user(p->pointer, param, p->length)) -+ ret = -EFAULT; -+ -+ kfree(param); -+out: -+ up(&ieee->wx_sem); -+ -+ return ret; -+} -+ -+void notify_wx_assoc_event(struct ieee80211_device *ieee) -+{ -+ union iwreq_data wrqu; -+ wrqu.ap_addr.sa_family = ARPHRD_ETHER; -+ if (ieee->state == IEEE80211_LINKED) -+ memcpy(wrqu.ap_addr.sa_data, ieee->current_network.bssid, ETH_ALEN); -+ else -+ memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); -+ wireless_send_event(ieee->dev, SIOCGIWAP, &wrqu, NULL); -+} -+ -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) -+EXPORT_SYMBOL(ieee80211_get_beacon); -+EXPORT_SYMBOL(ieee80211_wake_queue); -+EXPORT_SYMBOL(ieee80211_stop_queue); -+EXPORT_SYMBOL(ieee80211_reset_queue); -+EXPORT_SYMBOL(ieee80211_softmac_stop_protocol); -+EXPORT_SYMBOL(ieee80211_softmac_start_protocol); -+EXPORT_SYMBOL(ieee80211_is_shortslot); -+EXPORT_SYMBOL(ieee80211_is_54g); -+EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl); -+EXPORT_SYMBOL(ieee80211_ps_tx_ack); -+EXPORT_SYMBOL(notify_wx_assoc_event); -+EXPORT_SYMBOL(ieee80211_stop_send_beacons); -+EXPORT_SYMBOL(ieee80211_start_send_beacons); -+EXPORT_SYMBOL(ieee80211_start_scan_syncro); -+EXPORT_SYMBOL(ieee80211_start_protocol); -+EXPORT_SYMBOL(ieee80211_stop_protocol); -+EXPORT_SYMBOL(ieee80211_start_scan); -+EXPORT_SYMBOL(ieee80211_stop_scan); -+#ifdef _RTL8187_EXT_PATCH_ -+EXPORT_SYMBOL(ieee80211_ext_issue_assoc_req); -+EXPORT_SYMBOL(ieee80211_ext_issue_disassoc); -+EXPORT_SYMBOL(ieee80211_ext_issue_assoc_rsp); -+EXPORT_SYMBOL(softmac_mgmt_xmit); -+EXPORT_SYMBOL(ieee80211_ext_probe_resp_by_net); -+EXPORT_SYMBOL(ieee80211_stop_scan); -+EXPORT_SYMBOL(ieee80211_ext_send_11s_beacon); -+EXPORT_SYMBOL(ieee80211_rx_auth_rq); -+EXPORT_SYMBOL(ieee80211_associate_step1); -+#endif // _RTL8187_EXT_PATCH_ -+#else -+EXPORT_SYMBOL_NOVERS(ieee80211_get_beacon); -+EXPORT_SYMBOL_NOVERS(ieee80211_wake_queue); -+EXPORT_SYMBOL_NOVERS(ieee80211_stop_queue); -+EXPORT_SYMBOL_NOVERS(ieee80211_reset_queue); -+EXPORT_SYMBOL_NOVERS(ieee80211_softmac_stop_protocol); -+EXPORT_SYMBOL_NOVERS(ieee80211_softmac_start_protocol); -+EXPORT_SYMBOL_NOVERS(ieee80211_is_shortslot); -+EXPORT_SYMBOL_NOVERS(ieee80211_is_54g); -+EXPORT_SYMBOL_NOVERS(ieee80211_wpa_supplicant_ioctl); -+EXPORT_SYMBOL_NOVERS(ieee80211_ps_tx_ack); -+EXPORT_SYMBOL_NOVERS(ieee80211_start_scan); -+EXPORT_SYMBOL_NOVERS(ieee80211_stop_scan); -+#ifdef _RTL8187_EXT_PATCH_ -+EXPORT_SYMBOL_NOVERS(ieee80211_ext_issue_assoc_req); -+EXPORT_SYMBOL_NOVERS(ieee80211_ext_issue_disassoc); -+EXPORT_SYMBOL_NOVERS(ieee80211_ext_issue_assoc_rsp); -+EXPORT_SYMBOL_NOVERS(softmac_mgmt_xmit); -+EXPORT_SYMBOL_NOVERS(ieee80211_ext_probe_resp_by_net); -+EXPORT_SYMBOL_NOVERS(ieee80211_stop_scan); -+EXPORT_SYMBOL_NOVERS(ieee80211_ext_send_11s_beacon); -+EXPORT_SYMBOL_NOVERS(ieee80211_rx_auth_rq); -+EXPORT_SYMBOL(ieee80211_associate_step1); -+#endif // _RTL8187_EXT_PATCH_ -+ -+#endif -+//EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame); -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_softmac_wx.c linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_softmac_wx.c ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_softmac_wx.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_softmac_wx.c 2010-08-05 21:12:34.523620485 +0200 -@@ -0,0 +1,629 @@ -+/* IEEE 802.11 SoftMAC layer -+ * Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it> -+ * -+ * Mostly extracted from the rtl8180-sa2400 driver for the -+ * in-kernel generic ieee802.11 stack. -+ * -+ * Some pieces of code might be stolen from ipw2100 driver -+ * copyright of who own it's copyright ;-) -+ * -+ * PS wx handler mostly stolen from hostap, copyright who -+ * own it's copyright ;-) -+ * -+ * released under the GPL -+ */ -+ -+ -+#include "ieee80211.h" -+#ifdef ENABLE_DOT11D -+#include "dot11d.h" -+#endif -+ -+/* FIXME: add A freqs */ -+ -+const long ieee80211_wlan_frequencies[] = { -+ 2412, 2417, 2422, 2427, -+ 2432, 2437, 2442, 2447, -+ 2452, 2457, 2462, 2467, -+ 2472, 2484 -+}; -+ -+ -+int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info *a, -+ union iwreq_data *wrqu, char *b) -+{ -+ int ret; -+ struct iw_freq *fwrq = & wrqu->freq; -+ -+ down(&ieee->wx_sem); -+ -+ if(ieee->iw_mode == IW_MODE_INFRA){ -+ ret = -EOPNOTSUPP; -+ goto out; -+ } -+ -+ /* if setting by freq convert to channel */ -+ if (fwrq->e == 1) { -+ if ((fwrq->m >= (int) 2.412e8 && -+ fwrq->m <= (int) 2.487e8)) { -+ int f = fwrq->m / 100000; -+ int c = 0; -+ -+ while ((c < 14) && (f != ieee80211_wlan_frequencies[c])) -+ c++; -+ -+ /* hack to fall through */ -+ fwrq->e = 0; -+ fwrq->m = c + 1; -+ } -+ } -+ -+ if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){ -+ ret = -EOPNOTSUPP; -+ goto out; -+ -+ }else { /* Set the channel */ -+ -+#ifdef ENABLE_DOT11D -+ if(!IsLegalChannel(ieee, fwrq->m) ) -+ { -+ printk("channel(%d). is invalide\n", fwrq->m); -+ ret = -EOPNOTSUPP; -+ goto out; -+ } -+ else -+ { -+ if(ieee->iw_mode == IW_MODE_ADHOC) -+ { -+ if(ieee->MinPassiveChnlNum != MAX_CHANNEL_NUMBER+1) -+ { -+ if(fwrq->m >= ieee->MinPassiveChnlNum) -+ { -+ ret = -EOPNOTSUPP; -+ goto out; -+ } -+ } -+ } -+ } -+#endif -+ ieee->current_network.channel = fwrq->m; -+ ieee->set_chan(ieee->dev, ieee->current_network.channel); -+ -+ if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER) -+ if(ieee->state == IEEE80211_LINKED){ -+ -+ ieee80211_stop_send_beacons(ieee); -+ ieee80211_start_send_beacons(ieee); -+ } -+ } -+ -+ ret = 0; -+out: -+ up(&ieee->wx_sem); -+ return ret; -+} -+ -+ -+int ieee80211_wx_get_freq(struct ieee80211_device *ieee, -+ struct iw_request_info *a, -+ union iwreq_data *wrqu, char *b) -+{ -+ struct iw_freq *fwrq = & wrqu->freq; -+ -+ if (ieee->current_network.channel == 0) -+ return -1; -+ -+ fwrq->m = ieee->current_network.channel; -+ fwrq->e = 0; -+ -+ return 0; -+} -+ -+int ieee80211_wx_get_wap(struct ieee80211_device *ieee, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ unsigned long flags; -+ -+ wrqu->ap_addr.sa_family = ARPHRD_ETHER; -+ -+ if (ieee->iw_mode == IW_MODE_MONITOR) -+ return -1; -+ -+ /* We want avoid to give to the user inconsistent infos*/ -+ spin_lock_irqsave(&ieee->lock, flags); -+ -+ if (ieee->state != IEEE80211_LINKED && -+ ieee->state != IEEE80211_LINKED_SCANNING && -+ ieee->wap_set == 0) -+ -+ memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN); -+ else -+ memcpy(wrqu->ap_addr.sa_data, -+ ieee->current_network.bssid, ETH_ALEN); -+ -+ spin_unlock_irqrestore(&ieee->lock, flags); -+ -+ return 0; -+} -+ -+ -+int ieee80211_wx_set_wap(struct ieee80211_device *ieee, -+ struct iw_request_info *info, -+ union iwreq_data *awrq, -+ char *extra) -+{ -+ -+ int ret = 0; -+ u8 zero[] = {0,0,0,0,0,0}; -+ unsigned long flags; -+ -+ short ifup = ieee->proto_started;//dev->flags & IFF_UP; -+ struct sockaddr *temp = (struct sockaddr *)awrq; -+ -+ ieee->sync_scan_hurryup = 1; -+ -+ down(&ieee->wx_sem); -+ /* use ifconfig hw ether */ -+ if (ieee->iw_mode == IW_MODE_MASTER){ -+ ret = -1; -+ goto out; -+ } -+ -+ if (temp->sa_family != ARPHRD_ETHER){ -+ ret = -EINVAL; -+ goto out; -+ } -+ -+ if (ifup) -+ ieee80211_stop_protocol(ieee); -+ -+ /* just to avoid to give inconsistent infos in the -+ * get wx method. not really needed otherwise -+ */ -+ spin_lock_irqsave(&ieee->lock, flags); -+ -+ memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN); -+ ieee->wap_set = memcmp(temp->sa_data, zero,ETH_ALEN)!=0; -+ -+ spin_unlock_irqrestore(&ieee->lock, flags); -+ -+ if (ifup) -+ ieee80211_start_protocol(ieee); -+ -+out: -+ up(&ieee->wx_sem); -+ return ret; -+} -+ -+ int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b) -+{ -+ int len,ret = 0; -+ unsigned long flags; -+ -+ if (ieee->iw_mode == IW_MODE_MONITOR) -+ return -1; -+ -+ /* We want avoid to give to the user inconsistent infos*/ -+ spin_lock_irqsave(&ieee->lock, flags); -+ -+ if (ieee->current_network.ssid[0] == '\0' || -+ ieee->current_network.ssid_len == 0){ -+ ret = -1; -+ goto out; -+ } -+ -+ if (ieee->state != IEEE80211_LINKED && -+ ieee->state != IEEE80211_LINKED_SCANNING && -+ ieee->ssid_set == 0){ -+ ret = -1; -+ goto out; -+ } -+ len = ieee->current_network.ssid_len; -+ wrqu->essid.length = len; -+ strncpy(b,ieee->current_network.ssid,len); -+ wrqu->essid.flags = 1; -+ -+out: -+ spin_unlock_irqrestore(&ieee->lock, flags); -+ -+ return ret; -+ -+} -+ -+int ieee80211_wx_set_rate(struct ieee80211_device *ieee, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ -+ u32 target_rate = wrqu->bitrate.value; -+ -+ ieee->rate = target_rate/100000; -+ //FIXME: we might want to limit rate also in management protocols. -+ return 0; -+} -+ -+ -+ -+int ieee80211_wx_get_rate(struct ieee80211_device *ieee, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ -+ wrqu->bitrate.value = ieee->rate * 100000; -+ -+ return 0; -+} -+ -+int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a, -+ union iwreq_data *wrqu, char *b) -+{ -+ -+ ieee->sync_scan_hurryup = 1; -+ -+ down(&ieee->wx_sem); -+ //printk("=======>%s\n", __func__); -+ -+ if (wrqu->mode == ieee->iw_mode) -+ goto out; -+ -+ if (wrqu->mode == IW_MODE_MONITOR){ -+ -+ ieee->dev->type = ARPHRD_IEEE80211; -+ }else{ -+ ieee->dev->type = ARPHRD_ETHER; -+ } -+ -+ if (!ieee->proto_started){ -+ ieee->iw_mode = wrqu->mode; -+ }else{ -+ ieee80211_stop_protocol(ieee); -+ ieee->iw_mode = wrqu->mode; -+ ieee80211_start_protocol(ieee); -+ } -+ -+out: -+ up(&ieee->wx_sem); -+ return 0; -+} -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) -+void ieee80211_wx_sync_scan_wq(struct work_struct *work) -+{ -+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq); -+#else -+void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee) -+{ -+#endif -+ short chan; -+ -+ chan = ieee->current_network.channel; -+ -+ netif_carrier_off(ieee->dev); -+ -+ if (ieee->data_hard_stop) -+ ieee->data_hard_stop(ieee->dev); -+ -+ ieee80211_stop_send_beacons(ieee); -+ -+ ieee->state = IEEE80211_LINKED_SCANNING; -+ ieee->link_change(ieee->dev); -+ -+ ieee80211_start_scan_syncro(ieee); -+ -+ ieee->set_chan(ieee->dev, chan); -+ -+ ieee->state = IEEE80211_LINKED; -+ ieee->link_change(ieee->dev); -+ -+ if (ieee->data_hard_resume) -+ ieee->data_hard_resume(ieee->dev); -+ -+ if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER) -+ ieee80211_start_send_beacons(ieee); -+ -+ netif_carrier_on(ieee->dev); -+ -+ up(&ieee->wx_sem); -+ -+} -+ -+int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a, -+ union iwreq_data *wrqu, char *b) -+{ -+ int ret = 0; -+ -+ down(&ieee->wx_sem); -+ -+ if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){ -+ ret = -1; -+ goto out; -+ } -+ -+ if ( ieee->state == IEEE80211_LINKED){ -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+ queue_work(ieee->wq, &ieee->wx_sync_scan_wq); -+#else -+ schedule_task(&ieee->wx_sync_scan_wq); -+#endif -+ /* intentionally forget to up sem */ -+ return 0; -+ } -+ -+out: -+ up(&ieee->wx_sem); -+ return ret; -+} -+ -+int ieee80211_wx_set_essid(struct ieee80211_device *ieee, -+ struct iw_request_info *a, -+ union iwreq_data *wrqu, char *extra) -+{ -+ -+ int ret=0,len; -+ short proto_started; -+ unsigned long flags; -+ -+ ieee->sync_scan_hurryup = 1; -+ -+ down(&ieee->wx_sem); -+ -+ //printk("=======>%s\n", __func__); -+ proto_started = ieee->proto_started; -+ -+ if (wrqu->essid.length > IW_ESSID_MAX_SIZE){ -+ ret= -E2BIG; -+ goto out; -+ } -+ -+ if (ieee->iw_mode == IW_MODE_MONITOR){ -+ ret= -1; -+ goto out; -+ } -+ -+ if(proto_started){ -+ ieee80211_stop_protocol(ieee); -+ } -+ -+ /* this is just to be sure that the GET wx callback -+ * has consisten infos. not needed otherwise -+ */ -+ spin_lock_irqsave(&ieee->lock, flags); -+ -+ if (wrqu->essid.flags && wrqu->essid.length) { -+ len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -+ strncpy(ieee->current_network.ssid, extra, len); -+ ieee->current_network.ssid_len = len; -+#else -+ strncpy(ieee->current_network.ssid, extra, len+1); -+ ieee->current_network.ssid_len = len+1; -+#endif -+ ieee->ssid_set = 1; -+ //YJ,add,080819,for hidden ap -+ if(len == 0){ -+ memset(ieee->current_network.bssid, 0, ETH_ALEN); -+ ieee->current_network.capability = 0; -+ } -+ //YJ,add,080819,for hidden ap,end -+ } -+ else{ -+ ieee->ssid_set = 0; -+ ieee->current_network.ssid[0] = '\0'; -+ ieee->current_network.ssid_len = 0; -+ } -+ -+ spin_unlock_irqrestore(&ieee->lock, flags); -+ -+ if (proto_started){ -+ ieee80211_start_protocol(ieee); -+ } -+out: -+ up(&ieee->wx_sem); -+ return ret; -+} -+ -+ int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a, -+ union iwreq_data *wrqu, char *b) -+{ -+ -+ wrqu->mode = ieee->iw_mode; -+ return 0; -+} -+ -+ int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ -+ int *parms = (int *)extra; -+ int enable = (parms[0] > 0); -+ short prev = ieee->raw_tx; -+ -+ down(&ieee->wx_sem); -+ -+ if(enable) -+ ieee->raw_tx = 1; -+ else -+ ieee->raw_tx = 0; -+ -+ printk(KERN_INFO"raw TX is %s\n", -+ ieee->raw_tx ? "enabled" : "disabled"); -+ -+ if(ieee->iw_mode == IW_MODE_MONITOR) -+ { -+ if(prev == 0 && ieee->raw_tx){ -+ if (ieee->data_hard_resume) -+ ieee->data_hard_resume(ieee->dev); -+ -+ netif_carrier_on(ieee->dev); -+ } -+ -+ if(prev && ieee->raw_tx == 1) -+ netif_carrier_off(ieee->dev); -+ } -+ -+ up(&ieee->wx_sem); -+ -+ return 0; -+} -+ -+int ieee80211_wx_get_name(struct ieee80211_device *ieee, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ strcpy(wrqu->name, "802.11"); -+ if(ieee->modulation & IEEE80211_CCK_MODULATION){ -+ strcat(wrqu->name, "b"); -+ if(ieee->modulation & IEEE80211_OFDM_MODULATION) -+ strcat(wrqu->name, "/g"); -+ }else if(ieee->modulation & IEEE80211_OFDM_MODULATION) -+ strcat(wrqu->name, "g"); -+ -+ if((ieee->state == IEEE80211_LINKED) || -+ (ieee->state == IEEE80211_LINKED_SCANNING)) -+ strcat(wrqu->name," linked"); -+ else if(ieee->state != IEEE80211_NOLINK) -+ strcat(wrqu->name," link.."); -+ -+ -+ return 0; -+} -+ -+ -+/* this is mostly stolen from hostap */ -+int ieee80211_wx_set_power(struct ieee80211_device *ieee, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ int ret = 0; -+ -+ if( -+ (!ieee->sta_wake_up) || -+ (!ieee->ps_request_tx_ack) || -+ (!ieee->enter_sleep_state) || -+ (!ieee->ps_is_queue_empty)){ -+ -+ printk("ERROR. PS mode is tryied to be use but\ -+driver missed a callback\n\n"); -+ -+ return -1; -+ } -+ -+ down(&ieee->wx_sem); -+ -+ if (wrqu->power.disabled){ -+ ieee->ps = IEEE80211_PS_DISABLED; -+ -+ goto exit; -+ } -+ switch (wrqu->power.flags & IW_POWER_MODE) { -+ case IW_POWER_UNICAST_R: -+ ieee->ps = IEEE80211_PS_UNICAST; -+ -+ break; -+ case IW_POWER_ALL_R: -+ ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST; -+ break; -+ -+ case IW_POWER_ON: -+ ieee->ps = IEEE80211_PS_DISABLED; -+ break; -+ -+ default: -+ ret = -EINVAL; -+ goto exit; -+ } -+ -+ if (wrqu->power.flags & IW_POWER_TIMEOUT) { -+ -+ ieee->ps_timeout = wrqu->power.value / 1000; -+ printk("Timeout %d\n",ieee->ps_timeout); -+ } -+ -+ if (wrqu->power.flags & IW_POWER_PERIOD) { -+ -+ ret = -EOPNOTSUPP; -+ goto exit; -+ //wrq->value / 1024; -+ -+ } -+exit: -+ up(&ieee->wx_sem); -+ return ret; -+ -+} -+ -+/* this is stolen from hostap */ -+int ieee80211_wx_get_power(struct ieee80211_device *ieee, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ int ret =0; -+ -+ down(&ieee->wx_sem); -+ -+ if(ieee->ps == IEEE80211_PS_DISABLED){ -+ wrqu->power.disabled = 1; -+ goto exit; -+ } -+ -+ wrqu->power.disabled = 0; -+ -+// if ((wrqu->power.flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { -+ wrqu->power.flags = IW_POWER_TIMEOUT; -+ wrqu->power.value = ieee->ps_timeout * 1000; -+// } else { -+// ret = -EOPNOTSUPP; -+// goto exit; -+ //wrqu->power.flags = IW_POWER_PERIOD; -+ //wrqu->power.value = ieee->current_network.dtim_period * -+ // ieee->current_network.beacon_interval * 1024; -+// } -+ -+ -+ if (ieee->ps & IEEE80211_PS_MBCAST) -+ wrqu->power.flags |= IW_POWER_ALL_R; -+ else -+ wrqu->power.flags |= IW_POWER_UNICAST_R; -+ -+exit: -+ up(&ieee->wx_sem); -+ return ret; -+ -+} -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) -+EXPORT_SYMBOL(ieee80211_wx_get_essid); -+EXPORT_SYMBOL(ieee80211_wx_set_essid); -+EXPORT_SYMBOL(ieee80211_wx_set_rate); -+EXPORT_SYMBOL(ieee80211_wx_get_rate); -+EXPORT_SYMBOL(ieee80211_wx_set_wap); -+EXPORT_SYMBOL(ieee80211_wx_get_wap); -+EXPORT_SYMBOL(ieee80211_wx_set_mode); -+EXPORT_SYMBOL(ieee80211_wx_get_mode); -+EXPORT_SYMBOL(ieee80211_wx_set_scan); -+EXPORT_SYMBOL(ieee80211_wx_get_freq); -+EXPORT_SYMBOL(ieee80211_wx_set_freq); -+EXPORT_SYMBOL(ieee80211_wx_set_rawtx); -+EXPORT_SYMBOL(ieee80211_wx_get_name); -+EXPORT_SYMBOL(ieee80211_wx_set_power); -+EXPORT_SYMBOL(ieee80211_wx_get_power); -+EXPORT_SYMBOL(ieee80211_wlan_frequencies); -+#else -+EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_essid); -+EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_essid); -+EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_rate); -+EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_rate); -+EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_wap); -+EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_wap); -+EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_mode); -+EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_mode); -+EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_scan); -+EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_freq); -+EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_freq); -+EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_rawtx); -+EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_name); -+EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_power); -+EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_power); -+EXPORT_SYMBOL_NOVERS(ieee80211_wlan_frequencies); -+#endif -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_tx.c linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_tx.c ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_tx.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_tx.c 2010-08-05 21:12:34.563623786 +0200 -@@ -0,0 +1,876 @@ -+/****************************************************************************** -+ -+ Copyright(c) 2003 - 2004 Intel Corporation. All rights reserved. -+ -+ This program is free software; you can redistribute it and/or modify it -+ under the terms of version 2 of the GNU General Public License as -+ published by the Free Software Foundation. -+ -+ This program is distributed in the hope that it will be useful, but WITHOUT -+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -+ more details. -+ -+ You should have received a copy of the GNU General Public License along with -+ this program; if not, write to the Free Software Foundation, Inc., 59 -+ Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+ The full GNU General Public License is included in this distribution in the -+ file called LICENSE. -+ -+ Contact Information: -+ James P. Ketrenos <ipw2100-admin@linux.intel.com> -+ Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 -+ -+****************************************************************************** -+ -+ Few modifications for Realtek's Wi-Fi drivers by -+ Andrea Merello <andreamrl@tiscali.it> -+ -+ A special thanks goes to Realtek for their support ! -+ -+******************************************************************************/ -+ -+#include <linux/compiler.h> -+//#include <linux/config.h> -+#include <linux/errno.h> -+#include <linux/if_arp.h> -+#include <linux/in6.h> -+#include <linux/in.h> -+#include <linux/ip.h> -+#include <linux/kernel.h> -+#include <linux/module.h> -+#include <linux/netdevice.h> -+#include <linux/pci.h> -+#include <linux/proc_fs.h> -+#include <linux/skbuff.h> -+#include <linux/slab.h> -+#include <linux/tcp.h> -+#include <linux/types.h> -+#include <linux/version.h> -+#include <linux/wireless.h> -+#include <linux/etherdevice.h> -+#include <asm/uaccess.h> -+#include <linux/if_vlan.h> -+ -+#include "ieee80211.h" -+ -+ -+/* -+ -+ -+802.11 Data Frame -+ -+ -+802.11 frame_contorl for data frames - 2 bytes -+ ,-----------------------------------------------------------------------------------------. -+bits | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | a | b | c | d | e | -+ |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------| -+val | 0 | 0 | 0 | 1 | x | 0 | 0 | 0 | 1 | 0 | x | x | x | x | x | -+ |----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|------| -+desc | ^-ver-^ | ^type-^ | ^-----subtype-----^ | to |from |more |retry| pwr |more |wep | -+ | | | x=0 data,x=1 data+ack | DS | DS |frag | | mgm |data | | -+ '-----------------------------------------------------------------------------------------' -+ /\ -+ | -+802.11 Data Frame | -+ ,--------- 'ctrl' expands to >-----------' -+ | -+ ,--'---,-------------------------------------------------------------. -+Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | -+ |------|------|---------|---------|---------|------|---------|------| -+Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | Frame | fcs | -+ | | tion | (BSSID) | | | ence | data | | -+ `--------------------------------------------------| |------' -+Total: 28 non-data bytes `----.----' -+ | -+ .- 'Frame data' expands to <---------------------------' -+ | -+ V -+ ,---------------------------------------------------. -+Bytes | 1 | 1 | 1 | 3 | 2 | 0-2304 | -+ |------|------|---------|----------|------|---------| -+Desc. | SNAP | SNAP | Control |Eth Tunnel| Type | IP | -+ | DSAP | SSAP | | | | Packet | -+ | 0xAA | 0xAA |0x03 (UI)|0x00-00-F8| | | -+ `-----------------------------------------| | -+Total: 8 non-data bytes `----.----' -+ | -+ .- 'IP Packet' expands, if WEP enabled, to <--' -+ | -+ V -+ ,-----------------------. -+Bytes | 4 | 0-2296 | 4 | -+ |-----|-----------|-----| -+Desc. | IV | Encrypted | ICV | -+ | | IP Packet | | -+ `-----------------------' -+Total: 8 non-data bytes -+ -+ -+802.3 Ethernet Data Frame -+ -+ ,-----------------------------------------. -+Bytes | 6 | 6 | 2 | Variable | 4 | -+ |-------|-------|------|-----------|------| -+Desc. | Dest. | Source| Type | IP Packet | fcs | -+ | MAC | MAC | | | | -+ `-----------------------------------------' -+Total: 18 non-data bytes -+ -+In the event that fragmentation is required, the incoming payload is split into -+N parts of size ieee->fts. The first fragment contains the SNAP header and the -+remaining packets are just data. -+ -+If encryption is enabled, each fragment payload size is reduced by enough space -+to add the prefix and postfix (IV and ICV totalling 8 bytes in the case of WEP) -+So if you have 1500 bytes of payload with ieee->fts set to 500 without -+encryption it will take 3 frames. With WEP it will take 4 frames as the -+payload of each frame is reduced to 492 bytes. -+ -+* SKB visualization -+* -+* ,- skb->data -+* | -+* | ETHERNET HEADER ,-<-- PAYLOAD -+* | | 14 bytes from skb->data -+* | 2 bytes for Type --> ,T. | (sizeof ethhdr) -+* | | | | -+* |,-Dest.--. ,--Src.---. | | | -+* | 6 bytes| | 6 bytes | | | | -+* v | | | | | | -+* 0 | v 1 | v | v 2 -+* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 -+* ^ | ^ | ^ | -+* | | | | | | -+* | | | | `T' <---- 2 bytes for Type -+* | | | | -+* | | '---SNAP--' <-------- 6 bytes for SNAP -+* | | -+* `-IV--' <-------------------- 4 bytes for IV (WEP) -+* -+* SNAP HEADER -+* -+*/ -+ -+static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; -+static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; -+ -+static inline int ieee80211_put_snap(u8 *data, u16 h_proto) -+{ -+ struct ieee80211_snap_hdr *snap; -+ u8 *oui; -+ -+ snap = (struct ieee80211_snap_hdr *)data; -+ snap->dsap = 0xaa; -+ snap->ssap = 0xaa; -+ snap->ctrl = 0x03; -+ -+ if (h_proto == 0x8137 || h_proto == 0x80f3) -+ oui = P802_1H_OUI; -+ else -+ oui = RFC1042_OUI; -+ snap->oui[0] = oui[0]; -+ snap->oui[1] = oui[1]; -+ snap->oui[2] = oui[2]; -+ -+ *(u16 *)(data + SNAP_SIZE) = htons(h_proto); -+ -+ return SNAP_SIZE + sizeof(u16); -+} -+ -+int ieee80211_encrypt_fragment( -+ struct ieee80211_device *ieee, -+ struct sk_buff *frag, -+ int hdr_len) -+{ -+ struct ieee80211_crypt_data* crypt = NULL;//ieee->crypt[ieee->tx_keyidx]; -+ int res;//, i; -+// printk("====>wwwwww%s():ieee:%x, hdr_len:%d\n", __FUNCTION__, ieee, hdr_len); -+/* printk("\n%s(), hdr_len:%d\n", __FUNCTION__, hdr_len); -+ for (i = 0; i < 48; i++) { -+ if (i % 16 == 0) printk("\n\t"); -+ printk("%2x ", *(frag->data+i)); -+ } -+*/ -+ -+#ifdef _RTL8187_EXT_PATCH_ -+#if 0 -+ i = ieee80211_find_MP(ieee, ((struct ieee80211_hdr*) frag->data)->addr1); -+ if (i== -1){ -+ printk("error find MP entry in %s()\n", __FUNCTION__); -+ return i; -+ } -+ // printk("%s():"MAC_FMT", find in index:%d\n", __FUNCTION__, MAC_ARG(((struct ieee80211_hdr*)frag->data)->addr1), i); -+#endif -+// crypt = ieee->cryptlist[MAX_MP-1]->crypt[ieee->tx_keyidx]; -+ crypt = ieee->cryptlist[0]->crypt[ieee->tx_keyidx]; -+#else -+ crypt = ieee->crypt[ieee->tx_keyidx]; -+#endif -+ /*added to care about null crypt condition, to solve that system hangs when shared keys error*/ -+ if (!crypt || !crypt->ops) -+ return -1; -+ -+#ifdef CONFIG_IEEE80211_CRYPT_TKIP -+ struct ieee80211_hdr *header; -+ -+ if (ieee->tkip_countermeasures && -+ crypt && crypt->ops && strcmp(crypt->ops->name, "TKIP") == 0) { -+ header = (struct ieee80211_hdr *) frag->data; -+ if (net_ratelimit()) { -+ printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " -+ "TX packet to " MAC_FMT "\n", -+ ieee->dev->name, MAC_ARG(header->addr1)); -+ } -+ return -1; -+ } -+#endif -+ /* To encrypt, frame format is: -+ * IV (4 bytes), clear payload (including SNAP), ICV (4 bytes) */ -+ -+ // PR: FIXME: Copied from hostap. Check fragmentation/MSDU/MPDU encryption. -+ /* Host-based IEEE 802.11 fragmentation for TX is not yet supported, so -+ * call both MSDU and MPDU encryption functions from here. */ -+ atomic_inc(&crypt->refcnt); -+ res = 0; -+ if (crypt->ops->encrypt_msdu) -+ res = crypt->ops->encrypt_msdu(frag, hdr_len, crypt->priv); -+ if (res == 0 && crypt->ops->encrypt_mpdu) -+ res = crypt->ops->encrypt_mpdu(frag, hdr_len, crypt->priv); -+ atomic_dec(&crypt->refcnt); -+ if (res < 0) { -+ printk(KERN_INFO "%s: Encryption failed: len=%d.\n", -+ ieee->dev->name, frag->len); -+ ieee->ieee_stats.tx_discards++; -+ return -1; -+ } -+ -+ return 0; -+} -+ -+ -+void ieee80211_txb_free(struct ieee80211_txb *txb) { -+ int i; -+ if (unlikely(!txb)) -+ return; -+ for (i = 0; i < txb->nr_frags; i++) -+ if (txb->fragments[i]) -+ dev_kfree_skb_any(txb->fragments[i]); -+ kfree(txb); -+} -+ -+struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size, -+ int gfp_mask) -+{ -+ struct ieee80211_txb *txb; -+ int i; -+ txb = kmalloc( -+ sizeof(struct ieee80211_txb) + (sizeof(u8*) * nr_frags), -+ gfp_mask); -+ if (!txb) -+ return NULL; -+ -+ memset(txb, 0, sizeof(struct ieee80211_txb)); -+ txb->nr_frags = nr_frags; -+ txb->frag_size = txb_size; -+ -+ for (i = 0; i < nr_frags; i++) { -+ txb->fragments[i] = dev_alloc_skb(txb_size); -+ if (unlikely(!txb->fragments[i])) { -+ i--; -+ break; -+ } -+ } -+ if (unlikely(i != nr_frags)) { -+ while (i >= 0) -+ dev_kfree_skb_any(txb->fragments[i--]); -+ kfree(txb); -+ return NULL; -+ } -+ return txb; -+} -+ -+// Classify the to-be send data packet -+// Need to acquire the sent queue index. -+static int -+ieee80211_classify(struct sk_buff *skb, struct ieee80211_network *network) -+{ -+ struct ether_header *eh = (struct ether_header*)skb->data; -+ unsigned int wme_UP = 0; -+ -+ if(!network->QoS_Enable) { -+ skb->priority = 0; -+ return(wme_UP); -+ } -+ -+ if(eh->ether_type == __constant_htons(ETHERTYPE_IP)) { -+ const struct iphdr *ih = (struct iphdr*)(skb->data + \ -+ sizeof(struct ether_header)); -+ wme_UP = (ih->tos >> 5)&0x07; -+ } else if (vlan_tx_tag_present(skb)) {//vtag packet -+#ifndef VLAN_PRI_SHIFT -+#define VLAN_PRI_SHIFT 13 /* Shift to find VLAN user priority */ -+#define VLAN_PRI_MASK 7 /* Mask for user priority bits in VLAN */ -+#endif -+ u32 tag = vlan_tx_tag_get(skb); -+ wme_UP = (tag >> VLAN_PRI_SHIFT) & VLAN_PRI_MASK; -+ } else if(ETH_P_PAE == ntohs(((struct ethhdr *)skb->data)->h_proto)) { -+ //printk(KERN_WARNING "type = normal packet\n"); -+ wme_UP = 7; -+ } -+ skb->priority = wme_UP; -+/* -+ if (network->QoS_Enable) { -+ skb->priority = wme_UP; -+ }else { -+ skb->priority = 0; -+ } -+*/ -+ return(wme_UP); -+} -+ -+#ifdef _RTL8187_EXT_PATCH_ -+// based on part of ieee80211_xmit. Mainly allocate txb. ieee->lock is held -+struct ieee80211_txb *ieee80211_ext_alloc_txb(struct sk_buff *skb, struct net_device *dev, struct ieee80211_hdr_3addr *header, int hdr_len, u8 isQoS, u16 *pQOS_ctl, int isEncrypt, struct ieee80211_crypt_data* crypt) -+{ -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) -+ struct ieee80211_device *ieee = netdev_priv(dev); -+#else -+ struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv; -+#endif -+ struct ieee80211_txb *txb = NULL; -+ struct ieee80211_hdr_3addr *frag_hdr; -+ int i, bytes_per_frag, nr_frags, bytes_last_frag, frag_size; -+ int ether_type; -+ int bytes, QOS_ctl; -+ struct sk_buff *skb_frag; -+ -+ ether_type = ntohs(((struct ethhdr *)skb->data)->h_proto); -+ -+ /* Advance the SKB to the start of the payload */ -+ skb_pull(skb, sizeof(struct ethhdr)); -+ -+ /* Determine total amount of storage required for TXB packets */ -+ bytes = skb->len + SNAP_SIZE + sizeof(u16); -+ -+ /* Determine fragmentation size based on destination (multicast -+ * and broadcast are not fragmented) */ -+ // if (is_multicast_ether_addr(dest) || -+ // is_broadcast_ether_addr(dest)) { -+ if (is_multicast_ether_addr(header->addr1) || -+ is_broadcast_ether_addr(header->addr1)) { -+ frag_size = MAX_FRAG_THRESHOLD; -+ QOS_ctl = QOS_CTL_NOTCONTAIN_ACK; -+ } -+ else { -+ //printk(KERN_WARNING "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&frag_size = %d\n", frag_size); -+ frag_size = ieee->fts;//default:392 -+ QOS_ctl = 0; -+ } -+ -+ if(isQoS) { -+ QOS_ctl |= skb->priority; //set in the ieee80211_classify -+ *pQOS_ctl = cpu_to_le16(QOS_ctl); -+ } -+ //printk(KERN_WARNING "header size = %d, QOS_ctl = %x\n", hdr_len,QOS_ctl); -+ /* Determine amount of payload per fragment. Regardless of if -+ * this stack is providing the full 802.11 header, one will -+ * eventually be affixed to this fragment -- so we must account for -+ * it when determining the amount of payload space. */ -+ //bytes_per_frag = frag_size - (IEEE80211_3ADDR_LEN + (ieee->current_network->QoS_Enable ? 2:0)); -+ bytes_per_frag = frag_size - hdr_len; -+ if (ieee->config & -+ (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) -+ bytes_per_frag -= IEEE80211_FCS_LEN; -+ -+ /* Each fragment may need to have room for encryptiong pre/postfix */ -+ if (isEncrypt) -+ bytes_per_frag -= crypt->ops->extra_prefix_len + -+ crypt->ops->extra_postfix_len; -+ -+ /* Number of fragments is the total bytes_per_frag / -+ * payload_per_fragment */ -+ nr_frags = bytes / bytes_per_frag; -+ bytes_last_frag = bytes % bytes_per_frag; -+ if (bytes_last_frag) -+ nr_frags++; -+ else -+ bytes_last_frag = bytes_per_frag; -+ -+ /* When we allocate the TXB we allocate enough space for the reserve -+ * and full fragment bytes (bytes_per_frag doesn't include prefix, -+ * postfix, header, FCS, etc.) */ -+ txb = ieee80211_alloc_txb(nr_frags, frag_size, GFP_ATOMIC); -+ if (unlikely(!txb)) { -+ printk(KERN_WARNING "%s: Could not allocate TXB\n", -+ ieee->dev->name); -+ return NULL; -+ } -+ txb->encrypted = isEncrypt; -+ txb->payload_size = bytes; -+ -+ for (i = 0; i < nr_frags; i++) { -+ skb_frag = txb->fragments[i]; -+ skb_frag->priority = UP2AC(skb->priority); -+ if (isEncrypt) -+ skb_reserve(skb_frag, crypt->ops->extra_prefix_len); -+ -+ frag_hdr = (struct ieee80211_hdr_3addr *)skb_put(skb_frag, hdr_len); -+ memcpy(frag_hdr, (void *)header, hdr_len); -+ -+ /* If this is not the last fragment, then add the MOREFRAGS -+ * bit to the frame control */ -+ if (i != nr_frags - 1) { -+ frag_hdr->frame_ctl = cpu_to_le16( -+ header->frame_ctl | IEEE80211_FCTL_MOREFRAGS); -+ bytes = bytes_per_frag; -+ -+ } else { -+ /* The last fragment takes the remaining length */ -+ bytes = bytes_last_frag; -+ } -+ -+ frag_hdr->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0]<<4 | i); -+ //frag_hdr->seq_ctl = cpu_to_le16(ieee->seq_ctrl<<4 | i); -+ // -+ -+ /* Put a SNAP header on the first fragment */ -+ if (i == 0) { -+ ieee80211_put_snap( -+ skb_put(skb_frag, SNAP_SIZE + sizeof(u16)), ether_type); -+ bytes -= SNAP_SIZE + sizeof(u16); -+ } -+ -+ memcpy(skb_put(skb_frag, bytes), skb->data, bytes); -+ -+ /* Advance the SKB... */ -+ skb_pull(skb, bytes); -+ -+ /* Encryption routine will move the header forward in order -+ * to insert the IV between the header and the payload */ -+ if (isEncrypt) -+ ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len); -+ if (ieee->config & -+ (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) -+ skb_put(skb_frag, 4); -+ } -+ // Advance sequence number in data frame. -+ //printk(KERN_WARNING "QoS Enalbed? %s\n", ieee->current_network.QoS_Enable?"Y":"N"); -+ if (ieee->seq_ctrl[0] == 0xFFF) -+ ieee->seq_ctrl[0] = 0; -+ else -+ ieee->seq_ctrl[0]++; -+ // stanley, just for debug -+/* -+{ -+ int j=0; -+ for(j=0;j<nr_frags;j++) -+ { -+ int i; -+ struct sk_buff *skb = txb->fragments[j]; -+ printk("send(%d): ", j); -+ for (i=0;i<skb->len;i++) -+ printk("%02X ", skb->data[i]&0xff); -+ printk("\n"); -+ } -+} -+*/ -+ -+ return txb; -+} -+ -+ -+// based on part of ieee80211_xmit. Mainly allocate txb. ieee->lock is held -+// Assume no encryption, no FCS computing -+struct ieee80211_txb *ieee80211_ext_reuse_txb(struct sk_buff *skb, struct net_device *dev, struct ieee80211_hdr_3addr *header, int hdr_len, u8 isQoS, u16 *pQOS_ctl, int isEncrypt, struct ieee80211_crypt_data* crypt) -+{ -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) -+ struct ieee80211_device *ieee = netdev_priv(dev); -+#else -+ struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv; -+#endif -+ struct ieee80211_txb *txb = NULL; -+ struct ieee80211_hdr_3addr *frag_hdr; -+ int ether_type; -+ int bytes, QOS_ctl; -+ -+ ether_type = ntohs(((struct ethhdr *)skb->data)->h_proto); -+ -+ /* Advance the SKB to the start of the payload */ -+ skb_pull(skb, sizeof(struct ethhdr)); -+ -+ /* Determine total amount of storage required for TXB packets */ -+ bytes = skb->len + SNAP_SIZE + sizeof(u16); -+ -+ if (is_multicast_ether_addr(header->addr1) || -+ is_broadcast_ether_addr(header->addr1)) { -+ QOS_ctl = QOS_CTL_NOTCONTAIN_ACK; -+ } -+ else { -+ QOS_ctl = 0; -+ } -+ -+ if(isQoS) { -+ QOS_ctl |= skb->priority; //set in the ieee80211_classify -+ *pQOS_ctl = cpu_to_le16(QOS_ctl); -+ } -+ -+ txb = kmalloc( sizeof(struct ieee80211_txb) + sizeof(u8*), GFP_ATOMIC ); -+ if (unlikely(!txb)) { -+ printk(KERN_WARNING "%s: Could not allocate TXB\n", -+ ieee->dev->name); -+ return NULL; -+ } -+ -+ txb->nr_frags = 1; -+ txb->frag_size = bytes; -+ txb->encrypted = isEncrypt; -+ txb->payload_size = bytes; -+ -+ txb->fragments[0] = skb; -+ ieee80211_put_snap( -+ skb_push(skb, SNAP_SIZE + sizeof(u16)), ether_type); -+ frag_hdr = (struct ieee80211_hdr_3addr *)skb_push(skb, hdr_len); -+ memcpy(frag_hdr, (void *)header, hdr_len); -+ frag_hdr->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0]<<4 | 0); -+ skb->priority = UP2AC(skb->priority); -+ if(isEncrypt) -+ ieee80211_encrypt_fragment(ieee,skb,hdr_len); -+ -+ // Advance sequence number in data frame. -+ //printk(KERN_WARNING "QoS Enalbed? %s\n", ieee->current_network.QoS_Enable?"Y":"N"); -+ if (ieee->seq_ctrl[0] == 0xFFF) -+ ieee->seq_ctrl[0] = 0; -+ else -+ ieee->seq_ctrl[0]++; -+ -+ return txb; -+} -+ -+#endif // _RTL8187_EXT_PATCH_ -+ -+/* SKBs are added to the ieee->tx_queue. */ -+int ieee80211_xmit(struct sk_buff *skb, -+ struct net_device *dev) -+{ -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) -+ struct ieee80211_device *ieee = netdev_priv(dev); -+#else -+ struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv; -+#endif -+ struct ieee80211_txb *txb = NULL; -+ struct ieee80211_hdr_3addr_QOS *frag_hdr; -+ int i, bytes_per_frag, nr_frags, bytes_last_frag, frag_size; -+ unsigned long flags; -+ struct net_device_stats *stats = &ieee->stats; -+ int ether_type, encrypt; -+ int bytes, fc, QOS_ctl, hdr_len; -+ struct sk_buff *skb_frag; -+ //struct ieee80211_hdr header = { /* Ensure zero initialized */ -+ // .duration_id = 0, -+ // .seq_ctl = 0 -+ //}; -+ struct ieee80211_hdr_3addr_QOS header = { /* Ensure zero initialized */ -+ .duration_id = 0, -+ .seq_ctl = 0, -+ .QOS_ctl = 0 -+ }; -+ u8 dest[ETH_ALEN], src[ETH_ALEN]; -+ -+ struct ieee80211_crypt_data* crypt; -+ -+ //printk(KERN_WARNING "upper layer packet!\n"); -+ spin_lock_irqsave(&ieee->lock, flags); -+ -+ /* If there is no driver handler to take the TXB, dont' bother -+ * creating it... */ -+ if ((!ieee->hard_start_xmit && !(ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE))|| -+ ((!ieee->softmac_data_hard_start_xmit && (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)))) { -+ printk(KERN_WARNING "%s: No xmit handler.\n", -+ ieee->dev->name); -+ goto success; -+ } -+ -+ ieee80211_classify(skb,&ieee->current_network); -+ if(likely(ieee->raw_tx == 0)){ -+ -+ if (unlikely(skb->len < SNAP_SIZE + sizeof(u16))) { -+ printk(KERN_WARNING "%s: skb too small (%d).\n", -+ ieee->dev->name, skb->len); -+ goto success; -+ } -+ -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ // note, skb->priority which was set by ieee80211_classify, and used by physical tx -+ if((ieee->iw_mode == ieee->iw_ext_mode) && (ieee->ext_patch_ieee80211_xmit)) -+ { -+ txb = ieee->ext_patch_ieee80211_xmit(skb, dev); -+ goto success; -+ } -+#endif -+ -+ ether_type = ntohs(((struct ethhdr *)skb->data)->h_proto); -+#ifdef _RTL8187_EXT_PATCH_ -+ crypt = ieee->cryptlist[0]->crypt[ieee->tx_keyidx]; -+#else -+ crypt = ieee->crypt[ieee->tx_keyidx]; -+#endif -+ encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) && -+ ieee->host_encrypt && crypt && crypt->ops; -+ -+ if (!encrypt && ieee->ieee802_1x && -+ ieee->drop_unencrypted && ether_type != ETH_P_PAE) { -+ stats->tx_dropped++; -+ goto success; -+ } -+ -+ #ifdef CONFIG_IEEE80211_DEBUG -+ if (crypt && !encrypt && ether_type == ETH_P_PAE) { -+ struct eapol *eap = (struct eapol *)(skb->data + -+ sizeof(struct ethhdr) - SNAP_SIZE - sizeof(u16)); -+ IEEE80211_DEBUG_EAP("TX: IEEE 802.11 EAPOL frame: %s\n", -+ eap_get_type(eap->type)); -+ } -+ #endif -+ -+ /* Save source and destination addresses */ -+ memcpy(&dest, skb->data, ETH_ALEN); -+ memcpy(&src, skb->data+ETH_ALEN, ETH_ALEN); -+ -+ /* Advance the SKB to the start of the payload */ -+ skb_pull(skb, sizeof(struct ethhdr)); -+ -+ /* Determine total amount of storage required for TXB packets */ -+ bytes = skb->len + SNAP_SIZE + sizeof(u16); -+ -+ if(ieee->current_network.QoS_Enable) { -+ if (encrypt) -+ fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_DATA | -+ IEEE80211_FCTL_WEP; -+ else -+ fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_DATA; -+ -+ } else { -+ if (encrypt) -+ fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA | -+ IEEE80211_FCTL_WEP; -+ else -+ fc = IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA; -+ } -+ -+ if (ieee->iw_mode == IW_MODE_INFRA) { -+ fc |= IEEE80211_FCTL_TODS; -+ /* To DS: Addr1 = BSSID, Addr2 = SA, -+ Addr3 = DA */ -+ memcpy(&header.addr1, ieee->current_network.bssid, ETH_ALEN); -+ memcpy(&header.addr2, &src, ETH_ALEN); -+ memcpy(&header.addr3, &dest, ETH_ALEN); -+ } else if (ieee->iw_mode == IW_MODE_ADHOC) { -+ /* not From/To DS: Addr1 = DA, Addr2 = SA, -+ Addr3 = BSSID */ -+ memcpy(&header.addr1, dest, ETH_ALEN); -+ memcpy(&header.addr2, src, ETH_ALEN); -+ memcpy(&header.addr3, ieee->current_network.bssid, ETH_ALEN); -+ } -+ // printk(KERN_WARNING "essid MAC address is "MAC_FMT, MAC_ARG(&header.addr1)); -+ header.frame_ctl = cpu_to_le16(fc); -+ //hdr_len = IEEE80211_3ADDR_LEN; -+ -+ /* Determine fragmentation size based on destination (multicast -+ * and broadcast are not fragmented) */ -+// if (is_multicast_ether_addr(dest) || -+// is_broadcast_ether_addr(dest)) { -+ if (is_multicast_ether_addr(header.addr1) || -+ is_broadcast_ether_addr(header.addr1)) { -+ frag_size = MAX_FRAG_THRESHOLD; -+ QOS_ctl = QOS_CTL_NOTCONTAIN_ACK; -+ } -+ else { -+ //printk(KERN_WARNING "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&frag_size = %d\n", frag_size); -+ frag_size = ieee->fts;//default:392 -+ QOS_ctl = 0; -+ } -+ -+ if (ieee->current_network.QoS_Enable) { -+ hdr_len = IEEE80211_3ADDR_LEN + 2; -+ QOS_ctl |= skb->priority; //set in the ieee80211_classify -+ header.QOS_ctl = cpu_to_le16(QOS_ctl); -+ } else { -+ hdr_len = IEEE80211_3ADDR_LEN; -+ } -+ //printk(KERN_WARNING "header size = %d, QOS_ctl = %x\n", hdr_len,QOS_ctl); -+ /* Determine amount of payload per fragment. Regardless of if -+ * this stack is providing the full 802.11 header, one will -+ * eventually be affixed to this fragment -- so we must account for -+ * it when determining the amount of payload space. */ -+ //bytes_per_frag = frag_size - (IEEE80211_3ADDR_LEN + (ieee->current_network->QoS_Enable ? 2:0)); -+ bytes_per_frag = frag_size - hdr_len; -+ if (ieee->config & -+ (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) -+ bytes_per_frag -= IEEE80211_FCS_LEN; -+ -+ /* Each fragment may need to have room for encryptiong pre/postfix */ -+ if (encrypt) -+ bytes_per_frag -= crypt->ops->extra_prefix_len + -+ crypt->ops->extra_postfix_len; -+ -+ /* Number of fragments is the total bytes_per_frag / -+ * payload_per_fragment */ -+ nr_frags = bytes / bytes_per_frag; -+ bytes_last_frag = bytes % bytes_per_frag; -+ if (bytes_last_frag) -+ nr_frags++; -+ else -+ bytes_last_frag = bytes_per_frag; -+ -+ /* When we allocate the TXB we allocate enough space for the reserve -+ * and full fragment bytes (bytes_per_frag doesn't include prefix, -+ * postfix, header, FCS, etc.) */ -+ txb = ieee80211_alloc_txb(nr_frags, frag_size, GFP_ATOMIC); -+ if (unlikely(!txb)) { -+ printk(KERN_WARNING "%s: Could not allocate TXB\n", -+ ieee->dev->name); -+ goto failed; -+ } -+ txb->encrypted = encrypt; -+ txb->payload_size = bytes; -+ -+ for (i = 0; i < nr_frags; i++) { -+ skb_frag = txb->fragments[i]; -+ skb_frag->priority = UP2AC(skb->priority); -+ if (encrypt) -+ skb_reserve(skb_frag, crypt->ops->extra_prefix_len); -+ -+ frag_hdr = (struct ieee80211_hdr_3addr_QOS *)skb_put(skb_frag, hdr_len); -+ memcpy(frag_hdr, &header, hdr_len); -+ -+ /* If this is not the last fragment, then add the MOREFRAGS -+ * bit to the frame control */ -+ if (i != nr_frags - 1) { -+ frag_hdr->frame_ctl = cpu_to_le16( -+ fc | IEEE80211_FCTL_MOREFRAGS); -+ bytes = bytes_per_frag; -+ -+ } else { -+ /* The last fragment takes the remaining length */ -+ bytes = bytes_last_frag; -+ } -+ if(ieee->current_network.QoS_Enable) { -+ // add 1 only indicate to corresponding seq number control 2006/7/12 -+ frag_hdr->seq_ctl = cpu_to_le16(ieee->seq_ctrl[UP2AC(skb->priority)+1]<<4 | i); -+ //printk(KERN_WARNING "skb->priority = %d,", skb->priority); -+ //printk(KERN_WARNING "type:%d: seq = %d\n",UP2AC(skb->priority),ieee->seq_ctrl[UP2AC(skb->priority)+1]); -+ } else { -+ frag_hdr->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0]<<4 | i); -+ } -+ //frag_hdr->seq_ctl = cpu_to_le16(ieee->seq_ctrl<<4 | i); -+ // -+ -+ /* Put a SNAP header on the first fragment */ -+ if (i == 0) { -+ ieee80211_put_snap( -+ skb_put(skb_frag, SNAP_SIZE + sizeof(u16)), -+ ether_type); -+ bytes -= SNAP_SIZE + sizeof(u16); -+ } -+ -+ memcpy(skb_put(skb_frag, bytes), skb->data, bytes); -+ -+ /* Advance the SKB... */ -+ skb_pull(skb, bytes); -+ -+ /* Encryption routine will move the header forward in order -+ * to insert the IV between the header and the payload */ -+ if (encrypt) -+ ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len); -+ if (ieee->config & -+ (CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS)) -+ skb_put(skb_frag, 4); -+ } -+ // Advance sequence number in data frame. -+ //printk(KERN_WARNING "QoS Enalbed? %s\n", ieee->current_network.QoS_Enable?"Y":"N"); -+ if (ieee->current_network.QoS_Enable) { -+ if (ieee->seq_ctrl[UP2AC(skb->priority) + 1] == 0xFFF) -+ ieee->seq_ctrl[UP2AC(skb->priority) + 1] = 0; -+ else -+ ieee->seq_ctrl[UP2AC(skb->priority) + 1]++; -+ } else { -+ if (ieee->seq_ctrl[0] == 0xFFF) -+ ieee->seq_ctrl[0] = 0; -+ else -+ ieee->seq_ctrl[0]++; -+ } -+ //--- -+ }else{ -+ if (unlikely(skb->len < sizeof(struct ieee80211_hdr_3addr))) { -+ printk(KERN_WARNING "%s: skb too small (%d).\n", -+ ieee->dev->name, skb->len); -+ goto success; -+ } -+ -+ txb = ieee80211_alloc_txb(1, skb->len, GFP_ATOMIC); -+ if(!txb){ -+ printk(KERN_WARNING "%s: Could not allocate TXB\n", -+ ieee->dev->name); -+ goto failed; -+ } -+ -+ txb->encrypted = 0; -+ txb->payload_size = skb->len; -+ memcpy(skb_put(txb->fragments[0],skb->len), skb->data, skb->len); -+ } -+ -+ success: -+ spin_unlock_irqrestore(&ieee->lock, flags); -+#ifdef _RTL8187_EXT_PATCH_ -+ // Sometimes, extension mode can reuse skb (by txb->fragments[0]) -+ if( ! ((ieee->iw_mode == ieee->iw_ext_mode) && txb && (txb->fragments[0] == skb)) ) -+#endif -+ dev_kfree_skb_any(skb); -+ if (txb) { -+ if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE){ -+ ieee80211_softmac_xmit(txb, ieee); -+ }else{ -+ if ((*ieee->hard_start_xmit)(txb, dev) == 0) { -+ stats->tx_packets++; -+ stats->tx_bytes += txb->payload_size; -+ return 0; -+ } -+ ieee80211_txb_free(txb); -+ } -+ } -+ -+ return 0; -+ -+ failed: -+ spin_unlock_irqrestore(&ieee->lock, flags); -+ netif_stop_queue(dev); -+ printk("netif_stop_queue in ieee80211_xmit \n"); -+ stats->tx_errors++; -+ return 1; -+ -+} -+ -+ -+ -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) -+EXPORT_SYMBOL(ieee80211_txb_free); -+#ifdef _RTL8187_EXT_PATCH_ -+EXPORT_SYMBOL(ieee80211_alloc_txb); -+EXPORT_SYMBOL(ieee80211_ext_alloc_txb); -+EXPORT_SYMBOL(ieee80211_ext_reuse_txb); -+ -+EXPORT_SYMBOL(ieee80211_encrypt_fragment); -+#endif // _RTL8187_EXT_PATCH_ -+#else -+EXPORT_SYMBOL_NOVERS(ieee80211_txb_free); -+#ifdef _RTL8187_EXT_PATCH_ -+EXPORT_SYMBOL_NOVERS(ieee80211_alloc_txb); -+EXPORT_SYMBOL_NOVERS(ieee80211_ext_reuse_txb); -+ -+EXPORT_SYMBOL_NOVERS(ieee80211_encrypt_fragment); -+#endif // _RTL8187_EXT_PATCH_ -+#endif -+ -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_wx.c linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_wx.c ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_wx.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/ieee80211_wx.c 2010-08-05 21:12:34.603620591 +0200 -@@ -0,0 +1,926 @@ -+/****************************************************************************** -+ -+ Copyright(c) 2004 Intel Corporation. All rights reserved. -+ -+ Portions of this file are based on the WEP enablement code provided by the -+ Host AP project hostap-drivers v0.1.3 -+ Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen -+ <jkmaline@cc.hut.fi> -+ Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> -+ -+ This program is free software; you can redistribute it and/or modify it -+ under the terms of version 2 of the GNU General Public License as -+ published by the Free Software Foundation. -+ -+ This program is distributed in the hope that it will be useful, but WITHOUT -+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -+ more details. -+ -+ You should have received a copy of the GNU General Public License along with -+ this program; if not, write to the Free Software Foundation, Inc., 59 -+ Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+ The full GNU General Public License is included in this distribution in the -+ file called LICENSE. -+ -+ Contact Information: -+ James P. Ketrenos <ipw2100-admin@linux.intel.com> -+ Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 -+ -+******************************************************************************/ -+#include <linux/wireless.h> -+#include <linux/version.h> -+#include <linux/kmod.h> -+#include <linux/module.h> -+ -+#include "ieee80211.h" -+static const char *ieee80211_modes[] = { -+ "?", "a", "b", "ab", "g", "ag", "bg", "abg" -+}; -+ -+#define MAX_CUSTOM_LEN 64 -+static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, -+ char *start, char *stop, -+ struct ieee80211_network *network, -+ struct iw_request_info *info) -+{ -+ char custom[MAX_CUSTOM_LEN]; -+ char *p; -+ struct iw_event iwe; -+ int i, j; -+ u8 max_rate, rate; -+ -+ /* First entry *MUST* be the AP MAC address */ -+ iwe.cmd = SIOCGIWAP; -+ iwe.u.ap_addr.sa_family = ARPHRD_ETHER; -+ memcpy(iwe.u.ap_addr.sa_data, network->bssid, ETH_ALEN); -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) || defined (QMI_26_6)) -+ start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_ADDR_LEN); -+#else -+ start = iwe_stream_add_event(start, stop, &iwe, IW_EV_ADDR_LEN); -+#endif -+ /* Remaining entries will be displayed in the order we provide them */ -+ -+ /* Add the ESSID */ -+ iwe.cmd = SIOCGIWESSID; -+ iwe.u.data.flags = 1; -+ //YJ,modified,080903,for hidden ap -+ //if (network->flags & NETWORK_EMPTY_ESSID) { -+ if (network->ssid_len == 0) { -+ iwe.u.data.length = sizeof("<hidden>"); -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) || defined (QMI_26_6)) -+ start = iwe_stream_add_point(info, start, stop, &iwe, "<hidden>"); -+#else -+ start = iwe_stream_add_point(start, stop, &iwe, "<hidden>"); -+#endif -+ } else { -+ iwe.u.data.length = min(network->ssid_len, (u8)32); -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) || defined (QMI_26_6)) -+ start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid); -+#else -+ start = iwe_stream_add_point(start, stop, &iwe, network->ssid); -+#endif -+ } -+ -+ /* Add the protocol name */ -+ iwe.cmd = SIOCGIWNAME; -+ snprintf(iwe.u.name, IFNAMSIZ, "IEEE 802.11%s", ieee80211_modes[network->mode]); -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) || defined (QMI_26_6)) -+ start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_CHAR_LEN); -+#else -+ start = iwe_stream_add_event(start, stop, &iwe, IW_EV_CHAR_LEN); -+#endif -+ /* Add mode */ -+ iwe.cmd = SIOCGIWMODE; -+ if (network->capability & -+ (WLAN_CAPABILITY_BSS | WLAN_CAPABILITY_IBSS)) { -+ if (network->capability & WLAN_CAPABILITY_BSS) -+ iwe.u.mode = IW_MODE_MASTER; -+ else -+ iwe.u.mode = IW_MODE_ADHOC; -+ -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) || defined (QMI_26_6)) -+ start = iwe_stream_add_event(info, start, stop, &iwe, -+ IW_EV_UINT_LEN); -+#else -+ start = iwe_stream_add_event(start, stop, &iwe, -+ IW_EV_UINT_LEN); -+#endif -+ } -+ -+ /* Add frequency/channel */ -+ iwe.cmd = SIOCGIWFREQ; -+/* iwe.u.freq.m = ieee80211_frequency(network->channel, network->mode); -+ iwe.u.freq.e = 3; */ -+ iwe.u.freq.m = network->channel; -+ iwe.u.freq.e = 0; -+ iwe.u.freq.i = 0; -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) || defined (QMI_26_6)) -+ start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_FREQ_LEN); -+#else -+ start = iwe_stream_add_event(start, stop, &iwe, IW_EV_FREQ_LEN); -+#endif -+ /* Add encryption capability */ -+ iwe.cmd = SIOCGIWENCODE; -+ if (network->capability & WLAN_CAPABILITY_PRIVACY) -+ iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; -+ else -+ iwe.u.data.flags = IW_ENCODE_DISABLED; -+ iwe.u.data.length = 0; -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) || defined (QMI_26_6)) -+ start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid); -+#else -+ start = iwe_stream_add_point(start, stop, &iwe, network->ssid); -+#endif -+ /* Add basic and extended rates */ -+ max_rate = 0; -+ p = custom; -+ p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), " Rates (Mb/s): "); -+ for (i = 0, j = 0; i < network->rates_len; ) { -+ if (j < network->rates_ex_len && -+ ((network->rates_ex[j] & 0x7F) < -+ (network->rates[i] & 0x7F))) -+ rate = network->rates_ex[j++] & 0x7F; -+ else -+ rate = network->rates[i++] & 0x7F; -+ if (rate > max_rate) -+ max_rate = rate; -+ p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), -+ "%d%s ", rate >> 1, (rate & 1) ? ".5" : ""); -+ } -+ for (; j < network->rates_ex_len; j++) { -+ rate = network->rates_ex[j] & 0x7F; -+ p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), -+ "%d%s ", rate >> 1, (rate & 1) ? ".5" : ""); -+ if (rate > max_rate) -+ max_rate = rate; -+ } -+ -+ iwe.cmd = SIOCGIWRATE; -+ iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; -+ iwe.u.bitrate.value = max_rate * 500000; -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) || defined (QMI_26_6)) -+ start = iwe_stream_add_event(info, start, stop, &iwe,IW_EV_PARAM_LEN); -+#else -+ start = iwe_stream_add_event(start, stop, &iwe,IW_EV_PARAM_LEN); -+#endif -+ iwe.cmd = IWEVCUSTOM; -+ iwe.u.data.length = p - custom; -+ if (iwe.u.data.length) -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) || defined (QMI_26_6)) -+ start = iwe_stream_add_point(info, start, stop, &iwe, custom); -+#else -+ start = iwe_stream_add_point(start, stop, &iwe, custom); -+#endif -+ /* Add quality statistics */ -+ /* TODO: Fix these values... */ -+ iwe.cmd = IWEVQUAL; -+ iwe.u.qual.qual = network->stats.signalstrength;//network->stats.signal; -+ iwe.u.qual.level = network->stats.signal;//network->stats.rssi; -+ iwe.u.qual.noise = network->stats.noise; -+#if 0 -+ iwe.u.qual.updated = network->stats.mask & IEEE80211_STATMASK_WEMASK; -+ if (!(network->stats.mask & IEEE80211_STATMASK_RSSI)) -+ iwe.u.qual.updated |= IW_QUAL_LEVEL_INVALID; -+ if (!(network->stats.mask & IEEE80211_STATMASK_NOISE)) -+ iwe.u.qual.updated |= IW_QUAL_NOISE_INVALID; -+ if (!(network->stats.mask & IEEE80211_STATMASK_SIGNAL)) -+ iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID; -+#endif -+ -+ iwe.u.qual.updated = 0x7;//network->stats.mask & IEEE80211_STATMASK_WEMASK; -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) || defined (QMI_26_6)) -+ start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_QUAL_LEN); -+#else -+ start = iwe_stream_add_event(start, stop, &iwe, IW_EV_QUAL_LEN); -+#endif -+ iwe.cmd = IWEVCUSTOM; -+ p = custom; -+ -+ iwe.u.data.length = p - custom; -+ if (iwe.u.data.length) -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) || defined (QMI_26_6)) -+ start = iwe_stream_add_point(info, start, stop, &iwe, custom); -+#else -+ start = iwe_stream_add_point(start, stop, &iwe, custom); -+#endif -+#if 0 -+ if (ieee->wpa_enabled && network->wpa_ie_len){ -+ char buf[MAX_WPA_IE_LEN * 2 + 30]; -+ // printk("WPA IE\n"); -+ u8 *p = buf; -+ p += sprintf(p, "wpa_ie="); -+ for (i = 0; i < network->wpa_ie_len; i++) { -+ p += sprintf(p, "%02x", network->wpa_ie[i]); -+ } -+ -+ memset(&iwe, 0, sizeof(iwe)); -+ iwe.cmd = IWEVCUSTOM; -+ iwe.u.data.length = strlen(buf); -+ start = iwe_stream_add_point(start, stop, &iwe, buf); -+ } -+ -+ if (ieee->wpa_enabled && network->rsn_ie_len){ -+ char buf[MAX_WPA_IE_LEN * 2 + 30]; -+ -+ u8 *p = buf; -+ p += sprintf(p, "rsn_ie="); -+ for (i = 0; i < network->rsn_ie_len; i++) { -+ p += sprintf(p, "%02x", network->rsn_ie[i]); -+ } -+ -+ -+#else -+ memset(&iwe, 0, sizeof(iwe)); -+ if (network->wpa_ie_len) { -+ //printk("wpa_ie_len:%d\n", network->wpa_ie_len); -+ char buf[MAX_WPA_IE_LEN]; -+ memcpy(buf, network->wpa_ie, network->wpa_ie_len); -+ iwe.cmd = IWEVGENIE; -+ iwe.u.data.length = network->wpa_ie_len; -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) || defined (QMI_26_6)) -+ start = iwe_stream_add_point(info, start, stop, &iwe, buf); -+#else -+ start = iwe_stream_add_point(start, stop, &iwe, buf); -+#endif -+ } -+ -+ memset(&iwe, 0, sizeof(iwe)); -+ if (network->rsn_ie_len) { -+ //printk("=====>rsn_ie_len:\n", network->rsn_ie_len); -+ #if 0 -+ { -+ int i; -+ for (i=0; i<network->rsn_ie_len; i++); -+ printk("%2x ", network->rsn_ie[i]); -+ printk("\n"); -+ } -+ #endif -+ char buf[MAX_WPA_IE_LEN]; -+ memcpy(buf, network->rsn_ie, network->rsn_ie_len); -+ iwe.cmd = IWEVGENIE; -+ iwe.u.data.length = network->rsn_ie_len; -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) || defined (QMI_26_6)) -+ start = iwe_stream_add_point(info, start, stop, &iwe, buf); -+#else -+ start = iwe_stream_add_point(start, stop, &iwe, buf); -+#endif -+ } -+ -+#endif -+ -+ /* Add EXTRA: Age to display seconds since last beacon/probe response -+ * for given network. */ -+ iwe.cmd = IWEVCUSTOM; -+ p = custom; -+ p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), -+ " Last beacon: %lums ago", (jiffies - network->last_scanned) / (HZ / 100)); -+ iwe.u.data.length = p - custom; -+ if (iwe.u.data.length) -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) || defined (QMI_26_6)) -+ start = iwe_stream_add_point(info, start, stop, &iwe, custom); -+#else -+ start = iwe_stream_add_point(start, stop, &iwe, custom); -+#endif -+ -+ return start; -+} -+ -+int ieee80211_wx_get_scan(struct ieee80211_device *ieee, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct ieee80211_network *network; -+ unsigned long flags; -+ int err = 0; -+ char *ev = extra; -+ char *stop = ev + wrqu->data.length;//IW_SCAN_MAX_DATA; -+ //char *stop = ev + IW_SCAN_MAX_DATA; -+ int i = 0; -+ -+ IEEE80211_DEBUG_WX("Getting scan\n"); -+ down(&ieee->wx_sem); -+ spin_lock_irqsave(&ieee->lock, flags); -+ -+ if(!ieee->bHwRadioOff) -+ { -+ list_for_each_entry(network, &ieee->network_list, list) { -+ i++; -+ -+ if((stop-ev)<200) -+ { -+ err = -E2BIG; -+ break; -+ } -+ -+ if (ieee->scan_age == 0 || -+ time_after(network->last_scanned + ieee->scan_age, jiffies)) -+ { -+ ev = rtl819x_translate_scan(ieee, ev, stop, network, info); -+ } -+ else -+ IEEE80211_DEBUG_SCAN( -+ "Not showing network '%s (" -+ MAC_FMT ")' due to age (%lums).\n", -+ escape_essid(network->ssid, -+ network->ssid_len), -+ MAC_ARG(network->bssid), -+ (jiffies - network->last_scanned) / (HZ / 100)); -+ } -+ } -+ spin_unlock_irqrestore(&ieee->lock, flags); -+ up(&ieee->wx_sem); -+ wrqu->data.length = ev - extra; -+ wrqu->data.flags = 0; -+ -+ IEEE80211_DEBUG_WX("exit: %d networks returned.\n", i); -+ -+ return err; -+} -+ -+int ieee80211_wx_set_encode(struct ieee80211_device *ieee, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *keybuf) -+{ -+ struct iw_point *erq = &(wrqu->encoding); -+ struct net_device *dev = ieee->dev; -+ struct ieee80211_security sec = { -+ .flags = 0 -+ }; -+ int i, key, key_provided, len; -+ struct ieee80211_crypt_data **crypt; -+ -+ IEEE80211_DEBUG_WX("SET_ENCODE\n"); -+ -+ key = erq->flags & IW_ENCODE_INDEX; -+ if (key) { -+ if (key > WEP_KEYS) -+ return -EINVAL; -+ key--; -+ key_provided = 1; -+ } else { -+ key_provided = 0; -+ key = ieee->tx_keyidx; -+ } -+ -+ IEEE80211_DEBUG_WX("Key: %d [%s]\n", key, key_provided ? -+ "provided" : "default"); -+#ifdef _RTL8187_EXT_PATCH_ -+#if 0 -+{ -+ int j; -+ for(j=0; j<MAX_MP; j++){ -+ crypt = &ieee->cryptlist[j]->crypt[key]; -+#else -+ crypt = &ieee->cryptlist[0]->crypt[key]; -+#endif -+#else -+ crypt = &ieee->crypt[key]; -+#endif -+ if (erq->flags & IW_ENCODE_DISABLED) { -+ if (key_provided && *crypt) { -+ IEEE80211_DEBUG_WX("Disabling encryption on key %d.\n", -+ key); -+ ieee80211_crypt_delayed_deinit(ieee, crypt); -+ } else -+ IEEE80211_DEBUG_WX("Disabling encryption.\n"); -+ -+ /* Check all the keys to see if any are still configured, -+ * and if no key index was provided, de-init them all */ -+ for (i = 0; i < WEP_KEYS; i++) { -+#ifdef _RTL8187_EXT_PATCH_ -+ -+ if (ieee->cryptlist[0]->crypt[i] != NULL){ -+#else -+ -+ if (ieee->crypt[i] != NULL) { -+#endif -+ if (key_provided) -+ break; -+ ieee80211_crypt_delayed_deinit( -+#ifdef _RTL8187_EXT_PATCH_ -+ ieee, &ieee->cryptlist[0]->crypt[i]); -+#else -+ ieee, &ieee->crypt[i]); -+#endif -+ } -+ } -+ -+ if (i == WEP_KEYS) { -+ sec.enabled = 0; -+ sec.level = SEC_LEVEL_0; -+ sec.flags |= SEC_ENABLED | SEC_LEVEL; -+ } -+ -+ goto done; -+ } -+ -+ -+ -+ sec.enabled = 1; -+ sec.flags |= SEC_ENABLED; -+ -+ if (*crypt != NULL && (*crypt)->ops != NULL && -+ strcmp((*crypt)->ops->name, "WEP") != 0) { -+ /* changing to use WEP; deinit previously used algorithm -+ * on this key */ -+ ieee80211_crypt_delayed_deinit(ieee, crypt); -+ } -+ -+ if (*crypt == NULL) { -+ struct ieee80211_crypt_data *new_crypt; -+ -+ /* take WEP into use */ -+ new_crypt = kmalloc(sizeof(struct ieee80211_crypt_data), -+ GFP_KERNEL); -+ if (new_crypt == NULL) -+ return -ENOMEM; -+ memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data)); -+ new_crypt->ops = ieee80211_get_crypto_ops("WEP"); -+ if (!new_crypt->ops) { -+ request_module("ieee80211_crypt_wep"); -+ new_crypt->ops = ieee80211_get_crypto_ops("WEP"); -+ } -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) -+ if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) -+#else -+ if (new_crypt->ops && try_inc_mod_count(new_crypt->ops->owner)) -+#endif -+ new_crypt->priv = new_crypt->ops->init(key); -+ -+ if (!new_crypt->ops || !new_crypt->priv) { -+ kfree(new_crypt); -+ new_crypt = NULL; -+ -+ printk(KERN_WARNING "%s: could not initialize WEP: " -+ "load module ieee80211_crypt_wep\n", -+ dev->name); -+ return -EOPNOTSUPP; -+ } -+ *crypt = new_crypt; -+ } -+ -+ /* If a new key was provided, set it up */ -+ if (erq->length > 0) { -+ len = erq->length <= 5 ? 5 : 13; -+ memcpy(sec.keys[key], keybuf, erq->length); -+ if (len > erq->length) -+ memset(sec.keys[key] + erq->length, 0, -+ len - erq->length); -+ IEEE80211_DEBUG_WX("Setting key %d to '%s' (%d:%d bytes)\n", -+ key, escape_essid(sec.keys[key], len), -+ erq->length, len); -+ sec.key_sizes[key] = len; -+ (*crypt)->ops->set_key(sec.keys[key], len, NULL, -+ (*crypt)->priv); -+ sec.flags |= (1 << key); -+ /* This ensures a key will be activated if no key is -+ * explicitely set */ -+ if (key == sec.active_key) -+ sec.flags |= SEC_ACTIVE_KEY; -+ -+ ieee->tx_keyidx = key; //we need it to support multi_key setting. added by wb 2008_2_22 -+ } else { -+ len = (*crypt)->ops->get_key(sec.keys[key], WEP_KEY_LEN, -+ NULL, (*crypt)->priv); -+ if (len == 0) { -+ /* Set a default key of all 0 */ -+ IEEE80211_DEBUG_WX("Setting key %d to all zero.\n", -+ key); -+ memset(sec.keys[key], 0, 13); -+ (*crypt)->ops->set_key(sec.keys[key], 13, NULL, -+ (*crypt)->priv); -+ sec.key_sizes[key] = 13; -+ sec.flags |= (1 << key); -+ } -+ -+ /* No key data - just set the default TX key index */ -+ if (key_provided) { -+ IEEE80211_DEBUG_WX( -+ "Setting key %d to default Tx key.\n", key); -+ ieee->tx_keyidx = key; -+ sec.active_key = key; -+ sec.flags |= SEC_ACTIVE_KEY; -+ } -+ } -+#ifdef _RTL8187_EXT_PATCH_ -+#if 0 -+} -+} -+#endif -+#endif -+ done: -+ ieee->open_wep = !(erq->flags & IW_ENCODE_RESTRICTED); -+ sec.auth_mode = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY; -+ sec.flags |= SEC_AUTH_MODE; -+ IEEE80211_DEBUG_WX("Auth: %s\n", sec.auth_mode == WLAN_AUTH_OPEN ? -+ "OPEN" : "SHARED KEY"); -+ -+ /* For now we just support WEP, so only set that security level... -+ * TODO: When WPA is added this is one place that needs to change */ -+ sec.flags |= SEC_LEVEL; -+ sec.level = SEC_LEVEL_1; /* 40 and 104 bit WEP */ -+ -+ if (ieee->set_security) -+ ieee->set_security(dev, &sec); -+ -+ /* Do not reset port if card is in Managed mode since resetting will -+ * generate new IEEE 802.11 authentication which may end up in looping -+ * with IEEE 802.1X. If your hardware requires a reset after WEP -+ * configuration (for example... Prism2), implement the reset_port in -+ * the callbacks structures used to initialize the 802.11 stack. */ -+ if (ieee->reset_on_keychange && -+ ieee->iw_mode != IW_MODE_INFRA && -+ ieee->reset_port && ieee->reset_port(dev)) { -+ printk(KERN_DEBUG "%s: reset_port failed\n", dev->name); -+ return -EINVAL; -+ } -+ return 0; -+} -+ -+int ieee80211_wx_get_encode(struct ieee80211_device *ieee, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *keybuf) -+{ -+ struct iw_point *erq = &(wrqu->encoding); -+ int len, key; -+ struct ieee80211_crypt_data *crypt; -+ -+ IEEE80211_DEBUG_WX("GET_ENCODE\n"); -+ -+ if(ieee->iw_mode == IW_MODE_MONITOR) -+ return -1; -+ -+ key = erq->flags & IW_ENCODE_INDEX; -+ if (key) { -+ if (key > WEP_KEYS) -+ return -EINVAL; -+ key--; -+ } else -+ key = ieee->tx_keyidx; -+#ifdef _RTL8187_EXT_PATCH_ -+ crypt = ieee->cryptlist[0]->crypt[key]; -+#else -+ crypt = ieee->crypt[key]; -+#endif -+ erq->flags = key + 1; -+ -+ if (crypt == NULL || crypt->ops == NULL) { -+ erq->length = 0; -+ erq->flags |= IW_ENCODE_DISABLED; -+ return 0; -+ } -+ -+ if (strcmp(crypt->ops->name, "WEP") != 0) { -+ /* only WEP is supported with wireless extensions, so just -+ * report that encryption is used */ -+ erq->length = 0; -+ erq->flags |= IW_ENCODE_ENABLED; -+ return 0; -+ } -+ -+ len = crypt->ops->get_key(keybuf, WEP_KEY_LEN, NULL, crypt->priv); -+ erq->length = (len >= 0 ? len : 0); -+ -+ erq->flags |= IW_ENCODE_ENABLED; -+ -+ if (ieee->open_wep) -+ erq->flags |= IW_ENCODE_OPEN; -+ else -+ erq->flags |= IW_ENCODE_RESTRICTED; -+ -+ return 0; -+} -+ -+int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct net_device *dev = ieee->dev; -+ struct iw_point *encoding = &wrqu->encoding; -+ struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; -+ int i, idx, ret = 0; -+ int group_key = 0; -+ const char *alg, *module; -+ struct ieee80211_crypto_ops *ops; -+ struct ieee80211_crypt_data **crypt; -+ -+ struct ieee80211_security sec = { -+ .flags = 0, -+ }; -+ //printk("======>encoding flag:%x,ext flag:%x, ext alg:%d\n", encoding->flags,ext->ext_flags, ext->alg); -+ idx = encoding->flags & IW_ENCODE_INDEX; -+ if (idx) { -+ if (idx < 1 || idx > WEP_KEYS) -+ return -EINVAL; -+ idx--; -+ } else -+ idx = ieee->tx_keyidx; -+ -+ if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { -+#ifdef _RTL8187_EXT_PATCH_ -+ crypt = &ieee->cryptlist[0]->crypt[idx]; -+#else -+ crypt = &ieee->crypt[idx]; -+#endif -+ group_key = 1; -+ } else { -+ /* some Cisco APs use idx>0 for unicast in dynamic WEP */ -+ //printk("not group key, flags:%x, ext->alg:%d\n", ext->ext_flags, ext->alg); -+ if (idx != 0 && ext->alg != IW_ENCODE_ALG_WEP) -+ return -EINVAL; -+ if (ieee->iw_mode == IW_MODE_INFRA) -+#ifdef _RTL8187_EXT_PATCH_ -+ crypt = &ieee->cryptlist[0]->crypt[idx]; -+#else -+ crypt = &ieee->crypt[idx]; -+#endif -+ else -+ return -EINVAL; -+ } -+ -+ sec.flags |= SEC_ENABLED;// | SEC_ENCRYPT; -+ if ((encoding->flags & IW_ENCODE_DISABLED) || -+ ext->alg == IW_ENCODE_ALG_NONE) { -+ if (*crypt) -+ ieee80211_crypt_delayed_deinit(ieee, crypt); -+ -+ for (i = 0; i < WEP_KEYS; i++) -+#ifdef _RTL8187_EXT_PATCH_ -+ if (ieee->cryptlist[0]->crypt[i] != NULL) -+#else -+ if (ieee->crypt[i] != NULL) -+#endif -+ break; -+ -+ if (i == WEP_KEYS) { -+ sec.enabled = 0; -+ // sec.encrypt = 0; -+ sec.level = SEC_LEVEL_0; -+ sec.flags |= SEC_LEVEL; -+ } -+ //printk("disabled: flag:%x\n", encoding->flags); -+ goto done; -+ } -+ -+ sec.enabled = 1; -+ // sec.encrypt = 1; -+#if 0 -+ if (group_key ? !ieee->host_mc_decrypt : -+ !(ieee->host_encrypt || ieee->host_decrypt || -+ ieee->host_encrypt_msdu)) -+ goto skip_host_crypt; -+#endif -+ switch (ext->alg) { -+ case IW_ENCODE_ALG_WEP: -+ alg = "WEP"; -+ module = "ieee80211_crypt_wep"; -+ break; -+ case IW_ENCODE_ALG_TKIP: -+ alg = "TKIP"; -+ module = "ieee80211_crypt_tkip"; -+ break; -+ case IW_ENCODE_ALG_CCMP: -+ alg = "CCMP"; -+ module = "ieee80211_crypt_ccmp"; -+ break; -+ default: -+ IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n", -+ dev->name, ext->alg); -+ ret = -EINVAL; -+ goto done; -+ } -+ printk("alg name:%s\n",alg); -+ -+ ops = ieee80211_get_crypto_ops(alg); -+ if (ops == NULL) { -+ request_module(module); -+ ops = ieee80211_get_crypto_ops(alg); -+ } -+ if (ops == NULL) { -+ IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n", -+ dev->name, ext->alg); -+ printk("========>unknown crypto alg %d\n", ext->alg); -+ ret = -EINVAL; -+ goto done; -+ } -+ -+ if (*crypt == NULL || (*crypt)->ops != ops) { -+ struct ieee80211_crypt_data *new_crypt; -+ -+ ieee80211_crypt_delayed_deinit(ieee, crypt); -+ -+ new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL); -+ if (new_crypt == NULL) { -+ ret = -ENOMEM; -+ goto done; -+ } -+ new_crypt->ops = ops; -+ if (new_crypt->ops && try_module_get(new_crypt->ops->owner)) -+ new_crypt->priv = new_crypt->ops->init(idx); -+ if (new_crypt->priv == NULL) { -+ kfree(new_crypt); -+ ret = -EINVAL; -+ goto done; -+ } -+ *crypt = new_crypt; -+ -+ } -+ //I need to deinit other crypt here in mesh mode instead deinit them while use them to tx&rx. -+#ifdef _RTL8187_EXT_PATCH_ -+ if (ieee->iw_mode == ieee->iw_ext_mode) -+ { -+ int j; -+ for (j=1; j<MAX_MP; j++) -+ { -+ struct ieee80211_crypt_data ** crypttmp = &ieee->cryptlist[j]->crypt[idx]; -+ if (*crypttmp == NULL) -+ break; -+ if (*crypttmp && (*crypttmp)->ops != ops) -+ ieee80211_crypt_delayed_deinit(ieee, crypttmp); -+ } -+ } -+#endif -+ if (ext->key_len > 0 && (*crypt)->ops->set_key && -+ (*crypt)->ops->set_key(ext->key, ext->key_len, ext->rx_seq, -+ (*crypt)->priv) < 0) { -+ IEEE80211_DEBUG_WX("%s: key setting failed\n", dev->name); -+ printk("key setting failed\n"); -+ ret = -EINVAL; -+ goto done; -+ } -+#if 1 -+// skip_host_crypt: -+ //printk("skip_host_crypt:ext_flags:%x\n", ext->ext_flags); -+ if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { -+ ieee->tx_keyidx = idx; -+ sec.active_key = idx; -+ sec.flags |= SEC_ACTIVE_KEY; -+ } -+ -+ if (ext->alg != IW_ENCODE_ALG_NONE) { -+ memcpy(sec.keys[idx], ext->key, ext->key_len); -+ sec.key_sizes[idx] = ext->key_len; -+ sec.flags |= (1 << idx); -+ if (ext->alg == IW_ENCODE_ALG_WEP) { -+ // sec.encode_alg[idx] = SEC_ALG_WEP; -+ sec.flags |= SEC_LEVEL; -+ sec.level = SEC_LEVEL_1; -+ } else if (ext->alg == IW_ENCODE_ALG_TKIP) { -+ // sec.encode_alg[idx] = SEC_ALG_TKIP; -+ sec.flags |= SEC_LEVEL; -+ sec.level = SEC_LEVEL_2; -+ } else if (ext->alg == IW_ENCODE_ALG_CCMP) { -+ // sec.encode_alg[idx] = SEC_ALG_CCMP; -+ sec.flags |= SEC_LEVEL; -+ sec.level = SEC_LEVEL_3; -+ } -+ /* Don't set sec level for group keys. */ -+ if (group_key) -+ sec.flags &= ~SEC_LEVEL; -+ } -+#endif -+done: -+ if (ieee->set_security) -+ ieee->set_security(ieee->dev, &sec); -+ -+ if (ieee->reset_on_keychange && -+ ieee->iw_mode != IW_MODE_INFRA && -+ ieee->reset_port && ieee->reset_port(dev)) { -+ IEEE80211_DEBUG_WX("%s: reset_port failed\n", dev->name); -+ return -EINVAL; -+ } -+ -+ return ret; -+} -+int ieee80211_wx_set_mlme(struct ieee80211_device *ieee, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct iw_mlme *mlme = (struct iw_mlme *) extra; -+// printk("\ndkgadfslkdjgalskdf===============>%s(), cmd:%x\n", __FUNCTION__, mlme->cmd); -+#if 1 -+ switch (mlme->cmd) { -+ case IW_MLME_DEAUTH: -+ case IW_MLME_DISASSOC: -+ // printk("disassoc now\n"); -+ ieee80211_disassociate(ieee); -+ break; -+ default: -+ return -EOPNOTSUPP; -+ } -+#endif -+ return 0; -+} -+ -+int ieee80211_wx_set_auth(struct ieee80211_device *ieee, -+ struct iw_request_info *info, -+ struct iw_param *data, char *extra) -+{ -+/* -+ struct ieee80211_security sec = { -+ .flags = SEC_AUTH_MODE, -+ } -+*/ -+ //printk("set auth:flag:%x, data value:%x\n", data->flags, data->value); -+ switch (data->flags & IW_AUTH_INDEX) { -+ case IW_AUTH_WPA_VERSION: -+ /*need to support wpa2 here*/ -+ //printk("wpa version:%x\n", data->value); -+ break; -+ case IW_AUTH_CIPHER_PAIRWISE: -+ case IW_AUTH_CIPHER_GROUP: -+ case IW_AUTH_KEY_MGMT: -+ /* -+ * * Host AP driver does not use these parameters and allows -+ * * wpa_supplicant to control them internally. -+ * */ -+ break; -+ case IW_AUTH_TKIP_COUNTERMEASURES: -+ ieee->tkip_countermeasures = data->value; -+ break; -+ case IW_AUTH_DROP_UNENCRYPTED: -+ ieee->drop_unencrypted = data->value; -+ break; -+ -+ case IW_AUTH_80211_AUTH_ALG: -+ ieee->open_wep = (data->value&IW_AUTH_ALG_OPEN_SYSTEM)?1:0; -+ //printk("open_wep:%d\n", ieee->open_wep); -+ break; -+ -+#if 1 -+ case IW_AUTH_WPA_ENABLED: -+ ieee->wpa_enabled = (data->value)?1:0; -+ //printk("enalbe wpa:%d\n", ieee->wpa_enabled); -+ break; -+ -+#endif -+ case IW_AUTH_RX_UNENCRYPTED_EAPOL: -+ ieee->ieee802_1x = data->value; -+ break; -+ case IW_AUTH_PRIVACY_INVOKED: -+ ieee->privacy_invoked = data->value; -+ break; -+ default: -+ return -EOPNOTSUPP; -+ } -+ return 0; -+} -+ -+#if 1 -+int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len) -+{ -+#if 0 -+ printk("====>%s()\n", __FUNCTION__); -+ { -+ int i; -+ for (i=0; i<len; i++) -+ printk("%2x ", ie[i]&0xff); -+ printk("\n"); -+ } -+#endif -+ u8 *buf = NULL; -+ -+ if (len>MAX_WPA_IE_LEN || (len && ie == NULL)) -+ { -+ // printk("return error out, len:%d\n", len); -+ return -EINVAL; -+ } -+ if (len) -+ { -+ -+ if (len != ie[1]+2) printk("len:%d, ie:%d\n", (int)len, ie[1]); -+ buf = kmalloc(len, GFP_KERNEL); -+ if (buf == NULL) -+ return -ENOMEM; -+ memcpy(buf, ie, len); -+ kfree(ieee->wpa_ie); -+ ieee->wpa_ie = buf; -+ ieee->wpa_ie_len = len; -+ } -+ else{ -+ if (ieee->wpa_ie) -+ kfree(ieee->wpa_ie); -+ ieee->wpa_ie = NULL; -+ ieee->wpa_ie_len = 0; -+ } -+// printk("<=====out %s()\n", __FUNCTION__); -+ -+ return 0; -+ -+} -+#endif -+ -+EXPORT_SYMBOL(ieee80211_wx_set_gen_ie); -+EXPORT_SYMBOL(ieee80211_wx_set_mlme); -+EXPORT_SYMBOL(ieee80211_wx_set_auth); -+EXPORT_SYMBOL(ieee80211_wx_set_encode_ext); -+EXPORT_SYMBOL(ieee80211_wx_get_scan); -+EXPORT_SYMBOL(ieee80211_wx_set_encode); -+EXPORT_SYMBOL(ieee80211_wx_get_encode); -+#if 0 -+EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_scan); -+EXPORT_SYMBOL_NOVERS(ieee80211_wx_set_encode); -+EXPORT_SYMBOL_NOVERS(ieee80211_wx_get_encode); -+#endif -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/internal.h linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/internal.h ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/internal.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/internal.h 2010-08-05 21:12:34.643623535 +0200 -@@ -0,0 +1,115 @@ -+/* -+ * Cryptographic API. -+ * -+ * Copyright (c) 2002 James Morris <jmorris@intercode.com.au> -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License as published by the Free -+ * Software Foundation; either version 2 of the License, or (at your option) -+ * any later version. -+ * -+ */ -+#ifndef _CRYPTO_INTERNAL_H -+#define _CRYPTO_INTERNAL_H -+ -+ -+//#include <linux/crypto.h> -+#include "rtl_crypto.h" -+#include <linux/mm.h> -+#include <linux/highmem.h> -+#include <linux/init.h> -+#include <asm/hardirq.h> -+#include <asm/softirq.h> -+#include <asm/kmap_types.h> -+ -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20)) -+#define list_for_each_entry(pos, head, member) \ -+ for (pos = list_entry((head)->next, typeof(*pos), member), \ -+ prefetch(pos->member.next); \ -+ &pos->member != (head); \ -+ pos = list_entry(pos->member.next, typeof(*pos), member), \ -+ prefetch(pos->member.next)) -+ -+static inline void cond_resched(void) -+{ -+ if (need_resched()) { -+ set_current_state(TASK_RUNNING); -+ schedule(); -+ } -+} -+#endif -+ -+extern enum km_type crypto_km_types[]; -+ -+static inline enum km_type crypto_kmap_type(int out) -+{ -+ return crypto_km_types[(in_softirq() ? 2 : 0) + out]; -+} -+ -+static inline void *crypto_kmap(struct page *page, int out) -+{ -+ return kmap_atomic(page, crypto_kmap_type(out)); -+} -+ -+static inline void crypto_kunmap(void *vaddr, int out) -+{ -+ kunmap_atomic(vaddr, crypto_kmap_type(out)); -+} -+ -+static inline void crypto_yield(struct crypto_tfm *tfm) -+{ -+ if (!in_softirq()) -+ cond_resched(); -+} -+ -+static inline void *crypto_tfm_ctx(struct crypto_tfm *tfm) -+{ -+ return (void *)&tfm[1]; -+} -+ -+struct crypto_alg *crypto_alg_lookup(const char *name); -+ -+#ifdef CONFIG_KMOD -+void crypto_alg_autoload(const char *name); -+struct crypto_alg *crypto_alg_mod_lookup(const char *name); -+#else -+static inline struct crypto_alg *crypto_alg_mod_lookup(const char *name) -+{ -+ return crypto_alg_lookup(name); -+} -+#endif -+ -+#ifdef CONFIG_CRYPTO_HMAC -+int crypto_alloc_hmac_block(struct crypto_tfm *tfm); -+void crypto_free_hmac_block(struct crypto_tfm *tfm); -+#else -+static inline int crypto_alloc_hmac_block(struct crypto_tfm *tfm) -+{ -+ return 0; -+} -+ -+static inline void crypto_free_hmac_block(struct crypto_tfm *tfm) -+{ } -+#endif -+ -+#ifdef CONFIG_PROC_FS -+void __init crypto_init_proc(void); -+#else -+static inline void crypto_init_proc(void) -+{ } -+#endif -+ -+int crypto_init_digest_flags(struct crypto_tfm *tfm, u32 flags); -+int crypto_init_cipher_flags(struct crypto_tfm *tfm, u32 flags); -+int crypto_init_compress_flags(struct crypto_tfm *tfm, u32 flags); -+ -+int crypto_init_digest_ops(struct crypto_tfm *tfm); -+int crypto_init_cipher_ops(struct crypto_tfm *tfm); -+int crypto_init_compress_ops(struct crypto_tfm *tfm); -+ -+void crypto_exit_digest_ops(struct crypto_tfm *tfm); -+void crypto_exit_cipher_ops(struct crypto_tfm *tfm); -+void crypto_exit_compress_ops(struct crypto_tfm *tfm); -+ -+#endif /* _CRYPTO_INTERNAL_H */ -+ -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/kmap_types.h linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/kmap_types.h ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/kmap_types.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/kmap_types.h 2010-08-05 21:12:34.683618826 +0200 -@@ -0,0 +1,20 @@ -+#ifndef __KMAP_TYPES_H -+ -+#define __KMAP_TYPES_H -+ -+ -+enum km_type { -+ KM_BOUNCE_READ, -+ KM_SKB_SUNRPC_DATA, -+ KM_SKB_DATA_SOFTIRQ, -+ KM_USER0, -+ KM_USER1, -+ KM_BH_IRQ, -+ KM_SOFTIRQ0, -+ KM_SOFTIRQ1, -+ KM_TYPE_NR -+}; -+ -+#define _ASM_KMAP_TYPES_H -+ -+#endif -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/readme linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/readme ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/readme 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/readme 2010-08-05 21:12:34.723621451 +0200 -@@ -0,0 +1,162 @@ -+What this layer should do -+ -+- It mantain the old mechanism as alternative, so the -+ ipw2100 driver works with really few changes. -+- Encapsulate / Decapsulate ieee80211 packet -+- Handle fragmentation -+- Optionally provide an alterantive mechanism for netif queue stop/wake, -+ so that the ieee80211 layer will pass one fragment per time instead of -+ one txb struct per time. so the driver can stop the queue in the middle -+ of a packet. -+- Provide two different TX interfaces for cards that can handle management -+ frames on one HW queue, and data on another, and for cards that have only -+ one HW queue (the latter untested and very, very rough). -+- Optionally provide the logic for handling IBSS/MASTER/MONITOR/BSS modes -+ and for the channel, essid and wap get/set wireless extension requests. -+ so that the driver has only to change channel when the ieee stack tell it. -+- Optionally provide a scanning mechanism so that the driver has not to -+ worry about this, just implement the set channel calback and pass -+ frames to the upper layer -+- Optionally provide the bss client protocol handshaking (just with open -+ authentication) -+- Optionally provide the probe request send mechanism -+- Optionally provide the bss master mode logic to handle association -+ protocol (only open authentication) and probe responses. -+- SW wep encryption (with open authentication) -+- It collects some stats -+- It provides beacons to the card when it ask for them -+ -+What this layer doesn't do (yet) -+- Perform shared authentication -+- Have full support for master mode (the AP should loop back in the air -+ frames from an associated client to another. This could be done easily -+ with few lines of code, and it is done in my previous version of the -+ stach, but a table of association must be keept and a disassociation -+ policy must be decided and implemented. -+- Handle cleanly the full ieee 802.11 protocol. In AP mode it never -+ disassociate clients, and it is really prone to always allow access. -+ In bss client mode it is a bit rough with AP deauth and disassoc requests. -+- It has not any entry point to view the collected stats. -+- Altought it takes care of the card supported rates in the management frame -+ it sends, support for rate changing on TXed packet is not complete. -+- Give up once associated in bss client mode (it never detect a -+ signal loss condition to disassociate and restart scanning) -+- Provide a mechanism for enabling the TX in monitor mode, so -+ userspace programs can TX raw packets. -+- Provide a mechanism for cards that need that the SW take care of beacon -+ TX completely, in sense that the SW has to enqueue by itself beacons -+ to the card so it TX them (if any...) -+APIs -+ -+Callback functions in the original stack has been mantained. -+following has been added (from ieee80211.h) -+ -+ /* Softmac-generated frames (mamagement) are TXed via this -+ * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is -+ * not set. As some cards may have different HW queues that -+ * one might want to use for data and management frames -+ * the option to have two callbacks might be useful. -+ * This fucntion can't sleep. -+ */ -+ int (*softmac_hard_start_xmit)(struct sk_buff *skb, -+ struct net_device *dev); -+ -+ /* used instead of hard_start_xmit (not softmac_hard_start_xmit) -+ * if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data -+ * frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set -+ * then also management frames are sent via this callback. -+ * This function can't sleep. -+ */ -+ void (*softmac_data_hard_start_xmit)(struct sk_buff *skb, -+ struct net_device *dev); -+ -+ /* stops the HW queue for DATA frames. Useful to avoid -+ * waste time to TX data frame when we are reassociating -+ * This function can sleep. -+ */ -+ void (*data_hard_stop)(struct net_device *dev); -+ -+ /* OK this is complementar to data_poll_hard_stop */ -+ void (*data_hard_resume)(struct net_device *dev); -+ -+ /* ask to the driver to retune the radio . -+ * This function can sleep. the driver should ensure -+ * the radio has been swithced before return. -+ */ -+ void (*set_chan)(struct net_device *dev,short ch); -+ -+ /* These are not used if the ieee stack takes care of -+ * scanning (IEEE_SOFTMAC_SCAN feature set). -+ * In this case only the set_chan is used. -+ * -+ * The syncro version is similar to the start_scan but -+ * does not return until all channels has been scanned. -+ * this is called in user context and should sleep, -+ * it is called in a work_queue when swithcing to ad-hoc mode -+ * or in behalf of iwlist scan when the card is associated -+ * and root user ask for a scan. -+ * the fucntion stop_scan should stop both the syncro and -+ * background scanning and can sleep. -+ * The fucntion start_scan should initiate the background -+ * scanning and can't sleep. -+ */ -+ void (*scan_syncro)(struct net_device *dev); -+ void (*start_scan)(struct net_device *dev); -+ void (*stop_scan)(struct net_device *dev); -+ -+ /* indicate the driver that the link state is changed -+ * for example it may indicate the card is associated now. -+ * Driver might be interested in this to apply RX filter -+ * rules or simply light the LINK led -+ */ -+ void (*link_change)(struct net_device *dev); -+ -+Functions hard_data_[resume/stop] are optional and should not be used -+if the driver decides to uses data+management frames enqueue in a -+single HQ queue (thus using just the softmac_hard_data_start_xmit -+callback). -+ -+Function that the driver can use are: -+ -+ieee80211_get_beacon - this is called by the driver when -+ the HW needs a beacon. -+ieee80211_softmac_start_protocol - this should normally be called in the -+ driver open function -+ieee80211_softmac_stop_protocol - the opposite of the above -+ieee80211_wake_queue - this is similar to netif_wake_queue -+ieee80211_reset_queue - this throw away fragments pending(if any) -+ieee80211_stop_queue - this is similar to netif_stop_queue -+ -+ -+known BUGS: -+- When performing syncro scan (possiblily when swithcing to ad-hoc mode -+ and when running iwlist scan when associated) there is still an odd -+ behaviour.. I have not looked in this more accurately (yet). -+ -+locking: -+locking is done by means of three structures. -+1- ieee->lock (by means of spin_[un]lock_irq[save/restore] -+2- ieee->wx_sem -+3- ieee->scan_sem -+ -+the lock 1 is what protect most of the critical sections in the ieee stack. -+the lock 2 is used to avoid that more than one of the SET wireless extension -+handlers (as well as start/stop protocol function) are running at the same time. -+the lock 1 is used when we need to modify or read the shared data in the wx handlers. -+In other words the lock 2 will prevent one SET action will run across another SET -+action (by make sleep the 2nd one) but allow GET actions, while the lock 1 -+make atomic those little shared data access in both GET and SET operation. -+So get operation will be never be delayed really: they will never sleep.. -+Furthermore in the top of some SET operations a flag is set before acquiring -+the lock. This is an help to make the previous running SET operation to -+finish faster if needed (just in case the second one will totally undo the -+first, so there is not need to complete the 1st really.. ). -+The background scanning mechaninsm is protected by the lock 1 except for the -+workqueue. this wq is here just to let the set_chan callback sleep (I thinked it -+might be appreciated by USB network card driver developer). In this case the lock 3 -+take its turn. -+Thus the stop function needs both the locks. -+Funny in the syncro scan the lock 2 play its role (as both the syncro_scan -+function and the stop scan function are called with this semaphore held). -+ -+ -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/rtl8187_mesh.h linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/rtl8187_mesh.h ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/rtl8187_mesh.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/rtl8187_mesh.h 2010-08-05 21:12:34.763617830 +0200 -@@ -0,0 +1,282 @@ -+#ifndef _RTL8187_MESH_H_ -+#define _RTL8187_MESH_H_ -+ -+#include "msh_class.h" // struct mshclass -+#include "mesh.h" // struct MESH-Neighbor-Entry -+#include "ieee80211.h" // struct ieee80211-network -+#include "mesh_8185_util.h" // DOT11-QUEUE -+#include "hash_table.h" // hash-table -+#include "8185s_pathsel.h" -+#include <linux/list.h> -+ -+#define GET_MESH_PRIV(x) ((struct mshclass_priv *)(x->priv)) -+ -+struct ieee80211_hdr_mesh { -+ u16 frame_ctl; -+ u16 duration_id; -+ u8 addr1[ETH_ALEN]; -+ u8 addr2[ETH_ALEN]; -+ u8 addr3[ETH_ALEN]; -+ u16 seq_ctl; -+ u8 addr4[ETH_ALEN]; -+ unsigned char mesh_flag; -+ INT8 TTL; -+ UINT16 segNum; -+ unsigned char DestMACAddr[ETH_ALEN]; // modify for 6 address -+ unsigned char SrcMACAddr[ETH_ALEN]; -+} __attribute__ ((packed)); -+ -+struct myMeshIDNode { -+ struct list_head list; -+ char id[MESH_ID_LEN+1]; -+ short popEN; -+ char tried; -+ unsigned long expire; -+ struct ieee80211_network mesh_network; -+}; -+ -+struct ieee80211_hdr_mesh_QOS { -+ u16 frame_ctl; -+ u16 duration_id; -+ u8 addr1[ETH_ALEN]; -+ u8 addr2[ETH_ALEN]; -+ u8 addr3[ETH_ALEN]; -+ u16 seq_ctl; -+ u8 addr4[ETH_ALEN]; -+ u16 QOS_ctl; -+ unsigned char mesh_flag; -+ INT8 TTL; -+ UINT16 segNum; -+ unsigned char DestMACAddr[ETH_ALEN]; // modify for 6 address -+ unsigned char SrcMACAddr[ETH_ALEN]; -+} __attribute__ ((packed)); -+ -+ -+struct mesh_PeerEntry { -+ // based on 8185ag.h -+ struct list_head hash_list; -+ unsigned int used; ///< used == TRUE => has been allocated, \n used == FALSE => can be allocated -+ unsigned char hwaddr[MACADDRLEN]; ///< hardware address -+ -+ // struct list_head mesh_unEstablish_ptr; // ©|¥¼(©Î±q¤w³s½u -> ¥¼³s½u) ¤§ MP list -+ struct list_head mesh_mp_ptr; // MP list -+ -+ /*mesh_neighbor: -+ * Inited by "Neighbor Discovering" -+ * cleaned by "Disassociation" or "Expired" -+ */ -+ struct MESH_Neighbor_Entry mesh_neighbor_TBL; -+ -+ struct ieee80211_network * pstat; // a backward pointer -+ -+ // 802.11 seq checking -+ u16 last_rxseq; /* rx seq previous per-tid */ -+ u16 last_rxfrag;/* tx frag previous per-tid */ -+ unsigned long last_time; -+ // -+}; -+ -+ -+struct mshclass_priv { -+ -+ struct mesh_PeerEntry *meshEntries; // 1-to-1 for priv->ieee80211->networks -+ -+ spinlock_t lock_stainfo; // lock for accessing the data structure of stat info -+ spinlock_t lock_queue; // lock for DOT11_EnQueue2/DOT11_DeQueue2/enque/dequeue -+ spinlock_t lock_Rreq; // lock for rreq_retry. Some function like aodv_expire/tx use lock_queue simultaneously -+// spinlock_t lock_meshlist; -+ -+ // struct _DOT11_QUEUE *pevent_queue; ///< 802.11 QUEUEµ²ºc -+ // struct hash_table *pathsel_table; // GANTOE -+ //tsananiu -+ struct _DOT11_QUEUE *pathsel_queue; ///< 802.11 QUEUEµ²ºc -+ -+ //tsananiu end -+ -+ //add by shlu 20070518 -+ unsigned char RreqMAC[AODV_RREQ_TABLE_SIZE][6]; -+ unsigned int RreqBegin; -+ unsigned int RreqEnd; -+ -+#if defined(MESH_ROLE_ROOT) || defined(MESH_ROLE_PORTAL) -+#define MAX_SZ_BAD_MAC 3 -+ unsigned char BadMac[MAX_SZ_BAD_MAC][MACADDRLEN]; -+ int idx_BadMac; -+#endif // MESH_ROLE_ROOT || MESH_ROLE_PORTAL -+ -+ //------------- -+ unsigned char root_mac[MACADDRLEN]; -+ struct mesh_info dot11MeshInfo; // extrated from wifi_mib (ieee802_mib.h) -+ struct hash_table *proxy_table, *mesh_rreq_retry_queue; //GANTOE //GANTOE -+ struct hash_table *pathsel_table; // add by chuangch 2007.09.13 -+ // add by Jason -+ struct mpp_tb *pann_mpp_tb; -+ -+ struct timer_list expire_timer; // 1sec timer -+ -+ struct timer_list beacon_timer; // 1sec timer -+ struct list_head stat_hash[MAX_NETWORK_COUNT]; // sta_info hash table (aid_obj) -+ -+ struct list_head meshList[MAX_CHANNEL_NUMBER]; -+ int scanMode; -+ -+ struct { -+ struct ieee80211_network *pstat; -+ unsigned char hwaddr[MACADDRLEN]; -+ } stainfo_cache; -+ -+ // The following elements are used by 802.11s. -+ // For copyright-pretection, we use an independent (binary) module. -+ // Note that it can also be put either under r8180_priv or ieee80211_device. The adv of put under -+ // r8180_priv is to get "higher encapsulation". On the other hand, r8180_priv was originally designed -+ // for "hardward specific." -+ char mesh_mac_filter_allow[8][13]; -+ char mesh_mac_filter_deny[8][13]; -+ -+ struct MESH_Share meshare; // mesh share data -+ -+ struct { -+ -+ int prev_iw_mode; // Save this->iw_mode for r8180_wx->r8180_wx_enable_mesh. No init requirement -+ -+ struct MESH_Profile mesh_profile; // contains MESHID -+ -+ struct mesh_info dot11MeshInfo; // contains meshMaxAssocNum -+ -+ struct net_device_stats mesh_stats; -+ -+ UINT8 mesh_Version; // ¨Ï¥Îªºª©¥» -+ // WLAN Mesh Capability -+ INT16 mesh_PeerCAP_cap; // peer capability-Cap number (¦³¸¹¼Æ) -+ UINT8 mesh_PeerCAP_flags; // peer capability-flags -+ UINT8 mesh_PowerSaveCAP; // Power Save capability -+ UINT8 mesh_SyncCAP; // Synchronization capability -+ UINT8 mesh_MDA_CAP; // MDA capability -+ UINT32 mesh_ChannelPrecedence; // Channel Precedence -+ -+ // neighbor -> candidate neighbor, if mesh_available_peerlink > 0, page 56, D0.02 -+ UINT8 mesh_AvailablePeerLink; // ¦¹¬O§_¦³»Ýn?(¦]¥¦µ¥¦P©ó mesh_PeerCAP)=>¼È ®É«O ¯d -+ -+ UINT8 mesh_HeaderFlags; // mesh header ¤ºªº mesh flags field -+ -+ // MKD domain element [MKDDIE] -+ UINT8 mesh_MKD_DomainID[6]; -+ UINT8 mesh_MKDDIE_SecurityConfiguration; -+ -+ // EMSA Handshake element [EMSAIE] -+ UINT8 mesh_EMSAIE_ANonce[32]; -+ UINT8 mesh_EMSAIE_SNonce[32]; -+ UINT8 mesh_EMSAIE_MA_ID[6]; -+ UINT16 mesh_EMSAIE_MIC_Control; -+ UINT8 mesh_EMSAIE_MIC[16]; -+ -+ struct timer_list mesh_peer_link_timer; ///< ¹ï©|¥¼³s ½u(»P³s½u°h¦Ü¥¼³s½u) MP mesh_unEstablish_hdr §@ peer link time out -+ -+// struct timer_list mesh_beacon_timer; -+ // mesh_unEstablish_hdr: -+ // It is a list structure, only stores unEstablish (or Establish -> unEstablish [MP_HOLDING])MP entry -+ // Each entry is a pointer pointing to an entry in "stat_info->mesh_mp_ptr" -+ // and removed by successful "Peer link setup" or "Expired" -+ struct list_head mesh_unEstablish_hdr; -+ -+ // mesh_mp_hdr: -+ // It is a list of MP/MAP/MPP who has already passed "Peer link setup" -+ // Each entry is a pointer pointing to an entry in "stat_info->mesh_mp_ptr" -+ // Every entry is inserted by "successful peer link setup" -+ // and removed by "Expired" -+ struct list_head mesh_mp_hdr; -+ -+ } mesh; -+ -+ int iCurChannel; // remember the working channel -+}; -+ -+// Stanley, 04/23/07 -+// The following mode is used by ieee80211_device->iw_mode -+// Although it is better to put the definition under linux/wireless.h (or wireless_copy.h), it is a system file -+// that we shouldn't modify directly. -+#define IW_MODE_MESH 11 /* 802.11s mesh mode */ -+ -+// Default MESHID -+#define IEEE80211S_DEFAULT_MESHID "802.11s" -+ -+// callback for 802.11s -+extern short rtl8187_patch_ieee80211_probe_req_1 (struct ieee80211_device *ieee); -+extern u8* rtl8187_patch_ieee80211_probe_req_2 (struct ieee80211_device *ieee, struct sk_buff *skb, u8 *tag); -+ -+// wx -+extern int rtl8187_patch_r8180_wx_get_meshinfo(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra); -+extern int rtl8187_patch_r8180_wx_enable_mesh(struct net_device *dev); -+extern int rtl8187_patch_r8180_wx_disable_mesh(struct net_device *dev); -+extern int rtl8187_patch_r8180_wx_wx_set_meshID(struct net_device *dev, char *ext,unsigned char channel); -+extern void rtl8187_patch_r8180_wx_set_channel (struct ieee80211_device *ieee, int ch); -+extern int rtl8187_patch_r8180_wx_set_add_mac_allow(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra); -+extern int rtl8187_patch_r8180_wx_set_del_mac_allow(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra); -+extern int rtl8187_patch_r8180_wx_set_add_mac_deny(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra); -+extern int rtl8187_patch_r8180_wx_set_del_mac_deny(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra); -+extern int rtl8187_patch_r8180_wx_get_mac_allow(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra); -+extern int rtl8187_patch_r8180_wx_get_mac_deny(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra); -+ -+extern int rtl8187_patch_r8180_wx_get_mesh_list(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra); -+extern int rtl8187_patch_r8180_wx_mesh_scan(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra); -+extern int rtl8187_patch_r8180_wx_get_selected_mesh(struct net_device *dev, int en, char *cho, char* id); -+//by amy for networkmanager UI -+extern int rtl8187_patch_r8180_wx_get_selected_mesh_channel(struct net_device *dev, char *extmeshid, char *cho); -+//by amy for networkmanager UI -+// osdep -+extern int rtl8187_patch_ieee80211_start_protocol (struct ieee80211_device *ieee); -+extern u8 rtl8187_patch_rtl8180_up(struct mshclass *priv); -+extern void rtl8187_patch_ieee80211_stop_protocol(struct ieee80211_device *ieee); -+ -+// issue_assocreq_MP -+extern void rtl8187_patch_ieee80211_association_req_1 (struct ieee80211_assoc_request_frame *hdr); -+extern u8* rtl8187_patch_ieee80211_association_req_2 (struct ieee80211_device *ieee, struct ieee80211_network *pstat, struct sk_buff *skb); -+ -+// OnAssocReq_MP -+extern int rtl8187_patch_ieee80211_rx_frame_softmac_on_assoc_req (struct ieee80211_device *ieee, struct sk_buff *skb); -+ -+// issue_assocrsp_MP -+extern void rtl8187_patch_ieee80211_assoc_resp_by_net_1 (struct ieee80211_assoc_response_frame *assoc); -+u8* rtl8187_patch_ieee80211_assoc_resp_by_net_2 (struct ieee80211_device *ieee, struct ieee80211_network *pstat, int pkt_type, struct sk_buff *skb); -+ -+// OnAssocRsp_MP -+extern int rtl8187_patch_ieee80211_rx_frame_softmac_on_assoc_rsp (struct ieee80211_device *ieee, struct sk_buff *skb); -+ -+ -+extern int rtl8187_patch_ieee80211_rx_frame_softmac_on_auth(struct ieee80211_device *ieee, struct sk_buff *skb, struct ieee80211_rx_stats *rx_stats); -+extern int rtl8187_patch_ieee80211_rx_frame_softmac_on_deauth(struct ieee80211_device *ieee, struct sk_buff *skb, struct ieee80211_rx_stats *rx_stats); -+extern unsigned int rtl8187_patch_ieee80211_process_probe_response_1( struct ieee80211_device *ieee, struct ieee80211_probe_response *beacon, struct ieee80211_rx_stats *stats); -+extern void rtl8187_patch_ieee80211_rx_mgt_on_probe_req( struct ieee80211_device *ieee, struct ieee80211_probe_request *beacon, struct ieee80211_rx_stats *stats); -+extern void rtl8187_patch_ieee80211_rx_mgt_update_expire ( struct ieee80211_device *ieee, struct sk_buff *skb); -+ -+// set channel -+extern int rtl8187_patch_ieee80211_ext_stop_scan_wq_set_channel (struct ieee80211_device *ieee); -+ -+// on rx (rx isr) -+extern int rtl8187_patch_ieee80211_rx_on_rx (struct ieee80211_device *ieee, struct sk_buff *skb, struct ieee80211_rx_stats *rx_stats, u16 type, u16 stype); -+ -+// r8187_core -+// handle ioctl -+extern int rtl8187_patch_rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); -+// create proc -+extern void rtl8187_patch_create_proc(struct r8180_priv *priv); -+extern void rtl8187_patch_remove_proc(struct r8180_priv *priv); -+ -+// tx, xmit -+// locked by ieee->lock. Call ieee80211_softmac_xmit afterward -+extern struct ieee80211_txb* rtl8187_patch_ieee80211_xmit (struct sk_buff *skb, struct net_device *dev); -+ -+// given a skb, output header's length -+extern int rtl8187_patch_ieee80211_rx_frame_get_hdrlen (struct ieee80211_device *ieee, struct sk_buff *skb); -+ -+// check the frame control field, return 0: not accept, 1: accept -+extern int rtl8187_patch_ieee80211_rx_is_valid_framectl (struct ieee80211_device *ieee, u16 fc, u16 type, u16 stype); -+ -+// process_dataframe -+extern int rtl8187_patch_ieee80211_rx_process_dataframe (struct ieee80211_device *ieee, struct sk_buff *skb, struct ieee80211_rx_stats *rx_stats); -+ -+extern int rtl8187_patch_is_duplicate_packet (struct ieee80211_device *ieee, struct ieee80211_hdr *header, u16 type, u16 stype); -+ -+extern int rtl8187_patch_ieee80211_softmac_xmit_get_rate (struct ieee80211_device *ieee, struct sk_buff *skb); -+extern void ieee80211_start_mesh(struct ieee80211_device *ieee); -+#endif // _RTL8187_MESH_H_ -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/rtl_crypto.h linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/rtl_crypto.h ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/rtl_crypto.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/rtl_crypto.h 2010-08-05 21:12:34.803620839 +0200 -@@ -0,0 +1,399 @@ -+/* -+ * Scatterlist Cryptographic API. -+ * -+ * Copyright (c) 2002 James Morris <jmorris@intercode.com.au> -+ * Copyright (c) 2002 David S. Miller (davem@redhat.com) -+ * -+ * Portions derived from Cryptoapi, by Alexander Kjeldaas <astor@fast.no> -+ * and Nettle, by Niels Mé°ˆler. -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License as published by the Free -+ * Software Foundation; either version 2 of the License, or (at your option) -+ * any later version. -+ * -+ */ -+#ifndef _LINUX_CRYPTO_H -+#define _LINUX_CRYPTO_H -+ -+#include <linux/module.h> -+#include <linux/kernel.h> -+#include <linux/types.h> -+#include <linux/list.h> -+#include <linux/string.h> -+#include <asm/page.h> -+#include <asm/errno.h> -+ -+#define crypto_register_alg crypto_register_alg_rtl -+#define crypto_unregister_alg crypto_unregister_alg_rtl -+#define crypto_alloc_tfm crypto_alloc_tfm_rtl -+#define crypto_free_tfm crypto_free_tfm_rtl -+#define crypto_alg_available crypto_alg_available_rtl -+ -+/* -+ * Algorithm masks and types. -+ */ -+#define CRYPTO_ALG_TYPE_MASK 0x000000ff -+#define CRYPTO_ALG_TYPE_CIPHER 0x00000001 -+#define CRYPTO_ALG_TYPE_DIGEST 0x00000002 -+#define CRYPTO_ALG_TYPE_COMPRESS 0x00000004 -+ -+/* -+ * Transform masks and values (for crt_flags). -+ */ -+#define CRYPTO_TFM_MODE_MASK 0x000000ff -+#define CRYPTO_TFM_REQ_MASK 0x000fff00 -+#define CRYPTO_TFM_RES_MASK 0xfff00000 -+ -+#define CRYPTO_TFM_MODE_ECB 0x00000001 -+#define CRYPTO_TFM_MODE_CBC 0x00000002 -+#define CRYPTO_TFM_MODE_CFB 0x00000004 -+#define CRYPTO_TFM_MODE_CTR 0x00000008 -+ -+#define CRYPTO_TFM_REQ_WEAK_KEY 0x00000100 -+#define CRYPTO_TFM_RES_WEAK_KEY 0x00100000 -+#define CRYPTO_TFM_RES_BAD_KEY_LEN 0x00200000 -+#define CRYPTO_TFM_RES_BAD_KEY_SCHED 0x00400000 -+#define CRYPTO_TFM_RES_BAD_BLOCK_LEN 0x00800000 -+#define CRYPTO_TFM_RES_BAD_FLAGS 0x01000000 -+ -+/* -+ * Miscellaneous stuff. -+ */ -+#define CRYPTO_UNSPEC 0 -+#define CRYPTO_MAX_ALG_NAME 64 -+ -+struct scatterlist; -+ -+/* -+ * Algorithms: modular crypto algorithm implementations, managed -+ * via crypto_register_alg() and crypto_unregister_alg(). -+ */ -+struct cipher_alg { -+ unsigned int cia_min_keysize; -+ unsigned int cia_max_keysize; -+ int (*cia_setkey)(void *ctx, const u8 *key, -+ unsigned int keylen, u32 *flags); -+ void (*cia_encrypt)(void *ctx, u8 *dst, const u8 *src); -+ void (*cia_decrypt)(void *ctx, u8 *dst, const u8 *src); -+}; -+ -+struct digest_alg { -+ unsigned int dia_digestsize; -+ void (*dia_init)(void *ctx); -+ void (*dia_update)(void *ctx, const u8 *data, unsigned int len); -+ void (*dia_final)(void *ctx, u8 *out); -+ int (*dia_setkey)(void *ctx, const u8 *key, -+ unsigned int keylen, u32 *flags); -+}; -+ -+struct compress_alg { -+ int (*coa_init)(void *ctx); -+ void (*coa_exit)(void *ctx); -+ int (*coa_compress)(void *ctx, const u8 *src, unsigned int slen, -+ u8 *dst, unsigned int *dlen); -+ int (*coa_decompress)(void *ctx, const u8 *src, unsigned int slen, -+ u8 *dst, unsigned int *dlen); -+}; -+ -+#define cra_cipher cra_u.cipher -+#define cra_digest cra_u.digest -+#define cra_compress cra_u.compress -+ -+struct crypto_alg { -+ struct list_head cra_list; -+ u32 cra_flags; -+ unsigned int cra_blocksize; -+ unsigned int cra_ctxsize; -+ const char cra_name[CRYPTO_MAX_ALG_NAME]; -+ -+ union { -+ struct cipher_alg cipher; -+ struct digest_alg digest; -+ struct compress_alg compress; -+ } cra_u; -+ -+ struct module *cra_module; -+}; -+ -+/* -+ * Algorithm registration interface. -+ */ -+int crypto_register_alg(struct crypto_alg *alg); -+int crypto_unregister_alg(struct crypto_alg *alg); -+ -+/* -+ * Algorithm query interface. -+ */ -+int crypto_alg_available(const char *name, u32 flags); -+ -+/* -+ * Transforms: user-instantiated objects which encapsulate algorithms -+ * and core processing logic. Managed via crypto_alloc_tfm() and -+ * crypto_free_tfm(), as well as the various helpers below. -+ */ -+struct crypto_tfm; -+ -+struct cipher_tfm { -+ void *cit_iv; -+ unsigned int cit_ivsize; -+ u32 cit_mode; -+ int (*cit_setkey)(struct crypto_tfm *tfm, -+ const u8 *key, unsigned int keylen); -+ int (*cit_encrypt)(struct crypto_tfm *tfm, -+ struct scatterlist *dst, -+ struct scatterlist *src, -+ unsigned int nbytes); -+ int (*cit_encrypt_iv)(struct crypto_tfm *tfm, -+ struct scatterlist *dst, -+ struct scatterlist *src, -+ unsigned int nbytes, u8 *iv); -+ int (*cit_decrypt)(struct crypto_tfm *tfm, -+ struct scatterlist *dst, -+ struct scatterlist *src, -+ unsigned int nbytes); -+ int (*cit_decrypt_iv)(struct crypto_tfm *tfm, -+ struct scatterlist *dst, -+ struct scatterlist *src, -+ unsigned int nbytes, u8 *iv); -+ void (*cit_xor_block)(u8 *dst, const u8 *src); -+}; -+ -+struct digest_tfm { -+ void (*dit_init)(struct crypto_tfm *tfm); -+ void (*dit_update)(struct crypto_tfm *tfm, -+ struct scatterlist *sg, unsigned int nsg); -+ void (*dit_final)(struct crypto_tfm *tfm, u8 *out); -+ void (*dit_digest)(struct crypto_tfm *tfm, struct scatterlist *sg, -+ unsigned int nsg, u8 *out); -+ int (*dit_setkey)(struct crypto_tfm *tfm, -+ const u8 *key, unsigned int keylen); -+#ifdef CONFIG_CRYPTO_HMAC -+ void *dit_hmac_block; -+#endif -+}; -+ -+struct compress_tfm { -+ int (*cot_compress)(struct crypto_tfm *tfm, -+ const u8 *src, unsigned int slen, -+ u8 *dst, unsigned int *dlen); -+ int (*cot_decompress)(struct crypto_tfm *tfm, -+ const u8 *src, unsigned int slen, -+ u8 *dst, unsigned int *dlen); -+}; -+ -+#define crt_cipher crt_u.cipher -+#define crt_digest crt_u.digest -+#define crt_compress crt_u.compress -+ -+struct crypto_tfm { -+ -+ u32 crt_flags; -+ -+ union { -+ struct cipher_tfm cipher; -+ struct digest_tfm digest; -+ struct compress_tfm compress; -+ } crt_u; -+ -+ struct crypto_alg *__crt_alg; -+}; -+ -+/* -+ * Transform user interface. -+ */ -+ -+/* -+ * crypto_alloc_tfm() will first attempt to locate an already loaded algorithm. -+ * If that fails and the kernel supports dynamically loadable modules, it -+ * will then attempt to load a module of the same name or alias. A refcount -+ * is grabbed on the algorithm which is then associated with the new transform. -+ * -+ * crypto_free_tfm() frees up the transform and any associated resources, -+ * then drops the refcount on the associated algorithm. -+ */ -+struct crypto_tfm *crypto_alloc_tfm(const char *alg_name, u32 tfm_flags); -+void crypto_free_tfm(struct crypto_tfm *tfm); -+ -+/* -+ * Transform helpers which query the underlying algorithm. -+ */ -+static inline const char *crypto_tfm_alg_name(struct crypto_tfm *tfm) -+{ -+ return tfm->__crt_alg->cra_name; -+} -+ -+static inline const char *crypto_tfm_alg_modname(struct crypto_tfm *tfm) -+{ -+ struct crypto_alg *alg = tfm->__crt_alg; -+ -+ if (alg->cra_module) -+ return alg->cra_module->name; -+ else -+ return NULL; -+} -+ -+static inline u32 crypto_tfm_alg_type(struct crypto_tfm *tfm) -+{ -+ return tfm->__crt_alg->cra_flags & CRYPTO_ALG_TYPE_MASK; -+} -+ -+static inline unsigned int crypto_tfm_alg_min_keysize(struct crypto_tfm *tfm) -+{ -+ BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); -+ return tfm->__crt_alg->cra_cipher.cia_min_keysize; -+} -+ -+static inline unsigned int crypto_tfm_alg_max_keysize(struct crypto_tfm *tfm) -+{ -+ BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); -+ return tfm->__crt_alg->cra_cipher.cia_max_keysize; -+} -+ -+static inline unsigned int crypto_tfm_alg_ivsize(struct crypto_tfm *tfm) -+{ -+ BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); -+ return tfm->crt_cipher.cit_ivsize; -+} -+ -+static inline unsigned int crypto_tfm_alg_blocksize(struct crypto_tfm *tfm) -+{ -+ return tfm->__crt_alg->cra_blocksize; -+} -+ -+static inline unsigned int crypto_tfm_alg_digestsize(struct crypto_tfm *tfm) -+{ -+ BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); -+ return tfm->__crt_alg->cra_digest.dia_digestsize; -+} -+ -+/* -+ * API wrappers. -+ */ -+static inline void crypto_digest_init(struct crypto_tfm *tfm) -+{ -+ BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); -+ tfm->crt_digest.dit_init(tfm); -+} -+ -+static inline void crypto_digest_update(struct crypto_tfm *tfm, -+ struct scatterlist *sg, -+ unsigned int nsg) -+{ -+ BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); -+ tfm->crt_digest.dit_update(tfm, sg, nsg); -+} -+ -+static inline void crypto_digest_final(struct crypto_tfm *tfm, u8 *out) -+{ -+ BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); -+ tfm->crt_digest.dit_final(tfm, out); -+} -+ -+static inline void crypto_digest_digest(struct crypto_tfm *tfm, -+ struct scatterlist *sg, -+ unsigned int nsg, u8 *out) -+{ -+ BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); -+ tfm->crt_digest.dit_digest(tfm, sg, nsg, out); -+} -+ -+static inline int crypto_digest_setkey(struct crypto_tfm *tfm, -+ const u8 *key, unsigned int keylen) -+{ -+ BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST); -+ if (tfm->crt_digest.dit_setkey == NULL) -+ return -ENOSYS; -+ return tfm->crt_digest.dit_setkey(tfm, key, keylen); -+} -+ -+static inline int crypto_cipher_setkey(struct crypto_tfm *tfm, -+ const u8 *key, unsigned int keylen) -+{ -+ BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); -+ return tfm->crt_cipher.cit_setkey(tfm, key, keylen); -+} -+ -+static inline int crypto_cipher_encrypt(struct crypto_tfm *tfm, -+ struct scatterlist *dst, -+ struct scatterlist *src, -+ unsigned int nbytes) -+{ -+ BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); -+ return tfm->crt_cipher.cit_encrypt(tfm, dst, src, nbytes); -+} -+ -+static inline int crypto_cipher_encrypt_iv(struct crypto_tfm *tfm, -+ struct scatterlist *dst, -+ struct scatterlist *src, -+ unsigned int nbytes, u8 *iv) -+{ -+ BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); -+ BUG_ON(tfm->crt_cipher.cit_mode == CRYPTO_TFM_MODE_ECB); -+ return tfm->crt_cipher.cit_encrypt_iv(tfm, dst, src, nbytes, iv); -+} -+ -+static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm, -+ struct scatterlist *dst, -+ struct scatterlist *src, -+ unsigned int nbytes) -+{ -+ BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); -+ return tfm->crt_cipher.cit_decrypt(tfm, dst, src, nbytes); -+} -+ -+static inline int crypto_cipher_decrypt_iv(struct crypto_tfm *tfm, -+ struct scatterlist *dst, -+ struct scatterlist *src, -+ unsigned int nbytes, u8 *iv) -+{ -+ BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); -+ BUG_ON(tfm->crt_cipher.cit_mode == CRYPTO_TFM_MODE_ECB); -+ return tfm->crt_cipher.cit_decrypt_iv(tfm, dst, src, nbytes, iv); -+} -+ -+static inline void crypto_cipher_set_iv(struct crypto_tfm *tfm, -+ const u8 *src, unsigned int len) -+{ -+ BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); -+ memcpy(tfm->crt_cipher.cit_iv, src, len); -+} -+ -+static inline void crypto_cipher_get_iv(struct crypto_tfm *tfm, -+ u8 *dst, unsigned int len) -+{ -+ BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER); -+ memcpy(dst, tfm->crt_cipher.cit_iv, len); -+} -+ -+static inline int crypto_comp_compress(struct crypto_tfm *tfm, -+ const u8 *src, unsigned int slen, -+ u8 *dst, unsigned int *dlen) -+{ -+ BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_COMPRESS); -+ return tfm->crt_compress.cot_compress(tfm, src, slen, dst, dlen); -+} -+ -+static inline int crypto_comp_decompress(struct crypto_tfm *tfm, -+ const u8 *src, unsigned int slen, -+ u8 *dst, unsigned int *dlen) -+{ -+ BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_COMPRESS); -+ return tfm->crt_compress.cot_decompress(tfm, src, slen, dst, dlen); -+} -+ -+/* -+ * HMAC support. -+ */ -+#ifdef CONFIG_CRYPTO_HMAC -+void crypto_hmac_init(struct crypto_tfm *tfm, u8 *key, unsigned int *keylen); -+void crypto_hmac_update(struct crypto_tfm *tfm, -+ struct scatterlist *sg, unsigned int nsg); -+void crypto_hmac_final(struct crypto_tfm *tfm, u8 *key, -+ unsigned int *keylen, u8 *out); -+void crypto_hmac(struct crypto_tfm *tfm, u8 *key, unsigned int *keylen, -+ struct scatterlist *sg, unsigned int nsg, u8 *out); -+#endif /* CONFIG_CRYPTO_HMAC */ -+ -+#endif /* _LINUX_CRYPTO_H */ -+ -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/scatterwalk.h linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/scatterwalk.h ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/ieee80211/scatterwalk.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/ieee80211/scatterwalk.h 2010-08-05 21:12:34.843620278 +0200 -@@ -0,0 +1,51 @@ -+/* -+ * Cryptographic API. -+ * -+ * Copyright (c) 2002 James Morris <jmorris@intercode.com.au> -+ * Copyright (c) 2002 Adam J. Richter <adam@yggdrasil.com> -+ * Copyright (c) 2004 Jean-Luc Cooke <jlcooke@certainkey.com> -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License as published by the Free -+ * Software Foundation; either version 2 of the License, or (at your option) -+ * any later version. -+ * -+ */ -+ -+#ifndef _CRYPTO_SCATTERWALK_H -+#define _CRYPTO_SCATTERWALK_H -+#include <linux/mm.h> -+#include <asm/scatterlist.h> -+ -+struct scatter_walk { -+ struct scatterlist *sg; -+ struct page *page; -+ void *data; -+ unsigned int len_this_page; -+ unsigned int len_this_segment; -+ unsigned int offset; -+}; -+ -+/* Define sg_next is an inline routine now in case we want to change -+ scatterlist to a linked list later. */ -+static inline struct scatterlist *sg_next(struct scatterlist *sg) -+{ -+ return sg + 1; -+} -+ -+static inline int scatterwalk_samebuf(struct scatter_walk *walk_in, -+ struct scatter_walk *walk_out, -+ void *src_p, void *dst_p) -+{ -+ return walk_in->page == walk_out->page && -+ walk_in->offset == walk_out->offset && -+ walk_in->data == src_p && walk_out->data == dst_p; -+} -+ -+void *scatterwalk_whichbuf(struct scatter_walk *walk, unsigned int nbytes, void *scratch); -+void scatterwalk_start(struct scatter_walk *walk, struct scatterlist *sg); -+int scatterwalk_copychunks(void *buf, struct scatter_walk *walk, size_t nbytes, int out); -+void scatterwalk_map(struct scatter_walk *walk, int out); -+void scatterwalk_done(struct scatter_walk *walk, int out, int more); -+ -+#endif /* _CRYPTO_SCATTERWALK_H */ -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/Makefile linux-2.6.35/drivers/net/wireless/rtl8187b/Makefile ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/Makefile 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/Makefile 2010-08-05 21:12:34.883623740 +0200 -@@ -0,0 +1,41 @@ -+obj-$(CONFIG_RTL8187B) += rtl8187b.o -+ -+rtl8187b-objs := r8187_core.o \ -+ r8180_93cx6.o \ -+ r8180_wx.o \ -+ r8180_rtl8225.o \ -+ r8180_rtl8225z2.o \ -+ r8180_pm.o \ -+ r8180_dm.o \ -+ r8187_led.o \ -+ r8187_rfkill.o \ -+ ieee80211/dot11d.o \ -+ ieee80211/ieee80211_softmac.o \ -+ ieee80211/ieee80211_rx.o \ -+ ieee80211/ieee80211_tx.o \ -+ ieee80211/ieee80211_wx.o \ -+ ieee80211/ieee80211_module.o \ -+ ieee80211/ieee80211_softmac_wx.o \ -+ ieee80211/ieee80211_crypt.o \ -+ ieee80211/ieee80211_crypt_tkip.o \ -+ ieee80211/ieee80211_crypt_ccmp.o \ -+ ieee80211/ieee80211_crypt_wep.o -+ -+EXTRA_CFLAGS += -DCONFIG_RTL8180_PM -+EXTRA_CFLAGS += -DJACKSON_NEW_8187 -DJACKSON_NEW_RX -+EXTRA_CFLAGS += -DTHOMAS_BEACON -DTHOMAS_TASKLET -DTHOMAS_SKB -DTHOMAS_TURBO -+EXTRA_CFLAGS += -DJOHN_IOCTL -+EXTRA_CFLAGS += -DLED -+#EXTRA_CFLAGS += -DLED_SHIN -+#EXTRA_CFLAGS += -DSW_ANTE_DIVERSITY -+EXTRA_CFLAGS += -DCPU_64BIT -+EXTRA_CFLAGS += -DCONFIG_IPS -+#CFLAGS += -DJOHN_HWSEC -DJOHN_TKIP -+#CFLAGS += -DJOHN_DUMP_TX -+#EXTRA_CFLAGS += -DJOHN_DUMP_TXPKT -+ -+#Radio On/Off debug -+#EXTRA_CFLAGS += -DCONFIG_RADIO_DEBUG -+ -+#for dot11d -+EXTRA_CFLAGS += -DENABLE_DOT11D -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/msh_class.h linux-2.6.35/drivers/net/wireless/rtl8187b/msh_class.h ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/msh_class.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/msh_class.h 2010-08-05 21:12:34.933991193 +0200 -@@ -0,0 +1,117 @@ -+/*! \file msh_class.h -+ \brief msh CLASS extension -+ -+ \date 2007/5/2 -+ \author Stanley Chang <chagnsl@cs.nctu.edu.tw> -+*/ -+ -+#ifndef _MESH_CLASS_HDR_H_ -+#define _MESH_CLASS_HDR_H_ -+ -+#include <linux/if_ether.h> /* ETH_ALEN */ -+#include <linux/kernel.h> /* ARRAY_SIZE */ -+#include <linux/version.h> -+#include <linux/jiffies.h> -+#include <linux/timer.h> -+#include <linux/sched.h> -+ -+#include "ieee80211/ieee80211.h" // for struct ieee80211-xxxx -+#include "r8187.h" // for struct r8180-priv -+ -+#define MAC_TABLE_SIZE 8 -+ -+struct mshclass { -+ struct r8180_priv * p8187; -+ -+ // callback functions -+ // ieee80211_softmac.c -+ int (*ext_patch_ieee80211_start_protocol) (struct ieee80211_device *ieee); // start special mode -+ -+ short (*ext_patch_ieee80211_probe_req_1) (struct ieee80211_device *ieee); // return = 0: no more phases, >0: another phase -+ u8* (*ext_patch_ieee80211_probe_req_2) (struct ieee80211_device *ieee, struct sk_buff *skb, u8 *tag); // return tag -+ -+ void (*ext_patch_ieee80211_association_req_1) (struct ieee80211_assoc_request_frame *hdr); -+ u8* (*ext_patch_ieee80211_association_req_2) (struct ieee80211_device *ieee, struct ieee80211_network *pstat, struct sk_buff *skb); -+ -+ int (*ext_patch_ieee80211_rx_frame_softmac_on_assoc_req) (struct ieee80211_device *ieee, struct sk_buff *skb); -+ int (*ext_patch_ieee80211_rx_frame_softmac_on_assoc_rsp) (struct ieee80211_device *ieee, struct sk_buff *skb); -+ -+ void (*ext_patch_ieee80211_stop_protocol) (struct ieee80211_device *ieee); // stop timer -+ -+ void (*ext_patch_ieee80211_assoc_resp_by_net_1) (struct ieee80211_assoc_response_frame *assoc); -+ u8* (*ext_patch_ieee80211_assoc_resp_by_net_2) (struct ieee80211_device *ieee, struct ieee80211_network *pstat, int pkt_type, struct sk_buff *skb); -+ -+ int (*ext_patch_ieee80211_ext_stop_scan_wq_set_channel) (struct ieee80211_device *ieee); -+ -+ struct sk_buff* (*ext_patch_get_beacon_get_probersp)(struct ieee80211_device *ieee, u8 *dest, struct ieee80211_network *net); -+ -+ int (*ext_patch_ieee80211_softmac_xmit_get_rate) (struct ieee80211_device *ieee, struct sk_buff *skb); -+ int (*ext_patch_ieee80211_rx_frame_softmac_on_auth)(struct ieee80211_device *ieee, struct sk_buff *skb, struct ieee80211_rx_stats *rx_stats); -+ int (*ext_patch_ieee80211_rx_frame_softmac_on_deauth)(struct ieee80211_device *ieee, struct sk_buff *skb, struct ieee80211_rx_stats *rx_stats); -+//by amy for mesh -+ void (*ext_patch_ieee80211_start_mesh)(struct ieee80211_device *ieee); -+//by amy for mesh -+ /// r8180_wx.c -+ int (*ext_patch_r8180_wx_get_meshinfo) (struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra); -+ int (*ext_patch_r8180_wx_enable_mesh) (struct net_device *dev); -+ int (*ext_patch_r8180_wx_disable_mesh) (struct net_device *dev); -+ int (*ext_patch_r8180_wx_set_meshID) ( struct net_device *dev, char *ext); -+//by amy for mesh -+ int (*ext_patch_r8180_wx_set_mesh_chan)(struct net_device *dev, unsigned char channel); -+//by amy for mesh -+ void (*ext_patch_r8180_wx_set_channel) (struct ieee80211_device *ieee, int ch); -+ -+ int (*ext_patch_r8180_wx_set_add_mac_allow) (struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra); -+ int (*ext_patch_r8180_wx_set_del_mac_allow) (struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra); -+ int (*ext_patch_r8180_wx_set_add_mac_deny) (struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra); -+ int (*ext_patch_r8180_wx_set_del_mac_deny) (struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra); -+ int (*ext_patch_r8180_wx_get_mac_allow) (struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra); -+ int (*ext_patch_r8180_wx_get_mac_deny) (struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra); -+ -+ int (*ext_patch_r8180_wx_get_mesh_list) (struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra); -+ int (*ext_patch_r8180_wx_mesh_scan) (struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra); -+ int (*ext_patch_r8180_wx_get_selected_mesh)(struct net_device *dev, int en, char *cho, char* id); -+//by amy for networkmanager UI -+ int (*ext_patch_r8180_wx_get_selected_mesh_channel)(struct net_device *dev, char* extmeshid, char *cho); -+//by amy for networkmanager UI -+ /// r8187_core.c -+ u8 (*ext_patch_rtl8180_up) (struct mshclass *priv); -+ -+ // ieee80211_rx.c -+ unsigned int (*ext_patch_ieee80211_process_probe_response_1) ( struct ieee80211_device *ieee, struct ieee80211_probe_response *beacon, struct ieee80211_rx_stats *stats); -+ void (*ext_patch_ieee80211_rx_mgt_on_probe_req) ( struct ieee80211_device *ieee, struct ieee80211_probe_request *beacon, struct ieee80211_rx_stats *stats); -+ -+ void (*ext_patch_ieee80211_rx_mgt_update_expire) ( struct ieee80211_device *ieee, struct sk_buff *skb); -+ -+ int (*ext_patch_ieee80211_rx_on_rx) (struct ieee80211_device *ieee, struct sk_buff *skb, struct ieee80211_rx_stats *rx_stats, u16 type, u16 stype); -+ -+ int (*ext_patch_ieee80211_rx_frame_get_hdrlen) (struct ieee80211_device *ieee, struct sk_buff *skb); -+ -+ int (*ext_patch_ieee80211_rx_is_valid_framectl) (struct ieee80211_device *ieee, u16 fc, u16 type, u16 stype); -+ -+ // return > 0 is success. 0 when failed -+ int (*ext_patch_ieee80211_rx_process_dataframe) (struct ieee80211_device *ieee, struct sk_buff *skb, struct ieee80211_rx_stats *rx_stats); -+ -+ int (*ext_patch_is_duplicate_packet) (struct ieee80211_device *ieee, struct ieee80211_hdr *header, u16 type, u16 stype); -+ /* added by david for setting acl dynamically */ -+ u8 (*ext_patch_ieee80211_acl_query) (struct ieee80211_device *ieee, u8 *sa); -+ -+ // r8187_core.c -+ int (*ext_patch_rtl8180_ioctl) (struct net_device *dev, struct ifreq *rq, int cmd); -+ void (*ext_patch_create_proc) (struct r8180_priv *priv); -+ void (*ext_patch_remove_proc) (struct r8180_priv *priv); -+ -+ // ieee80211_tx.c -+ -+ // locked by ieee->lock. Call ieee80211_softmac_xmit afterward -+ struct ieee80211_txb* (*ext_patch_ieee80211_xmit) (struct sk_buff *skb, struct net_device *dev); -+ -+ // DO NOT MODIFY ANY STRUCTURE BELOW THIS LINE -+ u8 priv[0]; // mshclass_priv; -+}; -+ -+extern void free_mshobj(struct mshclass **pObj); -+extern struct mshclass *alloc_mshobj(struct r8180_priv *caller_priv); -+ -+ -+#endif // _MESH_CLASS_HDR_H_ -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8180_93cx6.c linux-2.6.35/drivers/net/wireless/rtl8187b/r8180_93cx6.c ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8180_93cx6.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/r8180_93cx6.c 2010-08-05 21:12:34.973623604 +0200 -@@ -0,0 +1,146 @@ -+/* -+ This files contains card eeprom (93c46 or 93c56) programming routines, -+ memory is addressed by 16 bits words. -+ -+ This is part of rtl8180 OpenSource driver. -+ Copyright (C) Andrea Merello 2004 <andreamrl@tiscali.it> -+ Released under the terms of GPL (General Public Licence) -+ -+ Parts of this driver are based on the GPL part of the -+ official realtek driver. -+ -+ Parts of this driver are based on the rtl8180 driver skeleton -+ from Patric Schenke & Andres Salomon. -+ -+ Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver. -+ -+ We want to tanks the Authors of those projects and the Ndiswrapper -+ project Authors. -+*/ -+ -+#include "r8180_93cx6.h" -+ -+void eprom_cs(struct net_device *dev, short bit) -+{ -+ if(bit) -+ write_nic_byte(dev, EPROM_CMD, -+ (1<<EPROM_CS_SHIFT) | \ -+ read_nic_byte(dev, EPROM_CMD)); //enable EPROM -+ else -+ write_nic_byte(dev, EPROM_CMD, read_nic_byte(dev, EPROM_CMD)\ -+ &~(1<<EPROM_CS_SHIFT)); //disable EPROM -+ -+ force_pci_posting(dev); -+ udelay(EPROM_DELAY); -+} -+ -+ -+void eprom_ck_cycle(struct net_device *dev) -+{ -+ write_nic_byte(dev, EPROM_CMD, -+ (1<<EPROM_CK_SHIFT) | read_nic_byte(dev,EPROM_CMD)); -+ force_pci_posting(dev); -+ udelay(EPROM_DELAY); -+ write_nic_byte(dev, EPROM_CMD, -+ read_nic_byte(dev, EPROM_CMD) &~ (1<<EPROM_CK_SHIFT)); -+ force_pci_posting(dev); -+ udelay(EPROM_DELAY); -+} -+ -+ -+void eprom_w(struct net_device *dev,short bit) -+{ -+ if(bit) -+ write_nic_byte(dev, EPROM_CMD, (1<<EPROM_W_SHIFT) | \ -+ read_nic_byte(dev,EPROM_CMD)); -+ else -+ write_nic_byte(dev, EPROM_CMD, read_nic_byte(dev,EPROM_CMD)\ -+ &~(1<<EPROM_W_SHIFT)); -+ -+ force_pci_posting(dev); -+ udelay(EPROM_DELAY); -+} -+ -+ -+short eprom_r(struct net_device *dev) -+{ -+ short bit; -+ -+ bit=(read_nic_byte(dev, EPROM_CMD) & (1<<EPROM_R_SHIFT) ); -+ udelay(EPROM_DELAY); -+ -+ if(bit) return 1; -+ return 0; -+} -+ -+ -+void eprom_send_bits_string(struct net_device *dev, short b[], int len) -+{ -+ int i; -+ -+ for(i=0; i<len; i++){ -+ eprom_w(dev, b[i]); -+ eprom_ck_cycle(dev); -+ } -+} -+ -+ -+u32 eprom_read(struct net_device *dev, u32 addr) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ short read_cmd[]={1,1,0}; -+ short addr_str[8]; -+ int i; -+ int addr_len; -+ u32 ret; -+ -+ ret=0; -+ //enable EPROM programming -+ write_nic_byte(dev, EPROM_CMD, -+ (EPROM_CMD_PROGRAM<<EPROM_CMD_OPERATING_MODE_SHIFT)); -+ force_pci_posting(dev); -+ udelay(EPROM_DELAY); -+ -+ if (priv->epromtype==EPROM_93c56){ -+ addr_str[7]=addr & 1; -+ addr_str[6]=addr & (1<<1); -+ addr_str[5]=addr & (1<<2); -+ addr_str[4]=addr & (1<<3); -+ addr_str[3]=addr & (1<<4); -+ addr_str[2]=addr & (1<<5); -+ addr_str[1]=addr & (1<<6); -+ addr_str[0]=addr & (1<<7); -+ addr_len=8; -+ }else{ -+ addr_str[5]=addr & 1; -+ addr_str[4]=addr & (1<<1); -+ addr_str[3]=addr & (1<<2); -+ addr_str[2]=addr & (1<<3); -+ addr_str[1]=addr & (1<<4); -+ addr_str[0]=addr & (1<<5); -+ addr_len=6; -+ } -+ eprom_cs(dev, 1); -+ eprom_ck_cycle(dev); -+ eprom_send_bits_string(dev, read_cmd, 3); -+ eprom_send_bits_string(dev, addr_str, addr_len); -+ -+ //keep chip pin D to low state while reading. -+ //I'm unsure if it is necessary, but anyway shouldn't hurt -+ eprom_w(dev, 0); -+ -+ for(i=0;i<16;i++){ -+ //eeprom needs a clk cycle between writing opcode&adr -+ //and reading data. (eeprom outs a dummy 0) -+ eprom_ck_cycle(dev); -+ ret |= (eprom_r(dev)<<(15-i)); -+ } -+ -+ eprom_cs(dev, 0); -+ eprom_ck_cycle(dev); -+ -+ //disable EPROM programming -+ write_nic_byte(dev, EPROM_CMD, -+ (EPROM_CMD_NORMAL<<EPROM_CMD_OPERATING_MODE_SHIFT)); -+ return ret; -+} -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8180_93cx6.h linux-2.6.35/drivers/net/wireless/rtl8187b/r8180_93cx6.h ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8180_93cx6.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/r8180_93cx6.h 2010-08-05 21:12:35.013619071 +0200 -@@ -0,0 +1,46 @@ -+/* -+ This is part of rtl8187 OpenSource driver -+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it> -+ Released under the terms of GPL (General Public Licence) -+ -+ Parts of this driver are based on the GPL part of the official realtek driver -+ Parts of this driver are based on the rtl8180 driver skeleton from Patric Schenke & Andres Salomon -+ Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver -+ -+ We want to tanks the Authors of such projects and the Ndiswrapper project Authors. -+*/ -+ -+/*This files contains card eeprom (93c46 or 93c56) programming routines*/ -+/*memory is addressed by WORDS*/ -+ -+#include "r8187.h" -+#include "r8180_hw.h" -+ -+#define EPROM_DELAY 10 -+ -+#define EPROM_ANAPARAM_ADDRLWORD 0xd -+#define EPROM_ANAPARAM_ADDRHWORD 0xe -+ -+#define EPROM_CHANNEL_PLAN 0x3 //0x6>>1 -+//0x77 BIT[0]0:use gpio 1 bit 1, 1:use gpio 1 bit 2. -+#define EPROM_SELECT_GPIO (0x77 >> 1) -+//#define EEPROM_COUNTRY_CODE 0x2E//87se channel plan is here -+ -+#define EPROM_RFCHIPID 0x6 -+#define EPROM_TXPW_BASE 0x05 -+#define EPROM_RFCHIPID_RTL8225U 5 -+#define EPROM_RFCHIPID_RTL8225U_VF 6 -+#define EPROM_RF_PARAM 0x4 -+#define EPROM_CONFIG2 0xc -+ -+#define EPROM_VERSION 0x1E -+#define MAC_ADR 0x7 -+ -+#define CIS 0x18 -+ -+#define EPROM_TXPW0 0x16 -+#define EPROM_TXPW2 0x1b -+#define EPROM_TXPW1 0x3d -+ -+ -+u32 eprom_read(struct net_device *dev,u32 addr); //reads a 16 bits word -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8180_dm.c linux-2.6.35/drivers/net/wireless/rtl8187b/r8180_dm.c ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8180_dm.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/r8180_dm.c 2010-08-05 21:12:35.063622294 +0200 -@@ -0,0 +1,882 @@ -+/*++ -+Copyright (c) Realtek Semiconductor Corp. All rights reserved. -+ -+Module Name: -+ r8180_dig.c -+ -+Abstract: -+ Hardware dynamic mechanism for RTL8187B -+ -+Major Change History: -+ When Who What -+ ---------- --------------- ------------------------------- -+ 2006-11-15 david Created -+ -+Notes: -+ This file is ported from RTL8187B Windows driver. -+ -+ -+--*/ -+#include "r8180_dm.h" -+#include "r8180_hw.h" -+#include "r8180_rtl8225.h" -+ -+//================================================================================ -+// Local Constant. -+//================================================================================ -+#define Z1_HIPWR_UPPER_TH 99 -+#define Z1_HIPWR_LOWER_TH 70 -+#define Z2_HIPWR_UPPER_TH 99 -+#define Z2_HIPWR_LOWER_TH 90 -+ -+bool CheckDig(struct net_device *dev) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ struct ieee80211_device *ieee = priv->ieee80211; -+ -+ if(ieee->state != IEEE80211_LINKED) -+ return false; -+ -+ if(priv->card_8187 == NIC_8187B) { -+ // -+ // We need to schedule dig workitem on either of the below mechanisms. -+ // By Bruce, 2007-06-01. -+ // -+ if(!priv->bDigMechanism && !priv->bCCKThMechanism) -+ return false; -+ -+ if(priv->CurrentOperaRate < 36) // Schedule Dig under all OFDM rates. By Bruce, 2007-06-01. -+ return false; -+ } else { -+ if(!priv->bDigMechanism) -+ return false; -+ -+ if(priv->CurrentOperaRate < 48) -+ return false; -+ } -+ return true; -+} -+ -+ -+// -+// Description: -+// Implementation of DIG for Zebra and Zebra2. -+// -+void DIG_Zebra(struct net_device *dev) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ //PHAL_DATA_8187 pHalData = GetHalData8187(Adapter); -+ u16 CCKFalseAlarm, OFDMFalseAlarm; -+ u16 OfdmFA1, OfdmFA2; -+ int InitialGainStep = 7; // The number of initial gain stages. -+ int LowestGainStage = 4; // The capable lowest stage of performing dig workitem. -+ -+// printk("---------> DIG_Zebra()\n"); -+ -+ //Read only 1 byte because of HW bug. This is a temporal modification. Joseph -+ // Modify by Isaiah 2006-06-27 -+ if(priv->card_8187_Bversion == VERSION_8187B_B) -+ { -+ CCKFalseAlarm = 0; -+ OFDMFalseAlarm = (u16)(priv->FalseAlarmRegValue); -+ OfdmFA1 = 0x01; -+ OfdmFA2 = priv->RegDigOfdmFaUpTh; -+ } -+ else -+ { -+ CCKFalseAlarm = (u16)(priv->FalseAlarmRegValue & 0x0000ffff); -+ OFDMFalseAlarm = (u16)((priv->FalseAlarmRegValue >> 16) & 0x0000ffff); -+ OfdmFA1 = 0x15; -+ //OfdmFA2 = 0xC00; -+ OfdmFA2 = ((u16)(priv->RegDigOfdmFaUpTh)) << 8; -+ } -+ -+// printk("DIG**********CCK False Alarm: %#X \n",CCKFalseAlarm); -+// printk("DIG**********OFDM False Alarm: %#X \n",OFDMFalseAlarm); -+ -+ -+ -+ // The number of initial gain steps is different, by Bruce, 2007-04-13. -+ if(priv->card_8187 == NIC_8187) { -+ if (priv->InitialGain == 0 ) //autoDIG -+ { -+ switch( priv->rf_chip) -+ { -+ case RF_ZEBRA: -+ priv->InitialGain = 5; // m74dBm; -+ break; -+ case RF_ZEBRA2: -+ priv->InitialGain = 4; // m78dBm; -+ break; -+ default: -+ priv->InitialGain = 5; // m74dBm; -+ break; -+ } -+ } -+ InitialGainStep = 7; -+ if(priv->InitialGain > 7) -+ priv->InitialGain = 5; -+ LowestGainStage = 4; -+ } else { -+ if (priv->InitialGain == 0 ) //autoDIG -+ { // Advised from SD3 DZ, by Bruce, 2007-06-05. -+ priv->InitialGain = 4; // In 87B, m74dBm means State 4 (m82dBm) -+ } -+ if(priv->card_8187_Bversion != VERSION_8187B_B) -+ { // Advised from SD3 DZ, by Bruce, 2007-06-05. -+ OfdmFA1 = 0x20; -+ } -+ InitialGainStep = 8; -+ LowestGainStage = priv->RegBModeGainStage; // Lowest gain stage. -+ } -+ -+ if (OFDMFalseAlarm > OfdmFA1) -+ { -+ if (OFDMFalseAlarm > OfdmFA2) -+ { -+ priv->DIG_NumberFallbackVote++; -+ if (priv->DIG_NumberFallbackVote >1) -+ { -+ //serious OFDM False Alarm, need fallback -+ // By Bruce, 2007-03-29. -+ // if (pHalData->InitialGain < 7) // In 87B, m66dBm means State 7 (m74dBm) -+ if (priv->InitialGain < InitialGainStep) -+ { -+ priv->InitialGain = (priv->InitialGain + 1); -+ //printk("DIG**********OFDM False Alarm: %#X, OfdmFA1: %#X, OfdmFA2: %#X\n", OFDMFalseAlarm, OfdmFA1, OfdmFA2); -+ //printk("DIG+++++++ fallback OFDM:%d \n", priv->InitialGain); -+ UpdateInitialGain(dev); // 2005.01.06, by rcnjko. -+ } -+ priv->DIG_NumberFallbackVote = 0; -+ priv->DIG_NumberUpgradeVote=0; -+ } -+ } -+ else -+ { -+ if (priv->DIG_NumberFallbackVote) -+ priv->DIG_NumberFallbackVote--; -+ } -+ priv->DIG_NumberUpgradeVote=0; -+ } -+ else //OFDM False Alarm < 0x15 -+ { -+ if (priv->DIG_NumberFallbackVote) -+ priv->DIG_NumberFallbackVote--; -+ priv->DIG_NumberUpgradeVote++; -+ -+ if (priv->DIG_NumberUpgradeVote>9) -+ { -+ if (priv->InitialGain > LowestGainStage) // In 87B, m78dBm means State 4 (m864dBm) -+ { -+ priv->InitialGain = (priv->InitialGain - 1); -+ //printk("DIG**********OFDM False Alarm: %#X, OfdmFA1: %#X, OfdmFA2: %#X\n", OFDMFalseAlarm, OfdmFA1, OfdmFA2); -+ //printk("DIG--------- Upgrade OFDM:%d \n", priv->InitialGain); -+ UpdateInitialGain(dev); // 2005.01.06, by rcnjko. -+ } -+ priv->DIG_NumberFallbackVote = 0; -+ priv->DIG_NumberUpgradeVote=0; -+ } -+ } -+ -+// printk("DIG+++++++ OFDM:%d\n", priv->InitialGain); -+// printk("<--------- DIG_Zebra()\n"); -+} -+ -+// -+// Description: -+// Dispatch DIG implementation according to RF. -+// -+void DynamicInitGain(struct net_device *dev) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ -+ switch(priv->rf_chip) -+ { -+ case RF_ZEBRA: -+ case RF_ZEBRA2: // [AnnieWorkaround] For Zebra2, 2005-08-01. -+ //case RF_ZEBRA4: -+ DIG_Zebra(dev); -+ break; -+ -+ default: -+ printk("DynamicInitGain(): unknown RFChipID(%d) !!!\n", priv->rf_chip); -+ break; -+ } -+} -+ -+// By Bruce, 2007-03-29. -+// -+// Description: -+// Dispatch CCK Power Detection implementation according to RF. -+// -+void DynamicCCKThreshold(struct net_device *dev) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ u16 CCK_Up_Th; -+ u16 CCK_Lw_Th; -+ u16 CCKFalseAlarm; -+ -+ printk("=====>DynamicCCKThreshold()\n"); -+ -+ CCK_Up_Th = priv->CCKUpperTh; -+ CCK_Lw_Th = priv->CCKLowerTh; -+ CCKFalseAlarm = (u16)((priv->FalseAlarmRegValue & 0x0000ffff) >> 8); // We only care about the higher byte. -+ printk("DynamicCCKThreshold(): CCK Upper Threshold: 0x%02X, Lower Threshold: 0x%02X, CCKFalseAlarmHighByte: 0x%02X\n", CCK_Up_Th, CCK_Lw_Th, CCKFalseAlarm); -+ -+ if(priv->StageCCKTh < 3 && CCKFalseAlarm >= CCK_Up_Th) -+ { -+ priv->StageCCKTh ++; -+ UpdateCCKThreshold(dev); -+ } -+ else if(priv->StageCCKTh > 0 && CCKFalseAlarm <= CCK_Lw_Th) -+ { -+ priv->StageCCKTh --; -+ UpdateCCKThreshold(dev); -+ } -+ -+ printk("<=====DynamicCCKThreshold()\n"); -+} -+ -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) -+void rtl8180_hw_dig_wq (struct work_struct *work) -+{ -+ struct delayed_work *dwork = container_of(work,struct delayed_work,work); -+ struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,hw_dig_wq); -+ struct net_device *dev = ieee->dev; -+#else -+void rtl8180_hw_dig_wq(struct net_device *dev) -+{ -+ // struct r8180_priv *priv = ieee80211_priv(dev); -+#endif -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ // Read CCK and OFDM False Alarm. -+ if(priv->card_8187_Bversion == VERSION_8187B_B) { -+ // Read only 1 byte because of HW bug. This is a temporal modification. Joseph -+ // Modify by Isaiah 2006-06-27 -+ priv->FalseAlarmRegValue = (u32)read_nic_byte(dev, (OFDM_FALSE_ALARM+1)); -+ } else { -+ priv->FalseAlarmRegValue = read_nic_dword(dev, CCK_FALSE_ALARM); -+ } -+ -+ // Adjust Initial Gain dynamically. -+ if(priv->bDigMechanism) { -+ DynamicInitGain(dev); -+ } -+ -+ // -+ // Move from DynamicInitGain to be independent of the OFDM DIG mechanism, by Bruce, 2007-06-01. -+ // -+ if(priv->card_8187 == NIC_8187B) { -+ // By Bruce, 2007-03-29. -+ // Dynamically update CCK Power Detection Threshold. -+ if(priv->bCCKThMechanism) -+ { -+ DynamicCCKThreshold(dev); -+ } -+ } -+} -+ -+void SetTxPowerLevel8187(struct net_device *dev, short chan) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ switch(priv->rf_chip) -+ { -+ case RF_ZEBRA: -+ rtl8225_SetTXPowerLevel(dev,chan); -+ break; -+ -+ case RF_ZEBRA2: -+ //case RF_ZEBRA4: -+ rtl8225z2_SetTXPowerLevel(dev,chan); -+ break; -+ } -+} -+ -+// -+// Description: -+// Check if input power signal strength exceeds maximum input power threshold -+// of current HW. -+// If yes, we set our HW to high input power state: -+// RX: always force TR switch to SW Tx mode to reduce input power. -+// TX: turn off smaller Tx output power (see RtUsbCheckForHang). -+// -+// If no, we restore our HW to normal input power state: -+/// RX: restore TR switch to HW controled mode. -+// TX: restore TX output power (see RtUsbCheckForHang). -+// -+// TODO: -+// 1. Tx power control shall not be done in Platform-dependent timer (e.g. RtUsbCheckForHang). -+// 2. Allow these threshold adjustable by RF SD. -+// -+void DoRxHighPower(struct net_device *dev) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ TR_SWITCH_STATE TrSwState; -+ u16 HiPwrUpperTh = 0; -+ u16 HiPwrLowerTh = 0; -+ u16 RSSIHiPwrUpperTh = 0; -+ u16 RSSIHiPwrLowerTh = 0; -+ -+ //87S remove TrSwitch mechanism -+ if((priv->card_8187 == NIC_8187B)||(priv->card_8187 == NIC_8187)) { -+ -+ //printk("----> DoRxHighPower()\n"); -+ -+ // -+ // Get current TR switch setting. -+ // -+ //Adapter->HalFunc.GetHwRegHandler(Adapter, HW_VAR_TR_SWITCH, (pu1Byte)(&TrSwState)); -+ TrSwState = priv->TrSwitchState; -+ -+ // -+ // Determine threshold according to RF type. -+ // -+ switch(priv->rf_chip) -+ { -+ case RF_ZEBRA: -+ HiPwrUpperTh = Z1_HIPWR_UPPER_TH; -+ HiPwrLowerTh = Z1_HIPWR_LOWER_TH; -+ printk("DoRxHighPower(): RF_ZEBRA, Upper Threshold: %d LOWER Threshold: %d\n", -+ HiPwrUpperTh, HiPwrLowerTh); -+ break; -+ -+ case RF_ZEBRA2: -+ if((priv->card_8187 == NIC_8187)) { -+ HiPwrUpperTh = Z2_HIPWR_UPPER_TH; -+ HiPwrLowerTh = Z2_HIPWR_LOWER_TH; -+ } else { -+ // By Bruce, 2007-04-11. -+ // HiPwrUpperTh = Z2_HIPWR_UPPER_TH; -+ // HiPwrLowerTh = Z2_HIPWR_LOWER_TH; -+ -+ HiPwrUpperTh = priv->Z2HiPwrUpperTh; -+ HiPwrLowerTh = priv->Z2HiPwrLowerTh; -+ HiPwrUpperTh = HiPwrUpperTh * 10; -+ HiPwrLowerTh = HiPwrLowerTh * 10; -+ -+ RSSIHiPwrUpperTh = priv->Z2RSSIHiPwrUpperTh; -+ RSSIHiPwrLowerTh = priv->Z2RSSIHiPwrLowerTh; -+ //printk("DoRxHighPower(): RF_ZEBRA2, Upper Threshold: %d LOWER Threshold: %d, RSSI Upper Th: %d, RSSI Lower Th: %d\n",HiPwrUpperTh, HiPwrLowerTh, RSSIHiPwrUpperTh, RSSIHiPwrLowerTh); -+ } -+ break; -+ -+ default: -+ printk("DoRxHighPower(): Unknown RFChipID(%d), UndecoratedSmoothedSS(%d), TrSwState(%d)!!!\n", -+ priv->rf_chip, priv->UndecoratedSmoothedSS, TrSwState); -+ return; -+ break; -+ } -+ -+ /*printk(">>>>>>>>>>Set TR switch to software control, UndecoratedSmoothedSS:%d, CurCCKRSSI = %d\n",\ -+ priv->UndecoratedSmoothedSS, priv->CurCCKRSSI); -+ */ -+ if((priv->card_8187 == NIC_8187)) { -+ // -+ // Perform Rx part High Power Mechanism by UndecoratedSmoothedSS. -+ // -+ if (priv->UndecoratedSmoothedSS > HiPwrUpperTh) -+ { // High input power state. -+ if( priv->TrSwitchState == TR_HW_CONTROLLED ) -+ { -+ /* printk(">>>>>>>>>>Set TR switch to software control, UndecoratedSmoothedSS:%d \n", \ -+ priv->UndecoratedSmoothedSS); -+ // printk(">>>>>>>>>> TR_SW_TX\n"); -+ */ -+ write_nic_byte(dev, RFPinsSelect, -+ (u8)(priv->wMacRegRfPinsSelect | TR_SW_MASK_8187 )); -+ write_nic_byte(dev, RFPinsOutput, -+ (u8)((priv->wMacRegRfPinsOutput&(~TR_SW_MASK_8187))|TR_SW_MASK_TX_8187)); -+ priv->TrSwitchState = TR_SW_TX; -+ priv->bToUpdateTxPwr = true; -+ } -+ } -+ else if (priv->UndecoratedSmoothedSS < HiPwrLowerTh) -+ { // Normal input power state. -+ if( priv->TrSwitchState == TR_SW_TX) -+ { -+ /* printk("<<<<<<<<<<<Set TR switch to hardware control UndecoratedSmoothedSS:%d \n", \ -+ priv->UndecoratedSmoothedSS); -+ // printk("<<<<<<<<<< TR_HW_CONTROLLED\n"); -+ */ -+ write_nic_byte(dev, RFPinsOutput, (u8)(priv->wMacRegRfPinsOutput)); -+ write_nic_byte(dev, RFPinsSelect, (u8)(priv->wMacRegRfPinsSelect)); -+ priv->TrSwitchState = TR_HW_CONTROLLED; -+ priv->bToUpdateTxPwr = true; -+ } -+ } -+ }else { -+ /*printk("=====>TrSwState = %s\n", (TrSwState==TR_HW_CONTROLLED)?"TR_HW_CONTROLLED":"TR_SW_TX"); -+ //printk("UndecoratedSmoothedSS:%d, CurCCKRSSI = %d\n",priv->UndecoratedSmoothedSS, priv->CurCCKRSSI); */ -+ // Asked by SD3 DZ, by Bruce, 2007-04-12. -+ if(TrSwState == TR_HW_CONTROLLED) -+ { -+ if((priv->UndecoratedSmoothedSS > HiPwrUpperTh) || -+ (priv->bCurCCKPkt && (priv->CurCCKRSSI > RSSIHiPwrUpperTh))) -+ { -+ //printk("===============================> high power!\n"); -+ write_nic_byte(dev, RFPinsSelect, (u8)(priv->wMacRegRfPinsSelect|TR_SW_MASK_8187 )); -+ write_nic_byte(dev, RFPinsOutput, -+ (u8)((priv->wMacRegRfPinsOutput&(~TR_SW_MASK_8187))|TR_SW_MASK_TX_8187)); -+ priv->TrSwitchState = TR_SW_TX; -+ priv->bToUpdateTxPwr = true; -+ } -+ } -+ else -+ { -+ if((priv->UndecoratedSmoothedSS < HiPwrLowerTh) && -+ (!priv->bCurCCKPkt || priv->CurCCKRSSI < RSSIHiPwrLowerTh)) -+ { -+ write_nic_byte(dev, RFPinsOutput, (u8)(priv->wMacRegRfPinsOutput)); -+ write_nic_byte(dev, RFPinsSelect, (u8)(priv->wMacRegRfPinsSelect)); -+ priv->TrSwitchState = TR_HW_CONTROLLED; -+ priv->bToUpdateTxPwr = true; -+ } -+ } -+ //printk("<=======TrSwState = %s\n", (TrSwState==TR_HW_CONTROLLED)?"TR_HW_CONTROLLED":"TR_SW_TX"); -+ } -+ //printk("<---- DoRxHighPower()\n"); -+ } -+} -+ -+ -+// -+// Description: -+// Callback function of UpdateTxPowerWorkItem. -+// Because of some event happend, e.g. CCX TPC, High Power Mechanism, -+// We update Tx power of current channel again. -+// -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) -+void rtl8180_tx_pw_wq (struct work_struct *work) -+{ -+ struct delayed_work *dwork = container_of(work,struct delayed_work,work); -+ struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,tx_pw_wq); -+ struct net_device *dev = ieee->dev; -+#else -+void rtl8180_tx_pw_wq(struct net_device *dev) -+{ -+ // struct r8180_priv *priv = ieee80211_priv(dev); -+#endif -+ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ //printk("----> UpdateTxPowerWorkItemCallback()\n"); -+ -+ if(priv->bToUpdateTxPwr) -+ { -+ //printk("DoTxHighPower(): schedule UpdateTxPowerWorkItem......\n"); -+ priv->bToUpdateTxPwr = false; -+ SetTxPowerLevel8187(dev, priv->chan); -+ } -+ -+ DoRxHighPower(dev); -+ //printk("<---- UpdateTxPowerWorkItemCallback()\n"); -+} -+ -+// -+// Description: -+// Return TRUE if we shall perform High Power Mecahnism, FALSE otherwise. -+// -+bool CheckHighPower(struct net_device *dev) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ struct ieee80211_device *ieee = priv->ieee80211; -+ -+ if(!priv->bRegHighPowerMechanism) -+ { -+ return false; -+ } -+ -+ if((ieee->state == IEEE80211_LINKED_SCANNING)||(ieee->state == IEEE80211_MESH_SCANNING)) -+ { -+ return false; -+ } -+ -+ return true; -+} -+ -+#ifdef SW_ANTE_DIVERSITY -+ -+#define ANTENNA_DIVERSITY_TIMER_PERIOD 1000 // 1000 m -+ -+void -+SwAntennaDiversityRxOk8185( -+ struct net_device *dev, -+ u8 SignalStrength -+ ) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ -+ //printk("+SwAntennaDiversityRxOk8185: RxSs: %d\n", SignalStrength); -+ -+ priv->AdRxOkCnt++; -+ -+ if( priv->AdRxSignalStrength != -1) -+ { -+ priv->AdRxSignalStrength = ((priv->AdRxSignalStrength*7) + (SignalStrength*3)) / 10; -+ } -+ else -+ { // Initialization case. -+ priv->AdRxSignalStrength = SignalStrength; -+ } -+ -+ //printk("====>pkt rcvd by %d\n", priv->LastRxPktAntenna); -+ if( priv->LastRxPktAntenna ) //Main antenna. -+ priv->AdMainAntennaRxOkCnt++; -+ else // Aux antenna. -+ priv->AdAuxAntennaRxOkCnt++; -+ //printk("-SwAntennaDiversityRxOk8185: AdRxOkCnt: %d AdRxSignalStrength: %d\n", priv->AdRxOkCnt, priv->AdRxSignalStrength); -+} -+ -+// -+// Description: Change Antenna Switch. -+// -+bool -+SetAntenna8185( -+ struct net_device *dev, -+ u8 u1bAntennaIndex -+ ) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ bool bAntennaSwitched = false; -+ -+// printk("+SetAntenna8185(): Antenna is switching to: %d \n", u1bAntennaIndex); -+ -+ switch(u1bAntennaIndex) -+ { -+ case 0://main antenna -+ switch(priv->rf_chip) -+ { -+ case RF_ZEBRA: -+ case RF_ZEBRA2: -+ //case RF_ZEBRA4: -+ // Tx Antenna. -+ write_nic_byte(dev, ANTSEL, 0x03); // Config TX antenna. -+ -+ //PlatformEFIOWrite4Byte(Adapter, BBAddr, 0x01009b90); // Config CCK RX antenna. -+ //PlatformEFIOWrite4Byte(Adapter, BBAddr, 0x5c8D); // Config OFDM RX antenna. -+ -+ // Rx CCK . -+ write_nic_byte(dev, 0x7f, ((0x01009b90 & 0xff000000) >> 24)); -+ write_nic_byte(dev, 0x7e, ((0x01009b90 & 0x00ff0000) >> 16)); -+ write_nic_byte(dev, 0x7d, ((0x01009b90 & 0x0000ff00) >> 8)); -+ write_nic_byte(dev, 0x7c, ((0x01009b90 & 0x000000ff) >> 0)); -+ -+ // Rx OFDM. -+ write_nic_byte(dev, 0x7f, ((0x00005c8D & 0xff000000) >> 24)); -+ write_nic_byte(dev, 0x7e, ((0x00005c8D & 0x00ff0000) >> 16)); -+ write_nic_byte(dev, 0x7d, ((0x00005c8D & 0x0000ff00) >> 8)); -+ write_nic_byte(dev, 0x7c, ((0x00005c8D & 0x000000ff) >> 0)); -+ -+ bAntennaSwitched = true; -+ break; -+ -+ default: -+ printk("SetAntenna8185: unkown RFChipID(%d)\n", priv->rf_chip); -+ break; -+ } -+ break; -+ -+ case 1: -+ switch(priv->rf_chip) -+ { -+ case RF_ZEBRA: -+ case RF_ZEBRA2: -+ //case RF_ZEBRA4: -+ // Tx Antenna. -+ write_nic_byte(dev, ANTSEL, 0x00); // Config TX antenna. -+ -+ //PlatformEFIOWrite4Byte(Adapter, BBAddr, 0x0100bb90); // Config CCK RX antenna. -+ //PlatformEFIOWrite4Byte(Adapter, BBAddr, 0x548D); // Config OFDM RX antenna. -+ -+ // Rx CCK. -+ write_nic_byte(dev, 0x7f, ((0x0100bb90 & 0xff000000) >> 24)); -+ write_nic_byte(dev, 0x7e, ((0x0100bb90 & 0x00ff0000) >> 16)); -+ write_nic_byte(dev, 0x7d, ((0x0100bb90 & 0x0000ff00) >> 8)); -+ write_nic_byte(dev, 0x7c, ((0x0100bb90 & 0x000000ff) >> 0)); -+ -+ // Rx OFDM. -+ write_nic_byte(dev, 0x7f, ((0x0000548D & 0xff000000) >> 24)); -+ write_nic_byte(dev, 0x7e, ((0x0000548D & 0x00ff0000) >> 16)); -+ write_nic_byte(dev, 0x7d, ((0x0000548D & 0x0000ff00) >> 8)); -+ write_nic_byte(dev, 0x7c, ((0x0000548D & 0x000000ff) >> 0)); -+ -+ bAntennaSwitched = true; -+ break; -+ -+ default: -+ printk("SetAntenna8185: unkown RFChipID(%d)\n", priv->rf_chip); -+ break; -+ } -+ break; -+ -+ default: -+ printk("SetAntenna8185: unkown u1bAntennaIndex(%d)\n", u1bAntennaIndex); -+ break; -+ } -+ -+ if(bAntennaSwitched) -+ { -+ priv->CurrAntennaIndex = u1bAntennaIndex; -+ } -+ -+// printk("-SetAntenna8185(): return (%#X)\n", bAntennaSwitched); -+ -+ return bAntennaSwitched; -+} -+ -+// -+// Description: Toggle Antenna switch. -+// -+bool SwitchAntenna(struct net_device *dev) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ -+ bool bResult = false; -+ -+ if(priv->CurrAntennaIndex == 0) -+ { -+ bResult = SetAntenna8185(dev, 1); -+ if(priv->ieee80211->state == IEEE80211_LINKED) -+ printk("Switching to Aux antenna 1 \n"); -+ } -+ else -+ { -+ bResult = SetAntenna8185(dev, 0); -+ if(priv->ieee80211->state == IEEE80211_LINKED) -+ printk("Switching to Main antenna 0 \n"); -+ } -+ -+ return bResult; -+} -+ -+// -+// Description: -+// Engine of SW Antenna Diversity mechanism. -+// Since 8187 has no Tx part information, -+// this implementation is only dependend on Rx part information. -+// -+// 2006.04.17, by rcnjko. -+// -+void SwAntennaDiversity(struct net_device *dev) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ //bool bSwCheckSS=false; -+ bool bSwCheckSS=true;//open the SignalStrength check if not switched by rx ok pkt. -+ -+// printk("+SwAntennaDiversity(): CurrAntennaIndex: %d\n", priv->CurrAntennaIndex); -+ -+//by amy 080312 -+ if(bSwCheckSS){ -+ priv->AdTickCount++; -+ -+ //printk("(1) AdTickCount: %d, AdCheckPeriod: %d\n", priv->AdTickCount, priv->AdCheckPeriod); -+ //printk("(2) AdRxSignalStrength: %ld, AdRxSsThreshold: %ld\n", priv->AdRxSignalStrength, priv->AdRxSsThreshold); -+ } -+// priv->AdTickCount++;//-by amy 080312 -+ -+ // Case 1. No Link. -+ if(priv->ieee80211->state != IEEE80211_LINKED){ -+ //printk("SwAntennaDiversity(): Case 1. No Link.\n"); -+ -+ priv->bAdSwitchedChecking = false; -+ // I switch antenna here to prevent any one of antenna is broken before link established, 2006.04.18, by rcnjko.. -+ SwitchAntenna(dev); -+ } -+ // Case 2. Linked but no packet received. -+ else if(priv->AdRxOkCnt == 0){ -+ printk("SwAntennaDiversity(): Case 2. Linked but no packet received.\n"); -+ -+ priv->bAdSwitchedChecking = false; -+ SwitchAntenna(dev); -+ } -+ // Case 3. Evaluate last antenna switch action in case4. and undo it if necessary. -+ else if(priv->bAdSwitchedChecking == true){ -+ //printk("SwAntennaDiversity(): Case 3. Evaluate last antenna switch action.\n"); -+ -+ priv->bAdSwitchedChecking = false; -+ -+ // Adjust Rx signal strength threashold. -+ priv->AdRxSsThreshold = (priv->AdRxSignalStrength + priv->AdRxSsBeforeSwitched) / 2; -+ -+ priv->AdRxSsThreshold = (priv->AdRxSsThreshold > priv->AdMaxRxSsThreshold) ? -+ priv->AdMaxRxSsThreshold: priv->AdRxSsThreshold; -+ if(priv->AdRxSignalStrength < priv->AdRxSsBeforeSwitched){ -+ // Rx signal strength is not improved after we swtiched antenna. => Swich back. -+ printk("SwAntennaDiversity(): Rx Signal Strength is not improved, CurrRxSs: %ld, LastRxSs: %ld\n", priv->AdRxSignalStrength, priv->AdRxSsBeforeSwitched); -+ -+ //by amy 080312 -+ // Increase Antenna Diversity checking period due to bad decision. -+ priv->AdCheckPeriod *= 2; -+ //by amy 080312 -+ // -+ // Increase Antenna Diversity checking period. -+ if(priv->AdCheckPeriod > priv->AdMaxCheckPeriod) -+ priv->AdCheckPeriod = priv->AdMaxCheckPeriod; -+ -+ // Wrong deceision => switch back. -+ SwitchAntenna(dev); -+ }else{ // Rx Signal Strength is improved. -+ printk("SwAntennaDiversity(): Rx Signal Strength is improved, CurrRxSs: %ld, LastRxSs: %ld\n", priv->AdRxSignalStrength, priv->AdRxSsBeforeSwitched); -+ -+ // Reset Antenna Diversity checking period to its min value. -+ priv->AdCheckPeriod = priv->AdMinCheckPeriod; -+ } -+ -+ //printk("SwAntennaDiversity(): AdRxSsThreshold: %ld, AdCheckPeriod: %d\n", -+ // priv->AdRxSsThreshold, priv->AdCheckPeriod); -+ } -+ // Case 4. Evaluate if we shall switch antenna now. -+ // Cause Table Speed is very fast in TRC Dell Lab, we check it every time. -+ else// if(priv->AdTickCount >= priv->AdCheckPeriod)//-by amy 080312 -+ { -+ //printk("SwAntennaDiversity(): Case 4. Evaluate if we shall switch antenna now.\n"); -+ -+ priv->AdTickCount = 0; -+ -+ // -+ // <Roger_Notes> We evaluate RxOk counts for each antenna first and than -+ // evaluate signal strength. -+ // The following operation can overcome the disability of CCA on both two antennas -+ // When signal strength was extremely low or high. -+ // 2008.01.30. -+ // -+ -+ // -+ // Evaluate RxOk count from each antenna if we shall switch default antenna now. -+ // Added by Roger, 2008.02.21. -+ -+ //{by amy 080312 -+ if((priv->AdMainAntennaRxOkCnt < priv->AdAuxAntennaRxOkCnt) && (priv->CurrAntennaIndex == 0)){ -+ // We set Main antenna as default but RxOk count was less than Aux ones. -+ -+ printk("SwAntennaDiversity(): Main antenna %d RxOK is poor, AdMainAntennaRxOkCnt: %d, AdAuxAntennaRxOkCnt: %d\n",priv->CurrAntennaIndex, priv->AdMainAntennaRxOkCnt, priv->AdAuxAntennaRxOkCnt); -+ -+ // Switch to Aux antenna. -+ SwitchAntenna(dev); -+ priv->bHWAdSwitched = true; -+ }else if((priv->AdAuxAntennaRxOkCnt < priv->AdMainAntennaRxOkCnt) && (priv->CurrAntennaIndex == 1)){ -+ // We set Aux antenna as default but RxOk count was less than Main ones. -+ -+ printk("SwAntennaDiversity(): Aux antenna %d RxOK is poor, AdMainAntennaRxOkCnt: %d, AdAuxAntennaRxOkCnt: %d\n",priv->CurrAntennaIndex, priv->AdMainAntennaRxOkCnt, priv->AdAuxAntennaRxOkCnt); -+ -+ // Switch to Main antenna. -+ SwitchAntenna(dev); -+ priv->bHWAdSwitched = true; -+ }else{// Default antenna is better. -+ -+ printk("SwAntennaDiversity(): Current Antenna %d is better., AdMainAntennaRxOkCnt: %d, AdAuxAntennaRxOkCnt: %d\n",priv->CurrAntennaIndex, priv->AdMainAntennaRxOkCnt, priv->AdAuxAntennaRxOkCnt); -+ -+ // Still need to check current signal strength. -+ priv->bHWAdSwitched = false; -+ } -+ // -+ // <Roger_Notes> We evaluate Rx signal strength ONLY when default antenna -+ // didn't changed by HW evaluation. -+ // 2008.02.27. -+ // -+ // [TRC Dell Lab] SignalStrength is inaccuracy. Isaiah 2008-03-05 -+ // For example, Throughput of aux is better than main antenna(about 10M v.s 2M), -+ // but AdRxSignalStrength is less than main. -+ // Our guess is that main antenna have lower throughput and get many change -+ // to receive more CCK packets(ex.Beacon) which have stronger SignalStrength. -+ // -+ if( (!priv->bHWAdSwitched) && (bSwCheckSS)){ -+ //by amy 080312} -+ -+ // Evaluate Rx signal strength if we shall switch antenna now. -+ if(priv->AdRxSignalStrength < priv->AdRxSsThreshold){ -+ // Rx signal strength is weak => Switch Antenna. -+ printk("SwAntennaDiversity(): Rx Signal Strength is weak, CurrRxSs: %ld, RxSsThreshold: %ld\n", priv->AdRxSignalStrength, priv->AdRxSsThreshold); -+ -+ priv->AdRxSsBeforeSwitched = priv->AdRxSignalStrength; -+ priv->bAdSwitchedChecking = true; -+ -+ SwitchAntenna(dev); -+ }else{ // Rx signal strength is OK. -+ printk("SwAntennaDiversity(): Rx Signal Strength is OK, CurrRxSs: %ld, RxSsThreshold: %ld\n", priv->AdRxSignalStrength, priv->AdRxSsThreshold); -+ -+ priv->bAdSwitchedChecking = false; -+ // Increase Rx signal strength threashold if necessary. -+ if( (priv->AdRxSignalStrength > (priv->AdRxSsThreshold + 10)) && // Signal is much stronger than current threshold -+ priv->AdRxSsThreshold <= priv->AdMaxRxSsThreshold) // Current threhold is not yet reach upper limit. -+ { -+ priv->AdRxSsThreshold = (priv->AdRxSsThreshold + priv->AdRxSignalStrength) / 2; -+ priv->AdRxSsThreshold = (priv->AdRxSsThreshold > priv->AdMaxRxSsThreshold) ? -+ priv->AdMaxRxSsThreshold: priv->AdRxSsThreshold;//+by amy 080312 -+ } -+ -+ // Reduce Antenna Diversity checking period if possible. -+ if( priv->AdCheckPeriod > priv->AdMinCheckPeriod ) -+ { -+ priv->AdCheckPeriod /= 2; -+ } -+ } -+ } -+ } -+//by amy 080312 -+ // Reset antenna diversity Rx related statistics. -+ priv->AdRxOkCnt = 0; -+ priv->AdMainAntennaRxOkCnt = 0; -+ priv->AdAuxAntennaRxOkCnt = 0; -+//by amy 080312 -+ -+// priv->AdRxOkCnt = 0;//-by amy 080312 -+ -+ //printk("-SwAntennaDiversity()\n"); -+} -+ -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) -+void SwAntennaWorkItemCallback(struct work_struct *work) -+{ -+ struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, SwAntennaWorkItem.work); -+ struct net_device *dev = ieee->dev; -+#else -+void SwAntennaWorkItemCallback(struct net_device *dev) -+{ -+#endif -+ //printk("==>%s \n", __func__); -+ SwAntennaDiversity(dev); -+} -+ -+// -+// Description: Timer callback function of SW Antenna Diversity. -+// -+void SwAntennaDiversityTimerCallback(struct net_device *dev) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ RT_RF_POWER_STATE rtState; -+ -+ //printk("+SwAntennaDiversityTimerCallback()\n"); -+ -+ // -+ // We do NOT need to switch antenna while RF is off. -+ // 2007.05.09, added by Roger. -+ // -+ rtState = priv->eRFPowerState; -+ do{ -+ if (rtState == eRfOff){ -+// printk("SwAntennaDiversityTimer - RF is OFF.\n"); -+ break; -+ }else if (rtState == eRfSleep){ -+ // Don't access BB/RF under Disable PLL situation. -+ //RT_TRACE((COMP_RF|COMP_ANTENNA), DBG_LOUD, ("SwAntennaDiversityTimerCallback(): RF is Sleep => skip it\n")); -+ break; -+ } -+ -+ queue_work(priv->ieee80211->wq,(void *)&priv->ieee80211->SwAntennaWorkItem); -+ -+ }while(false); -+ -+ if(priv->up){ -+ //priv->SwAntennaDiversityTimer.expires = jiffies + MSECS(ANTENNA_DIVERSITY_TIMER_PERIOD); -+ //add_timer(&priv->SwAntennaDiversityTimer); -+ mod_timer(&priv->SwAntennaDiversityTimer, jiffies + MSECS(ANTENNA_DIVERSITY_TIMER_PERIOD)); -+ } -+ -+} -+#endif -+ -+ -+ -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8180_dm.h linux-2.6.35/drivers/net/wireless/rtl8187b/r8180_dm.h ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8180_dm.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/r8180_dm.h 2010-08-05 21:12:35.103620706 +0200 -@@ -0,0 +1,38 @@ -+/* -+ Hardware dynamic mechanism for RTL8187B. -+Notes: -+ This file is ported from RTL8187B Windows driver -+*/ -+ -+#ifndef R8180_DM_H -+#define R8180_DM_H -+ -+#include "r8187.h" -+ -+bool CheckDig(struct net_device *dev); -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) -+void rtl8180_hw_dig_wq (struct work_struct *work); -+#else -+void rtl8180_hw_dig_wq(struct net_device *dev); -+#endif -+ -+bool CheckHighPower(struct net_device *dev); -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) -+void rtl8180_tx_pw_wq (struct work_struct *work); -+#else -+void rtl8180_tx_pw_wq(struct net_device *dev); -+#endif -+ -+//by lzm for antenna -+#ifdef SW_ANTE_DIVERSITY -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) -+void SwAntennaWorkItemCallback(struct work_struct *work); -+#else -+void SwAntennaWorkItemCallback(struct net_device *dev); -+#endif -+void SwAntennaDiversityRxOk8185(struct net_device *dev, u8 SignalStrength); -+void SwAntennaDiversityTimerCallback(struct net_device *dev); -+#endif -+//by lzm for antenna -+ -+#endif //R8180_PM_H -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8180_hw.h linux-2.6.35/drivers/net/wireless/rtl8187b/r8180_hw.h ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8180_hw.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/r8180_hw.h 2010-08-05 21:12:35.143622600 +0200 -@@ -0,0 +1,788 @@ -+/* -+ This is part of rtl8187 OpenSource driver. -+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it> -+ Released under the terms of GPL (General Public Licence) -+ -+ Parts of this driver are based on the GPL part of the -+ official Realtek driver. -+ Parts of this driver are based on the rtl8180 driver skeleton -+ from Patric Schenke & Andres Salomon. -+ Parts of this driver are based on the Intel Pro Wireless -+ 2100 GPL driver. -+ -+ We want to tanks the Authors of those projects -+ and the Ndiswrapper project Authors. -+*/ -+ -+/* Mariusz Matuszek added full registers definition with Realtek's name */ -+ -+/* this file contains register definitions for the rtl8187 MAC controller */ -+#ifndef R8180_HW -+#define R8180_HW -+ -+typedef enum _RF_TYPE_8187{ -+ RF_TYPE_MIN, -+ RF_ZEBRA = 5, -+ RF_ZEBRA2, // added by Annie, 2005-08-01. -+ RF_TYPE_MAX, -+}RF_TYPE_8187,*PRF_TYPE_8187; -+ -+typedef enum _VERSION_8187{ -+ // RTL8187 -+ VERSION_8187_B, // B-cut -+ VERSION_8187_D, // D-cut -+ // RTL8187B -+ VERSION_8187B_B, // B-cut -+ VERSION_8187B_D, //D-cut //added 2007-9-14 -+ VERSION_8187B_E, //E-cut //added 2007-9-14 -+}VERSION_8187,*PVERSION_8187; -+ -+//by lzm for antenna -+#ifdef SW_ANTE_DIVERSITY -+#define RF_PARAM 0x19 -+#define RF_PARAM_DIGPHY_SHIFT 0 -+#define RF_PARAM_ANTBDEFAULT_SHIFT 1 -+#define EEPROM_VERSION 0x3c -+#define EEPROM_CONFIG2 0x18 -+#define EEPROM_CS_THRESHOLD 0x2F -+#define EEPROM_RF_PARAM 0x08 -+//// BIT[8-9] is for SW Antenna Diversity. Only the value EEPROM_SW_AD_ENABLE means enable, other values are diable. -+#define EEPROM_SW_AD_MASK 0x0300 -+#define EEPROM_SW_AD_ENABLE 0x0100 -+//// BIT[10-11] determine if Antenna 1 is the Default Antenna. Only the value EEPROM_DEF_ANT_1 means TRUE, other values are FALSE. -+#define EEPROM_DEF_ANT_MASK 0x0C00 -+#define EEPROM_DEF_ANT_1 0x0400 -+ -+#define RCR_EnCS1 BIT29 // enable carrier sense method 1 -+#define RCR_EnCS2 BIT30 // enable carrier sense method 2 -+#endif -+//by lzm for antenna -+ -+#define RTL8187_RF_INDEX 0x8225 -+#define RTL8187_REQT_READ 0xc0 -+#define RTL8187_REQT_WRITE 0x40 -+#define RTL8187_REQ_GET_REGS 0x05 -+#define RTL8187_REQ_SET_REGS 0x05 -+ -+ -+ -+#define MAX_TX_URB 5 -+#define MAX_RX_URB 16 -+#define RX_URB_SIZE 0x9C4 -+ -+ -+ -+ -+ -+#define BB_ANTATTEN_CHAN14 0x0c -+#define BB_ANTENNA_B 0x40 -+ -+#define BB_HOST_BANG (1<<30) -+#define BB_HOST_BANG_EN (1<<2) -+#define BB_HOST_BANG_CLK (1<<1) -+#define BB_HOST_BANG_RW (1<<3) -+#define BB_HOST_BANG_DATA 1 -+ -+#define ANAPARAM_TXDACOFF_SHIFT 27 -+#define ANAPARAM_PWR0_MASK ((1<<30)|(1<<29)|(1<<28)) -+#define ANAPARAM_PWR0_SHIFT 28 -+#define ANAPARAM_PWR1_MASK ((1<<26)|(1<<25)|(1<<24)|(1<<23)|(1<<22)|(1<<21)|(1<<20)) -+#define ANAPARAM_PWR1_SHIFT 20 -+ -+#define MAC0 0 -+#define MAC1 1 -+#define MAC2 2 -+#define MAC3 3 -+#define MAC4 4 -+#define MAC5 5 -+ -+#define RXFIFOCOUNT 0x10 -+#define TXFIFOCOUNT 0x12 -+#define BcnIntTime 0x74 -+#define TALLY_SEL 0xfc -+#define BQREQ 0x13 -+ -+#define CMD 0x37 -+#define CMD_RST_SHIFT 4 -+#define CMD_RESERVED_MASK ((1<<1) | (1<<5) | (1<<6) | (1<<7)) -+#define CMD_RX_ENABLE_SHIFT 3 -+#define CMD_TX_ENABLE_SHIFT 2 -+ -+#define EPROM_CMD 0x50 -+#define EPROM_CMD_RESERVED_MASK ((1<<5)|(1<<4)) -+#define EPROM_CMD_OPERATING_MODE_SHIFT 6 -+#define EPROM_CMD_OPERATING_MODE_MASK ((1<<7)|(1<<6)) -+#define EPROM_CMD_CONFIG 0x3 -+#define EPROM_CMD_NORMAL 0 -+#define EPROM_CMD_LOAD 1 -+#define EPROM_CMD_PROGRAM 2 -+#define EPROM_CS_SHIFT 3 -+#define EPROM_CK_SHIFT 2 -+#define EPROM_W_SHIFT 1 -+#define EPROM_R_SHIFT 0 -+#define CONFIG2_DMA_POLLING_MODE_SHIFT 3 -+#define INTA 0x3e -+#define INTA_TXOVERFLOW (1<<15) -+#define INTA_TIMEOUT (1<<14) -+#define INTA_BEACONTIMEOUT (1<<13) -+#define INTA_ATIM (1<<12) -+#define INTA_BEACONDESCERR (1<<11) -+#define INTA_BEACONDESCOK (1<<10) -+#define INTA_HIPRIORITYDESCERR (1<<9) -+#define INTA_HIPRIORITYDESCOK (1<<8) -+#define INTA_NORMPRIORITYDESCERR (1<<7) -+#define INTA_NORMPRIORITYDESCOK (1<<6) -+#define INTA_RXOVERFLOW (1<<5) -+#define INTA_RXDESCERR (1<<4) -+#define INTA_LOWPRIORITYDESCERR (1<<3) -+#define INTA_LOWPRIORITYDESCOK (1<<2) -+#define INTA_RXCRCERR (1<<1) -+#define INTA_RXOK (1) -+#define INTA_MASK 0x3c -+#define RXRING_ADDR 0xe4 // page 0 -+#define PGSELECT 0x5e -+#define PGSELECT_PG_SHIFT 0 -+#define RX_CONF 0x44 -+#define MAC_FILTER_MASK ((1<<0) | (1<<1) | (1<<2) | (1<<3) | (1<<5) | \ -+(1<<12) | (1<<18) | (1<<19) | (1<<20) | (1<<21) | (1<<22) | (1<<23)) -+#define RX_CHECK_BSSID_SHIFT 23 -+#define ACCEPT_PWR_FRAME_SHIFT 22 -+#define ACCEPT_MNG_FRAME_SHIFT 20 -+#define ACCEPT_CTL_FRAME_SHIFT 19 -+#define ACCEPT_DATA_FRAME_SHIFT 18 -+#define ACCEPT_ICVERR_FRAME_SHIFT 12 -+#define ACCEPT_CRCERR_FRAME_SHIFT 5 -+#define ACCEPT_BCAST_FRAME_SHIFT 3 -+#define ACCEPT_MCAST_FRAME_SHIFT 2 -+#define ACCEPT_ALLMAC_FRAME_SHIFT 0 -+#define ACCEPT_NICMAC_FRAME_SHIFT 1 -+#define RX_FIFO_THRESHOLD_MASK ((1<<13) | (1<<14) | (1<<15)) -+#define RX_FIFO_THRESHOLD_SHIFT 13 -+#define RX_FIFO_THRESHOLD_128 3 -+#define RX_FIFO_THRESHOLD_256 4 -+#define RX_FIFO_THRESHOLD_512 5 -+#define RX_FIFO_THRESHOLD_1024 6 -+#define RX_FIFO_THRESHOLD_NONE 7 -+#define RX_AUTORESETPHY_SHIFT 28 -+#define EPROM_TYPE_SHIFT 6 -+#define TX_CONF 0x40 -+#define TX_CONF_HEADER_AUTOICREMENT_SHIFT 30 -+#define TX_LOOPBACK_SHIFT 17 -+#define TX_LOOPBACK_MAC 1 -+#define TX_LOOPBACK_BASEBAND 2 -+#define TX_LOOPBACK_NONE 0 -+#define TX_LOOPBACK_CONTINUE 3 -+#define TX_LOOPBACK_MASK ((1<<17)|(1<<18)) -+#define TX_LRLRETRY_SHIFT 0 -+#define R8180_MAX_RETRY 255 -+#define TX_SRLRETRY_SHIFT 8 -+#define TX_NOICV_SHIFT 19 -+#define TX_NOCRC_SHIFT 16 -+#define TX_DMA_POLLING 0xd9 -+#define TX_DMA_POLLING_BEACON_SHIFT 7 -+#define TX_DMA_POLLING_HIPRIORITY_SHIFT 6 -+#define TX_DMA_POLLING_NORMPRIORITY_SHIFT 5 -+#define TX_DMA_POLLING_LOWPRIORITY_SHIFT 4 -+#define TX_DMA_STOP_BEACON_SHIFT 3 -+#define TX_DMA_STOP_HIPRIORITY_SHIFT 2 -+#define TX_DMA_STOP_NORMPRIORITY_SHIFT 1 -+#define TX_DMA_STOP_LOWPRIORITY_SHIFT 0 -+#define TX_NORMPRIORITY_RING_ADDR 0x24 -+#define TX_HIGHPRIORITY_RING_ADDR 0x28 -+#define TX_LOWPRIORITY_RING_ADDR 0x20 -+#define MAX_RX_DMA_MASK ((1<<8) | (1<<9) | (1<<10)) -+#define MAX_RX_DMA_2048 7 -+#define MAX_RX_DMA_1024 6 -+#define MAX_RX_DMA_SHIFT 10 -+#define INT_TIMEOUT 0x48 -+#define CONFIG3_CLKRUN_SHIFT 2 -+#define CONFIG3_ANAPARAM_W_SHIFT 6 -+#define ANAPARAM 0x54 -+#define BEACON_INTERVAL 0x70 -+#define BEACON_INTERVAL_MASK ((1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)| \ -+(1<<6)|(1<<7)|(1<<8)|(1<<9)) -+#define ATIM_MASK ((1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)| \ -+(1<<8)|(1<<9)) -+#define ATIM 0x72 -+#define EPROM_CS_SHIFT 3 -+#define EPROM_CK_SHIFT 2 -+#define PHY_DELAY 0x78 -+#define PHY_CONFIG 0x80 -+#define PHY_ADR 0x7c -+#define PHY_READ 0x7e -+#define CARRIER_SENSE_COUNTER 0x79 //byte -+#define SECURITY 0x5f -+#define SECURITY_WEP_TX_ENABLE_SHIFT 1 -+#define SECURITY_WEP_RX_ENABLE_SHIFT 0 -+#define SECURITY_ENCRYP_104 1 -+#define SECURITY_ENCRYP_SHIFT 4 -+#define SECURITY_ENCRYP_MASK ((1<<4)|(1<<5)) -+#define KEY0 0x90 -+#define CONFIG2_ANTENNA_SHIFT 6 -+#define TX_BEACON_RING_ADDR 0x4c -+#define CONFIG0_WEP40_SHIFT 7 -+#define CONFIG0_WEP104_SHIFT 6 -+#define AGCRESET_SHIFT 5 -+ -+ -+ -+/* -+ * Operational registers offsets in PCI (I/O) space. -+ * RealTek names are used. -+ */ -+ -+#define IDR0 0x0000 -+#define IDR1 0x0001 -+#define IDR2 0x0002 -+#define IDR3 0x0003 -+#define IDR4 0x0004 -+#define IDR5 0x0005 -+ -+/* 0x0006 - 0x0007 - reserved */ -+ -+#define MAR0 0x0008 -+#define MAR1 0x0009 -+#define MAR2 0x000A -+#define MAR3 0x000B -+#define MAR4 0x000C -+#define MAR5 0x000D -+#define MAR6 0x000E -+#define MAR7 0x000F -+ -+/* 0x0010 - 0x0017 - reserved */ -+ -+#define TSFTR 0x0018 -+#define TSFTR_END 0x001F -+ -+#define TLPDA 0x0020 -+#define TLPDA_END 0x0023 -+#define TNPDA 0x0024 -+#define TNPDA_END 0x0027 -+#define THPDA 0x0028 -+#define THPDA_END 0x002B -+ -+#define BRSR_8187 0x002C -+#define BRSR_8187_END 0x002D -+#define BRSR_8187B 0x0034 -+#define BRSR_8187B_END 0x0035 -+ -+#define BSSID 0x002E -+#define BSSID_END 0x0033 -+ -+/* 0x0034 - 0x0034 - reserved */ -+ -+/* 0x0038 - 0x003B - reserved */ -+ -+#define IMR 0x003C -+#define IMR_END 0x003D -+ -+#define ISR 0x003E -+#define ISR_END 0x003F -+ -+#define TCR 0x0040 -+#define TCR_END 0x0043 -+ -+#define RCR 0x0044 -+#define RCR_END 0x0047 -+ -+#define TimerInt 0x0048 -+#define TimerInt_END 0x004B -+ -+#define TBDA 0x004C -+#define TBDA_END 0x004F -+ -+#define CR9346 0x0050 -+ -+#define CONFIG0 0x0051 -+#define CONFIG1 0x0052 -+#define CONFIG2 0x0053 -+ -+#define ANA_PARAM 0x0054 -+#define ANA_PARAM_END 0x0x0057 -+ -+#define MSR 0x0058 -+ -+#define CONFIG3 0x0059 -+#define CONFIG4 0x005A -+ -+#define TESTR 0x005B -+ -+/* 0x005C - 0x005D - reserved */ -+#define TFPC_AC 0x005C -+#define PSR 0x005E -+ -+#define SCR 0x005F -+ -+/* 0x0060 - 0x006F - reserved */ -+#define ANA_PARAM2 0x0060 -+#define ANA_PARAM2_END 0x0063 -+ -+#define BcnIntv 0x0070 -+#define BcnItv_END 0x0071 -+ -+#define AtimWnd 0x0072 -+#define AtimWnd_END 0x0073 -+ -+#define BintrItv 0x0074 -+#define BintrItv_END 0x0075 -+ -+#define AtimtrItv 0x0076 -+#define AtimtrItv_END 0x0077 -+ -+#define PhyDelay 0x0078 -+ -+//#define CRCount 0x0079 -+ -+#define AckTimeOutReg 0x79 // ACK timeout register, in unit of 4 us. -+/* 0x007A - 0x007B - reserved */ -+#define BBAddr 0x007C -+ -+ -+#define PhyAddr 0x007C -+#define PhyDataW 0x007D -+#define PhyDataR 0x007E -+#define RF_Ready 0x007F -+ -+#define PhyCFG 0x0080 -+#define PhyCFG_END 0x0083 -+ -+/* following are for rtl8185 */ -+#define RFPinsOutput 0x80 -+#define RFPinsEnable 0x82 -+#define RF_TIMING 0x8c -+#define RFPinsSelect 0x84 -+#define ANAPARAM2 0x60 -+#define RF_PARA 0x88 -+#define RFPinsInput 0x86 -+#define GP_ENABLE 0x90 -+#define GPIO 0x91 -+#define HSSI_PARA 0x94 // HSS Parameter -+#define SW_CONTROL_GPIO 0x400 -+#define CCK_TXAGC 0x9d -+#define OFDM_TXAGC 0x9e -+#define ANTSEL 0x9f -+#define TXAGC_CTL_PER_PACKET_ANT_SEL 0x02 -+#define WPA_CONFIG 0xb0 -+#define TX_AGC_CTL 0x9c -+#define TX_AGC_CTL_PER_PACKET_TXAGC 0x01 -+#define TX_AGC_CTL_PERPACKET_GAIN_SHIFT 0 -+#define TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT 1 -+#define TX_AGC_CTL_FEEDBACK_ANT 2 -+#define RESP_RATE 0x34 -+#define SIFS 0xb4 -+#define DIFS 0xb5 -+#define EIFS_8187 0x35 -+#define EIFS_8187B 0x2D -+#define SLOT 0xb6 -+#define CW_VAL 0xbd -+#define CW_CONF 0xbc -+#define CW_CONF_PERPACKET_RETRY_LIMIT 0x02 -+#define CW_CONF_PERPACKET_CW 0x01 -+#define CW_CONF_PERPACKET_RETRY_SHIFT 1 -+#define CW_CONF_PERPACKET_CW_SHIFT 0 -+#define MAX_RESP_RATE_SHIFT 4 -+#define MIN_RESP_RATE_SHIFT 0 -+#define RATE_FALLBACK 0xbe -+#define RATE_FALLBACK_CTL_ENABLE 0x80 -+#define RATE_FALLBACK_CTL_AUTO_STEP0 0x00 -+ -+#define ARFR 0x1E0 // Auto Rate Fallback Register (0x1e0 ~ 0x1e2) -+#define RMS 0x1EC // Rx Max Pacetk Size (0x1ec[0:12]) -+ -+/* -+ * 0x0084 - 0x00D3 is selected to page 1 when PSEn bit (bit0, PSR) -+ * is set to 1 -+ */ -+ -+#define Wakeup0 0x0084 -+#define Wakeup0_END 0x008B -+ -+#define Wakeup1 0x008C -+#define Wakeup1_END 0x0093 -+ -+#define Wakeup2LD 0x0094 -+#define Wakeup2LD_END 0x009B -+#define Wakeup2HD 0x009C -+#define Wakeup2HD_END 0x00A3 -+ -+#define Wakeup3LD 0x00A4 -+#define Wakeup3LD_END 0x00AB -+#define Wakeup3HD 0x00AC -+#define Wakeup3HD_END 0x00B3 -+ -+#define Wakeup4LD 0x00B4 -+#define Wakeup4LD_END 0x00BB -+#define Wakeup4HD 0x00BC -+#define Wakeup4HD_END 0x00C3 -+ -+#define CRC0 0x00C4 -+#define CRC0_END 0x00C5 -+#define CRC1 0x00C6 -+#define CRC1_END 0x00C7 -+#define CRC2 0x00C8 -+#define CRC2_END 0x00C9 -+#define CRC3 0x00CA -+#define CRC3_END 0x00CB -+#define CRC4 0x00CC -+#define CRC4_END 0x00CD -+ -+/* 0x00CE - 0x00D3 - reserved */ -+ -+ -+ -+/* -+ * 0x0084 - 0x00D3 is selected to page 0 when PSEn bit (bit0, PSR) -+ * is set to 0 -+ */ -+ -+/* 0x0084 - 0x008F - reserved */ -+ -+#define DK0 0x0090 -+#define DK0_END 0x009F -+#define DK1 0x00A0 -+#define DK1_END 0x00AF -+#define DK2 0x00B0 -+#define DK2_END 0x00BF -+#define DK3 0x00C0 -+#define DK3_END 0x00CF -+ -+#define GPO 0x90 -+#define GPE 0x91 -+#define GPI 0x92 -+ -+#define RFTiming 0x008C -+#define ACM_CONTROL 0x00BF // ACM Control Registe -+#define INT_MIG 0x00E2 // Interrupt Migration (0xE2 ~ 0xE3) -+#define TID_AC_MAP 0x00E8 // TID to AC Mapping Register -+ -+#define AC_VO_PARAM 0x00F0 // AC_VO Parameters Record -+#define AC_VI_PARAM 0x00F4 // AC_VI Parameters Record -+#define AC_BE_PARAM 0x00F8 // AC_BE Parameters Record -+#define AC_BK_PARAM 0x00FC // AC_BK Parameters Record -+ -+/* 0x00D0 - 0x00D3 - reserved */ -+#define CCK_FALSE_ALARM 0x00D0 -+#define OFDM_FALSE_ALARM 0x00D2 -+ -+ -+/* 0x00D4 - 0x00D7 - reserved */ -+ -+#define CONFIG5 0x00D8 -+ -+#define TPPoll 0x00D9 -+ -+/* 0x00DA - 0x00DB - reserved */ -+ -+#define CWR 0x00DC -+#define CWR_END 0x00DD -+ -+#define RetryCTR 0x00DE -+ -+/* 0x00DF - 0x00E3 - reserved */ -+ -+#define RDSAR 0x00E4 -+#define RDSAR_END 0x00E7 -+ -+/* 0x00E8 - 0x00EF - reserved */ -+#define ANA_PARAM3 0x00EE -+ -+#define FER 0x00F0 -+#define FER_END 0x00F3 -+ -+#define FEMR 0x1D4 // Function Event Mask register (0xf4 ~ 0xf7) -+//#define FEMR 0x00F4 -+#define FEMR_END 0x00F7 -+ -+#define FPSR 0x00F8 -+#define FPSR_END 0x00FB -+ -+#define FFER 0x00FC -+#define FFER_END 0x00FF -+ -+/* -+ * 0x0000 - 0x00ff is selected to page 0 when PSEn bit (bit0, PSR) -+ * is set to 2 -+ */ -+#define RFSW_CTRL 0x272 // 0x272-0x273. -+ -+ -+ -+//---------------------------------------------------------------------------- -+// 8187B AC_XX_PARAM bits -+//---------------------------------------------------------------------------- -+#define AC_PARAM_TXOP_LIMIT_OFFSET 16 -+#define AC_PARAM_ECW_MAX_OFFSET 12 -+#define AC_PARAM_ECW_MIN_OFFSET 8 -+#define AC_PARAM_AIFS_OFFSET 0 -+ -+//---------------------------------------------------------------------------- -+// 8187B ACM_CONTROL bits (Offset 0xBF, 1 Byte) -+//---------------------------------------------------------------------------- -+#define VOQ_ACM_EN (0x01 << 7) //BIT7 -+#define VIQ_ACM_EN (0x01 << 6) //BIT6 -+#define BEQ_ACM_EN (0x01 << 5) //BIT5 -+#define ACM_HW_EN (0x01 << 4) //BIT4 -+#define TXOPSEL (0x01 << 3) //BIT3 -+#define VOQ_ACM_CTL (0x01 << 2) //BIT2 // Set to 1 when AC_VO used time reaches or exceeds the admitted time -+#define VIQ_ACM_CTL (0x01 << 1) //BIT1 // Set to 1 when AC_VI used time reaches or exceeds the admitted time -+#define BEQ_ACM_CTL (0x01 << 0) //BIT0 // Set to 1 when AC_BE used time reaches or exceeds the admitted time -+ -+//---------------------------------------------------------------------------- -+// 8187B RF pins related setting (offset 0xFF80-0xFF87,) -+//---------------------------------------------------------------------------- -+#define TR_SW_MASK_TX_8187 BIT5 -+#define TR_SW_MASK_RX_8187 BIT6 -+#define TR_SW_MASK_8187 (TR_SW_MASK_TX_8187 | TR_SW_MASK_RX_8187) -+ -+/* -+ * Bitmasks for specific register functions. -+ * Names are derived from the register name and function name. -+ * -+ * <REGISTER>_<FUNCTION>[<bit>] -+ * -+ * this leads to some awkward names... -+ */ -+ -+#define BRSR_BPLCP ((1<< 8)) -+#define BRSR_MBR ((1<< 1)|(1<< 0)) -+#define BRSR_MBR_8185 ((1<< 11)|(1<< 10)|(1<< 9)|(1<< 8)|(1<< 7)|(1<< 6)|(1<< 5)|(1<< 4)|(1<< 3)|(1<< 2)|(1<< 1)|(1<< 0)) -+#define BRSR_MBR0 ((1<< 0)) -+#define BRSR_MBR1 ((1<< 1)) -+ -+#define CR_RST ((1<< 4)) -+#define CR_RE ((1<< 3)) -+#define CR_TE ((1<< 2)) -+#define CR_MulRW ((1<< 0)) -+ -+#define IMR_TXFOVW ((1<<15)) -+#define IMR_TimeOut ((1<<14)) -+#define IMR_BcnInt ((1<<13)) -+#define IMR_ATIMInt ((1<<12)) -+#define IMR_TBDER ((1<<11)) -+#define IMR_TBDOK ((1<<10)) -+#define IMR_THPDER ((1<< 9)) -+#define IMR_THPDOK ((1<< 8)) -+#define IMR_TNPDER ((1<< 7)) -+#define IMR_TNPDOK ((1<< 6)) -+#define IMR_RXFOVW ((1<< 5)) -+#define IMR_RDU ((1<< 4)) -+#define IMR_TLPDER ((1<< 3)) -+#define IMR_TLPDOK ((1<< 2)) -+#define IMR_RER ((1<< 1)) -+#define IMR_ROK ((1<< 0)) -+ -+#define ISR_TXFOVW ((1<<15)) -+#define ISR_TimeOut ((1<<14)) -+#define ISR_BcnInt ((1<<13)) -+#define ISR_ATIMInt ((1<<12)) -+#define ISR_TBDER ((1<<11)) -+#define ISR_TBDOK ((1<<10)) -+#define ISR_THPDER ((1<< 9)) -+#define ISR_THPDOK ((1<< 8)) -+#define ISR_TNPDER ((1<< 7)) -+#define ISR_TNPDOK ((1<< 6)) -+#define ISR_RXFOVW ((1<< 5)) -+#define ISR_RDU ((1<< 4)) -+#define ISR_TLPDER ((1<< 3)) -+#define ISR_TLPDOK ((1<< 2)) -+#define ISR_RER ((1<< 1)) -+#define ISR_ROK ((1<< 0)) -+ -+#define HW_VERID_R8180_F 3 -+#define HW_VERID_R8180_ABCD 2 -+#define HW_VERID_R8185_ABC 4 -+#define HW_VERID_R8185_D 5 -+ -+#define TCR_DurProcMode ((1<<30)) -+#define TCR_DISReqQsize ((1<<28)) -+#define TCR_HWVERID_MASK ((1<<27)|(1<<26)|(1<<25)) -+#define TCR_HWVERID_SHIFT 25 -+#define TCR_SWPLCPLEN ((1<<24)) -+#define TCR_PLCP_LEN TCR_SAT // rtl8180 -+#define TCR_MXDMA_MASK ((1<<23)|(1<<22)|(1<<21)) -+#define TCR_MXDMA_1024 6 -+#define TCR_MXDMA_2048 7 -+#define TCR_MXDMA_SHIFT 21 -+#define TCR_DISCW ((1<<20)) -+#define TCR_ICV ((1<<19)) -+#define TCR_LBK ((1<<18)|(1<<17)) -+#define TCR_LBK1 ((1<<18)) -+#define TCR_LBK0 ((1<<17)) -+#define TCR_CRC ((1<<16)) -+#define TCR_SRL_MASK ((1<<15)|(1<<14)|(1<<13)|(1<<12)|(1<<11)|(1<<10)|(1<<9)|(1<<8)) -+#define TCR_LRL_MASK ((1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)) -+#define TCR_PROBE_NOTIMESTAMP_SHIFT 29 //rtl8185 -+ -+#define RCR_ONLYERLPKT ((1<<31)) -+#define RCR_CS_SHIFT 29 -+#define RCR_CS_MASK ((1<<30) | (1<<29)) -+#define RCR_ENMARP ((1<<28)) -+#define RCR_CBSSID ((1<<23)) -+#define RCR_APWRMGT ((1<<22)) -+#define RCR_ADD3 ((1<<21)) -+#define RCR_AMF ((1<<20)) -+#define RCR_ACF ((1<<19)) -+#define RCR_ADF ((1<<18)) -+#define RCR_RXFTH ((1<<15)|(1<<14)|(1<<13)) -+#define RCR_RXFTH2 ((1<<15)) -+#define RCR_RXFTH1 ((1<<14)) -+#define RCR_RXFTH0 ((1<<13)) -+#define RCR_AICV ((1<<12)) -+#define RCR_MXDMA ((1<<10)|(1<< 9)|(1<< 8)) -+#define RCR_MXDMA2 ((1<<10)) -+#define RCR_MXDMA1 ((1<< 9)) -+#define RCR_MXDMA0 ((1<< 8)) -+#define RCR_9356SEL ((1<< 6)) -+#define RCR_ACRC32 ((1<< 5)) -+#define RCR_AB ((1<< 3)) -+#define RCR_AM ((1<< 2)) -+#define RCR_APM ((1<< 1)) -+#define RCR_AAP ((1<< 0)) -+ -+#define CR9346_EEM ((1<<7)|(1<<6)) -+#define CR9346_EEM1 ((1<<7)) -+#define CR9346_EEM0 ((1<<6)) -+#define CR9346_EECS ((1<<3)) -+#define CR9346_EESK ((1<<2)) -+#define CR9346_EED1 ((1<<1)) -+#define CR9346_EED0 ((1<<0)) -+ -+#define CONFIG0_WEP104 ((1<<6)) -+#define CONFIG0_LEDGPO_En ((1<<4)) -+#define CONFIG0_Aux_Status ((1<<3)) -+#define CONFIG0_GL ((1<<1)|(1<<0)) -+#define CONFIG0_GL1 ((1<<1)) -+#define CONFIG0_GL0 ((1<<0)) -+ -+#define CONFIG1_LEDS ((1<<7)|(1<<6)) -+#define CONFIG1_LEDS1 ((1<<7)) -+#define CONFIG1_LEDS0 ((1<<6)) -+#define CONFIG1_LWACT ((1<<4)) -+#define CONFIG1_MEMMAP ((1<<3)) -+#define CONFIG1_IOMAP ((1<<2)) -+#define CONFIG1_VPD ((1<<1)) -+#define CONFIG1_PMEn ((1<<0)) -+ -+#define CONFIG2_LCK ((1<<7)) -+#define CONFIG2_ANT ((1<<6)) -+#define CONFIG2_DPS ((1<<3)) -+#define CONFIG2_PAPE_sign ((1<<2)) -+#define CONFIG2_PAPE_time ((1<<1)|(1<<0)) -+#define CONFIG2_PAPE_time1 ((1<<1)) -+#define CONFIG2_PAPE_time0 ((1<<0)) -+ -+#define CONFIG3_GNTSel ((1<<7)) -+#define CONFIG3_PARM_En ((1<<6)) -+#define CONFIG3_Magic ((1<<5)) -+#define CONFIG3_CardB_En ((1<<3)) -+#define CONFIG3_CLKRUN_En ((1<<2)) -+#define CONFIG3_FuncRegEn ((1<<1)) -+#define CONFIG3_FBtbEn ((1<<0)) -+ -+#define CONFIG4_VCOPDN ((1<<7)) -+#define CONFIG4_PWROFF ((1<<6)) -+#define CONFIG4_PWRMGT ((1<<5)) -+#define CONFIG4_LWPME ((1<<4)) -+#define CONFIG4_LWPTN ((1<<2)) -+#define CONFIG4_RFTYPE ((1<<1)|(1<<0)) -+#define CONFIG4_RFTYPE1 ((1<<1)) -+#define CONFIG4_RFTYPE0 ((1<<0)) -+ -+#define CONFIG5_TX_FIFO_OK ((1<<7)) -+#define CONFIG5_RX_FIFO_OK ((1<<6)) -+#define CONFIG5_CALON ((1<<5)) -+#define CONFIG5_EACPI ((1<<2)) -+#define CONFIG5_LANWake ((1<<1)) -+#define CONFIG5_PME_STS ((1<<0)) -+ -+#define MSR_LINK_MASK ((1<<2)|(1<<3)) -+#define MSR_LINK_MANAGED 2 -+#define MSR_LINK_NONE 0 -+#define MSR_LINK_SHIFT 2 -+#define MSR_LINK_ADHOC 1 -+#define MSR_LINK_MASTER 3 -+#define MSR_LINK_ENEDCA (1<<4) -+ -+#define PSR_GPO ((1<<7)) -+#define PSR_GPI ((1<<6)) -+#define PSR_LEDGPO1 ((1<<5)) -+#define PSR_LEDGPO0 ((1<<4)) -+#define PSR_UWF ((1<<1)) -+#define PSR_PSEn ((1<<0)) -+ -+#define SCR_KM ((1<<5)|(1<<4)) -+#define SCR_KM1 ((1<<5)) -+#define SCR_KM0 ((1<<4)) -+#define SCR_TXSECON ((1<<1)) -+#define SCR_RXSECON ((1<<0)) -+ -+#define BcnItv_BcnItv (0x01FF) -+ -+#define AtimWnd_AtimWnd (0x01FF) -+ -+#define BintrItv_BintrItv (0x01FF) -+ -+#define AtimtrItv_AtimtrItv (0x01FF) -+ -+#define PhyDelay_PhyDelay ((1<<2)|(1<<1)|(1<<0)) -+ -+#define TPPoll_BQ ((1<<7)) -+#define TPPoll_HPQ ((1<<6)) -+#define TPPoll_NPQ ((1<<5)) -+#define TPPoll_LPQ ((1<<4)) -+#define TPPoll_SBQ ((1<<3)) -+#define TPPoll_SHPQ ((1<<2)) -+#define TPPoll_SNPQ ((1<<1)) -+#define TPPoll_SLPQ ((1<<0)) -+ -+#define CWR_CW (0x01FF) -+ -+#define FER_INTR ((1<<15)) -+#define FER_GWAKE ((1<< 4)) -+ -+#define FEMR_INTR ((1<<15)) -+#define FEMR_WKUP ((1<<14)) -+#define FEMR_GWAKE ((1<< 4)) -+ -+#define FPSR_INTR ((1<<15)) -+#define FPSR_GWAKE ((1<< 4)) -+ -+#define FFER_INTR ((1<<15)) -+#define FFER_GWAKE ((1<< 4)) -+ -+ -+//---------------------------------------------------------------------------- -+// 818xB AnaParm & AnaParm2 Register -+//---------------------------------------------------------------------------- -+/* -+#ifdef RTL8185B_FPGA -+#define ANAPARM_FPGA_ON 0xa0000b59 -+//#define ANAPARM_FPGA_OFF -+#define ANAPARM2_FPGA_ON 0x860dec11 -+//#define ANAPARM2_FPGA_OFF -+#else //ASIC -+*/ -+#define ANAPARM_ASIC_ON 0x45090658 -+//#define ANAPARM_ASIC_OFF -+#define ANAPARM2_ASIC_ON 0x727f3f52 -+//#define ANAPARM2_ASIC_OFF -+//#endif -+//by amy for power save -+#define RF_CHANGE_BY_SW BIT31 -+#define RF_CHANGE_BY_HW BIT30 -+#define RF_CHANGE_BY_PS BIT29 -+#define RF_CHANGE_BY_IPS BIT28 -+#define ANAPARM_ASIC_ON 0x45090658 -+#define ANAPARM2_ASIC_ON 0x727f3f52 -+ -+#define ANAPARM_ON ANAPARM_ASIC_ON -+#define ANAPARM2_ON ANAPARM2_ASIC_ON -+#define TFPC 0x5C // Tx FIFO Packet Count for BK, BE, VI, VO queues (2 bytes) -+#define Config4_PowerOff BIT6 // Turn ON/Off RF Power(RFMD) -+#define ANAPARM_OFF 0x51480658 -+#define ANAPARM2_OFF 0x72003f70 -+//by amy for power save -+ -+#define MAX_DOZE_WAITING_TIMES_87B 500 -+ -+#endif -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8180_pm.c linux-2.6.35/drivers/net/wireless/rtl8187b/r8180_pm.c ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8180_pm.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/r8180_pm.c 2010-08-05 21:12:35.173620797 +0200 -@@ -0,0 +1,97 @@ -+/* -+ Power management interface routines. -+ Written by Mariusz Matuszek. -+ This code is currently just a placeholder for later work and -+ does not do anything useful. -+ -+ This is part of rtl8180 OpenSource driver. -+ Copyright (C) Andrea Merello 2004 <andreamrl@tiscali.it> -+ Released under the terms of GPL (General Public Licence) -+*/ -+ -+#ifdef CONFIG_RTL8180_PM -+ -+ -+#include "r8180_hw.h" -+#include "r8180_pm.h" -+#include "r8187.h" -+int rtl8180_save_state (struct pci_dev *dev, u32 state) -+{ -+ printk(KERN_NOTICE "r8180 save state call (state %u).\n", state); -+ return(-EAGAIN); -+} -+ -+//netif_running is set to 0 before system call rtl8180_close, -+//netif_running is set to 1 before system call rtl8180_open, -+//if open success it will not change, or it change to 0; -+int rtl8187_suspend (struct usb_interface *intf, pm_message_t state) -+{ -+ struct r8180_priv *priv; -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+ struct net_device *dev = usb_get_intfdata(intf); -+#else -+ //struct net_device *dev = (struct net_device *)ptr; -+#endif -+ -+ printk("====>%s \n", __func__); -+ priv=ieee80211_priv(dev); -+ -+ if(dev) { -+ /* save the old rfkill state and then power off it */ -+ priv->eInactivePowerState = priv->eRFPowerState; -+ /* power off the wifi by default */ -+ r8187b_wifi_change_rfkill_state(dev, eRfOff); -+ -+ if (!netif_running(dev)) { -+ //printk(KERN_WARNING "UI or other close dev before suspend, go out suspend function\n"); -+ return 0; -+ } -+ -+ dev->netdev_ops->ndo_stop(dev); -+ netif_device_detach(dev); -+ } -+ return 0; -+} -+ -+ -+int rtl8187_resume (struct usb_interface *intf) -+{ -+ struct r8180_priv *priv; -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+ struct net_device *dev = usb_get_intfdata(intf); -+#else -+ //struct net_device *dev = (struct net_device *)ptr; -+#endif -+ -+ printk("====>%s \n", __func__); -+ priv=ieee80211_priv(dev); -+ -+ if(dev) { -+ /* resume the old rfkill state */ -+ r8187b_wifi_change_rfkill_state(dev, priv->eInactivePowerState); -+ -+ if (!netif_running(dev)){ -+ //printk(KERN_WARNING "UI or other close dev before suspend, go out resume function\n"); -+ return 0; -+ } -+ -+ netif_device_attach(dev); -+ dev->netdev_ops->ndo_open(dev); -+ } -+ -+ return 0; -+} -+ -+ -+int rtl8180_enable_wake (struct pci_dev *dev, u32 state, int enable) -+{ -+ -+ //printk(KERN_NOTICE "r8180 enable wake call (state %u, enable %d).\n", -+ // state, enable); -+ return 0; -+ //return(-EAGAIN); -+} -+ -+ -+ -+#endif //CONFIG_RTL8180_PM -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8180_pm.h linux-2.6.35/drivers/net/wireless/rtl8187b/r8180_pm.h ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8180_pm.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/r8180_pm.h 2010-08-05 21:12:35.213623756 +0200 -@@ -0,0 +1,28 @@ -+/* -+ Power management interface routines. -+ Written by Mariusz Matuszek. -+ This code is currently just a placeholder for later work and -+ does not do anything useful. -+ -+ This is part of rtl8180 OpenSource driver. -+ Copyright (C) Andrea Merello 2004 <andreamrl@tiscali.it> -+ Released under the terms of GPL (General Public Licence) -+ -+*/ -+ -+#ifdef CONFIG_RTL8180_PM -+ -+#ifndef R8180_PM_H -+#define R8180_PM_H -+ -+#include <linux/types.h> -+#include <linux/usb.h> -+ -+int rtl8180_save_state (struct pci_dev *dev, u32 state); -+int rtl8187_suspend (struct usb_interface *intf,pm_message_t state); -+int rtl8187_resume (struct usb_interface *intf); -+int rtl8180_enable_wake (struct pci_dev *dev, u32 state, int enable); -+ -+#endif //R8180_PM_H -+ -+#endif // CONFIG_RTL8180_PM -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8180_rtl8225.c linux-2.6.35/drivers/net/wireless/rtl8187b/r8180_rtl8225.c ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8180_rtl8225.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/r8180_rtl8225.c 2010-08-05 21:12:35.253629369 +0200 -@@ -0,0 +1,1007 @@ -+/* -+ This is part of the rtl8180-sa2400 driver -+ released under the GPL (See file COPYING for details). -+ Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it> -+ -+ This files contains programming code for the rtl8225 -+ radio frontend. -+ -+ *Many* thanks to Realtek Corp. for their great support! -+ -+*/ -+ -+ -+ -+#include "r8180_hw.h" -+#include "r8180_rtl8225.h" -+#ifdef ENABLE_DOT11D -+#include "dot11d.h" -+#endif -+ -+#define USE_8051_3WIRE 1 -+ -+u8 rtl8225_threshold[]={ -+ 0x8d, 0x8d, 0x8d, 0x8d, 0x9d, 0xad, 0xbd, -+}; -+ -+u8 rtl8225_gain[]={ -+ 0x23,0x88,0x7c,0xa5,// -82dbm -+ 0x23,0x88,0x7c,0xb5,// -82dbm -+ 0x23,0x88,0x7c,0xc5,// -82dbm -+ 0x33,0x80,0x79,0xc5,// -78dbm -+ 0x43,0x78,0x76,0xc5,// -74dbm -+ 0x53,0x60,0x73,0xc5,// -70dbm -+ 0x63,0x58,0x70,0xc5,// -66dbm -+}; -+ -+u16 rtl8225bcd_rxgain[]={ -+ 0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409, -+ 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541, -+ 0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583, -+ 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644, -+ 0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688, -+ 0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745, -+ 0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789, -+ 0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793, -+ 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d, -+ 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9, -+ 0x07aa, 0x07ab, 0x07ac, 0x07ad, 0x07b0, 0x07b1, 0x07b2, 0x07b3, -+ 0x07b4, 0x07b5, 0x07b8, 0x07b9, 0x07ba, 0x07bb, 0x07bb -+ -+}; -+ -+ -+ -+u8 rtl8225_tx_gain_cck_ofdm[]={ -+ 0x02,0x06,0x0e,0x1e,0x3e,0x7e -+}; -+ -+ -+u8 rtl8225_tx_power_ofdm[]={ -+ 0x80,0x90,0xa2,0xb5,0xcb,0xe4 -+}; -+ -+ -+u8 rtl8225_tx_power_cck_ch14[]={ -+ 0x18,0x17,0x15,0x0c,0x00,0x00,0x00,0x00, -+ 0x1b,0x1a,0x17,0x0e,0x00,0x00,0x00,0x00, -+ 0x1f,0x1e,0x1a,0x0f,0x00,0x00,0x00,0x00, -+ 0x22,0x21,0x1d,0x11,0x00,0x00,0x00,0x00, -+ 0x26,0x25,0x21,0x13,0x00,0x00,0x00,0x00, -+ 0x2b,0x2a,0x25,0x15,0x00,0x00,0x00,0x00 -+}; -+ -+ -+u8 rtl8225_tx_power_cck[]={ -+ 0x18,0x17,0x15,0x11,0x0c,0x08,0x04,0x02, -+ 0x1b,0x1a,0x17,0x13,0x0e,0x09,0x04,0x02, -+ 0x1f,0x1e,0x1a,0x15,0x10,0x0a,0x05,0x02, -+ 0x22,0x21,0x1d,0x18,0x11,0x0b,0x06,0x02, -+ 0x26,0x25,0x21,0x1b,0x14,0x0d,0x06,0x03, -+ 0x2b,0x2a,0x25,0x1e,0x16,0x0e,0x07,0x03 -+}; -+ -+u8 rtl8225_agc[]={ -+ 0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9d,0x9c,0x9b,0x9a,0x99,0x98,0x97,0x96, -+ 0x95,0x94,0x93,0x92,0x91,0x90,0x8f,0x8e,0x8d,0x8c,0x8b,0x8a,0x89,0x88,0x87,0x86, -+ 0x85,0x84,0x83,0x82,0x81,0x80,0x3f,0x3e,0x3d,0x3c,0x3b,0x3a,0x39,0x38,0x37,0x36, -+ 0x35,0x34,0x33,0x32,0x31,0x30,0x2f,0x2e,0x2d,0x2c,0x2b,0x2a,0x29,0x28,0x27,0x26, -+ 0x25,0x24,0x23,0x22,0x21,0x20,0x1f,0x1e,0x1d,0x1c,0x1b,0x1a,0x19,0x18,0x17,0x16, -+ 0x15,0x14,0x13,0x12,0x11,0x10,0x0f,0x0e,0x0d,0x0c,0x0b,0x0a,0x09,0x08,0x07,0x06, -+ 0x05,0x04,0x03,0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, -+ 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, -+}; -+ -+u32 rtl8225_chan[] = { -+ 0, //dummy channel 0 -+ 0x085c, //1 -+ 0x08dc, //2 -+ 0x095c, //3 -+ 0x09dc, //4 -+ 0x0a5c, //5 -+ 0x0adc, //6 -+ 0x0b5c, //7 -+ 0x0bdc, //8 -+ 0x0c5c, //9 -+ 0x0cdc, //10 -+ 0x0d5c, //11 -+ 0x0ddc, //12 -+ 0x0e5c, //13 -+ //0x0f5c, //14 -+ 0x0f72, // 14 -+}; -+ -+void rtl8225_set_gain(struct net_device *dev, short gain) -+{ -+ write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 4]); -+ write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 4 + 2]); -+ write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 4 + 3]); -+ write_phy_ofdm(dev, 0x23, rtl8225_gain[gain * 4 + 1]); -+ -+} -+ -+ -+void write_rtl8225(struct net_device *dev, u8 adr, u16 data) -+{ -+//in windows the delays in this function was del from 85 to 87, -+//here we mod to sleep, or The CPU occupany is too hight. LZM 31/10/2008 -+ -+#ifdef USE_8051_3WIRE -+ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ struct usb_device *udev = priv->udev; -+ //u8 bit; -+ //u16 wReg80, wReg82, wReg84; -+ u16 wReg80, wReg84; -+ -+ wReg80 = read_nic_word(dev, RFPinsOutput); -+ wReg80 &= 0xfff3; -+// wReg82 = read_nic_word(dev, RFPinsEnable); -+ wReg84 = read_nic_word(dev, RFPinsSelect); -+ // <RJ_NOTE> 3-wire should be controled by HW when we finish SW 3-wire programming. 2005.08.10, by rcnjko. -+ //wReg84 &= 0xfff0; -+ wReg84 &= 0xfff8; //modified by david according to windows segment code. -+ -+ // We must set SW enabled before terminating HW 3-wire, 2005.07.29, by rcnjko. -+// write_nic_word(dev, RFPinsEnable, (wReg82|0x0007)); // Set To Output Enable -+ write_nic_word(dev, RFPinsSelect, (wReg84|0x0007)); // Set To SW Switch -+// force_pci_posting(dev); -+// udelay(10); // -+ -+ write_nic_word(dev, 0x80, (BB_HOST_BANG_EN|wReg80)); // Set SI_EN (RFLE) -+// force_pci_posting(dev); -+// udelay(2); -+ //twreg.struc.enableB = 0; -+ write_nic_word(dev, 0x80, (wReg80)); // Clear SI_EN (RFLE) -+// force_pci_posting(dev); -+// udelay(10); -+ -+ usb_control_msg(udev, usb_sndctrlpipe(udev, 0), -+ RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, -+ adr, 0x8225, &data, 2, HZ / 2); -+ -+ // write_nic_word(dev, 0x80, (BB_HOST_BANG_EN|wReg80)); -+// force_pci_posting(dev); -+// udelay(10); -+ -+ write_nic_word(dev, 0x80, (wReg80|0x0004)); -+ write_nic_word(dev, 0x84, (wReg84|0x0000));// Set To SW Switch -+ -+ if(priv->card_type == USB) -+ ;// msleep(2); -+ else -+ ; // rtl8185_rf_pins_enable(dev); -+ -+#else -+ int i; -+ u16 out,select; -+ u8 bit; -+ u32 bangdata = (data << 4) | (adr & 0xf); -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ out = read_nic_word(dev, RFPinsOutput) & 0xfff3; -+ -+ write_nic_word(dev,RFPinsEnable, -+ (read_nic_word(dev,RFPinsEnable) | 0x7)); -+ -+ select = read_nic_word(dev, RFPinsSelect); -+ -+ write_nic_word(dev, RFPinsSelect, select | 0x7 | -+ ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO)); -+ -+// force_pci_posting(dev); -+// udelay(10); -+ -+ write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN );//| 0x1fff); -+ -+// force_pci_posting(dev); -+// udelay(2); -+ -+ write_nic_word(dev, RFPinsOutput, out); -+ -+// force_pci_posting(dev); -+// udelay(10); -+ -+ -+ for(i=15; i>=0;i--){ -+ -+ bit = (bangdata & (1<<i)) >> i; -+ -+ write_nic_word(dev, RFPinsOutput, bit | out); -+ -+ write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK); -+ write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK); -+ -+ i--; -+ bit = (bangdata & (1<<i)) >> i; -+ -+ write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK); -+ write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK); -+ -+ write_nic_word(dev, RFPinsOutput, bit | out); -+ -+ } -+ -+ write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN); -+ -+// force_pci_posting(dev); -+// udelay(10); -+ -+ write_nic_word(dev, RFPinsOutput, out | -+ ((priv->card_type == USB) ? 4 : BB_HOST_BANG_EN)); -+ -+ write_nic_word(dev, RFPinsSelect, select | -+ ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO)); -+ -+ if(priv->card_type == USB) -+ ;// msleep(2); -+ else -+// rtl8185_rf_pins_enable(dev); -+#endif -+} -+ -+ -+void write_rtl8225_patch(struct net_device *dev, u8 adr, u16 data) -+{ -+ -+ int i; -+ u16 out,select; -+ u8 bit; -+ u32 bangdata = (data << 4) | (adr & 0xf); -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ out = read_nic_word(dev, RFPinsOutput) & 0xfff3; -+ -+ write_nic_word(dev,RFPinsEnable, -+ (read_nic_word(dev,RFPinsEnable) | 0x7)); -+ -+ select = read_nic_word(dev, RFPinsSelect); -+ -+ write_nic_word(dev, RFPinsSelect, select | 0x7 | -+ ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO)); -+ -+ force_pci_posting(dev); -+ udelay(10); -+ -+ write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN );//| 0x1fff); -+ -+ force_pci_posting(dev); -+ udelay(2); -+ -+ write_nic_word(dev, RFPinsOutput, out); -+ -+ force_pci_posting(dev); -+ udelay(10); -+ -+ for(i=15; i>=0;i--){ -+ -+ bit = (bangdata & (1<<i)) >> i; -+ -+ write_nic_word(dev, RFPinsOutput, bit | out); -+ -+ write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK); -+ write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK); -+ -+ i--; -+ bit = (bangdata & (1<<i)) >> i; -+ -+ write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK); -+ write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK); -+ -+ write_nic_word(dev, RFPinsOutput, bit | out); -+ -+ } -+ -+ write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN); -+ -+ force_pci_posting(dev); -+ udelay(10); -+ -+ write_nic_word(dev, RFPinsOutput, out | -+ ((priv->card_type == USB) ? 4 : BB_HOST_BANG_EN)); -+ -+ write_nic_word(dev, RFPinsSelect, select | -+ ((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO)); -+ -+ if(priv->card_type == USB) -+ mdelay(2); -+ else -+ rtl8185_rf_pins_enable(dev); -+ -+} -+ -+void rtl8225_rf_close(struct net_device *dev) -+{ -+ write_rtl8225(dev, 0x4, 0x1f); -+ -+ force_pci_posting(dev); -+ mdelay(1); -+ -+ rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_OFF); -+ rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_OFF); -+} -+ -+#ifdef ENABLE_DOT11D -+// -+// Description: -+// Map dBm into Tx power index according to -+// current HW model, for example, RF and PA, and -+// current wireless mode. -+// -+s8 -+DbmToTxPwrIdx( -+ struct r8180_priv *priv, -+ WIRELESS_MODE WirelessMode, -+ s32 PowerInDbm -+ ) -+{ -+ bool bUseDefault = true; -+ s8 TxPwrIdx = 0; -+ -+#ifdef CONFIG_RTL818X_S -+ // -+ // 071011, SD3 SY: -+ // OFDM Power in dBm = Index * 0.5 + 0 -+ // CCK Power in dBm = Index * 0.25 + 13 -+ // -+ if(priv->card_8185 >= VERSION_8187S_B) -+ { -+ s32 tmp = 0; -+ -+ if(WirelessMode == WIRELESS_MODE_G) -+ { -+ bUseDefault = false; -+ tmp = (2 * PowerInDbm); -+ -+ if(tmp < 0) -+ TxPwrIdx = 0; -+ else if(tmp > 40) // 40 means 20 dBm. -+ TxPwrIdx = 40; -+ else -+ TxPwrIdx = (s8)tmp; -+ } -+ else if(WirelessMode == WIRELESS_MODE_B) -+ { -+ bUseDefault = false; -+ tmp = (4 * PowerInDbm) - 52; -+ -+ if(tmp < 0) -+ TxPwrIdx = 0; -+ else if(tmp > 28) // 28 means 20 dBm. -+ TxPwrIdx = 28; -+ else -+ TxPwrIdx = (s8)tmp; -+ } -+ } -+#endif -+ -+ // -+ // TRUE if we want to use a default implementation. -+ // We shall set it to FALSE when we have exact translation formular -+ // for target IC. 070622, by rcnjko. -+ // -+ if(bUseDefault) -+ { -+ if(PowerInDbm < 0) -+ TxPwrIdx = 0; -+ else if(PowerInDbm > 35) -+ TxPwrIdx = 35; -+ else -+ TxPwrIdx = (u8)PowerInDbm; -+ } -+ -+ return TxPwrIdx; -+} -+#endif -+ -+ -+short rtl8225_rf_set_sens(struct net_device *dev, short sens) -+{ -+ if (sens <0 || sens > 6) return -1; -+ -+ if(sens > 4) -+ write_rtl8225(dev, 0x0c, 0x850); -+ else -+ write_rtl8225(dev, 0x0c, 0x50); -+ -+ sens= 6-sens; -+ rtl8225_set_gain(dev, sens); -+ -+ write_phy_cck(dev, 0x41, rtl8225_threshold[sens]); -+ return 0; -+ -+} -+ -+void rtl8225_SetTXPowerLevel(struct net_device *dev, short ch) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ int GainIdx; -+ int GainSetting; -+ int i; -+ u8 power; -+ u8 *cck_power_table; -+ u8 max_cck_power_level; -+ u8 max_ofdm_power_level; -+ u8 min_ofdm_power_level; -+ u8 cck_power_level = 0xff & priv->chtxpwr[ch]; -+ u8 ofdm_power_level = 0xff & priv->chtxpwr_ofdm[ch]; -+ -+#ifdef ENABLE_DOT11D -+ if(IS_DOT11D_ENABLE(priv->ieee80211) && -+ IS_DOT11D_STATE_DONE(priv->ieee80211) ) -+ { -+ //PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(priv->ieee80211); -+ u8 MaxTxPwrInDbm = DOT11D_GetMaxTxPwrInDbm(priv->ieee80211, ch); -+ u8 CckMaxPwrIdx = DbmToTxPwrIdx(priv, WIRELESS_MODE_B, MaxTxPwrInDbm); -+ u8 OfdmMaxPwrIdx = DbmToTxPwrIdx(priv, WIRELESS_MODE_G, MaxTxPwrInDbm); -+ -+ //printk("Max Tx Power dBm (%d) => CCK Tx power index : %d, OFDM Tx power index: %d\n", MaxTxPwrInDbm, CckMaxPwrIdx, OfdmMaxPwrIdx); -+ -+ //printk("EEPROM channel(%d) => CCK Tx power index: %d, OFDM Tx power index: %d\n", -+ // ch, cck_power_level, ofdm_power_level); -+ -+ if(cck_power_level > CckMaxPwrIdx) -+ cck_power_level = CckMaxPwrIdx; -+ if(ofdm_power_level > OfdmMaxPwrIdx) -+ ofdm_power_level = OfdmMaxPwrIdx; -+ } -+ -+ //priv->CurrentCckTxPwrIdx = cck_power_level; -+ //priv->CurrentOfdmTxPwrIdx = ofdm_power_level; -+#endif -+ -+ -+ if(priv->card_type == USB){ -+ max_cck_power_level = 11; -+ max_ofdm_power_level = 25; // 12 -> 25 -+ min_ofdm_power_level = 10; -+ }else{ -+ max_cck_power_level = 35; -+ max_ofdm_power_level = 35; -+ min_ofdm_power_level = 0; -+ } -+ if( priv->TrSwitchState == TR_SW_TX ) -+ { -+ printk("SetTxPowerLevel8187(): Origianl OFDM Tx power level %d\n", ofdm_power_level); -+ ofdm_power_level -= GetTxOfdmHighPowerBias(dev); -+ cck_power_level -= GetTxCckHighPowerBias(dev); -+ printk("SetTxPowerLevel8187(): Adjusted OFDM Tx power level %d for we are in High Power state\n", -+ ofdm_power_level); -+ printk("SetTxPowerLevel8187(): Adjusted CCK Tx power level %d for we are in High Power state\n", -+ cck_power_level); -+ } -+ -+ -+ -+ /* CCK power setting */ -+ if(cck_power_level > max_cck_power_level) -+ cck_power_level = max_cck_power_level; -+ GainIdx=cck_power_level % 6; -+ GainSetting=cck_power_level / 6; -+ -+ if(ch == 14) -+ cck_power_table = rtl8225_tx_power_cck_ch14; -+ else -+ cck_power_table = rtl8225_tx_power_cck; -+ -+// if(priv->card_8185 == 1 && priv->card_8185_Bversion ){ -+ /*Ver B*/ -+// write_nic_byte(dev, TX_GAIN_CCK, rtl8225_tx_gain_cck_ofdm[GainSetting]); -+// }else{ -+ /*Ver C - D */ -+ write_nic_byte(dev, CCK_TXAGC, rtl8225_tx_gain_cck_ofdm[GainSetting]>>1); -+// } -+ -+ for(i=0;i<8;i++){ -+ -+ power = cck_power_table[GainIdx * 8 + i]; -+ write_phy_cck(dev, 0x44 + i, power); -+ } -+ -+ /* FIXME Is this delay really needeed ? */ -+ force_pci_posting(dev); -+ mdelay(1); -+ -+ /* OFDM power setting */ -+// Old: -+// if(ofdm_power_level > max_ofdm_power_level) -+// ofdm_power_level = 35; -+// ofdm_power_level += min_ofdm_power_level; -+// Latest: -+ if(ofdm_power_level > (max_ofdm_power_level - min_ofdm_power_level)) -+ ofdm_power_level = max_ofdm_power_level; -+ else -+ ofdm_power_level += min_ofdm_power_level; -+ if(ofdm_power_level > 35) -+ ofdm_power_level = 35; -+// -+ -+ GainIdx=ofdm_power_level % 6; -+ GainSetting=ofdm_power_level / 6; -+#if 1 -+// if(priv->card_type == USB){ -+ rtl8185_set_anaparam2(dev,RTL8225_ANAPARAM2_ON); -+ -+ write_phy_ofdm(dev,2,0x42); -+ write_phy_ofdm(dev,6,0); -+ write_phy_ofdm(dev,8,0); -+// } -+#endif -+// if(priv->card_8185 == 1 && priv->card_8185_Bversion){ -+// /*Ver B*/ -+// write_nic_byte(dev, TX_GAIN_OFDM, rtl8225_tx_gain_cck_ofdm[GainSetting]); -+// }else{ -+ /*Ver C - D */ -+ write_nic_byte(dev, OFDM_TXAGC, rtl8225_tx_gain_cck_ofdm[GainSetting]>>1); -+// } -+ -+ -+ power = rtl8225_tx_power_ofdm[GainIdx]; -+ -+ write_phy_ofdm(dev, 0x5, power); -+ write_phy_ofdm(dev, 0x7, power); -+ -+ force_pci_posting(dev); -+ mdelay(1); -+ //write_nic_byte(dev, TX_AGC_CONTROL,4); -+} -+ -+void rtl8225_rf_set_chan(struct net_device *dev, short ch) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ short gset = (priv->ieee80211->state == IEEE80211_LINKED && -+ ieee80211_is_54g(priv->ieee80211->current_network)) || -+ priv->ieee80211->iw_mode == IW_MODE_MONITOR; -+ int eifs_addr; -+ -+ if(NIC_8187 == priv->card_8187) { -+ eifs_addr = EIFS_8187; -+ } else { -+ eifs_addr = EIFS_8187B; -+ } -+ -+#ifdef ENABLE_DOT11D -+ if(!IsLegalChannel(priv->ieee80211, ch) ) -+ { -+ printk("channel(%d). is invalide\n", ch); -+ return; -+ } -+#endif -+ -+ rtl8225_SetTXPowerLevel(dev, ch); -+ -+ write_rtl8225(dev, 0x7, rtl8225_chan[ch]); -+ -+ force_pci_posting(dev); -+ mdelay(10); -+ -+ write_nic_byte(dev,SIFS,0x22);// SIFS: 0x22 -+ -+ if(gset) -+ write_nic_byte(dev,DIFS,20); //DIFS: 20 -+ else -+ write_nic_byte(dev,DIFS,0x24); //DIFS: 36 -+ -+ if(priv->ieee80211->state == IEEE80211_LINKED && -+ ieee80211_is_shortslot(priv->ieee80211->current_network)) -+ write_nic_byte(dev,SLOT,0x9); //SLOT: 9 -+ -+ else -+ write_nic_byte(dev,SLOT,0x14); //SLOT: 20 (0x14) -+ -+ -+ if(gset){ -+ write_nic_byte(dev,eifs_addr,91 - 20); // EIFS: 91 (0x5B) -+ write_nic_byte(dev,CW_VAL,0x73); //CW VALUE: 0x37 -+ //DMESG("using G net params"); -+ }else{ -+ write_nic_byte(dev,eifs_addr,91 - 0x24); // EIFS: 91 (0x5B) -+ write_nic_byte(dev,CW_VAL,0xa5); //CW VALUE: 0x37 -+ //DMESG("using B net params"); -+ } -+ -+ -+} -+ -+void rtl8225_host_pci_init(struct net_device *dev) -+{ -+ write_nic_word(dev, RFPinsOutput, 0x480); -+ -+ rtl8185_rf_pins_enable(dev); -+ -+ //if(priv->card_8185 == 2 && priv->enable_gpio0 ) /* version D */ -+ //write_nic_word(dev, RFPinsSelect, 0x88); -+ //else -+ write_nic_word(dev, RFPinsSelect, 0x88 | SW_CONTROL_GPIO); /* 0x488 | SW_CONTROL_GPIO */ -+ -+ write_nic_byte(dev, GP_ENABLE, 0); -+ -+ force_pci_posting(dev); -+ mdelay(200); -+ -+ write_nic_word(dev, GP_ENABLE, 0xff & (~(1<<6))); /* bit 6 is for RF on/off detection */ -+ -+ -+} -+ -+void rtl8225_host_usb_init(struct net_device *dev) -+{ -+ write_nic_byte(dev,RFPinsSelect+1,0); -+ -+ write_nic_byte(dev,GPIO,0); -+ -+ write_nic_byte_E(dev,0x53,read_nic_byte_E(dev,0x53) | (1<<7)); -+ -+ write_nic_byte(dev,RFPinsSelect+1,4); -+ -+ write_nic_byte(dev,GPIO,0x20); -+ -+ write_nic_byte(dev,GP_ENABLE,0); -+ -+ -+ /* Config BB & RF */ -+ write_nic_word(dev, RFPinsOutput, 0x80); -+ -+ write_nic_word(dev, RFPinsSelect, 0x80); -+ -+ write_nic_word(dev, RFPinsEnable, 0x80); -+ -+ -+ mdelay(100); -+ -+ mdelay(1000); -+ -+} -+ -+void rtl8225_rf_init(struct net_device *dev) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ int i; -+ short channel = 1; -+ u16 brsr; -+ int brsr_addr; -+ -+ if(NIC_8187 == priv->card_8187) { -+ brsr_addr = BRSR_8187; -+ } else { -+ brsr_addr = BRSR_8187B; -+ } -+ -+ -+ priv->chan = channel; -+ -+ rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON); -+ -+ -+ if(priv->card_type == USB) -+ rtl8225_host_usb_init(dev); -+ else -+ rtl8225_host_pci_init(dev); -+ -+ write_nic_dword(dev, RF_TIMING, 0x000a8008); -+ -+ //brsr = read_nic_word(dev, BRSR); -+ brsr = read_nic_word(dev, brsr_addr); -+ -+ //write_nic_word(dev, BRSR, 0xffff); -+ write_nic_word(dev, brsr_addr, 0xffff); -+ -+ write_nic_dword(dev, RF_PARA, 0x100044); -+ -+ #if 1 //0->1 -+ rtl8180_set_mode(dev, EPROM_CMD_CONFIG); -+ write_nic_byte(dev, CONFIG3, 0x44); -+ rtl8180_set_mode(dev, EPROM_CMD_NORMAL); -+ #endif -+ -+ if(priv->card_type == USB){ -+ rtl8185_rf_pins_enable(dev); -+ -+ mdelay(1000); -+ } -+ -+ write_rtl8225(dev, 0x0, 0x67); mdelay(1); -+ -+ -+ write_rtl8225(dev, 0x1, 0xfe0); mdelay(1); -+ -+ write_rtl8225(dev, 0x2, 0x44d); mdelay(1); -+ -+ write_rtl8225(dev, 0x3, 0x441); mdelay(1); -+ -+ if(priv->card_type == USB) -+ write_rtl8225(dev, 0x4, 0x486); -+ else -+ write_rtl8225(dev, 0x4, 0x8be); -+ -+ mdelay(1); -+ -+ -+ /* version B & C */ -+ -+ if(priv->card_type == USB) -+ write_rtl8225(dev, 0x5, 0xbc0); -+ else if(priv->card_type == MINIPCI) -+ write_rtl8225(dev, 0x5, 0xbc0 + 3 +(6<<3)); -+ else -+ write_rtl8225(dev, 0x5, 0xbc0 + (6<<3)); -+ -+ mdelay(1); -+// } -+ -+ write_rtl8225(dev, 0x6, 0xae6); mdelay(1); -+ -+ write_rtl8225(dev, 0x7, ((priv->card_type == USB)? 0x82a : rtl8225_chan[channel])); mdelay(1); -+ -+ write_rtl8225(dev, 0x8, 0x1f); mdelay(1); -+ -+ write_rtl8225(dev, 0x9, 0x334); mdelay(1); -+ -+ write_rtl8225(dev, 0xa, 0xfd4); mdelay(1); -+ -+ write_rtl8225(dev, 0xb, 0x391); mdelay(1); -+ -+ write_rtl8225(dev, 0xc, 0x50); mdelay(1); -+ -+ -+ write_rtl8225(dev, 0xd, 0x6db); mdelay(1); -+ -+ write_rtl8225(dev, 0xe, 0x29); mdelay(1); -+ -+ write_rtl8225(dev, 0xf, 0x914); -+ -+ if(priv->card_type == USB){ -+ //force_pci_posting(dev); -+ mdelay(100); -+ } -+ -+ write_rtl8225(dev, 0x2, 0xc4d); -+ -+ if(priv->card_type == USB){ -+ // force_pci_posting(dev); -+ mdelay(200); -+ -+ write_rtl8225(dev, 0x2, 0x44d); -+ -+ // force_pci_posting(dev); -+ mdelay(100); -+ -+ }//End of if(priv->card_type == USB) -+ /* FIXME!! rtl8187 we have to check if calibrarion -+ * is successful and eventually cal. again (repeat -+ * the two write on reg 2) -+ */ -+ force_pci_posting(dev); -+ -+ mdelay(100); //200 for 8187 -+ -+ //if(priv->card_type != USB) /* maybe not needed even for 8185 */ -+// write_rtl8225(dev, 0x7, rtl8225_chan[channel]); -+ -+ write_rtl8225(dev, 0x0, 0x127); -+ -+ for(i=0;i<95;i++){ -+ write_rtl8225(dev, 0x1, (u8)(i+1)); -+ -+ /* version B & C & D*/ -+ -+ write_rtl8225(dev, 0x2, rtl8225bcd_rxgain[i]); -+ } -+ -+ write_rtl8225(dev, 0x0, 0x27); -+ -+ -+// //if(priv->card_type != USB){ -+// write_rtl8225(dev, 0x2, 0x44d); -+// write_rtl8225(dev, 0x7, rtl8225_chan[channel]); -+// write_rtl8225(dev, 0x2, 0x47d); -+// -+// force_pci_posting(dev); -+// mdelay(100); -+// -+// write_rtl8225(dev, 0x2, 0x44d); -+// //} -+ -+ write_rtl8225(dev, 0x0, 0x22f); -+ -+ if(priv->card_type != USB) -+ rtl8185_rf_pins_enable(dev); -+ -+ for(i=0;i<128;i++){ -+ write_phy_ofdm(dev, 0xb, rtl8225_agc[i]); -+ -+ mdelay(1); -+ write_phy_ofdm(dev, 0xa, (u8)i+ 0x80); -+ -+ mdelay(1); -+ } -+ -+ force_pci_posting(dev); -+ mdelay(1); -+ -+ write_phy_ofdm(dev, 0x0, 0x1); mdelay(1); -+ write_phy_ofdm(dev, 0x1, 0x2); mdelay(1); -+ write_phy_ofdm(dev, 0x2, ((priv->card_type == USB)? 0x42 : 0x62)); mdelay(1); -+ write_phy_ofdm(dev, 0x3, 0x0); mdelay(1); -+ write_phy_ofdm(dev, 0x4, 0x0); mdelay(1); -+ write_phy_ofdm(dev, 0x5, 0x0); mdelay(1); -+ write_phy_ofdm(dev, 0x6, 0x40); mdelay(1); -+ write_phy_ofdm(dev, 0x7, 0x0); mdelay(1); -+ write_phy_ofdm(dev, 0x8, 0x40); mdelay(1); -+ write_phy_ofdm(dev, 0x9, 0xfe); mdelay(1); -+ -+ /* ver C & D */ -+ write_phy_ofdm(dev, 0xa, 0x9); mdelay(1); -+ -+ //write_phy_ofdm(dev, 0x18, 0xef); -+ // } -+ //} -+ write_phy_ofdm(dev, 0xb, 0x80); mdelay(1); -+ -+ write_phy_ofdm(dev, 0xc, 0x1);mdelay(1); -+ -+ -+ //if(priv->card_type != USB) -+ //write_phy_ofdm(dev, 0xd, 0x33); // <> -+ -+ write_phy_ofdm(dev, 0xe, 0xd3);mdelay(1); -+ -+ write_phy_ofdm(dev, 0xf, 0x38);mdelay(1); -+/*ver D & 8187*/ -+// } -+ -+// if(priv->card_8185 == 1 && priv->card_8185_Bversion) -+// write_phy_ofdm(dev, 0x10, 0x04);/*ver B*/ -+// else -+ write_phy_ofdm(dev, 0x10, 0x84);mdelay(1); -+/*ver C & D & 8187*/ -+ -+ write_phy_ofdm(dev, 0x11, 0x06);mdelay(1); -+/*agc resp time 700*/ -+ -+ -+// if(priv->card_8185 == 2){ -+ /* Ver D & 8187*/ -+ write_phy_ofdm(dev, 0x12, 0x20);mdelay(1); -+ -+ write_phy_ofdm(dev, 0x13, 0x20);mdelay(1); -+ -+ write_phy_ofdm(dev, 0x14, 0x0); mdelay(1); -+ write_phy_ofdm(dev, 0x15, 0x40); mdelay(1); -+ write_phy_ofdm(dev, 0x16, 0x0); mdelay(1); -+ write_phy_ofdm(dev, 0x17, 0x40); mdelay(1); -+ -+// if (priv->card_type == USB) -+// write_phy_ofdm(dev, 0x18, 0xef); -+ -+ write_phy_ofdm(dev, 0x18, 0xef);mdelay(1); -+ -+ -+ write_phy_ofdm(dev, 0x19, 0x19); mdelay(1); -+ write_phy_ofdm(dev, 0x1a, 0x20); mdelay(1); -+ -+// if (priv->card_type != USB){ -+// if(priv->card_8185 == 1 && priv->card_8185_Bversion) -+// write_phy_ofdm(dev, 0x1b, 0x66); /* Ver B */ -+// else -+ write_phy_ofdm(dev, 0x1b, 0x76);mdelay(1); -+ /* Ver C & D */ //FIXME:MAYBE not needed -+// } -+ -+ write_phy_ofdm(dev, 0x1c, 0x4);mdelay(1); -+ -+ /*ver D & 8187*/ -+ write_phy_ofdm(dev, 0x1e, 0x95);mdelay(1); -+ -+ write_phy_ofdm(dev, 0x1f, 0x75); mdelay(1); -+ -+// } -+ -+ write_phy_ofdm(dev, 0x20, 0x1f);mdelay(1); -+ -+ write_phy_ofdm(dev, 0x21, 0x27);mdelay(1); -+ -+ write_phy_ofdm(dev, 0x22, 0x16);mdelay(1); -+ -+// if(priv->card_type != USB) -+ //write_phy_ofdm(dev, 0x23, 0x43); //FIXME maybe not needed // <> -+ -+ write_phy_ofdm(dev, 0x24, 0x46); mdelay(1); -+ write_phy_ofdm(dev, 0x25, 0x20); mdelay(1); -+ write_phy_ofdm(dev, 0x26, 0x90); mdelay(1); -+ write_phy_ofdm(dev, 0x27, 0x88); mdelay(1); -+/* Ver C & D & 8187*/ -+ -+ // <> Set init. gain to m74dBm. -+ -+ rtl8225_set_gain(dev,4); -+ /*write_phy_ofdm(dev, 0x0d, 0x43); mdelay(1); -+ write_phy_ofdm(dev, 0x1b, 0x76); mdelay(1); -+ write_phy_ofdm(dev, 0x1d, 0xc5); mdelay(1); -+ write_phy_ofdm(dev, 0x23, 0x78); mdelay(1); -+*/ -+ //if(priv->card_type == USB); -+ // rtl8225_set_gain_usb(dev, 1); /* FIXME this '2' is random */ -+ -+ write_phy_cck(dev, 0x0, 0x98); mdelay(1); -+ write_phy_cck(dev, 0x3, 0x20); mdelay(1); -+ write_phy_cck(dev, 0x4, 0x7e); mdelay(1); -+ write_phy_cck(dev, 0x5, 0x12); mdelay(1); -+ write_phy_cck(dev, 0x6, 0xfc); mdelay(1); -+ write_phy_cck(dev, 0x7, 0x78);mdelay(1); -+ /* Ver C & D & 8187*/ -+ -+ write_phy_cck(dev, 0x8, 0x2e);mdelay(1); -+ -+ write_phy_cck(dev, 0x10, ((priv->card_type == USB) ? 0x9b: 0x93)); mdelay(1); -+ write_phy_cck(dev, 0x11, 0x88); mdelay(1); -+ write_phy_cck(dev, 0x12, 0x47); mdelay(1); -+ write_phy_cck(dev, 0x13, 0xd0); /* Ver C & D & 8187*/ -+ -+ write_phy_cck(dev, 0x19, 0x0); -+ write_phy_cck(dev, 0x1a, 0xa0); -+ write_phy_cck(dev, 0x1b, 0x8); -+ write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */ -+ -+ write_phy_cck(dev, 0x41, 0x8d);mdelay(1); -+ -+ -+ write_phy_cck(dev, 0x42, 0x15); mdelay(1); -+ write_phy_cck(dev, 0x43, 0x18); mdelay(1); -+ write_phy_cck(dev, 0x44, 0x1f); mdelay(1); -+ write_phy_cck(dev, 0x45, 0x1e); mdelay(1); -+ write_phy_cck(dev, 0x46, 0x1a); mdelay(1); -+ write_phy_cck(dev, 0x47, 0x15); mdelay(1); -+ write_phy_cck(dev, 0x48, 0x10); mdelay(1); -+ write_phy_cck(dev, 0x49, 0xa); mdelay(1); -+ write_phy_cck(dev, 0x4a, 0x5); mdelay(1); -+ write_phy_cck(dev, 0x4b, 0x2); mdelay(1); -+ write_phy_cck(dev, 0x4c, 0x5);mdelay(1); -+ -+ -+ write_nic_byte(dev, 0x5b, 0x0d); mdelay(1); -+ -+ -+ -+// <> -+// // TESTR 0xb 8187 -+// write_phy_cck(dev, 0x10, 0x93);// & 0xfb); -+// -+// //if(priv->card_type != USB){ -+// write_phy_ofdm(dev, 0x2, 0x62); -+// write_phy_ofdm(dev, 0x6, 0x0); -+// write_phy_ofdm(dev, 0x8, 0x0); -+// //} -+ -+ rtl8225_SetTXPowerLevel(dev, channel); -+ -+ write_phy_cck(dev, 0x10, 0x9b); mdelay(1); /* Rx ant A, 0xdb for B */ -+ write_phy_ofdm(dev, 0x26, 0x90); mdelay(1); /* Rx ant A, 0x10 for B */ -+ -+ rtl8185_tx_antenna(dev, 0x3); /* TX ant A, 0x0 for B */ -+ -+ /* switch to high-speed 3-wire -+ * last digit. 2 for both cck and ofdm -+ */ -+ if(priv->card_type == USB) -+ write_nic_dword(dev, 0x94, 0x3dc00002); -+ else{ -+ write_nic_dword(dev, 0x94, 0x15c00002); -+ rtl8185_rf_pins_enable(dev); -+ } -+ -+// if(priv->card_type != USB) -+// rtl8225_set_gain(dev, 4); /* FIXME this '1' is random */ // <> -+// rtl8225_set_mode(dev, 1); /* FIXME start in B mode */ // <> -+// -+// /* make sure is waken up! */ -+// write_rtl8225(dev,0x4, 0x9ff); -+// rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON); -+// rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON); -+ -+ rtl8225_rf_set_chan(dev, priv->chan); -+ -+ //write_nic_word(dev,BRSR,brsr); -+ -+} -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8180_rtl8225.h linux-2.6.35/drivers/net/wireless/rtl8187b/r8180_rtl8225.h ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8180_rtl8225.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/r8180_rtl8225.h 2010-08-05 21:12:35.303617868 +0200 -@@ -0,0 +1,77 @@ -+/* -+ This is part of the rtl8180-sa2400 driver -+ released under the GPL (See file COPYING for details). -+ Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it> -+ -+ This files contains programming code for the rtl8225 -+ radio frontend. -+ -+ *Many* thanks to Realtek Corp. for their great support! -+ -+*/ -+ -+#ifndef RTL8225H -+#define RTL8225H -+ -+#include "r8187.h" -+ -+#define RTL8225_ANAPARAM_ON 0xa0000a59 -+ -+// FIXME: OFF ANAPARAM MIGHT BE WRONG! -+#define RTL8225_ANAPARAM_OFF 0xa00beb59 -+#define RTL8225_ANAPARAM2_OFF 0x840dec11 -+ -+#define RTL8225_ANAPARAM2_ON 0x860c7312 -+ -+void rtl8225_rf_init(struct net_device *dev); -+void rtl8225z2_rf_init(struct net_device *dev); -+void rtl8225z2_rf_set_chan(struct net_device *dev, short ch); -+short rtl8225_is_V_z2(struct net_device *dev); -+void rtl8225_rf_set_chan(struct net_device *dev,short ch); -+void rtl8225_rf_close(struct net_device *dev); -+short rtl8225_rf_set_sens(struct net_device *dev, short sens); -+void rtl8225_host_pci_init(struct net_device *dev); -+void rtl8225_host_usb_init(struct net_device *dev); -+void write_rtl8225(struct net_device *dev, u8 adr, u16 data); -+void rtl8225z2_rf_set_mode(struct net_device *dev) ; -+void rtl8185_rf_pins_enable(struct net_device *dev); -+void rtl8180_set_mode(struct net_device *dev,int mode); -+void UpdateInitialGain(struct net_device *dev); -+void UpdateCCKThreshold(struct net_device *dev); -+void rtl8225_SetTXPowerLevel(struct net_device *dev, short ch); -+void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch); -+ -+#define RTL8225_RF_MAX_SENS 6 -+#define RTL8225_RF_DEF_SENS 4 -+ -+extern inline char GetTxOfdmHighPowerBias(struct net_device *dev) -+{ -+ // -+ // We should always adjust our Tx Power for 8187 and 8187B. -+ // It was ever recommended not to adjust Tx Power of 8187B with Atheros AP -+ // for throughput by David, but now we found it is not the issue to impact -+ // the Atheros's problem and also no adjustion for Tx Power will cause "low" -+ // throughput. By Bruce, 2007-07-03. -+ // -+ return 10; -+} -+ -+// -+// Description: -+// Return Tx power level to minus if we are in high power state. -+// -+// Note: -+// Adjust it according to RF if required. -+// -+extern inline char GetTxCckHighPowerBias(struct net_device *dev) -+{ -+ return 7; -+} -+ -+ -+ -+extern u8 rtl8225_agc[]; -+ -+extern u32 rtl8225_chan[]; -+ -+#endif -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8180_rtl8225z2.c linux-2.6.35/drivers/net/wireless/rtl8187b/r8180_rtl8225z2.c ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8180_rtl8225z2.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/r8180_rtl8225z2.c 2010-08-05 21:12:35.343622044 +0200 -@@ -0,0 +1,2092 @@ -+/* -+ This is part of the rtl8180-sa2400 driver -+ released under the GPL (See file COPYING for details). -+ Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it> -+ -+ This files contains programming code for the rtl8225 -+ radio frontend. -+ -+ *Many* thanks to Realtek Corp. for their great support! -+ -+*/ -+ -+ -+ -+#include "r8180_hw.h" -+#include "r8180_rtl8225.h" -+#ifdef ENABLE_DOT11D -+#include "dot11d.h" -+#endif -+ -+//2005.11.16 -+u8 rtl8225z2_threshold[]={ -+ 0x8d, 0x8d, 0x8d, 0x8d, 0x9d, 0xad, 0xbd, -+}; -+ -+// 0xd 0x19 0x1b 0x21 -+u8 rtl8225z2_gain_bg[]={ -+ 0x23, 0x15, 0xa5, // -82-1dbm -+ 0x23, 0x15, 0xb5, // -82-2dbm -+ 0x23, 0x15, 0xc5, // -82-3dbm -+ 0x33, 0x15, 0xc5, // -78dbm -+ 0x43, 0x15, 0xc5, // -74dbm -+ 0x53, 0x15, 0xc5, // -70dbm -+ 0x63, 0x15, 0xc5, // -66dbm -+}; -+ -+u8 rtl8225z2_gain_a[]={ -+ 0x13,0x27,0x5a,//,0x37,// -82dbm -+ 0x23,0x23,0x58,//,0x37,// -82dbm -+ 0x33,0x1f,0x56,//,0x37,// -82dbm -+ 0x43,0x1b,0x54,//,0x37,// -78dbm -+ 0x53,0x17,0x51,//,0x37,// -74dbm -+ 0x63,0x24,0x4f,//,0x37,// -70dbm -+ 0x73,0x0f,0x4c,//,0x37,// -66dbm -+}; -+static u32 MAC_REG_TABLE[][3]={ -+ {0xf0, 0x32, 0000}, {0xf1, 0x32, 0000}, {0xf2, 0x00, 0000}, {0xf3, 0x00, 0000}, -+ {0xf4, 0x32, 0000}, {0xf5, 0x43, 0000}, {0xf6, 0x00, 0000}, {0xf7, 0x00, 0000}, -+ {0xf8, 0x46, 0000}, {0xf9, 0xa4, 0000}, {0xfa, 0x00, 0000}, {0xfb, 0x00, 0000}, -+ {0xfc, 0x96, 0000}, {0xfd, 0xa4, 0000}, {0xfe, 0x00, 0000}, {0xff, 0x00, 0000}, -+ -+ {0x58, 0x4b, 0001}, {0x59, 0x00, 0001}, {0x5a, 0x4b, 0001}, {0x5b, 0x00, 0001}, -+ {0x60, 0x4b, 0001}, {0x61, 0x09, 0001}, {0x62, 0x4b, 0001}, {0x63, 0x09, 0001}, -+ {0xce, 0x0f, 0001}, {0xcf, 0x00, 0001}, {0xe0, 0xff, 0001}, {0xe1, 0x0f, 0001}, -+ {0xe2, 0x00, 0001}, {0xf0, 0x4e, 0001}, {0xf1, 0x01, 0001}, {0xf2, 0x02, 0001}, -+ {0xf3, 0x03, 0001}, {0xf4, 0x04, 0001}, {0xf5, 0x05, 0001}, {0xf6, 0x06, 0001}, -+ {0xf7, 0x07, 0001}, {0xf8, 0x08, 0001}, -+ -+ {0x4e, 0x00, 0002}, {0x0c, 0x04, 0002}, {0x21, 0x61, 0002}, {0x22, 0x68, 0002}, -+ {0x23, 0x6f, 0002}, {0x24, 0x76, 0002}, {0x25, 0x7d, 0002}, {0x26, 0x84, 0002}, -+ {0x27, 0x8d, 0002}, {0x4d, 0x08, 0002}, {0x50, 0x05, 0002}, {0x51, 0xf5, 0002}, -+ {0x52, 0x04, 0002}, {0x53, 0xa0, 0002}, {0x54, 0x1f, 0002}, {0x55, 0x23, 0002}, -+ {0x56, 0x45, 0002}, {0x57, 0x67, 0002}, {0x58, 0x08, 0002}, {0x59, 0x08, 0002}, -+ {0x5a, 0x08, 0002}, {0x5b, 0x08, 0002}, {0x60, 0x08, 0002}, {0x61, 0x08, 0002}, -+ {0x62, 0x08, 0002}, {0x63, 0x08, 0002}, {0x64, 0xcf, 0002}, {0x72, 0x56, 0002}, -+ {0x73, 0x9a, 0002}, -+ -+ {0x34, 0xf0, 0000}, {0x35, 0x0f, 0000}, {0x5b, 0x40, 0000}, {0x84, 0x88, 0000}, -+ {0x85, 0x24, 0000}, {0x88, 0x54, 0000}, {0x8b, 0xb8, 0000}, {0x8c, 0x07, 0000}, -+ {0x8d, 0x00, 0000}, {0x94, 0x1b, 0000}, {0x95, 0x12, 0000}, {0x96, 0x00, 0000}, -+ {0x97, 0x06, 0000}, {0x9d, 0x1a, 0000}, {0x9f, 0x10, 0000}, {0xb4, 0x22, 0000}, -+ {0xbe, 0x80, 0000}, {0xdb, 0x00, 0000}, {0xee, 0x00, 0000}, {0x91, 0x01, 0000}, -+ //lzm mode 0x91 form 0x03->0x01 open GPIO BIT1, -+ //because Polling methord will rurn off Radio -+ //the first time when read GPI(0x92). -+ //because after 0x91:bit1 form 1->0, there will -+ //be time for 0x92:bit1 form 0->1 -+ -+ {0x4c, 0x00, 0002}, {0x9f, 0x00, 0003}, {0x8c, 0x01, 0000}, {0x8d, 0x10, 0000}, -+ {0x8e, 0x08, 0000}, {0x8f, 0x00, 0000} -+}; -+ -+static u8 ZEBRA_AGC[]={ -+ 0, -+ 0x5e,0x5e,0x5e,0x5e,0x5d,0x5b,0x59,0x57,0x55,0x53,0x51,0x4f,0x4d,0x4b,0x49,0x47, -+ 0x45,0x43,0x41,0x3f,0x3d,0x3b,0x39,0x37,0x35,0x33,0x31,0x2f,0x2d,0x2b,0x29,0x27, -+ 0x25,0x23,0x21,0x1f,0x1d,0x1b,0x19,0x17,0x15,0x13,0x11,0x0f,0x0d,0x0b,0x09,0x07, -+ 0x05,0x03,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, -+ 0x19,0x19,0x19,0x019,0x19,0x19,0x19,0x19,0x19,0x20,0x21,0x22,0x23,0x24,0x25,0x26, -+ 0x26,0x27,0x27,0x28,0x28,0x29,0x2a,0x2a,0x2a,0x2b,0x2b,0x2b,0x2c,0x2c,0x2c,0x2d, -+ 0x2d,0x2d,0x2d,0x2e,0x2e,0x2e,0x2e,0x2f,0x2f,0x2f,0x30,0x30,0x31,0x31,0x31,0x31, -+ 0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31 -+}; -+ -+static u32 ZEBRA_RF_RX_GAIN_TABLE[]={ -+ 0, -+ 0x0400,0x0401,0x0402,0x0403,0x0404,0x0405,0x0408,0x0409, -+ 0x040a,0x040b,0x0502,0x0503,0x0504,0x0505,0x0540,0x0541, -+ 0x0542,0x0543,0x0544,0x0545,0x0580,0x0581,0x0582,0x0583, -+ 0x0584,0x0585,0x0588,0x0589,0x058a,0x058b,0x0643,0x0644, -+ 0x0645,0x0680,0x0681,0x0682,0x0683,0x0684,0x0685,0x0688, -+ 0x0689,0x068a,0x068b,0x068c,0x0742,0x0743,0x0744,0x0745, -+ 0x0780,0x0781,0x0782,0x0783,0x0784,0x0785,0x0788,0x0789, -+ 0x078a,0x078b,0x078c,0x078d,0x0790,0x0791,0x0792,0x0793, -+ 0x0794,0x0795,0x0798,0x0799,0x079a,0x079b,0x079c,0x079d, -+ 0x07a0,0x07a1,0x07a2,0x07a3,0x07a4,0x07a5,0x07a8,0x07a9, -+ 0x03aa,0x03ab,0x03ac,0x03ad,0x03b0,0x03b1,0x03b2,0x03b3, -+ 0x03b4,0x03b5,0x03b8,0x03b9,0x03ba,0x03bb,0x03bb -+}; -+ -+// Use the new SD3 given param, by shien chang, 2006.07.14 -+ -+static u8 OFDM_CONFIG[]={ -+ // 0x00 -+ 0x10, 0x0d, 0x01, 0x00, 0x14, 0xfb, 0xfb, 0x60, -+ 0x00, 0x60, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, -+ -+ // 0x10 -+ 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0xa8, 0x26, -+ 0x32, 0x33, 0x07, 0xa5, 0x6f, 0x55, 0xc8, 0xb3, -+ -+ // 0x20 -+ 0x0a, 0xe1, 0x2C, 0x8a, 0x86, 0x83, 0x34, 0x0f, -+ 0x4f, 0x24, 0x6f, 0xc2, 0x6b, 0x40, 0x80, 0x00, -+ -+ // 0x30 -+ 0xc0, 0xc1, 0x58, 0xf1, 0x00, 0xe4, 0x90, 0x3e, -+ 0x6d, 0x3c, 0xfb, 0x07//0xc7 -+ }; -+ -+//2005.11.16, -+u8 ZEBRA2_CCK_OFDM_GAIN_SETTING[]={ -+ 0x00,0x01,0x02,0x03,0x04,0x05, -+ 0x06,0x07,0x08,0x09,0x0a,0x0b, -+ 0x0c,0x0d,0x0e,0x0f,0x10,0x11, -+ 0x12,0x13,0x14,0x15,0x16,0x17, -+ 0x18,0x19,0x1a,0x1b,0x1c,0x1d, -+ 0x1e,0x1f,0x20,0x21,0x22,0x23, -+}; -+//- -+u16 rtl8225z2_rxgain[]={ -+ 0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409, -+ 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541, -+ 0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583, -+ 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644, -+ 0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688, -+ 0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745, -+ 0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789, -+ 0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793, -+ 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d, -+ 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9, -+ 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3, -+ 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb -+ -+}; -+ -+ -+/* -+ from 0 to 0x23 -+u8 rtl8225_tx_gain_cck_ofdm[]={ -+ 0x02,0x06,0x0e,0x1e,0x3e,0x7e -+}; -+*/ -+ -+//- -+u8 rtl8225z2_tx_power_ofdm[]={ -+ 0x42,0x00,0x40,0x00,0x40 -+}; -+ -+ -+//- -+u8 rtl8225z2_tx_power_cck_ch14[]={ -+ 0x36,0x35,0x2e,0x1b,0x00,0x00,0x00,0x00, -+ 0x30, 0x2f, 0x29, 0x15, 0x00, 0x00, 0x00, 0x00, -+ 0x30, 0x2f, 0x29, 0x15, 0x00, 0x00, 0x00, 0x00, -+ 0x30, 0x2f, 0x29, 0x15, 0x00, 0x00, 0x00, 0x00, -+}; -+ -+ -+//- -+u8 rtl8225z2_tx_power_cck[]={ -+ 0x36,0x35,0x2e,0x25,0x1c,0x12,0x09,0x04, -+ 0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03, -+ 0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03, -+ 0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03 -+}; -+ -+#ifdef ENABLE_DOT11D -+// -+// Description: -+// Map dBm into Tx power index according to -+// current HW model, for example, RF and PA, and -+// current wireless mode. -+// -+s8 -+rtl8187B_DbmToTxPwrIdx( -+ struct r8180_priv *priv, -+ WIRELESS_MODE WirelessMode, -+ s32 PowerInDbm -+ ) -+{ -+ bool bUseDefault = true; -+ s8 TxPwrIdx = 0; -+ -+#ifdef CONFIG_RTL818X_S -+ // -+ // 071011, SD3 SY: -+ // OFDM Power in dBm = Index * 0.5 + 0 -+ // CCK Power in dBm = Index * 0.25 + 13 -+ // -+ if(priv->card_8185 >= VERSION_8187S_B) -+ { -+ s32 tmp = 0; -+ -+ if(WirelessMode == WIRELESS_MODE_G) -+ { -+ bUseDefault = false; -+ tmp = (2 * PowerInDbm); -+ -+ if(tmp < 0) -+ TxPwrIdx = 0; -+ else if(tmp > 40) // 40 means 20 dBm. -+ TxPwrIdx = 40; -+ else -+ TxPwrIdx = (s8)tmp; -+ } -+ else if(WirelessMode == WIRELESS_MODE_B) -+ { -+ bUseDefault = false; -+ tmp = (4 * PowerInDbm) - 52; -+ -+ if(tmp < 0) -+ TxPwrIdx = 0; -+ else if(tmp > 28) // 28 means 20 dBm. -+ TxPwrIdx = 28; -+ else -+ TxPwrIdx = (s8)tmp; -+ } -+ } -+#endif -+ -+ // -+ // TRUE if we want to use a default implementation. -+ // We shall set it to FALSE when we have exact translation formular -+ // for target IC. 070622, by rcnjko. -+ // -+ if(bUseDefault) -+ { -+ if(PowerInDbm < 0) -+ TxPwrIdx = 0; -+ else if(PowerInDbm > 35) -+ TxPwrIdx = 35; -+ else -+ TxPwrIdx = (u8)PowerInDbm; -+ } -+ -+ return TxPwrIdx; -+} -+#endif -+ -+ -+void rtl8225z2_set_gain(struct net_device *dev, short gain) -+{ -+ u8* rtl8225_gain; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ u8 mode = priv->ieee80211->mode; -+ -+ if(mode == IEEE_B || mode == IEEE_G) -+ rtl8225_gain = rtl8225z2_gain_bg; -+ else -+ rtl8225_gain = rtl8225z2_gain_a; -+ -+ //write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 3]); -+ //write_phy_ofdm(dev, 0x19, rtl8225_gain[gain * 3 + 1]); -+ //write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 2]); -+ //2005.11.17, by ch-hsu -+ write_phy_ofdm(dev, 0x0b, rtl8225_gain[gain * 3]); -+ write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 1]); -+ write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 3 + 2]); -+ write_phy_ofdm(dev, 0x21, 0x37); -+ -+} -+ -+u32 read_rtl8225(struct net_device *dev, u8 adr) -+{ -+ u32 data2Write = ((u32)(adr & 0x1f)) << 27; -+ u32 dataRead; -+ u32 mask; -+ u16 oval,oval2,oval3,tmp; -+// ThreeWireReg twreg; -+// ThreeWireReg tdata; -+ int i; -+ short bit, rw; -+ -+ u8 wLength = 6; -+ u8 rLength = 12; -+ u8 low2high = 0; -+ -+ oval = read_nic_word(dev, RFPinsOutput); -+ oval2 = read_nic_word(dev, RFPinsEnable); -+ oval3 = read_nic_word(dev, RFPinsSelect); -+ write_nic_word(dev, RFPinsEnable, (oval2|0xf)); -+ write_nic_word(dev, RFPinsSelect, (oval3|0xf)); -+ -+ dataRead = 0; -+ -+ oval &= ~0xf; -+ -+ write_nic_word(dev, RFPinsOutput, oval | BB_HOST_BANG_EN ); udelay(4); -+ -+ write_nic_word(dev, RFPinsOutput, oval ); udelay(5); -+ -+ rw = 0; -+ -+ mask = (low2high) ? 0x01 : (((u32)0x01)<<(32-1)); -+ for(i = 0; i < wLength/2; i++) -+ { -+ bit = ((data2Write&mask) != 0) ? 1 : 0; -+ write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(1); -+ -+ write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2); -+ write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2); -+ -+ mask = (low2high) ? (mask<<1): (mask>>1); -+ -+ if(i == 2) -+ { -+ rw = BB_HOST_BANG_RW; -+ write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2); -+ write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(2); -+ break; -+ } -+ -+ bit = ((data2Write&mask) != 0) ? 1: 0; -+ -+ write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2); -+ write_nic_word(dev, RFPinsOutput, oval|bit|rw| BB_HOST_BANG_CLK); udelay(2); -+ -+ write_nic_word(dev, RFPinsOutput, oval| bit |rw); udelay(1); -+ -+ mask = (low2high) ? (mask<<1) : (mask>>1); -+ } -+ -+ //twreg.struc.clk = 0; -+ //twreg.struc.data = 0; -+ write_nic_word(dev, RFPinsOutput, rw|oval); udelay(2); -+ mask = (low2high) ? 0x01 : (((u32)0x01) << (12-1)); -+ -+ // We must set data pin to HW controled, otherwise RF can't driver it and -+ // value RF register won't be able to read back properly. 2006.06.13, by rcnjko. -+ write_nic_word(dev, RFPinsEnable,((oval2|0xe) & (~0x01))); -+ -+ for(i = 0; i < rLength; i++) -+ { -+ write_nic_word(dev, RFPinsOutput, rw|oval); udelay(1); -+ -+ write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2); -+ write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2); -+ write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2); -+ tmp = read_nic_word(dev, RFPinsInput); -+ -+ dataRead |= (tmp & BB_HOST_BANG_CLK ? mask : 0); -+ -+ write_nic_word(dev, RFPinsOutput, (rw|oval)); udelay(2); -+ -+ mask = (low2high) ? (mask<<1) : (mask>>1); -+ } -+ -+ write_nic_word(dev, RFPinsOutput, BB_HOST_BANG_EN|BB_HOST_BANG_RW|oval); udelay(2); -+ -+ write_nic_word(dev, RFPinsEnable, oval2); -+ write_nic_word(dev, RFPinsSelect, oval3); // Set To SW Switch -+ write_nic_word(dev, RFPinsOutput, 0x3a0); -+ -+ return dataRead; -+ -+} -+short rtl8225_is_V_z2(struct net_device *dev) -+{ -+ short vz2 = 1; -+ //set VCO-PDN pin -+// printk("%s()\n", __FUNCTION__); -+ write_nic_word(dev, RFPinsOutput, 0x0080); -+ write_nic_word(dev, RFPinsSelect, 0x0080); -+ write_nic_word(dev, RFPinsEnable, 0x0080); -+ -+ //lzm mod for up take too long time 20081201 -+ //mdelay(100); -+ //mdelay(1000); -+ -+ /* sw to reg pg 1 */ -+ write_rtl8225(dev, 0, 0x1b7); -+ /* reg 8 pg 1 = 23*/ -+ if( read_rtl8225(dev, 8) != 0x588) -+ vz2 = 0; -+ -+ else /* reg 9 pg 1 = 24 */ -+ if( read_rtl8225(dev, 9) != 0x700) -+ vz2 = 0; -+ -+ /* sw back to pg 0 */ -+ write_rtl8225(dev, 0, 0xb7); -+ -+ return vz2; -+ -+} -+ -+void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+// int GainIdx; -+// int GainSetting; -+ int i; -+ u8 power; -+ u8 *cck_power_table; -+ u8 max_cck_power_level; -+ u8 min_cck_power_level; -+ u8 max_ofdm_power_level; -+ u8 min_ofdm_power_level; -+ s8 cck_power_level = 0xff & priv->chtxpwr[ch]; -+ s8 ofdm_power_level = 0xff & priv->chtxpwr_ofdm[ch]; -+ u8 hw_version = priv->card_8187_Bversion; -+ -+#ifdef ENABLE_DOT11D -+ if(IS_DOT11D_ENABLE(priv->ieee80211) && -+ IS_DOT11D_STATE_DONE(priv->ieee80211) ) -+ { -+ //PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(priv->ieee80211); -+ u8 MaxTxPwrInDbm = DOT11D_GetMaxTxPwrInDbm(priv->ieee80211, ch); -+ u8 CckMaxPwrIdx = rtl8187B_DbmToTxPwrIdx(priv, WIRELESS_MODE_B, MaxTxPwrInDbm); -+ u8 OfdmMaxPwrIdx = rtl8187B_DbmToTxPwrIdx(priv, WIRELESS_MODE_G, MaxTxPwrInDbm); -+ -+ //printk("Max Tx Power dBm (%d) => CCK Tx power index : %d, OFDM Tx power index: %d\n", MaxTxPwrInDbm, CckMaxPwrIdx, OfdmMaxPwrIdx); -+ -+ //printk("EEPROM channel(%d) => CCK Tx power index: %d, OFDM Tx power index: %d\n", -+ // ch, cck_power_level, ofdm_power_level); -+ -+ if(cck_power_level > CckMaxPwrIdx) -+ cck_power_level = CckMaxPwrIdx; -+ if(ofdm_power_level > OfdmMaxPwrIdx) -+ ofdm_power_level = OfdmMaxPwrIdx; -+ } -+ -+ //priv->CurrentCckTxPwrIdx = cck_power_level; -+ //priv->CurrentOfdmTxPwrIdx = ofdm_power_level; -+#endif -+ -+ if (NIC_8187B == priv->card_8187) -+ { -+ if (hw_version == VERSION_8187B_B) -+ { -+ min_cck_power_level = 0; -+ max_cck_power_level = 15; -+ min_ofdm_power_level = 2; -+ max_ofdm_power_level = 17; -+ }else -+ { -+ min_cck_power_level = 7; -+ max_cck_power_level = 22; -+ min_ofdm_power_level = 10; -+ max_ofdm_power_level = 25; -+ } -+ -+ if( priv->TrSwitchState == TR_SW_TX ) -+ { -+ //printk("SetTxPowerLevel8187(): Origianl OFDM Tx power level %d, adjust value = %d\n", ofdm_power_level,GetTxOfdmHighPowerBias(dev)); -+ ofdm_power_level -= GetTxOfdmHighPowerBias(dev); -+ cck_power_level -= GetTxCckHighPowerBias(dev); -+ //printk("SetTxPowerLevel8187(): Adjusted OFDM Tx power level %d for we are in High Power state\n", -+ // ofdm_power_level); -+ //printk("SetTxPowerLevel8187(): Adjusted CCK Tx power level %d for we are in High Power state\n", -+ // cck_power_level); -+ } -+ /* CCK power setting */ -+ if(cck_power_level > (max_cck_power_level -min_cck_power_level)) -+ cck_power_level = max_cck_power_level; -+ else -+ cck_power_level += min_cck_power_level; -+ cck_power_level += priv->cck_txpwr_base; -+ -+ if(cck_power_level > 35) -+ cck_power_level = 35; -+ if(cck_power_level < 0) -+ cck_power_level = 0; -+ -+ if(ch == 14) -+ cck_power_table = rtl8225z2_tx_power_cck_ch14; -+ else -+ cck_power_table = rtl8225z2_tx_power_cck; -+ if (hw_version == VERSION_8187B_B) -+ { -+ if (cck_power_level <= 6){ -+ } -+ else if (cck_power_level <=11){ -+ cck_power_table += 8; -+ } -+ else{ -+ cck_power_table += (8*2); -+ } -+ }else{ -+ if (cck_power_level<=5){ -+ }else if(cck_power_level<=11){ -+ cck_power_table += 8; -+ }else if(cck_power_level <= 17){ -+ cck_power_table += 8*2; -+ }else{ -+ cck_power_table += 8*3; -+ } -+ } -+ -+ -+ -+ for(i=0;i<8;i++){ -+ -+ power = cck_power_table[i]; -+ write_phy_cck(dev, 0x44 + i, power); -+ } -+ -+ //write_nic_byte(dev, TX_GAIN_CCK, power); -+ //2005.11.17, -+ write_nic_byte(dev, CCK_TXAGC, (ZEBRA2_CCK_OFDM_GAIN_SETTING[cck_power_level]*2)); -+ -+// force_pci_posting(dev); -+// msleep(1); -+//in windows the delay was del from 85 to 87, -+//here we mod to sleep, or The CPU occupany is too hight. LZM 31/10/2008 -+ -+ /* OFDM power setting */ -+ // Old: -+ // if(ofdm_power_level > max_ofdm_power_level) -+ // ofdm_power_level = 35; -+ // ofdm_power_level += min_ofdm_power_level; -+ // Latest: -+ if(ofdm_power_level > (max_ofdm_power_level - min_ofdm_power_level)) -+ ofdm_power_level = max_ofdm_power_level; -+ else -+ ofdm_power_level += min_ofdm_power_level; -+ -+ ofdm_power_level += priv->ofdm_txpwr_base; -+ -+ if(ofdm_power_level > 35) -+ ofdm_power_level = 35; -+ -+ if(ofdm_power_level < 0) -+ ofdm_power_level = 0; -+ write_nic_byte(dev, OFDM_TXAGC, ZEBRA2_CCK_OFDM_GAIN_SETTING[ofdm_power_level]*2); -+ -+ if (hw_version == VERSION_8187B_B) -+ { -+ if(ofdm_power_level<=11){ -+ write_phy_ofdm(dev, 0x87, 0x60); -+ write_phy_ofdm(dev, 0x89, 0x60); -+ } -+ else{ -+ write_phy_ofdm(dev, 0x87, 0x5c); -+ write_phy_ofdm(dev, 0x89, 0x5c); -+ } -+ }else{ -+ if(ofdm_power_level<=11){ -+ write_phy_ofdm(dev, 0x87, 0x5c); -+ write_phy_ofdm(dev, 0x89, 0x5c); -+ } -+ if(ofdm_power_level<=17){ -+ write_phy_ofdm(dev, 0x87, 0x54); -+ write_phy_ofdm(dev, 0x89, 0x54); -+ } -+ else{ -+ write_phy_ofdm(dev, 0x87, 0x50); -+ write_phy_ofdm(dev, 0x89, 0x50); -+ } -+ } -+// force_pci_posting(dev); -+// msleep(1); -+//in windows the delay was del from 85 to 87, -+//and here we mod to sleep, or The CPU occupany is too hight. LZM 31/10/2008 -+ }else if(NIC_8187 == priv->card_8187) { -+ min_cck_power_level = 0; -+ max_cck_power_level = 15; -+ min_ofdm_power_level = 10; -+ max_ofdm_power_level = 25; -+ if(cck_power_level > (max_cck_power_level -min_cck_power_level)) -+ cck_power_level = max_cck_power_level; -+ else -+ cck_power_level += min_cck_power_level; -+ cck_power_level += priv->cck_txpwr_base; -+ -+ if(cck_power_level > 35) -+ cck_power_level = 35; -+ -+ if(ch == 14) -+ cck_power_table = rtl8225z2_tx_power_cck_ch14; -+ else -+ cck_power_table = rtl8225z2_tx_power_cck; -+ for(i=0;i<8;i++){ -+ power = cck_power_table[i]; -+ write_phy_cck(dev, 0x44 + i, power); -+ } -+ -+ //write_nic_byte(dev, TX_GAIN_CCK, power); -+ //2005.11.17, -+ write_nic_byte(dev, CCK_TXAGC, ZEBRA2_CCK_OFDM_GAIN_SETTING[cck_power_level]); -+ -+// force_pci_posting(dev); -+// msleep(1); -+//in windows the delay was del from 85 to 87, -+//and here we mod to sleep, or The CPU occupany is too hight. LZM 31/10/2008 -+ if(ofdm_power_level > (max_ofdm_power_level - min_ofdm_power_level)) -+ ofdm_power_level = max_ofdm_power_level; -+ else -+ ofdm_power_level += min_ofdm_power_level; -+ -+ ofdm_power_level += priv->ofdm_txpwr_base; -+ -+ if(ofdm_power_level > 35) -+ ofdm_power_level = 35; -+ write_nic_byte(dev, OFDM_TXAGC, ZEBRA2_CCK_OFDM_GAIN_SETTING[ofdm_power_level]); -+ -+ rtl8185_set_anaparam2(dev,RTL8225_ANAPARAM2_ON); -+ -+ write_phy_ofdm(dev,2,0x42); -+ write_phy_ofdm(dev,5,0); -+ write_phy_ofdm(dev,6,0x40); -+ write_phy_ofdm(dev,7,0); -+ write_phy_ofdm(dev,8,0x40); -+ } -+ -+} -+ -+void rtl8225z2_rf_set_chan(struct net_device *dev, short ch) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ short gset = (priv->ieee80211->state == IEEE80211_LINKED && -+ ieee80211_is_54g(priv->ieee80211->current_network)) || -+ priv->ieee80211->iw_mode == IW_MODE_MONITOR; -+ int eifs_addr; -+ -+ down(&priv->set_chan_sem); -+ -+ if(NIC_8187 == priv->card_8187) { -+ eifs_addr = EIFS_8187; -+ } else { -+ eifs_addr = EIFS_8187B; -+ } -+ -+#ifdef ENABLE_DOT11D -+ if(!IsLegalChannel(priv->ieee80211, ch) ) -+ { -+ printk("channel(%d). is invalide\n", ch); -+ up(&priv->set_chan_sem); -+ return; -+ } -+#endif -+ //87B not do it FIXME -+ rtl8225z2_SetTXPowerLevel(dev, ch); -+ -+ //write_nic_byte(dev,0x7,(u8)rtl8225_chan[ch]); -+ write_rtl8225(dev, 0x7, rtl8225_chan[ch]); -+ -+ force_pci_posting(dev); -+ //mdelay(10); -+//in windows the delay was del from 85 to 87, -+//and here we mod to sleep, or The CPU occupany is too hight. LZM 31/10/2008 -+ if(NIC_8187 == priv->card_8187){ -+ write_nic_byte(dev,SIFS,0x22);// SIFS: 0x22 -+ -+ if(gset) -+ write_nic_byte(dev,DIFS,20); //DIFS: 20 -+ else -+ write_nic_byte(dev,DIFS,0x24); //DIFS: 36 -+ -+ if(priv->ieee80211->state == IEEE80211_LINKED && -+ ieee80211_is_shortslot(priv->ieee80211->current_network)) -+ write_nic_byte(dev,SLOT,0x9); //SLOT: 9 -+ -+ else -+ write_nic_byte(dev,SLOT,0x14); //SLOT: 20 (0x14) -+ -+ -+ if(gset){ -+ write_nic_byte(dev,eifs_addr,91 - 20); // EIFS: 91 (0x5B) -+ write_nic_byte(dev,CW_VAL,0x73); //CW VALUE: 0x37 -+ //DMESG("using G net params"); -+ }else{ -+ write_nic_byte(dev,eifs_addr,91 - 0x24); // EIFS: 91 (0x5B) -+ write_nic_byte(dev,CW_VAL,0xa5); //CW VALUE: 0x37 -+ //DMESG("using B net params"); -+ } -+ } -+ -+ else { -+#ifdef THOMAS_TURBO -+ if(priv->ieee80211->current_network.Turbo_Enable && priv->ieee80211->iw_mode == IW_MODE_INFRA){ -+ write_nic_word(dev,AC_VO_PARAM,0x5114); -+ write_nic_word(dev,AC_VI_PARAM,0x5114); -+ write_nic_word(dev,AC_BE_PARAM,0x5114); -+ write_nic_word(dev,AC_BK_PARAM,0x5114); -+ } else { -+ write_nic_word(dev,AC_VO_PARAM,0x731c); -+ write_nic_word(dev,AC_VI_PARAM,0x731c); -+ write_nic_word(dev,AC_BE_PARAM,0x731c); -+ write_nic_word(dev,AC_BK_PARAM,0x731c); -+ } -+#endif -+ } -+ -+ up(&priv->set_chan_sem); -+} -+void -+MacConfig_87BASIC_HardCode(struct net_device *dev) -+{ -+ //============================================================================ -+ // MACREG.TXT -+ //============================================================================ -+ int nLinesRead = 0; -+ u32 u4bRegOffset, u4bRegValue, u4bPageIndex; -+ int i; -+ -+ nLinesRead=(sizeof(MAC_REG_TABLE)/3)/4; -+ -+ for(i = 0; i < nLinesRead; i++) -+ { -+ u4bRegOffset=MAC_REG_TABLE[i][0]; -+ u4bRegValue=MAC_REG_TABLE[i][1]; -+ u4bPageIndex=MAC_REG_TABLE[i][2]; -+ -+ u4bRegOffset|= (u4bPageIndex << 8); -+ -+ write_nic_byte(dev, u4bRegOffset, (u8)u4bRegValue); -+ } -+ //============================================================================ -+} -+ -+static void MacConfig_87BASIC(struct net_device *dev) -+{ -+ MacConfig_87BASIC_HardCode(dev); -+ -+ //============================================================================ -+ -+ // Follow TID_AC_MAP of WMac. -+ //PlatformEFIOWrite2Byte(dev, TID_AC_MAP, 0xfa50); -+ write_nic_word(dev, TID_AC_MAP, 0xfa50); -+ -+ // Interrupt Migration, Jong suggested we use set 0x0000 first, 2005.12.14, by rcnjko. -+ write_nic_word(dev, INT_MIG, 0x0000); -+ -+ // Prevent TPC to cause CRC error. Added by Annie, 2006-06-10. -+ write_nic_dword(dev, 0x1F0, 0x00000000); -+ write_nic_dword(dev, 0x1F4, 0x00000000); -+ write_nic_byte(dev, 0x1F8, 0x00); -+ -+ // For WiFi 5.2.2.5 Atheros AP performance. Added by Annie, 2006-06-12. -+ // PlatformIOWrite4Byte(dev, RFTiming, 0x0008e00f); -+ // Asked for by SD3 CM Lin, 2006.06.27, by rcnjko. -+ write_nic_dword(dev, RFTiming, 0x00004001); -+ -+#ifdef TODO -+ // Asked for by Victor, for 87B B-cut Rx FIFO overflow bug, 2006.06.27, by rcnjko. -+ if(dev->NdisUsbDev.CardInfo.USBIsHigh == FALSE) -+ { -+ PlatformEFIOWrite1Byte(dev, 0x24E, 0x01); -+ } -+#endif -+} -+ -+ -+// -+// Description: -+// Initialize RFE and read Zebra2 version code. -+// -+// 2005-08-01, by Annie. -+// -+void -+SetupRFEInitialTiming(struct net_device* dev) -+{ -+ //u32 data8, data9; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ // setup initial timing for RFE -+ // Set VCO-PDN pin. -+ write_nic_word(dev, RFPinsOutput, 0x0480); -+ write_nic_word(dev, RFPinsSelect, 0x2488); -+ write_nic_word(dev, RFPinsEnable, 0x1FFF); -+ -+ mdelay(100); -+ // Steven recommends: delay 1 sec for setting RF 1.8V. by Annie, 2005-04-28. -+ mdelay(1000); -+ -+ // -+ // TODO: Read Zebra version code if necessary. -+ // -+ priv->rf_chip = RF_ZEBRA2; -+} -+ -+ -+void ZEBRA_Config_87BASIC_HardCode(struct net_device* dev) -+{ -+ u32 i; -+ u32 addr,data; -+ u32 u4bRegOffset, u4bRegValue; -+ -+ -+ //============================================================================= -+ // RADIOCFG.TXT -+ //============================================================================= -+ write_rtl8225(dev, 0x00, 0x00b7); mdelay(1); -+ write_rtl8225(dev, 0x01, 0x0ee0); mdelay(1); -+ write_rtl8225(dev, 0x02, 0x044d); mdelay(1); -+ write_rtl8225(dev, 0x03, 0x0441); mdelay(1); -+ write_rtl8225(dev, 0x04, 0x08c3); mdelay(1); -+ write_rtl8225(dev, 0x05, 0x0c72); mdelay(1); -+ write_rtl8225(dev, 0x06, 0x00e6); mdelay(1); -+ write_rtl8225(dev, 0x07, 0x082a); mdelay(1); -+ write_rtl8225(dev, 0x08, 0x003f); mdelay(1); -+ write_rtl8225(dev, 0x09, 0x0335); mdelay(1); -+ write_rtl8225(dev, 0x0a, 0x09d4); mdelay(1); -+ write_rtl8225(dev, 0x0b, 0x07bb); mdelay(1); -+ write_rtl8225(dev, 0x0c, 0x0850); mdelay(1); -+ write_rtl8225(dev, 0x0d, 0x0cdf); mdelay(1); -+ write_rtl8225(dev, 0x0e, 0x002b); mdelay(1); -+ write_rtl8225(dev, 0x0f, 0x0114); mdelay(1); -+ -+ write_rtl8225(dev, 0x00, 0x01b7); mdelay(1); -+ -+ -+ for(i=1;i<=95;i++) -+ { -+ write_rtl8225(dev, 0x01, i);mdelay(1); -+ write_rtl8225(dev, 0x02, ZEBRA_RF_RX_GAIN_TABLE[i]); mdelay(1); -+ //DbgPrint("RF - 0x%x = 0x%x\n", i, ZEBRA_RF_RX_GAIN_TABLE[i]); -+ } -+ -+ write_rtl8225(dev, 0x03, 0x0080); mdelay(1); // write reg 18 -+ write_rtl8225(dev, 0x05, 0x0004); mdelay(1); // write reg 20 -+ write_rtl8225(dev, 0x00, 0x00b7); mdelay(1); // switch to reg0-reg15 -+ //lzm mod for up take too long time 20081201 -+#ifdef THOMAS_BEACON -+ msleep(1000);// Deay 1 sec. //0xfd -+ //msleep(1000);// Deay 1 sec. //0xfd -+ //msleep(1000);// Deay 1 sec. //0xfd -+ msleep(400);// Deay 1 sec. //0xfd -+#else -+ -+ mdelay(1000); -+ //mdelay(1000); -+ //mdelay(1000); -+ mdelay(400); -+#endif -+ write_rtl8225(dev, 0x02, 0x0c4d); mdelay(1); -+ //lzm mod for up take too long time 20081201 -+ //mdelay(1000); -+ //mdelay(1000); -+ msleep(100);// Deay 100 ms. //0xfe -+ msleep(100);// Deay 100 ms. //0xfe -+ write_rtl8225(dev, 0x02, 0x044d); mdelay(1); -+ write_rtl8225(dev, 0x00, 0x02bf); mdelay(1); //0x002f disable 6us corner change, 06f--> enable -+ -+ //============================================================================= -+ -+ //============================================================================= -+ // CCKCONF.TXT -+ //============================================================================= -+ /* -+ u4bRegOffset=0x41; -+ u4bRegValue=0xc8; -+ -+ //DbgPrint("\nCCK- 0x%x = 0x%x\n", u4bRegOffset, u4bRegValue); -+ WriteBB(dev, (0x01000080 | (u4bRegOffset & 0x7f) | ((u4bRegValue & 0xff) << 8))); -+ */ -+ -+ -+ //============================================================================= -+ -+ //============================================================================= -+ // Follow WMAC RTL8225_Config() -+ //============================================================================= -+// // -+// // enable EEM0 and EEM1 in 9346CR -+// PlatformEFIOWrite1Byte(dev, CR9346, PlatformEFIORead1Byte(dev, CR9346)|0xc0); -+// // enable PARM_En in Config3 -+// PlatformEFIOWrite1Byte(dev, CONFIG3, PlatformEFIORead1Byte(dev, CONFIG3)|0x40); -+// -+// PlatformEFIOWrite4Byte(dev, AnaParm2, ANAPARM2_ASIC_ON); //0x727f3f52 -+// PlatformEFIOWrite4Byte(dev, AnaParm, ANAPARM_ASIC_ON); //0x45090658 -+ -+ // power control -+ write_nic_byte(dev, CCK_TXAGC, 0x03); -+ write_nic_byte(dev, OFDM_TXAGC, 0x07); -+ write_nic_byte(dev, ANTSEL, 0x03); -+ -+// // disable PARM_En in Config3 -+// PlatformEFIOWrite1Byte(dev, CONFIG3, PlatformEFIORead1Byte(dev, CONFIG3)&0xbf); -+// // disable EEM0 and EEM1 in 9346CR -+// PlatformEFIOWrite1Byte(dev, CR9346, PlatformEFIORead1Byte(dev, CR9346)&0x3f); -+ //============================================================================= -+ -+ //============================================================================= -+ // AGC.txt -+ //============================================================================= -+ //write_nic_dword( dev, PhyAddr, 0x00001280); // Annie, 2006-05-05 -+ //write_phy_ofdm( dev, 0x00, 0x12); // David, 2006-08-01 -+ write_phy_ofdm( dev, 0x80, 0x12); // David, 2006-08-09 -+ -+ for (i=0; i<128; i++) -+ { -+ //DbgPrint("AGC - [%x+1] = 0x%x\n", i, ZEBRA_AGC[i+1]); -+ -+ data = ZEBRA_AGC[i+1]; -+ data = data << 8; -+ data = data | 0x0000008F; -+ -+ addr = i + 0x80; //enable writing AGC table -+ addr = addr << 8; -+ addr = addr | 0x0000008E; -+ -+ write_phy_ofdm(dev,data&0x7f,(data>>8)&0xff); -+ write_phy_ofdm(dev,addr&0x7f,(addr>>8)&0xff); -+ write_phy_ofdm(dev,0x0E,0x00); -+ } -+ -+ //write_nic_dword(dev, PhyAddr, 0x00001080); // Annie, 2006-05-05 -+ //write_phy_ofdm( dev, 0x00, 0x10); // David, 2006-08-01 -+ write_phy_ofdm( dev, 0x80, 0x10); // David, 2006-08-09 -+ -+ //============================================================================= -+ -+ //============================================================================= -+ // OFDMCONF.TXT -+ //============================================================================= -+ -+ for(i=0; i<60; i++) -+ { -+ u4bRegOffset=i; -+ u4bRegValue=OFDM_CONFIG[i]; -+ //u4bRegValue=OFDM_CONFIG3m82[i]; -+ -+ // write_nic_dword(dev,PhyAddr,(0x00000080 | (u4bRegOffset & 0x7f) | ((u4bRegValue & 0xff) << 8))); -+ write_phy_ofdm(dev,i,u4bRegValue); -+ } -+ -+ -+ //============================================================================= -+} -+ -+void ZEBRA_Config_87BASIC(struct net_device *dev) -+{ -+ ZEBRA_Config_87BASIC_HardCode(dev); -+} -+//by amy for DIG -+// -+// Description: -+// Update initial gain into PHY. -+// -+void -+UpdateCCKThreshold( -+ struct net_device *dev -+ ) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ // Update CCK Power Detection(0x41) value. -+ switch(priv->StageCCKTh) -+ { -+ case 0: -+// printk("Update CCK Stage 0: 88 \n"); -+ write_phy_cck(dev, 0xc1, 0x88);mdelay(1); -+ break; -+ -+ case 1: -+// printk("Update CCK Stage 1: 98 \n"); -+ write_phy_cck(dev, 0xc1, 0x98);mdelay(1); -+ break; -+ -+ case 2: -+// printk("Update CCK Stage 2: C8 \n"); -+ write_phy_cck(dev, 0xc1, 0xC8);mdelay(1); -+ break; -+ -+ case 3: -+// printk("Update CCK Stage 3: D8 \n"); -+ write_phy_cck(dev, 0xc1, 0xD8);mdelay(1); -+ break; -+ -+ default: -+// printk("Update CCK Stage %d ERROR!\n", pHalData->StageCCKTh); -+ break; -+ } -+} -+// -+// Description: -+// Update initial gain into PHY. -+// -+void -+UpdateInitialGain( -+ struct net_device *dev -+ ) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ //u8 u1Tmp=0; -+ -+ //printk("UpdateInitialGain(): InitialGain: %d RFChipID: %d\n", priv->InitialGain, priv->rf_chip); -+ -+ switch(priv->rf_chip) -+ { -+ case RF_ZEBRA: -+ case RF_ZEBRA2: -+ -+ // -+ // Note: -+ // Whenever we update this gain table, we should be careful about those who call it. -+ // Functions which call UpdateInitialGain as follows are important: -+ // (1)StaRateAdaptive87B -+ // (2)DIG_Zebra -+ // (3)ActSetWirelessMode8187 (when the wireless mode is "B" mode, we set the -+ // OFDM[0x17] = 0x26 to improve the Rx sensitivity). -+ // By Bruce, 2007-06-01. -+ // -+ -+ // -+ // SD3 C.M. Lin Initial Gain Table, by Bruce, 2007-06-01. -+ // -+ switch(priv->InitialGain) -+ { -+ case 1: //m861dBm -+// DMESG("RTL8187 + 8225 Initial Gain State 1: -82 dBm "); -+ write_phy_ofdm(dev, 0x97, 0x26); mdelay(1); -+ write_phy_ofdm(dev, 0xa4, 0x86); mdelay(1); -+ write_phy_ofdm(dev, 0x85, 0xfa); mdelay(1); -+ break; -+ -+ case 2: //m862dBm -+// DMESG("RTL8187 + 8225 Initial Gain State 2: -78 dBm "); -+ write_phy_ofdm(dev, 0x97, 0x36); mdelay(1);// Revise 0x26 to 0x36, by Roger, 2007.05.03. -+ write_phy_ofdm(dev, 0xa4, 0x86); mdelay(1); -+ write_phy_ofdm(dev, 0x85, 0xfa); mdelay(1); -+ break; -+ -+ case 3: //m863dBm -+// DMESG("RTL8187 + 8225 Initial Gain State 3: -78 dBm "); -+ write_phy_ofdm(dev, 0x97, 0x36); mdelay(1);// Revise 0x26 to 0x36, by Roger, 2007.05.03. -+ write_phy_ofdm(dev, 0xa4, 0x86); mdelay(1); -+ write_phy_ofdm(dev, 0x85, 0xfb); mdelay(1); -+ break; -+ -+ case 4: //m864dBm -+// DMESG("RTL8187 + 8225 Initial Gain State 4: -74 dBm "); -+ write_phy_ofdm(dev, 0x97, 0x46); mdelay(1);// Revise 0x26 to 0x36, by Roger, 2007.05.03. -+ write_phy_ofdm(dev, 0xa4, 0x86); mdelay(1); -+ write_phy_ofdm(dev, 0x85, 0xfb); mdelay(1); -+ break; -+ -+ case 5: //m82dBm -+// DMESG("RTL8187 + 8225 Initial Gain State 5: -74 dBm "); -+ write_phy_ofdm(dev, 0x97, 0x46); mdelay(1); -+ write_phy_ofdm(dev, 0xa4, 0x96); mdelay(1); -+ write_phy_ofdm(dev, 0x85, 0xfb); mdelay(1); -+ break; -+ -+ case 6: //m78dBm -+// DMESG("RTL8187 + 8225 Initial Gain State 6: -70 dBm "); -+ write_phy_ofdm(dev, 0x97, 0x56); mdelay(1); -+ write_phy_ofdm(dev, 0xa4, 0x96); mdelay(1); -+ write_phy_ofdm(dev, 0x85, 0xfc); mdelay(1); -+ break; -+ -+ case 7: //m74dBm -+// DMESG("RTL8187 + 8225 Initial Gain State 7: -70 dBm "); -+ write_phy_ofdm(dev, 0x97, 0x56); mdelay(1); -+ write_phy_ofdm(dev, 0xa4, 0xa6); mdelay(1); -+ write_phy_ofdm(dev, 0x85, 0xfc); mdelay(1); -+ break; -+ -+ // By Bruce, 2007-03-29. -+ case 8: -+ write_phy_ofdm(dev, 0x97, 0x66); mdelay(1); -+ write_phy_ofdm(dev, 0xa4, 0xb6); mdelay(1); -+ write_phy_ofdm(dev, 0x85, 0xfc); mdelay(1); -+ break; -+ -+ default: //MP -+// DMESG("RTL8187 + 8225 Initial Gain State: -82 dBm (default), InitialGain(%d)", priv->InitialGain); -+ write_phy_ofdm(dev, 0x97, 0x26); mdelay(1); -+ write_phy_ofdm(dev, 0xa4, 0x86); mdelay(1); -+ write_phy_ofdm(dev, 0x85, 0xfa); mdelay(1); -+ break; -+ } -+ break; -+ -+ default: -+ break; -+ } -+} -+//by amy for DIG -+void PhyConfig8187(struct net_device *dev) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ u8 btConfig4; -+ -+ btConfig4 = read_nic_byte(dev, CONFIG4); -+ priv->RFProgType = (btConfig4 & 0x03); -+ -+ -+ -+ switch(priv->rf_chip) -+ { -+ case RF_ZEBRA2: -+ ZEBRA_Config_87BASIC(dev); -+ break; -+ } -+ if(priv->bDigMechanism) -+ { -+ if(priv->InitialGain == 0) -+ priv->InitialGain = 4; -+ //DMESG("DIG is enabled, set default initial gain index to %d", priv->InitialGain); -+ } -+ -+ // By Bruce, 2007-03-29. -+ UpdateCCKThreshold(dev); -+ // Update initial gain after PhyConfig comleted, asked for by SD3 CMLin. -+ UpdateInitialGain(dev); -+ return ; -+} -+ -+u8 GetSupportedWirelessMode8187(struct net_device* dev) -+{ -+ u8 btSupportedWirelessMode; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ btSupportedWirelessMode = 0; -+ -+ switch(priv->rf_chip) -+ { -+ case RF_ZEBRA: -+ case RF_ZEBRA2: -+ btSupportedWirelessMode = (WIRELESS_MODE_B | WIRELESS_MODE_G); -+ break; -+ default: -+ btSupportedWirelessMode = WIRELESS_MODE_B; -+ break; -+ } -+ return btSupportedWirelessMode; -+} -+ -+void ActUpdateChannelAccessSetting(struct net_device *dev, -+ int WirelessMode, -+ PCHANNEL_ACCESS_SETTING ChnlAccessSetting) -+{ -+ AC_CODING eACI; -+ AC_PARAM AcParam; -+#ifdef TODO -+ PSTA_QOS pStaQos = Adapter->MgntInfo.pStaQos; -+#endif -+ //bool bFollowLegacySetting = false; -+ -+ -+ switch( WirelessMode ) -+ { -+ case WIRELESS_MODE_A: -+ ChnlAccessSetting->SIFS_Timer = 0x22; -+ ChnlAccessSetting->DIFS_Timer = 34; // 34 = 16 + 2*9. 2006.06.07, by rcnjko. -+ ChnlAccessSetting->SlotTimeTimer = 9; -+ ChnlAccessSetting->EIFS_Timer = 23; -+ ChnlAccessSetting->CWminIndex = 4; -+ ChnlAccessSetting->CWmaxIndex = 10; -+ break; -+ -+ case WIRELESS_MODE_B: -+ ChnlAccessSetting->SIFS_Timer = 0x22; -+ ChnlAccessSetting->DIFS_Timer = 50; // 50 = 10 + 2*20. 2006.06.07, by rcnjko. -+ ChnlAccessSetting->SlotTimeTimer = 20; -+ ChnlAccessSetting->EIFS_Timer = 91; -+ ChnlAccessSetting->CWminIndex = 5; -+ ChnlAccessSetting->CWmaxIndex = 10; -+ break; -+ -+ case WIRELESS_MODE_G: -+ // -+ // <RJ_TODO_8185B> -+ // TODO: We still don't know how to set up these registers, just follow WMAC to -+ // verify 8185B FPAG. -+ // -+ // <RJ_TODO_8185B> -+ // Jong said CWmin/CWmax register are not functional in 8185B, -+ // so we shall fill channel access realted register into AC parameter registers, -+ // even in nQBss. -+ // -+ ChnlAccessSetting->SIFS_Timer = 0x22; // Suggested by Jong, 2005.12.08. -+ ChnlAccessSetting->SlotTimeTimer = 9; // 2006.06.07, by rcnjko. -+ ChnlAccessSetting->DIFS_Timer = 28; // 28 = 10 + 2*9. 2006.06.07, by rcnjko. -+ ChnlAccessSetting->EIFS_Timer = 0x5B; // Suggested by wcchu, it is the default value of EIFS register, 2005.12.08. -+#ifdef TODO -+ switch (Adapter->NdisUsbDev.CWinMaxMin) -+#else -+ switch (2) -+#endif -+ { -+ case 0:// 0: [max:7 min:1 ] -+ ChnlAccessSetting->CWminIndex = 1; -+ ChnlAccessSetting->CWmaxIndex = 7; -+ break; -+ case 1:// 1: [max:7 min:2 ] -+ ChnlAccessSetting->CWminIndex = 2; -+ ChnlAccessSetting->CWmaxIndex = 7; -+ break; -+ case 2:// 2: [max:7 min:3 ] -+ ChnlAccessSetting->CWminIndex = 3; -+ ChnlAccessSetting->CWmaxIndex = 7; -+ break; -+ case 3:// 3: [max:9 min:1 ] -+ ChnlAccessSetting->CWminIndex = 1; -+ ChnlAccessSetting->CWmaxIndex = 9; -+ break; -+ case 4:// 4: [max:9 min:2 ] -+ ChnlAccessSetting->CWminIndex = 2; -+ ChnlAccessSetting->CWmaxIndex = 9; -+ break; -+ case 5:// 5: [max:9 min:3 ] -+ ChnlAccessSetting->CWminIndex = 3; -+ ChnlAccessSetting->CWmaxIndex = 9; -+ break; -+ case 6:// 6: [max:A min:5 ] -+ ChnlAccessSetting->CWminIndex = 5; -+ ChnlAccessSetting->CWmaxIndex = 10; -+ break; -+ case 7:// 7: [max:A min:4 ] -+ ChnlAccessSetting->CWminIndex = 4; -+ ChnlAccessSetting->CWmaxIndex = 10; -+ break; -+ -+ default: -+ ChnlAccessSetting->CWminIndex = 1; -+ ChnlAccessSetting->CWmaxIndex = 7; -+ break; -+ } -+#ifdef TODO -+ if( Adapter->MgntInfo.OpMode == RT_OP_MODE_IBSS) -+ { -+ ChnlAccessSetting->CWminIndex= 4; -+ ChnlAccessSetting->CWmaxIndex= 10; -+ } -+#endif -+ break; -+ } -+ -+ -+ write_nic_byte(dev, SIFS, ChnlAccessSetting->SIFS_Timer); -+//{ update slot time related by david, 2006-7-21 -+ write_nic_byte(dev, SLOT, ChnlAccessSetting->SlotTimeTimer); // Rewrited from directly use PlatformEFIOWrite1Byte(), by Annie, 2006-03-29. -+#ifdef TODO -+ if(pStaQos->CurrentQosMode > QOS_DISABLE) -+ { -+ for(eACI = 0; eACI < AC_MAX; eACI++) -+ { -+ Adapter->HalFunc.SetHwRegHandler(Adapter, HW_VAR_AC_PARAM, \ -+ (pu1Byte)(&(pStaQos->WMMParamEle.AcParam[eACI])) ); -+ } -+ } -+ else -+#endif -+ { -+ u8 u1bAIFS = aSifsTime + (2 * ChnlAccessSetting->SlotTimeTimer ); -+ -+ write_nic_byte(dev, AC_VO_PARAM, u1bAIFS); -+ write_nic_byte(dev, AC_VI_PARAM, u1bAIFS); -+ write_nic_byte(dev, AC_BE_PARAM, u1bAIFS); -+ write_nic_byte(dev, AC_BK_PARAM, u1bAIFS); -+ } -+//} -+ -+ write_nic_byte(dev, EIFS_8187B, ChnlAccessSetting->EIFS_Timer); -+ write_nic_byte(dev, AckTimeOutReg, 0x5B); // <RJ_EXPR_QOS> Suggested by wcchu, it is the default value of EIFS register, 2005.12.08. -+#ifdef TODO -+ // <RJ_TODO_NOW_8185B> Update ECWmin/ECWmax, AIFS, TXOP Limit of each AC to the value defined by SPEC. -+ if( pStaQos->CurrentQosMode > QOS_DISABLE ) -+ { // QoS mode. -+ if(pStaQos->QBssWirelessMode == WirelessMode) -+ { -+ // Follow AC Parameters of the QBSS. -+ for(eACI = 0; eACI < AC_MAX; eACI++) -+ { -+ Adapter->HalFunc.SetHwRegHandler(Adapter, HW_VAR_AC_PARAM, (pu1Byte)(&(pStaQos->WMMParamEle.AcParam[eACI])) ); -+ } -+ } -+ else -+ { -+ // Follow Default WMM AC Parameters. -+ bFollowLegacySetting = TRUE; -+ } -+ } -+ else -+ { // Legacy 802.11. -+ bFollowLegacySetting = TRUE; -+ } -+ -+ if(bFollowLegacySetting) -+#endif -+ if(true) -+ { -+ // -+ // Follow 802.11 seeting to AC parameter, all AC shall use the same parameter. -+ // 2005.12.01, by rcnjko. -+ // -+ AcParam.longData = 0; -+ AcParam.f.AciAifsn.f.AIFSN = 2; // Follow 802.11 DIFS. -+ AcParam.f.AciAifsn.f.ACM = 0; -+ AcParam.f.Ecw.f.ECWmin = ChnlAccessSetting->CWminIndex; // Follow 802.11 CWmin. -+ AcParam.f.Ecw.f.ECWmax = ChnlAccessSetting->CWmaxIndex; // Follow 802.11 CWmax. -+ AcParam.f.TXOPLimit = 0; -+ for(eACI = 0; eACI < AC_MAX; eACI++) -+ { -+ AcParam.f.AciAifsn.f.ACI = (u8)eACI; -+ { -+ PAC_PARAM pAcParam = (PAC_PARAM)(&AcParam); -+ AC_CODING eACI; -+ u8 u1bAIFS; -+ u32 u4bAcParam; -+ -+ // Retrive paramters to udpate. -+ eACI = pAcParam->f.AciAifsn.f.ACI; -+ u1bAIFS = pAcParam->f.AciAifsn.f.AIFSN * ChnlAccessSetting->SlotTimeTimer + aSifsTime; -+ u4bAcParam = ( (((u32)(pAcParam->f.TXOPLimit)) << AC_PARAM_TXOP_LIMIT_OFFSET) | -+ (((u32)(pAcParam->f.Ecw.f.ECWmax)) << AC_PARAM_ECW_MAX_OFFSET) | -+ (((u32)(pAcParam->f.Ecw.f.ECWmin)) << AC_PARAM_ECW_MIN_OFFSET) | -+ (((u32)u1bAIFS) << AC_PARAM_AIFS_OFFSET)); -+ -+ switch(eACI) -+ { -+ case AC1_BK: -+ write_nic_dword(dev, AC_BK_PARAM, u4bAcParam); -+ break; -+ -+ case AC0_BE: -+ write_nic_dword(dev, AC_BE_PARAM, u4bAcParam); -+ break; -+ -+ case AC2_VI: -+ write_nic_dword(dev, AC_VI_PARAM, u4bAcParam); -+ break; -+ -+ case AC3_VO: -+ write_nic_dword(dev, AC_VO_PARAM, u4bAcParam); -+ break; -+ -+ default: -+ printk(KERN_WARNING "SetHwReg8185(): invalid ACI: %d !\n", eACI); -+ break; -+ } -+ -+ // Cehck ACM bit. -+ // If it is set, immediately set ACM control bit to downgrading AC for passing WMM testplan. Annie, 2005-12-13. -+ //write_nic_byte(dev, ACM_CONTROL, pAcParam->f.AciAifsn); -+ { -+ PACI_AIFSN pAciAifsn = (PACI_AIFSN)(&pAcParam->f.AciAifsn); -+ AC_CODING eACI = pAciAifsn->f.ACI; -+ -+ //modified Joseph -+ //for 8187B AsynIORead issue -+#ifdef TODO -+ u8 AcmCtrl = pHalData->AcmControl; -+#else -+ u8 AcmCtrl = 0; -+#endif -+ if( pAciAifsn->f.ACM ) -+ { // ACM bit is 1. -+ switch(eACI) -+ { -+ case AC0_BE: -+ AcmCtrl |= (BEQ_ACM_EN|BEQ_ACM_CTL|ACM_HW_EN); // or 0x21 -+ break; -+ -+ case AC2_VI: -+ AcmCtrl |= (VIQ_ACM_EN|VIQ_ACM_CTL|ACM_HW_EN); // or 0x42 -+ break; -+ -+ case AC3_VO: -+ AcmCtrl |= (VOQ_ACM_EN|VOQ_ACM_CTL|ACM_HW_EN); // or 0x84 -+ break; -+ -+ default: -+ printk(KERN_WARNING "SetHwReg8185(): [HW_VAR_ACM_CTRL] ACM set\ -+ failed: eACI is %d\n", eACI ); -+ break; -+ } -+ } -+ else -+ { // ACM bit is 0. -+ switch(eACI) -+ { -+ case AC0_BE: -+ AcmCtrl &= ( (~BEQ_ACM_EN) & (~BEQ_ACM_CTL) & (~ACM_HW_EN) ); // and 0xDE -+ break; -+ -+ case AC2_VI: -+ AcmCtrl &= ( (~VIQ_ACM_EN) & (~VIQ_ACM_CTL) & (~ACM_HW_EN) ); // and 0xBD -+ break; -+ -+ case AC3_VO: -+ AcmCtrl &= ( (~VOQ_ACM_EN) & (~VOQ_ACM_CTL) & (~ACM_HW_EN) ); // and 0x7B -+ break; -+ -+ default: -+ break; -+ } -+ } -+ -+ //printk(KERN_WARNING "SetHwReg8185(): [HW_VAR_ACM_CTRL] Write 0x%X\n", AcmCtrl); -+ -+#ifdef TO_DO -+ pHalData->AcmControl = AcmCtrl; -+#endif -+ write_nic_byte(dev, ACM_CONTROL, AcmCtrl); -+ } -+ } -+ } -+ } -+} -+ -+void ActSetWirelessMode8187(struct net_device* dev, u8 btWirelessMode) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ struct ieee80211_device *ieee = priv->ieee80211; -+ //PMGNT_INFO pMgntInfo = &(pAdapter->MgntInfo); -+ u8 btSupportedWirelessMode = GetSupportedWirelessMode8187(dev); -+ -+ if( (btWirelessMode & btSupportedWirelessMode) == 0 ) -+ { // Don't switch to unsupported wireless mode, 2006.02.15, by rcnjko. -+ printk(KERN_WARNING "ActSetWirelessMode8187(): WirelessMode(%d) is not supported (%d)!\n", -+ btWirelessMode, btSupportedWirelessMode); -+ return; -+ } -+ -+ // 1. Assign wireless mode to swtich if necessary. -+ if( (btWirelessMode == WIRELESS_MODE_AUTO) || -+ (btWirelessMode & btSupportedWirelessMode) == 0 ) -+ { -+ if((btSupportedWirelessMode & WIRELESS_MODE_A)) -+ { -+ btWirelessMode = WIRELESS_MODE_A; -+ } -+ else if((btSupportedWirelessMode & WIRELESS_MODE_G)) -+ { -+ btWirelessMode = WIRELESS_MODE_G; -+ } -+ else if((btSupportedWirelessMode & WIRELESS_MODE_B)) -+ { -+ btWirelessMode = WIRELESS_MODE_B; -+ } -+ else -+ { -+ printk(KERN_WARNING "MptActSetWirelessMode8187(): No valid wireless mode supported, \ -+ btSupportedWirelessMode(%x)!!!\n", btSupportedWirelessMode); -+ btWirelessMode = WIRELESS_MODE_B; -+ } -+ } -+ -+ // 2. Swtich band. -+ switch(priv->rf_chip) -+ { -+ case RF_ZEBRA: -+ case RF_ZEBRA2: -+ { -+ // Update current wireless mode if we swtich to specified band successfully. -+ ieee->mode = (WIRELESS_MODE)btWirelessMode; -+ } -+ break; -+ -+ default: -+ printk(KERN_WARNING "MptActSetWirelessMode8187(): unsupported RF: 0x%X !!!\n", priv->rf_chip); -+ break; -+ } -+ -+ // 4. Change related setting. -+#if 0 -+ if( ieee->mode == WIRELESS_MODE_A ){ -+ DMESG("WIRELESS_MODE_A"); -+ } -+ else if(ieee->mode == WIRELESS_MODE_B ){ -+ DMESG("WIRELESS_MODE_B"); -+ } -+ else if( ieee->mode == WIRELESS_MODE_G ){ -+ DMESG("WIRELESS_MODE_G"); -+ } -+#endif -+ ActUpdateChannelAccessSetting(dev, ieee->mode, &priv->ChannelAccessSetting ); -+//by amy 0305 -+#ifdef TODO -+ if(ieee->mode == WIRELESS_MODE_B && priv->InitialGain > pHalData->RegBModeGainStage) -+ { -+ pHalData->InitialGain = pHalData->RegBModeGainStage; // B mode, OFDM[0x17] = 26. -+ RT_TRACE(COMP_INIT | COMP_DIG, DBG_LOUD, ("ActSetWirelessMode8187(): update init_gain to index %d for B mode\n",pHalData->InitialGain)); -+ PlatformScheduleWorkItem( &(pHalData->UpdateDigWorkItem) ); -+ } -+// pAdapter->MgntInfo.dot11CurrentWirelessMode = pHalData->CurrentWirelessMode; -+// MgntSetRegdot11OperationalRateSet( pAdapter ); -+#endif -+//by amy 0305 -+} -+ -+ -+void -+InitializeExtraRegsOn8185(struct net_device *dev) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ struct ieee80211_device *ieee = priv->ieee80211; -+ //RTL8185_TODO: Determine Retrylimit, TxAGC, AutoRateFallback control. -+ bool bUNIVERSAL_CONTROL_RL = false; // Enable per-packet tx retry, 2005.03.31, by rcnjko. -+ bool bUNIVERSAL_CONTROL_AGC = true;//false; -+ bool bUNIVERSAL_CONTROL_ANT = true;//false; -+ bool bAUTO_RATE_FALLBACK_CTL = true; -+ u8 val8; -+ -+ // Set up ACK rate. -+ // Suggested by wcchu, 2005.08.25, by rcnjko. -+ // 1. Initialize (MinRR, MaxRR) to (6,24) for A/G. -+ // 2. MUST Set RR before BRSR. -+ // 3. CCK must be basic rate. -+ if((ieee->mode == IEEE_G)||(ieee->mode == IEEE_A)) -+ { -+ write_nic_word(dev, BRSR_8187B, 0x0fff); -+ } -+ else -+ { -+ write_nic_word(dev, BRSR_8187B, 0x000f); -+ } -+ -+ -+ // Retry limit -+ val8 = read_nic_byte(dev, CW_CONF); -+ if(bUNIVERSAL_CONTROL_RL) -+ { -+ val8 &= (~CW_CONF_PERPACKET_RETRY_LIMIT); -+ } -+ else -+ { -+ val8 |= CW_CONF_PERPACKET_RETRY_LIMIT; -+ } -+ -+ write_nic_byte(dev, CW_CONF, val8); -+ -+ // Tx AGC -+ val8 = read_nic_byte(dev, TX_AGC_CTL); -+ if(bUNIVERSAL_CONTROL_AGC) -+ { -+ val8 &= (~TX_AGC_CTL_PER_PACKET_TXAGC); -+ write_nic_byte(dev, CCK_TXAGC, 128); -+ write_nic_byte(dev, OFDM_TXAGC, 128); -+ } -+ else -+ { -+ val8 |= TX_AGC_CTL_PER_PACKET_TXAGC; -+ } -+ write_nic_byte(dev, TX_AGC_CTL, val8); -+ -+ // Tx Antenna including Feedback control -+ val8 = read_nic_byte(dev, TX_AGC_CTL); -+ -+ if(bUNIVERSAL_CONTROL_ANT) -+ { -+ write_nic_byte(dev, ANTSEL, 0x00); -+ val8 &= (~TXAGC_CTL_PER_PACKET_ANT_SEL); -+ } -+ else -+ { -+ val8 |= TXAGC_CTL_PER_PACKET_ANT_SEL; -+ } -+ write_nic_byte(dev, TX_AGC_CTL, val8); -+ -+ // Auto Rate fallback control -+ val8 = read_nic_byte(dev, RATE_FALLBACK); -+ if( bAUTO_RATE_FALLBACK_CTL ) -+ { -+ val8 |= RATE_FALLBACK_CTL_ENABLE | RATE_FALLBACK_CTL_AUTO_STEP0; -+ -+ // <RJ_TODO_8187B> We shall set up the ARFR according to user's setting. -+ write_nic_word(dev, ARFR, 0x0fff); // set 1M ~ 54M -+ } -+ else -+ { -+ val8 &= (~RATE_FALLBACK_CTL_ENABLE); -+ } -+ write_nic_byte(dev, RATE_FALLBACK, val8); -+ -+} -+/////////////////////////// -+void rtl8225z2_rf_init(struct net_device *dev) -+{ -+ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ if (NIC_8187B == priv->card_8187){ -+ struct ieee80211_device *ieee = priv->ieee80211; -+ u8 InitWirelessMode; -+ u8 SupportedWirelessMode; -+ bool bInvalidWirelessMode = false; -+ InitializeExtraRegsOn8185(dev); -+ -+ write_nic_byte(dev, MSR, read_nic_byte(dev,MSR) & 0xf3); // default network type to 'No Link' -+ //{to avoid tx stall -+ write_nic_byte(dev, MSR, read_nic_byte(dev, MSR)|MSR_LINK_ENEDCA);//should always set ENDCA bit -+ write_nic_byte(dev, ACM_CONTROL, priv->AcmControl); -+ -+ write_nic_word(dev, BcnIntv, 100); -+ write_nic_word(dev, AtimWnd, 2); -+ write_nic_word(dev, FEMR, 0xFFFF); -+ //LED TYPE -+ { -+ write_nic_byte(dev, CONFIG1,((read_nic_byte(dev, CONFIG1)&0x3f)|0x80)); //turn on bit 5:Clkrun_mode -+ } -+ write_nic_byte(dev, CR9346, 0x0); // disable config register write -+ -+ //{ add some info here -+ write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]); -+ write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff ); -+ -+ write_nic_byte(dev, WPA_CONFIG, 0); -+ //} -+ -+ MacConfig_87BASIC(dev); -+ -+ // Override the RFSW_CTRL (MAC offset 0x272-0x273), 2006.06.07, by rcnjko. -+ write_nic_word(dev, RFSW_CTRL, 0x569a); -+#ifdef JOHN_TKIP -+ { -+ void CamResetAllEntry(struct net_device *dev); -+ void EnableHWSecurityConfig8187(struct net_device *dev); -+ CamResetAllEntry(dev); -+ EnableHWSecurityConfig8187(dev); -+ write_nic_word(dev, AESMSK_FC, AESMSK_FC_DEFAULT); mdelay(1); -+ write_nic_word(dev, AESMSK_SC, AESMSK_SC_DEFAULT); mdelay(1); -+ write_nic_word(dev, AESMSK_QC, AESMSK_QC_DEFAULT); mdelay(1); -+ } -+#endif -+ //----------------------------------------------------------------------------- -+ // Set up PHY related. -+ //----------------------------------------------------------------------------- -+ // Enable Config3.PARAM_En to revise AnaaParm. -+ write_nic_byte(dev, CR9346, 0xC0); -+ write_nic_byte(dev, CONFIG3, read_nic_byte(dev,CONFIG3)|CONFIG3_PARM_En); -+ write_nic_byte(dev, CR9346, 0x0); -+ -+ // Initialize RFE and read Zebra2 version code. Added by Annie, 2005-08-01. -+ SetupRFEInitialTiming(dev); -+ // PHY config. -+ PhyConfig8187(dev); -+ -+ // We assume RegWirelessMode has already been initialized before, -+ // however, we has to validate the wireless mode here and provide a reasonble -+ // initialized value if necessary. 2005.01.13, by rcnjko. -+ SupportedWirelessMode = GetSupportedWirelessMode8187(dev); -+ -+ if((ieee->mode != WIRELESS_MODE_B) && -+ (ieee->mode != WIRELESS_MODE_G) && -+ (ieee->mode != WIRELESS_MODE_A) && -+ (ieee->mode != WIRELESS_MODE_AUTO)) -+ { // It should be one of B, G, A, or AUTO. -+ bInvalidWirelessMode = true; -+ } -+ else -+ { // One of B, G, A, or AUTO. -+ // Check if the wireless mode is supported by RF. -+ if( (ieee->mode != WIRELESS_MODE_AUTO) && -+ (ieee->mode & SupportedWirelessMode) == 0 ) -+ { -+ bInvalidWirelessMode = true; -+ } -+ } -+ -+ if(bInvalidWirelessMode || ieee->mode==WIRELESS_MODE_AUTO) -+ { // Auto or other invalid value. -+ // Assigne a wireless mode to initialize. -+ if((SupportedWirelessMode & WIRELESS_MODE_A)) -+ { -+ InitWirelessMode = WIRELESS_MODE_A; -+ } -+ else if((SupportedWirelessMode & WIRELESS_MODE_G)) -+ { -+ -+ InitWirelessMode = WIRELESS_MODE_G; -+ } -+ else if((SupportedWirelessMode & WIRELESS_MODE_B)) -+ { -+ -+ InitWirelessMode = WIRELESS_MODE_B; -+ } -+ else -+ { -+ printk(KERN_WARNING -+ "InitializeAdapter8187(): No valid wireless mode supported, SupportedWirelessMode(%x)!!!\n", -+ SupportedWirelessMode); -+ InitWirelessMode = WIRELESS_MODE_B; -+ } -+ -+ // Initialize RegWirelessMode if it is not a valid one. -+ if(bInvalidWirelessMode) -+ { -+ ieee->mode = (WIRELESS_MODE)InitWirelessMode; -+ } -+ } -+ else -+ { // One of B, G, A. -+ InitWirelessMode = ieee->mode; -+ } -+ ActSetWirelessMode8187(dev, (u8)(InitWirelessMode)); -+ {//added for init gain -+ write_phy_ofdm(dev, 0x97, 0x46); mdelay(1); -+ write_phy_ofdm(dev, 0xa4, 0xb6); mdelay(1); -+ write_phy_ofdm(dev, 0x85, 0xfc); mdelay(1); -+ write_phy_cck(dev, 0xc1, 0x88); mdelay(1); -+ } -+ -+ } -+ else{ -+ int i; -+ short channel = 1; -+ u16 brsr; -+ u32 data,addr; -+ -+ priv->chan = channel; -+ -+ rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON); -+ -+ if(priv->card_type == USB) -+ rtl8225_host_usb_init(dev); -+ else -+ rtl8225_host_pci_init(dev); -+ -+ write_nic_dword(dev, RF_TIMING, 0x000a8008); -+ -+ brsr = read_nic_word(dev, BRSR_8187); -+ -+ write_nic_word(dev, BRSR_8187, 0xffff); -+ -+ -+ write_nic_dword(dev, RF_PARA, 0x100044); -+ -+ #if 1 //0->1 -+ rtl8180_set_mode(dev, EPROM_CMD_CONFIG); -+ write_nic_byte(dev, CONFIG3, 0x44); -+ rtl8180_set_mode(dev, EPROM_CMD_NORMAL); -+ #endif -+ -+ -+ rtl8185_rf_pins_enable(dev); -+ -+ // mdelay(1000); -+ -+ write_rtl8225(dev, 0x0, 0x2bf); mdelay(1); -+ -+ -+ write_rtl8225(dev, 0x1, 0xee0); mdelay(1); -+ -+ write_rtl8225(dev, 0x2, 0x44d); mdelay(1); -+ -+ write_rtl8225(dev, 0x3, 0x441); mdelay(1); -+ -+ -+ write_rtl8225(dev, 0x4, 0x8c3);mdelay(1); -+ -+ -+ -+ write_rtl8225(dev, 0x5, 0xc72);mdelay(1); -+ // } -+ -+ write_rtl8225(dev, 0x6, 0xe6); mdelay(1); -+ -+ write_rtl8225(dev, 0x7, ((priv->card_type == USB)? 0x82a : rtl8225_chan[channel])); mdelay(1); -+ -+ write_rtl8225(dev, 0x8, 0x3f); mdelay(1); -+ -+ write_rtl8225(dev, 0x9, 0x335); mdelay(1); -+ -+ write_rtl8225(dev, 0xa, 0x9d4); mdelay(1); -+ -+ write_rtl8225(dev, 0xb, 0x7bb); mdelay(1); -+ -+ write_rtl8225(dev, 0xc, 0x850); mdelay(1); -+ -+ -+ write_rtl8225(dev, 0xd, 0xcdf); mdelay(1); -+ -+ write_rtl8225(dev, 0xe, 0x2b); mdelay(1); -+ -+ write_rtl8225(dev, 0xf, 0x114); -+ -+ -+ mdelay(100); -+ -+ -+ //if(priv->card_type != USB) /* maybe not needed even for 8185 */ -+ // write_rtl8225(dev, 0x7, rtl8225_chan[channel]); -+ -+ write_rtl8225(dev, 0x0, 0x1b7); -+ -+ for(i=0;i<95;i++){ -+ write_rtl8225(dev, 0x1, (u8)(i+1)); -+ /* version B & C & D*/ -+ write_rtl8225(dev, 0x2, rtl8225z2_rxgain[i]); -+ } -+ //write_rtl8225(dev, 0x3, 0x80); -+ write_rtl8225(dev, 0x3, 0x2); -+ write_rtl8225(dev, 0x5, 0x4); -+ -+ write_rtl8225(dev, 0x0, 0xb7); -+ -+ write_rtl8225(dev, 0x2, 0xc4d); -+ -+ if(priv->card_type == USB){ -+ // force_pci_posting(dev); -+ mdelay(200); -+ -+ write_rtl8225(dev, 0x2, 0x44d); -+ -+ // force_pci_posting(dev); -+ mdelay(200); -+ -+ }//End of if(priv->card_type == USB) -+ /* FIXME!! rtl8187 we have to check if calibrarion -+ * is successful and eventually cal. again (repeat -+ * the two write on reg 2) -+ */ -+ // Check for calibration status, 2005.11.17, -+ data = read_rtl8225(dev, 6); -+ if (!(data&0x00000080)) -+ { -+ write_rtl8225(dev, 0x02, 0x0c4d); -+ force_pci_posting(dev); mdelay(200); -+ write_rtl8225(dev, 0x02, 0x044d); -+ force_pci_posting(dev); mdelay(100); -+ data = read_rtl8225(dev, 6); -+ if (!(data&0x00000080)) -+ { -+ DMESGW("RF Calibration Failed!!!!\n"); -+ } -+ } -+ //force_pci_posting(dev); -+ -+ mdelay(200); //200 for 8187 -+ -+ -+ // //if(priv->card_type != USB){ -+ // write_rtl8225(dev, 0x2, 0x44d); -+ // write_rtl8225(dev, 0x7, rtl8225_chan[channel]); -+ // write_rtl8225(dev, 0x2, 0x47d); -+ // -+ // force_pci_posting(dev); -+ // mdelay(100); -+ // -+ // write_rtl8225(dev, 0x2, 0x44d); -+ // //} -+ -+ write_rtl8225(dev, 0x0, 0x2bf); -+ -+ if(priv->card_type != USB) -+ rtl8185_rf_pins_enable(dev); -+ //set up ZEBRA AGC table, 2005.11.17, -+ for(i=0;i<128;i++){ -+ data = rtl8225_agc[i]; -+ -+ addr = i + 0x80; //enable writing AGC table -+ write_phy_ofdm(dev, 0xb, data); -+ -+ mdelay(1); -+ write_phy_ofdm(dev, 0xa, addr); -+ -+ mdelay(1); -+ } -+ -+ force_pci_posting(dev); -+ mdelay(1); -+ -+ write_phy_ofdm(dev, 0x0, 0x1); mdelay(1); -+ write_phy_ofdm(dev, 0x1, 0x2); mdelay(1); -+ write_phy_ofdm(dev, 0x2, ((priv->card_type == USB)? 0x42 : 0x62)); mdelay(1); -+ write_phy_ofdm(dev, 0x3, 0x0); mdelay(1); -+ write_phy_ofdm(dev, 0x4, 0x0); mdelay(1); -+ write_phy_ofdm(dev, 0x5, 0x0); mdelay(1); -+ write_phy_ofdm(dev, 0x6, 0x40); mdelay(1); -+ write_phy_ofdm(dev, 0x7, 0x0); mdelay(1); -+ write_phy_ofdm(dev, 0x8, 0x40); mdelay(1); -+ write_phy_ofdm(dev, 0x9, 0xfe); mdelay(1); -+ -+ write_phy_ofdm(dev, 0xa, 0x8); mdelay(1); -+ -+ //write_phy_ofdm(dev, 0x18, 0xef); -+ // } -+ //} -+ write_phy_ofdm(dev, 0xb, 0x80); mdelay(1); -+ -+ write_phy_ofdm(dev, 0xc, 0x1);mdelay(1); -+ -+ -+ //if(priv->card_type != USB) -+ write_phy_ofdm(dev, 0xd, 0x43); -+ -+ write_phy_ofdm(dev, 0xe, 0xd3);mdelay(1); -+ -+ write_phy_ofdm(dev, 0xf, 0x38);mdelay(1); -+ /*ver D & 8187*/ -+ // } -+ -+ // if(priv->card_8185 == 1 && priv->card_8185_Bversion) -+ // write_phy_ofdm(dev, 0x10, 0x04);/*ver B*/ -+ // else -+ write_phy_ofdm(dev, 0x10, 0x84);mdelay(1); -+ /*ver C & D & 8187*/ -+ -+ write_phy_ofdm(dev, 0x11, 0x07);mdelay(1); -+ /*agc resp time 700*/ -+ -+ -+ // if(priv->card_8185 == 2){ -+ /* Ver D & 8187*/ -+ write_phy_ofdm(dev, 0x12, 0x20);mdelay(1); -+ -+ write_phy_ofdm(dev, 0x13, 0x20);mdelay(1); -+ -+ write_phy_ofdm(dev, 0x14, 0x0); mdelay(1); -+ write_phy_ofdm(dev, 0x15, 0x40); mdelay(1); -+ write_phy_ofdm(dev, 0x16, 0x0); mdelay(1); -+ write_phy_ofdm(dev, 0x17, 0x40); mdelay(1); -+ -+ // if (priv->card_type == USB) -+ // write_phy_ofdm(dev, 0x18, 0xef); -+ -+ write_phy_ofdm(dev, 0x18, 0xef);mdelay(1); -+ -+ -+ write_phy_ofdm(dev, 0x19, 0x19); mdelay(1); -+ write_phy_ofdm(dev, 0x1a, 0x20); mdelay(1); -+ write_phy_ofdm(dev, 0x1b, 0x15);mdelay(1); -+ -+ write_phy_ofdm(dev, 0x1c, 0x4);mdelay(1); -+ -+ write_phy_ofdm(dev, 0x1d, 0xc5);mdelay(1); //2005.11.17, -+ -+ write_phy_ofdm(dev, 0x1e, 0x95);mdelay(1); -+ -+ write_phy_ofdm(dev, 0x1f, 0x75); mdelay(1); -+ -+ // } -+ -+ write_phy_ofdm(dev, 0x20, 0x1f);mdelay(1); -+ -+ write_phy_ofdm(dev, 0x21, 0x17);mdelay(1); -+ -+ write_phy_ofdm(dev, 0x22, 0x16);mdelay(1); -+ -+ // if(priv->card_type != USB) -+ write_phy_ofdm(dev, 0x23, 0x80);mdelay(1); //FIXME maybe not needed // <> -+ -+ write_phy_ofdm(dev, 0x24, 0x46); mdelay(1); -+ write_phy_ofdm(dev, 0x25, 0x00); mdelay(1); -+ write_phy_ofdm(dev, 0x26, 0x90); mdelay(1); -+ -+ write_phy_ofdm(dev, 0x27, 0x88); mdelay(1); -+ -+ -+ // <> Set init. gain to m74dBm. -+ -+ rtl8225z2_set_gain(dev,4); -+ //rtl8225z2_set_gain(dev,2); -+ -+ write_phy_cck(dev, 0x0, 0x98); mdelay(1); -+ write_phy_cck(dev, 0x3, 0x20); mdelay(1); -+ write_phy_cck(dev, 0x4, 0x7e); mdelay(1); -+ write_phy_cck(dev, 0x5, 0x12); mdelay(1); -+ write_phy_cck(dev, 0x6, 0xfc); mdelay(1); -+ write_phy_cck(dev, 0x7, 0x78);mdelay(1); -+ /* Ver C & D & 8187*/ -+ write_phy_cck(dev, 0x8, 0x2e);mdelay(1); -+ -+ write_phy_cck(dev, 0x9, 0x11);mdelay(1); -+ write_phy_cck(dev, 0xa, 0x17);mdelay(1); -+ write_phy_cck(dev, 0xb, 0x11);mdelay(1); -+ -+ write_phy_cck(dev, 0x10, ((priv->card_type == USB) ? 0x9b: 0x93)); mdelay(1); -+ write_phy_cck(dev, 0x11, 0x88); mdelay(1); -+ write_phy_cck(dev, 0x12, 0x47); mdelay(1); -+ write_phy_cck(dev, 0x13, 0xd0); /* Ver C & D & 8187*/ -+ -+ write_phy_cck(dev, 0x19, 0x0); mdelay(1); -+ write_phy_cck(dev, 0x1a, 0xa0); mdelay(1); -+ write_phy_cck(dev, 0x1b, 0x8); mdelay(1); -+ write_phy_cck(dev, 0x1d, 0x0); mdelay(1); -+ -+ write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */ mdelay(1); -+ -+ write_phy_cck(dev, 0x41, 0x9d);mdelay(1); -+ -+ -+ write_phy_cck(dev, 0x42, 0x15); mdelay(1); -+ write_phy_cck(dev, 0x43, 0x18); mdelay(1); -+ -+ -+ write_phy_cck(dev, 0x44, 0x36); mdelay(1); -+ write_phy_cck(dev, 0x45, 0x35); mdelay(1); -+ write_phy_cck(dev, 0x46, 0x2e); mdelay(1); -+ write_phy_cck(dev, 0x47, 0x25); mdelay(1); -+ write_phy_cck(dev, 0x48, 0x1c); mdelay(1); -+ write_phy_cck(dev, 0x49, 0x12); mdelay(1); -+ write_phy_cck(dev, 0x4a, 0x09); mdelay(1); -+ write_phy_cck(dev, 0x4b, 0x04); mdelay(1); -+ write_phy_cck(dev, 0x4c, 0x5);mdelay(1); -+ -+ -+ write_nic_byte(dev, 0x5b, 0x0d); mdelay(1); -+ -+ -+ -+ // <> -+ // // TESTR 0xb 8187 -+ // write_phy_cck(dev, 0x10, 0x93);// & 0xfb); -+ // -+ // //if(priv->card_type != USB){ -+ // write_phy_ofdm(dev, 0x2, 0x62); -+ // write_phy_ofdm(dev, 0x6, 0x0); -+ // write_phy_ofdm(dev, 0x8, 0x0); -+ // //} -+ -+ rtl8225z2_SetTXPowerLevel(dev, channel); -+ -+ write_phy_cck(dev, 0x10, 0x9b); mdelay(1); /* Rx ant A, 0xdb for B */ -+ write_phy_ofdm(dev, 0x26, 0x90); mdelay(1); /* Rx ant A, 0x10 for B */ -+ -+ rtl8185_tx_antenna(dev, 0x3); /* TX ant A, 0x0 for B */ -+ -+ /* switch to high-speed 3-wire -+ * last digit. 2 for both cck and ofdm -+ */ -+ if(priv->card_type == USB) -+ write_nic_dword(dev, 0x94, 0x3dc00002); -+ else{ -+ write_nic_dword(dev, 0x94, 0x15c00002); -+ rtl8185_rf_pins_enable(dev); -+ } -+ -+ // if(priv->card_type != USB) -+ // rtl8225_set_gain(dev, 4); /* FIXME this '1' is random */ // <> -+ // rtl8225_set_mode(dev, 1); /* FIXME start in B mode */ // <> -+ // -+ // /* make sure is waken up! */ -+ // write_rtl8225(dev,0x4, 0x9ff); -+ // rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON); -+ // rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON); -+ -+ rtl8225_rf_set_chan(dev, priv->chan); -+ -+ //write_nic_word(dev,BRSR,brsr); -+ -+ //rtl8225z2_rf_set_mode(dev); -+ } -+} -+ -+void rtl8225z2_rf_set_mode(struct net_device *dev) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ if(priv->ieee80211->mode == IEEE_A) -+ { -+ write_rtl8225(dev, 0x5, 0x1865); -+ write_nic_dword(dev, RF_PARA, 0x10084); -+ write_nic_dword(dev, RF_TIMING, 0xa8008); -+ write_phy_ofdm(dev, 0x0, 0x0); -+ write_phy_ofdm(dev, 0xa, 0x6); -+ write_phy_ofdm(dev, 0xb, 0x99); -+ write_phy_ofdm(dev, 0xf, 0x20); -+ write_phy_ofdm(dev, 0x11, 0x7); -+ -+ rtl8225z2_set_gain(dev,4); -+ -+ write_phy_ofdm(dev,0x15, 0x40); -+ write_phy_ofdm(dev,0x17, 0x40); -+ -+ write_nic_dword(dev, 0x94,0x10000000); -+ }else{ -+ -+ write_rtl8225(dev, 0x5, 0x1864); -+ write_nic_dword(dev, RF_PARA, 0x10044); -+ write_nic_dword(dev, RF_TIMING, 0xa8008); -+ write_phy_ofdm(dev, 0x0, 0x1); -+ write_phy_ofdm(dev, 0xa, 0x6); -+ write_phy_ofdm(dev, 0xb, 0x99); -+ write_phy_ofdm(dev, 0xf, 0x20); -+ write_phy_ofdm(dev, 0x11, 0x7); -+ -+ rtl8225z2_set_gain(dev,4); -+ -+ write_phy_ofdm(dev,0x15, 0x40); -+ write_phy_ofdm(dev,0x17, 0x40); -+ -+ write_nic_dword(dev, 0x94,0x04000002); -+ } -+} -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8180_wx.c linux-2.6.35/drivers/net/wireless/rtl8187b/r8180_wx.c ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8180_wx.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/r8180_wx.c 2010-08-05 21:12:35.383627915 +0200 -@@ -0,0 +1,2067 @@ -+/* -+ This file contains wireless extension handlers. -+ -+ This is part of rtl8180 OpenSource driver. -+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it> -+ Released under the terms of GPL (General Public Licence) -+ -+ Parts of this driver are based on the GPL part -+ of the official realtek driver. -+ -+ Parts of this driver are based on the rtl8180 driver skeleton -+ from Patric Schenke & Andres Salomon. -+ -+ Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver. -+ -+ We want to tanks the Authors of those projects and the Ndiswrapper -+ project Authors. -+*/ -+ -+ -+ -+#include "r8187.h" -+#include "r8180_hw.h" -+//added 1117 -+#include "ieee80211/ieee80211.h" -+#ifdef ENABLE_DOT11D -+#include "dot11d.h" -+#endif -+ -+ -+//#define RATE_COUNT 4 -+u32 rtl8180_rates[] = {1000000,2000000,5500000,11000000, -+ 6000000,9000000,12000000,18000000,24000000,36000000,48000000,54000000}; -+#define RATE_COUNT sizeof(rtl8180_rates)/(sizeof(rtl8180_rates[0])) -+ -+#ifdef _RTL8187_EXT_PATCH_ -+#define IW_MODE_MESH 11 -+static int r8180_wx_join_mesh(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra); -+int r8180_wx_set_channel(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra); -+static int r8180_wx_mesh_scan(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra); -+static int r8180_wx_get_mesh_list(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra); -+#endif -+ -+static int r8180_wx_get_freq(struct net_device *dev, -+ struct iw_request_info *a, -+ union iwreq_data *wrqu, char *b) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ return ieee80211_wx_get_freq(priv->ieee80211,a,wrqu,b); -+} -+ -+ -+#if 0 -+ -+static int r8180_wx_set_beaconinterval(struct net_device *dev, struct iw_request_info *aa, -+ union iwreq_data *wrqu, char *b) -+{ -+ int *parms = (int *)b; -+ int bi = parms[0]; -+ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ if(priv->ieee80211->bHwRadioOff) -+ return 0; -+ down(&priv->wx_sem); -+ DMESG("setting beacon interval to %x",bi); -+ -+ priv->ieee80211->beacon_interval=bi; -+ rtl8180_commit(dev); -+ up(&priv->wx_sem); -+ -+ return 0; -+} -+ -+ -+static int r8180_wx_set_forceassociate(struct net_device *dev, struct iw_request_info *aa, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv=ieee80211_priv(dev); -+ int *parms = (int *)extra; -+ if(priv->ieee80211->bHwRadioOff) -+ return 0; -+ -+ priv->ieee80211->force_associate = (parms[0] > 0); -+ -+ -+ return 0; -+} -+ -+#endif -+static int r8180_wx_get_mode(struct net_device *dev, struct iw_request_info *a, -+ union iwreq_data *wrqu, char *b) -+{ -+ struct r8180_priv *priv=ieee80211_priv(dev); -+ -+ return ieee80211_wx_get_mode(priv->ieee80211,a,wrqu,b); -+} -+ -+ -+ -+static int r8180_wx_get_rate(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ return ieee80211_wx_get_rate(priv->ieee80211,info,wrqu,extra); -+} -+ -+ -+ -+static int r8180_wx_set_rate(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ int ret; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ if(priv->ieee80211->bHwRadioOff) -+ return 0; -+ -+ down(&priv->wx_sem); -+ -+ ret = ieee80211_wx_set_rate(priv->ieee80211,info,wrqu,extra); -+ -+ up(&priv->wx_sem); -+ -+ return ret; -+} -+#ifdef JOHN_IOCTL -+u16 read_rtl8225(struct net_device *dev, u8 addr); -+void write_rtl8225(struct net_device *dev, u8 adr, u16 data); -+u32 john_read_rtl8225(struct net_device *dev, u8 adr); -+void _write_rtl8225(struct net_device *dev, u8 adr, u16 data); -+ -+static int r8180_wx_read_regs(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ u8 addr = 0; -+ u16 data1; -+ -+ down(&priv->wx_sem); -+ -+ -+ get_user(addr,(u8*)wrqu->data.pointer); -+ data1 = read_rtl8225(dev, addr); -+ wrqu->data.length = data1; -+ -+ up(&priv->wx_sem); -+ return 0; -+ -+} -+ -+static int r8180_wx_write_regs(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ u8 addr = 0; -+ -+ down(&priv->wx_sem); -+ -+ get_user(addr, (u8*)wrqu->data.pointer); -+ write_rtl8225(dev, addr, wrqu->data.length); -+ -+ up(&priv->wx_sem); -+ return 0; -+ -+} -+ -+void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data); -+u8 rtl8187_read_phy(struct net_device *dev,u8 adr, u32 data); -+ -+static int r8180_wx_read_bb(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ u8 databb; -+#if 0 -+ int i; -+ for(i=0;i<12;i++) printk("%8x\n", read_cam(dev, i) ); -+#endif -+ -+ down(&priv->wx_sem); -+ -+ databb = rtl8187_read_phy(dev, (u8)wrqu->data.length, 0x00000000); -+ wrqu->data.length = databb; -+ -+ up(&priv->wx_sem); -+ return 0; -+} -+ -+void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data); -+static int r8180_wx_write_bb(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ u8 databb = 0; -+ -+ down(&priv->wx_sem); -+ -+ get_user(databb, (u8*)wrqu->data.pointer); -+ rtl8187_write_phy(dev, wrqu->data.length, databb); -+ -+ up(&priv->wx_sem); -+ return 0; -+ -+} -+ -+ -+static int r8180_wx_write_nicb(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ u32 addr = 0; -+ -+ down(&priv->wx_sem); -+ -+ get_user(addr, (u32*)wrqu->data.pointer); -+ write_nic_byte(dev, addr, wrqu->data.length); -+ -+ up(&priv->wx_sem); -+ return 0; -+ -+} -+static int r8180_wx_read_nicb(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ u32 addr = 0; -+ u16 data1; -+ -+ down(&priv->wx_sem); -+ -+ get_user(addr,(u32*)wrqu->data.pointer); -+ data1 = read_nic_byte(dev, addr); -+ wrqu->data.length = data1; -+ -+ up(&priv->wx_sem); -+ return 0; -+} -+ -+static inline int is_same_network(struct ieee80211_network *src, -+ struct ieee80211_network *dst, -+ struct ieee80211_device *ieee) -+{ -+ /* A network is only a duplicate if the channel, BSSID, ESSID -+ * and the capability field (in particular IBSS and BSS) all match. -+ * We treat all <hidden> with the same BSSID and channel -+ * as one network */ -+ return (((src->ssid_len == dst->ssid_len)||(ieee->iw_mode == IW_MODE_INFRA)) && //YJ,mod, 080819,for hidden ap -+ //((src->ssid_len == dst->ssid_len) && -+ (src->channel == dst->channel) && -+ !memcmp(src->bssid, dst->bssid, ETH_ALEN) && -+ (!memcmp(src->ssid, dst->ssid, src->ssid_len)||(ieee->iw_mode == IW_MODE_INFRA)) && //YJ,mod, 080819,for hidden ap -+ //!memcmp(src->ssid, dst->ssid, src->ssid_len) && -+ ((src->capability & WLAN_CAPABILITY_IBSS) == -+ (dst->capability & WLAN_CAPABILITY_IBSS)) && -+ ((src->capability & WLAN_CAPABILITY_BSS) == -+ (dst->capability & WLAN_CAPABILITY_BSS))); -+} -+ -+static int r8180_wx_get_ap_status(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ struct ieee80211_device *ieee = priv->ieee80211; -+ struct ieee80211_network *target; -+ int name_len; -+ -+ down(&priv->wx_sem); -+ -+ //count the length of input ssid -+ for(name_len=0 ; ((char*)wrqu->data.pointer)[name_len]!='\0' ; name_len++); -+ -+ //search for the correspoding info which is received -+ list_for_each_entry(target, &ieee->network_list, list) { -+ if ( (target->ssid_len == name_len) && -+ (strncmp(target->ssid, (char*)wrqu->data.pointer, name_len)==0)){ -+ if( ((jiffies-target->last_scanned)/HZ > 1) && (ieee->state == IEEE80211_LINKED) && (is_same_network(&ieee->current_network,target, ieee)) ) -+ wrqu->data.length = 999; -+ else -+ wrqu->data.length = target->SignalStrength; -+ if(target->wpa_ie_len>0 || target->rsn_ie_len>0 ) -+ //set flags=1 to indicate this ap is WPA -+ wrqu->data.flags = 1; -+ else wrqu->data.flags = 0; -+ -+ -+ break; -+ } -+ } -+ -+ if (&target->list == &ieee->network_list){ -+ wrqu->data.flags = 3; -+ } -+ up(&priv->wx_sem); -+ return 0; -+} -+ -+ -+ -+#endif -+ -+static int r8180_wx_set_rawtx(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ int ret; -+ -+ if(priv->ieee80211->bHwRadioOff) -+ return 0; -+ -+ down(&priv->wx_sem); -+ -+ ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra); -+ -+ up(&priv->wx_sem); -+ -+ return ret; -+ -+} -+ -+static int r8180_wx_set_crcmon(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ int *parms = (int *)extra; -+ int enable = (parms[0] > 0); -+ short prev = priv->crcmon; -+ -+ if(priv->ieee80211->bHwRadioOff) -+ return 0; -+ -+ down(&priv->wx_sem); -+ -+ if(enable) -+ priv->crcmon=1; -+ else -+ priv->crcmon=0; -+ -+ DMESG("bad CRC in monitor mode are %s", -+ priv->crcmon ? "accepted" : "rejected"); -+ -+ if(prev != priv->crcmon && priv->up){ -+ rtl8180_down(dev); -+ rtl8180_up(dev); -+ } -+ -+ up(&priv->wx_sem); -+ -+ return 0; -+} -+ -+static int r8180_wx_set_mode(struct net_device *dev, struct iw_request_info *a, -+ union iwreq_data *wrqu, char *b) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ int ret; -+ if(priv->ieee80211->bHwRadioOff) -+ return 0; -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ if (priv->mshobj && (priv->ieee80211->iw_ext_mode==11)) return 0; -+#endif -+ down(&priv->wx_sem); -+ -+#ifdef CONFIG_IPS -+ if(priv->bInactivePs){ -+ if(wrqu->mode != IW_MODE_INFRA){ -+ down(&priv->ieee80211->ips_sem); -+ IPSLeave(dev); -+ up(&priv->ieee80211->ips_sem); -+ } -+ } -+#endif -+ ret = ieee80211_wx_set_mode(priv->ieee80211,a,wrqu,b); -+ -+ rtl8187_set_rxconf(dev); -+ -+ up(&priv->wx_sem); -+ return ret; -+} -+ -+ -+//YJ,add,080819,for hidden ap -+struct iw_range_with_scan_capa -+{ -+ /* Informative stuff (to choose between different interface) */ -+ __u32 throughput; /* To give an idea... */ -+ /* In theory this value should be the maximum benchmarked -+ * TCP/IP throughput, because with most of these devices the -+ * bit rate is meaningless (overhead an co) to estimate how -+ * fast the connection will go and pick the fastest one. -+ * I suggest people to play with Netperf or any benchmark... -+ */ -+ -+ /* NWID (or domain id) */ -+ __u32 min_nwid; /* Minimal NWID we are able to set */ -+ __u32 max_nwid; /* Maximal NWID we are able to set */ -+ -+ /* Old Frequency (backward compat - moved lower ) */ -+ __u16 old_num_channels; -+ __u8 old_num_frequency; -+ -+ /* Scan capabilities */ -+ __u8 scan_capa; -+}; -+//YJ,add,080819,for hidden ap -+ -+static int rtl8180_wx_get_range(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct iw_range *range = (struct iw_range *)extra; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ u16 val; -+ int i; -+ struct iw_range_with_scan_capa* tmp = (struct iw_range_with_scan_capa*)range; //YJ,add,080819,for hidden ap -+ -+ wrqu->data.length = sizeof(*range); -+ memset(range, 0, sizeof(*range)); -+ -+ /* Let's try to keep this struct in the same order as in -+ * linux/include/wireless.h -+ */ -+ -+ /* TODO: See what values we can set, and remove the ones we can't -+ * set, or fill them with some default data. -+ */ -+ -+ /* ~5 Mb/s real (802.11b) */ -+ range->throughput = 5 * 1000 * 1000; -+ -+ // TODO: Not used in 802.11b? -+// range->min_nwid; /* Minimal NWID we are able to set */ -+ // TODO: Not used in 802.11b? -+// range->max_nwid; /* Maximal NWID we are able to set */ -+ -+ /* Old Frequency (backward compat - moved lower ) */ -+// range->old_num_channels; -+// range->old_num_frequency; -+// range->old_freq[6]; /* Filler to keep "version" at the same offset */ -+ if(priv->rf_set_sens != NULL) -+ range->sensitivity = priv->max_sens; /* signal level threshold range */ -+ -+ range->max_qual.qual = 100; -+ /* TODO: Find real max RSSI and stick here */ -+ range->max_qual.level = 0; -+ range->max_qual.noise = -98; -+ range->max_qual.updated = 7; /* Updated all three */ -+ -+ range->avg_qual.qual = 92; /* > 8% missed beacons is 'bad' */ -+ /* TODO: Find real 'good' to 'bad' threshol value for RSSI */ -+ range->avg_qual.level = 20 + -98; -+ range->avg_qual.noise = 0; -+ range->avg_qual.updated = 7; /* Updated all three */ -+ -+ range->num_bitrates = RATE_COUNT; -+ -+ for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++) { -+ range->bitrate[i] = rtl8180_rates[i]; -+ } -+ -+ range->min_frag = MIN_FRAG_THRESHOLD; -+ range->max_frag = MAX_FRAG_THRESHOLD; -+ -+ range->pm_capa = 0; -+ -+ range->we_version_compiled = WIRELESS_EXT; -+ range->we_version_source = 16; -+ -+// range->retry_capa; /* What retry options are supported */ -+// range->retry_flags; /* How to decode max/min retry limit */ -+// range->r_time_flags; /* How to decode max/min retry life */ -+// range->min_retry; /* Minimal number of retries */ -+// range->max_retry; /* Maximal number of retries */ -+// range->min_r_time; /* Minimal retry lifetime */ -+// range->max_r_time; /* Maximal retry lifetime */ -+ -+ range->num_channels = 14; -+ -+ for (i = 0, val = 0; i < 14; i++) { -+ -+ // Include only legal frequencies for some countries -+#ifdef ENABLE_DOT11D -+ if ((GET_DOT11D_INFO(priv->ieee80211)->channel_map)[i+1]) { -+#else -+ if ((priv->ieee80211->channel_map)[i+1]) { -+#endif -+ range->freq[val].i = i + 1; -+ range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000; -+ range->freq[val].e = 1; -+ val++; -+ } else { -+ // FIXME: do we need to set anything for channels -+ // we don't use ? -+ } -+ -+ if (val == IW_MAX_FREQUENCIES) -+ break; -+ } -+ -+ range->num_frequency = val; -+ range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | -+ IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; -+ -+ tmp->scan_capa = 0x01; //YJ,add,080819,for hidden ap -+ -+ return 0; -+} -+ -+ -+static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a, -+ union iwreq_data *wrqu, char *b) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ struct ieee80211_device* ieee = priv->ieee80211; -+ int ret; -+ -+ if(priv->ieee80211->bHwRadioOff) -+ return 0; -+ //printk("==============>%s()\n",__FUNCTION__); -+ if(!priv->up) -+ return -1; -+ -+ if (wrqu->data.flags & IW_SCAN_THIS_ESSID) -+ { -+ struct iw_scan_req* req = (struct iw_scan_req*)b; -+ if (req->essid_len) -+ { -+ ieee->current_network.ssid_len = req->essid_len; -+ memcpy(ieee->current_network.ssid, req->essid, req->essid_len); -+ } -+ } -+ -+ //set Tr switch to hardware control to scan more bss -+ if(priv->TrSwitchState == TR_SW_TX) { -+ //YJ,add,080611 -+ write_nic_byte(dev, RFPinsSelect, (u8)(priv->wMacRegRfPinsSelect)); -+ write_nic_byte(dev, RFPinsOutput, (u8)(priv->wMacRegRfPinsOutput)); -+ //YJ,add,080611,end -+ priv->TrSwitchState = TR_HW_CONTROLLED; -+ } -+#ifdef _RTL8187_EXT_PATCH_ -+ if((priv->ieee80211->iw_mode == IW_MODE_MESH) && (priv->ieee80211->iw_ext_mode == IW_MODE_MESH)){ -+ r8180_wx_mesh_scan(dev,a,wrqu,b); -+ ret = 0; -+ } -+ else -+#endif -+ { -+ down(&priv->wx_sem); -+ if(priv->ieee80211->state != IEEE80211_LINKED){ -+ //printk("===>start no link scan\n"); -+ //ieee80211_start_scan(priv->ieee80211); -+ //lzm mod 090115 because wq can't scan complete once -+ //because after start protocal wq scan is in doing -+ //so we should stop it first. -+ ieee80211_stop_scan(priv->ieee80211); -+ ieee80211_start_scan_syncro(priv->ieee80211); -+ ret = 0; -+ } else { -+ ret = ieee80211_wx_set_scan(priv->ieee80211,a,wrqu,b); -+ } -+ up(&priv->wx_sem); -+ } -+ return ret; -+} -+ -+ -+static int r8180_wx_get_scan(struct net_device *dev, struct iw_request_info *a, -+ union iwreq_data *wrqu, char *b) -+{ -+ -+ int ret; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ if(!priv->up) return -1; -+#ifdef _RTL8187_EXT_PATCH_ -+ if((priv->ieee80211->iw_mode == IW_MODE_MESH) && (priv->ieee80211->iw_ext_mode == IW_MODE_MESH)){ -+ ret = r8180_wx_get_mesh_list(dev, a, wrqu, b); -+ } -+ else -+#endif -+ { -+ down(&priv->wx_sem); -+ -+ ret = ieee80211_wx_get_scan(priv->ieee80211,a,wrqu,b); -+ -+ up(&priv->wx_sem); -+ } -+ return ret; -+} -+ -+ -+static int r8180_wx_set_essid(struct net_device *dev, -+ struct iw_request_info *a, -+ union iwreq_data *wrqu, char *b) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ int ret; -+#ifdef _RTL8187_EXT_PATCH_ -+ struct ieee80211_device *ieee = priv->ieee80211; -+ char ch = 0; -+ char tmpmeshid[32]; -+ char *p; -+ int tmpmeshid_len=0; -+ int i; -+ short proto_started; -+#endif -+ if(priv->ieee80211->bHwRadioOff) -+ return 0; -+ //printk("==========>%s()\n",__FUNCTION__); -+ down(&priv->wx_sem); -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ if((priv->ieee80211->iw_mode == IW_MODE_MESH) && (priv->ieee80211->iw_ext_mode == IW_MODE_MESH)){ -+ if (wrqu->essid.length > IW_ESSID_MAX_SIZE){ -+ ret= -E2BIG; -+ goto out; -+ } -+ if (wrqu->essid.flags && (wrqu->essid.length > 1)) { -+ memset(tmpmeshid,0,32); -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -+ tmpmeshid_len=wrqu->essid.length; -+#else -+ tmpmeshid_len=wrqu->essid.length + 1; -+#endif -+ p=b+tmpmeshid_len-2; -+ for(i=tmpmeshid_len-1;i>0;i--) -+ { -+ if((*p)=='@') -+ break; -+ p--; -+ } -+ if((i == 0) || (i == 1)){ -+ printk("error:wrong meshid\n"); -+ ret = -1; -+ goto out; -+ } -+ -+ memcpy(tmpmeshid,b,(i-1)); -+ p++; -+ if((tmpmeshid_len-1-i)==1) -+ { -+ if(*p > '9'|| *p <= '0'){ -+ goto out; -+ } else { -+ ch = *p - '0'; -+ } -+ } -+ else if((tmpmeshid_len-1-i)==2) -+ { -+ if((*p == '1') && (*(p+1) >= '0') && (*(p+1) <= '9')) -+ ch = (*p - '0') * 10 + (*(p+1) - '0'); -+ else -+ goto out; -+ } -+ else { -+ ret = 0; -+ goto out; -+ } -+ if(ch > 14) -+ { -+ ret = 0; -+ printk("channel is invalid: %d\n",ch); -+ goto out; -+ } -+ ieee->sync_scan_hurryup = 1; -+ -+ proto_started = ieee->proto_started; -+ if(proto_started) -+ ieee80211_stop_protocol(ieee); -+ -+ printk("==============>tmpmeshid is %s\n",tmpmeshid); -+ priv->mshobj->ext_patch_r8180_wx_set_meshID(dev, tmpmeshid); -+ priv->mshobj->ext_patch_r8180_wx_set_mesh_chan(dev,ch); -+ r8180_wx_set_channel(dev, NULL, NULL, &ch); -+ if (proto_started) -+ ieee80211_start_protocol(ieee); -+ } -+ else{ -+ printk("BUG:meshid is null\n"); -+ ret=0; -+ goto out; -+ } -+ -+ ret = 0; -+ } -+ else -+#endif -+ { -+ ret = ieee80211_wx_set_essid(priv->ieee80211,a,wrqu,b); -+ } -+ -+#ifdef _RTL8187_EXT_PATCH_ -+out: -+#endif -+ up(&priv->wx_sem); -+ return ret; -+} -+ -+ -+static int r8180_wx_get_essid(struct net_device *dev, -+ struct iw_request_info *a, -+ union iwreq_data *wrqu, char *b) -+{ -+ int ret; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ down(&priv->wx_sem); -+ -+ ret = ieee80211_wx_get_essid(priv->ieee80211, a, wrqu, b); -+ -+ up(&priv->wx_sem); -+ -+ return ret; -+} -+ -+ -+static int r8180_wx_set_freq(struct net_device *dev, struct iw_request_info *a, -+ union iwreq_data *wrqu, char *b) -+{ -+ int ret; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ if(priv->ieee80211->bHwRadioOff) -+ return 0; -+ -+ down(&priv->wx_sem); -+ -+ ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b); -+ -+ up(&priv->wx_sem); -+ return ret; -+} -+ -+static int r8180_wx_get_name(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ return ieee80211_wx_get_name(priv->ieee80211, info, wrqu, extra); -+} -+ -+ -+static int r8180_wx_set_frag(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ if(priv->ieee80211->bHwRadioOff) -+ return 0; -+ -+ if (wrqu->frag.disabled) -+ priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD; -+ else { -+ if (wrqu->frag.value < MIN_FRAG_THRESHOLD || -+ wrqu->frag.value > MAX_FRAG_THRESHOLD) -+ return -EINVAL; -+ -+ priv->ieee80211->fts = wrqu->frag.value & ~0x1; -+ } -+ -+ return 0; -+} -+ -+ -+static int r8180_wx_get_frag(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ wrqu->frag.value = priv->ieee80211->fts; -+ wrqu->frag.fixed = 0; /* no auto select */ -+ wrqu->frag.disabled = (wrqu->frag.value == DEFAULT_FRAG_THRESHOLD); -+ -+ return 0; -+} -+ -+ -+static int r8180_wx_set_wap(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *awrq, -+ char *extra) -+{ -+ int ret; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ if(priv->ieee80211->bHwRadioOff) -+ return 0; -+ -+ //printk("in function %s\n",__FUNCTION__); -+#ifdef _RTL8187_EXT_PATCH_ -+ if (priv->mshobj && (priv->ieee80211->iw_ext_mode==11)){ -+ return 0; -+ } -+#endif -+ down(&priv->wx_sem); -+ -+ ret = ieee80211_wx_set_wap(priv->ieee80211,info,awrq,extra); -+ -+ up(&priv->wx_sem); -+ return ret; -+ -+} -+ -+ -+static int r8180_wx_get_wap(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ return ieee80211_wx_get_wap(priv->ieee80211,info,wrqu,extra); -+} -+ -+ -+static int r8180_wx_get_enc(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *key) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ return ieee80211_wx_get_encode(priv->ieee80211, info, wrqu, key); -+} -+ -+static int r8180_wx_set_enc(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *key) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ int ret; -+#ifdef JOHN_HWSEC -+// struct ieee80211_device *ieee = priv->ieee80211; -+// u32 TargetContent; -+ u32 hwkey[4]={0,0,0,0}; -+ u8 mask=0xff; -+ u32 key_idx=0; -+ u8 broadcast_addr[6] ={ 0xff,0xff,0xff,0xff,0xff,0xff}; -+ u8 zero_addr[4][6] ={ {0x00,0x00,0x00,0x00,0x00,0x00}, -+ {0x00,0x00,0x00,0x00,0x00,0x01}, -+ {0x00,0x00,0x00,0x00,0x00,0x02}, -+ {0x00,0x00,0x00,0x00,0x00,0x03} }; -+ int i; -+ -+#endif -+ -+ if(priv->ieee80211->bHwRadioOff) -+ return 0; -+ -+ down(&priv->wx_sem); -+ -+ DMESG("Setting SW wep key"); -+ ret = ieee80211_wx_set_encode(priv->ieee80211,info,wrqu,key); -+ -+ up(&priv->wx_sem); -+ -+#ifdef JOHN_HWSEC -+ -+ //sometimes, the length is zero while we do not type key value -+ if(wrqu->encoding.length!=0){ -+ -+ for(i=0 ; i<4 ; i++){ -+ hwkey[i] |= key[4*i+0]&mask; -+ if(i==1&&(4*i+1)==wrqu->encoding.length) mask=0x00; -+ if(i==3&&(4*i+1)==wrqu->encoding.length) mask=0x00; -+ hwkey[i] |= (key[4*i+1]&mask)<<8; -+ hwkey[i] |= (key[4*i+2]&mask)<<16; -+ hwkey[i] |= (key[4*i+3]&mask)<<24; -+ } -+ -+ #define CONF_WEP40 0x4 -+ #define CONF_WEP104 0x14 -+ -+ switch(wrqu->encoding.flags){ -+ case 0: -+ case 1: key_idx = 0; break; -+ case 2: key_idx = 1; break; -+ case 3: key_idx = 2; break; -+ case 4: key_idx = 3; break; -+ default: break; -+ } -+ -+ if(wrqu->encoding.length==0x5){ -+ setKey( dev, -+ key_idx, //EntryNo -+ key_idx, //KeyIndex -+ KEY_TYPE_WEP40, //KeyType -+ zero_addr[key_idx], -+ 0, //DefaultKey -+ hwkey); //KeyContent -+ -+ if(key_idx == 0){ -+ -+ write_nic_byte(dev, WPA_CONFIG, 7); -+ -+ setKey( dev, -+ 4, //EntryNo -+ key_idx, //KeyIndex -+ KEY_TYPE_WEP40, //KeyType -+ broadcast_addr, //addr -+ 0, //DefaultKey -+ hwkey); //KeyContent -+ } -+ } -+ -+ else if(wrqu->encoding.length==0xd){ -+ setKey( dev, -+ key_idx, //EntryNo -+ key_idx, //KeyIndex -+ KEY_TYPE_WEP104, //KeyType -+ zero_addr[key_idx], -+ 0, //DefaultKey -+ hwkey); //KeyContent -+ -+ if(key_idx == 0){ -+ -+ write_nic_byte(dev, WPA_CONFIG, 7); -+ -+ setKey( dev, -+ 4, //EntryNo -+ key_idx, //KeyIndex -+ KEY_TYPE_WEP104, //KeyType -+ broadcast_addr, //addr -+ 0, //DefaultKey -+ hwkey); //KeyContent -+ } -+ } -+ else printk("wrong type in WEP, not WEP40 and WEP104\n"); -+ -+ } -+ -+ //consider the setting different key index situation -+ //wrqu->encoding.flags = 801 means that we set key with index "1" -+ if(wrqu->encoding.length==0 && (wrqu->encoding.flags >>8) == 0x8 ){ -+ -+ write_nic_byte(dev, WPA_CONFIG, 7); -+ -+ //copy wpa config from default key(key0~key3) to broadcast key(key5) -+ // -+ key_idx = (wrqu->encoding.flags & 0xf)-1 ; -+ write_cam(dev, (4*6), 0xffff0000|read_cam(dev, key_idx*6) ); -+ write_cam(dev, (4*6)+1, 0xffffffff); -+ write_cam(dev, (4*6)+2, read_cam(dev, (key_idx*6)+2) ); -+ write_cam(dev, (4*6)+3, read_cam(dev, (key_idx*6)+3) ); -+ write_cam(dev, (4*6)+4, read_cam(dev, (key_idx*6)+4) ); -+ write_cam(dev, (4*6)+5, read_cam(dev, (key_idx*6)+5) ); -+ } -+ -+#endif /*JOHN_HWSEC*/ -+ return ret; -+} -+ -+ -+static int r8180_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa, union -+ iwreq_data *wrqu, char *p){ -+ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ int *parms=(int*)p; -+ int mode=parms[0]; -+ -+ if(priv->ieee80211->bHwRadioOff) -+ return 0; -+ -+ priv->ieee80211->active_scan = mode; -+ -+ return 1; -+} -+ -+ -+ -+static int r8180_wx_set_retry(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ int err = 0; -+ -+ if(priv->ieee80211->bHwRadioOff) -+ return 0; -+ -+ down(&priv->wx_sem); -+ -+ if (wrqu->retry.flags & IW_RETRY_LIFETIME || -+ wrqu->retry.disabled){ -+ err = -EINVAL; -+ goto exit; -+ } -+ if (!(wrqu->retry.flags & IW_RETRY_LIMIT)){ -+ err = -EINVAL; -+ goto exit; -+ } -+ -+ if(wrqu->retry.value > R8180_MAX_RETRY){ -+ err= -EINVAL; -+ goto exit; -+ } -+ if (wrqu->retry.flags & IW_RETRY_MAX) { -+ priv->retry_rts = wrqu->retry.value; -+ DMESG("Setting retry for RTS/CTS data to %d", wrqu->retry.value); -+ -+ }else { -+ priv->retry_data = wrqu->retry.value; -+ DMESG("Setting retry for non RTS/CTS data to %d", wrqu->retry.value); -+ } -+ -+ /* FIXME ! -+ * We might try to write directly the TX config register -+ * or to restart just the (R)TX process. -+ * I'm unsure if whole reset is really needed -+ */ -+ -+ rtl8180_commit(dev); -+ /* -+ if(priv->up){ -+ rtl8180_rtx_disable(dev); -+ rtl8180_rx_enable(dev); -+ rtl8180_tx_enable(dev); -+ -+ } -+ */ -+exit: -+ up(&priv->wx_sem); -+ -+ return err; -+} -+ -+static int r8180_wx_get_retry(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ -+ wrqu->retry.disabled = 0; /* can't be disabled */ -+ -+ if ((wrqu->retry.flags & IW_RETRY_TYPE) == -+ IW_RETRY_LIFETIME) -+ return -EINVAL; -+ -+ if (wrqu->retry.flags & IW_RETRY_MAX) { -+ wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MAX; -+ wrqu->retry.value = priv->retry_rts; -+ } else { -+ wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MIN; -+ wrqu->retry.value = priv->retry_data; -+ } -+ //DMESG("returning %d",wrqu->retry.value); -+ -+ -+ return 0; -+} -+ -+static int r8180_wx_get_sens(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ if(priv->rf_set_sens == NULL) -+ return -1; /* we have not this support for this radio */ -+ wrqu->sens.value = priv->sens; -+ return 0; -+} -+ -+ -+static int r8180_wx_set_sens(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ short err = 0; -+ -+ if(priv->ieee80211->bHwRadioOff) -+ return 0; -+ -+ down(&priv->wx_sem); -+ //DMESG("attempt to set sensivity to %ddb",wrqu->sens.value); -+ if(priv->rf_set_sens == NULL) { -+ err= -1; /* we have not this support for this radio */ -+ goto exit; -+ } -+ if(priv->rf_set_sens(dev, wrqu->sens.value) == 0) -+ priv->sens = wrqu->sens.value; -+ else -+ err= -EINVAL; -+ -+exit: -+ up(&priv->wx_sem); -+ -+ return err; -+} -+ -+ -+static int dummy(struct net_device *dev, struct iw_request_info *a, -+ union iwreq_data *wrqu,char *b) -+{ -+ return -1; -+} -+static int r8180_wx_set_enc_ext(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ //printk("===>%s()\n", __FUNCTION__); -+ -+ int ret=0; -+ -+ if(priv->ieee80211->bHwRadioOff) -+ return 0; -+ -+ down(&priv->wx_sem); -+ ret = ieee80211_wx_set_encode_ext(priv->ieee80211, info, wrqu, extra); -+ up(&priv->wx_sem); -+ return ret; -+ -+} -+static int r8180_wx_set_auth(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data* data, char *extra) -+{ -+ //printk("====>%s()\n", __FUNCTION__); -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ int ret=0; -+ -+ if(priv->ieee80211->bHwRadioOff) -+ return 0; -+ -+ down(&priv->wx_sem); -+ ret = ieee80211_wx_set_auth(priv->ieee80211, info, &(data->param), extra); -+ up(&priv->wx_sem); -+ return ret; -+} -+ -+static int r8180_wx_set_mlme(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ //printk("====>%s()\n", __FUNCTION__); -+ -+ int ret=0; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ if(priv->ieee80211->bHwRadioOff) -+ return 0; -+ -+ down(&priv->wx_sem); -+#if 1 -+ ret = ieee80211_wx_set_mlme(priv->ieee80211, info, wrqu, extra); -+#endif -+ up(&priv->wx_sem); -+ return ret; -+} -+ -+static int r8180_wx_set_gen_ie(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data* data, char *extra) -+{ -+ //printk("====>%s(), len:%d\n", __FUNCTION__, data->length); -+ int ret=0; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ if(priv->ieee80211->bHwRadioOff) -+ return 0; -+ -+ down(&priv->wx_sem); -+#if 1 -+ ret = ieee80211_wx_set_gen_ie(priv->ieee80211, extra, data->data.length); -+#endif -+ up(&priv->wx_sem); -+ //printk("<======%s(), ret:%d\n", __FUNCTION__, ret); -+ return ret; -+ -+ -+} -+ -+#ifdef _RTL8187_EXT_PATCH_ -+/* -+ Output: -+ (case 1) Mesh: Enable. MESHID=[%s] (max length of %s is 32 bytes). -+ (case 2) Mesh: Disable. -+*/ -+static int r8180_wx_get_meshinfo(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ if( ! priv->mshobj || !priv->mshobj->ext_patch_r8180_wx_get_meshinfo ) -+ return 0; -+ return priv->mshobj->ext_patch_r8180_wx_get_meshinfo(dev, info, wrqu, extra); -+} -+ -+ -+static int r8180_wx_enable_mesh(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ struct ieee80211_device *ieee = priv->ieee80211; -+ -+ int ret = 0; -+ -+ if( ! priv->mshobj || !priv->mshobj->ext_patch_r8180_wx_enable_mesh ) -+ return 0; -+ -+ down(&priv->wx_sem); -+ if(priv->mshobj->ext_patch_r8180_wx_enable_mesh(dev)) -+ { -+ union iwreq_data tmprqu; -+ tmprqu.mode = ieee->iw_mode; -+ ieee->iw_mode = 0; -+ ret = ieee80211_wx_set_mode(ieee, info, &tmprqu, extra); -+ rtl8187_set_rxconf(dev); -+ } -+ -+ up(&priv->wx_sem); -+ -+ return ret; -+ -+} -+ -+static int r8180_wx_disable_mesh(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ struct ieee80211_device *ieee = priv->ieee80211; -+ -+ int ret = 0; -+ -+ if( ! priv->mshobj || !priv->mshobj->ext_patch_r8180_wx_disable_mesh ) -+ return 0; -+ -+ down(&priv->wx_sem); -+ if(priv->mshobj->ext_patch_r8180_wx_disable_mesh(dev)) -+ { -+ union iwreq_data tmprqu; -+ tmprqu.mode = ieee->iw_mode; -+ ieee->iw_mode = 999; -+ ret = ieee80211_wx_set_mode(ieee, info, &tmprqu, extra); -+ rtl8187_set_rxconf(dev); -+ } -+ -+ up(&priv->wx_sem); -+ -+ return ret; -+} -+ -+ -+int r8180_wx_set_channel(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ int ch = *extra; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ struct ieee80211_device *ieee = priv->ieee80211; -+ -+ if(priv->ieee80211->bHwRadioOff) -+ return 0; -+ -+ // is 11s ? -+ if (!priv->mshobj || (ieee->iw_mode != ieee->iw_ext_mode) || !priv->mshobj->ext_patch_r8180_wx_set_channel ) -+ return 0; -+ -+ printk("set channel = %d\n", ch); -+ if ( ch < 0 ) -+ { -+ ieee80211_start_scan(ieee); // auto -+ ieee->meshScanMode =2; -+ } -+ else -+ { -+//#ifdef NETWORKMANAGER_UI -+ if((priv->ieee80211->iw_mode == IW_MODE_MESH) && (priv->ieee80211->iw_ext_mode == IW_MODE_MESH)){ -+ } -+//#else -+ else{ -+ down(&priv->wx_sem);} -+//#endif -+ ieee->meshScanMode =0; -+ // ieee->set_chan(dev, ch); -+//#ifdef _RTL8187_EXT_PATCH_ -+ if(priv->mshobj->ext_patch_r8180_wx_set_channel) -+ { -+ priv->mshobj->ext_patch_r8180_wx_set_channel(ieee, ch); -+ priv->mshobj->ext_patch_r8180_wx_set_mesh_chan(dev,ch); -+ } -+//#endif -+ ieee->set_chan(ieee->dev, ch); -+ ieee->current_network.channel = ch; -+ queue_work(ieee->wq, &ieee->ext_stop_scan_wq); -+ ieee80211_ext_send_11s_beacon(ieee); -+//#ifdef NETWORKMANAGER_UI -+ if((priv->ieee80211->iw_mode == IW_MODE_MESH) && (priv->ieee80211->iw_ext_mode == IW_MODE_MESH)){ -+ } -+//#else -+ else{ -+ up(&priv->wx_sem);} -+//#endif -+ //up(&ieee->wx_sem); -+ -+ // ieee80211_stop_scan(ieee); // user set -+ // -+ -+ /* -+ netif_carrier_off(ieee->dev); -+ -+ if (ieee->data_hard_stop) -+ ieee->data_hard_stop(ieee->dev); -+ -+ ieee->state = IEEE80211_NOLINK; -+ ieee->link_change(ieee->dev); -+ -+ ieee->current_network.channel = fwrq->m; -+ ieee->set_chan(ieee->dev, ieee->current_network.channel); -+ -+ -+ if (ieee->data_hard_resume) -+ ieee->data_hard_resume(ieee->dev); -+ -+ netif_carrier_on(ieee->dev); -+ */ -+ -+ } -+ -+ return 0; -+} -+ -+static int r8180_wx_set_meshID(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ if(priv->ieee80211->bHwRadioOff) -+ return 0; -+ -+ if( ! priv->mshobj || !priv->mshobj->ext_patch_r8180_wx_set_meshID ) -+ return 0; -+ -+ //printk("len=%d\n", wrqu->data.length); -+ //printk("\nCall setMeshid."); -+ return priv->mshobj->ext_patch_r8180_wx_set_meshID(dev, wrqu->data.pointer); -+} -+ -+ -+/* reserved for future -+static int r8180_wx_add_mac_allow(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ if( ! priv->mshobj || !priv->mshobj->ext_patch_r8180_wx_set_add_mac_allow ) -+ return 0; -+ -+ return priv->mshobj->ext_patch_r8180_wx_set_add_mac_allow(dev, info, wrqu, extra); -+} -+ -+static int r8180_wx_del_mac_allow(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ if( ! priv->mshobj || !priv->mshobj->ext_patch_r8180_wx_set_del_mac_allow ) -+ return 0; -+ -+ return priv->mshobj->ext_patch_r8180_wx_set_del_mac_allow(dev, info, wrqu, extra); -+} -+*/ -+static int r8180_wx_add_mac_deny(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ if( ! priv->mshobj || !priv->mshobj->ext_patch_r8180_wx_set_add_mac_deny ) -+ return 0; -+ -+ return priv->mshobj->ext_patch_r8180_wx_set_add_mac_deny(dev, info, wrqu, extra); -+} -+ -+static int r8180_wx_del_mac_deny(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ if( ! priv->mshobj || !priv->mshobj->ext_patch_r8180_wx_set_del_mac_deny ) -+ return 0; -+ -+ return priv->mshobj->ext_patch_r8180_wx_set_del_mac_deny(dev, info, wrqu, extra); -+} -+ -+/* reserved for future -+static int r8180_wx_get_mac_allow(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ if( ! priv->mshobj || !priv->mshobj->ext_patch_r8180_wx_get_mac_allow ) -+ return 0; -+ -+ return priv->mshobj->ext_patch_r8180_wx_get_mac_allow(dev, info, wrqu, extra); -+} -+*/ -+ -+static int r8180_wx_get_mac_deny(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ if( ! priv->mshobj || !priv->mshobj->ext_patch_r8180_wx_get_mac_deny ) -+ return 0; -+ -+ return priv->mshobj->ext_patch_r8180_wx_get_mac_deny(dev, info, wrqu, extra); -+} -+ -+ -+static int r8180_wx_get_mesh_list(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ if( ! priv->mshobj || !priv->mshobj->ext_patch_r8180_wx_get_mesh_list ) -+ return 0; -+ -+ return priv->mshobj->ext_patch_r8180_wx_get_mesh_list(dev, info, wrqu, extra); -+} -+ -+static int r8180_wx_mesh_scan(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ if( ! priv->mshobj || !priv->mshobj->ext_patch_r8180_wx_mesh_scan ) -+ return 0; -+ -+ return priv->mshobj->ext_patch_r8180_wx_mesh_scan(dev, info, wrqu, extra); -+} -+ -+static int r8180_wx_join_mesh(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ int index; -+ int ret=0; -+ char extmeshid[32]; -+ int len=0; -+ char id[50], ch; -+//#ifdef NETWORKMANAGER_UI -+ -+ if((priv->ieee80211->iw_mode == IW_MODE_MESH) && (priv->ieee80211->iw_ext_mode == IW_MODE_MESH)){ -+ printk("join mesh %s\n",extra); -+ if (wrqu->essid.length > IW_ESSID_MAX_SIZE){ -+ ret= -E2BIG; -+ goto out; -+ } -+ //printk("wrqu->essid.length is %d\n",wrqu->essid.length); -+ //printk("wrqu->essid.flags is %d\n",wrqu->essid.flags); -+ if((wrqu->essid.length == 1) && (wrqu->essid.flags == 1)){ -+ ret = 0; -+ goto out; -+ } -+ if (wrqu->essid.flags && wrqu->essid.length) { -+ if(priv->mshobj->ext_patch_r8180_wx_get_selected_mesh_channel(dev, extra, &ch)) -+ { -+ priv->mshobj->ext_patch_r8180_wx_set_meshID(dev, extra); -+ priv->mshobj->ext_patch_r8180_wx_set_mesh_chan(dev,ch); -+ r8180_wx_set_channel(dev, NULL, NULL, &ch); -+ } -+ else -+ printk("invalid mesh #\n"); -+ -+ } -+#if 0 -+ else{ -+ if(priv->mshobj->ext_patch_r8180_wx_get_selected_mesh_channel(dev, 0, &ch)) -+ { -+ priv->mshobj->ext_patch_r8180_wx_set_meshID(dev, extra); -+ priv->mshobj->ext_patch_r8180_wx_set_mesh_chan(dev,ch); -+ r8180_wx_set_channel(dev, NULL, NULL, &ch); -+ } -+ else -+ printk("invalid mesh #\n"); -+ -+ } -+#endif -+ } -+ else{ -+//#else -+ index = *(extra); -+// printk("index=%d\n", index); -+ -+ if( ! priv->mshobj -+ || !priv->mshobj->ext_patch_r8180_wx_set_meshID -+ || !priv->mshobj->ext_patch_r8180_wx_get_selected_mesh ) -+ return 0; -+ -+ if( priv->mshobj->ext_patch_r8180_wx_get_selected_mesh(dev, index, &ch, id) ) -+ { -+ // printk("ch=%d, id=%s\n", ch, id); -+ priv->mshobj->ext_patch_r8180_wx_set_meshID(dev, id); -+ priv->mshobj->ext_patch_r8180_wx_set_mesh_chan(dev,ch); -+ r8180_wx_set_channel(dev, NULL, NULL, &ch); -+ } -+ else -+ printk("invalid mesh #\n"); -+ } -+//#endif -+out: -+ return ret; -+} -+ -+#endif // _RTL8187_EXT_PATCH_ -+ -+ -+static int r8180_wx_get_radion(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+// u8 addr; -+ -+ down(&priv->wx_sem); -+ if(priv->radion == 1) { -+ *(int *)extra = 1; -+ } else { -+ -+ *(int *)extra = 0; -+ } -+ up(&priv->wx_sem); -+ return 0; -+ -+} -+ -+static int r8180_wx_set_radion(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ int radion = *extra; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+// struct ieee80211_device *ieee = priv->ieee80211; -+ u8 btCR9346, btConfig3; -+ int i; -+ u16 u2bTFPC = 0; -+ u8 u1bTmp; -+ -+ if(priv->ieee80211->bHwRadioOff) -+ return 0; -+ -+ down(&priv->wx_sem); -+ printk("set radion = %d\n", radion); -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ if(ieee->iw_mode == ieee->iw_ext_mode) { -+ printk("mesh mode:: could not set radi on/off = %d\n", radion); -+ up(&priv->wx_sem); -+ return 0; -+ } -+#endif -+ // Set EEM0 and EEM1 in 9346CR. -+ btCR9346 = read_nic_byte(dev, CR9346); -+ write_nic_byte(dev, CR9346, (btCR9346|0xC0) ); -+ // Set PARM_En in Config3. -+ btConfig3 = read_nic_byte(dev, CONFIG3); -+ write_nic_byte(dev, CONFIG3, (btConfig3|CONFIG3_PARM_En) ); -+ -+ if ( radion == 1) //radion off -+ { -+ printk("==================>RF on\n"); -+ write_nic_dword(dev, ANAPARAM, ANAPARM_ON); -+ write_nic_dword(dev, ANAPARAM2, ANAPARM2_ON); -+ write_nic_byte(dev, CONFIG4, (priv->RFProgType)); -+ -+ write_nic_byte(dev, 0x085, 0x24); // 061219, SD3 ED: for minicard CCK power leakage issue. -+ write_rtl8225(dev, 0x4, 0x9FF); -+ -+ u1bTmp = read_nic_byte(dev, 0x24E); -+ write_nic_byte(dev, 0x24E, (u1bTmp & (~(BIT5|BIT6))) );// 070124 SD1 Alex: turn on CCK and OFDM. -+ priv->radion = 1; //radion on -+ } -+ else -+ { -+ printk("==================>RF off\n"); -+ for(i = 0; i < MAX_DOZE_WAITING_TIMES_87B; i++) -+ { // Make sure TX FIFO is empty befor turn off RFE pwoer. -+ u2bTFPC = read_nic_word(dev, TFPC); -+ if(u2bTFPC == 0) -+ { -+ break; -+ } -+ else -+ { -+ printk("%d times TFPC: %d != 0 before doze!\n", (i+1), u2bTFPC); -+ udelay(10); -+ } -+ } -+ if( i == MAX_DOZE_WAITING_TIMES_87B ) -+ { -+ printk("\n\n\n SetZebraRFPowerState8187B(): %d times TFPC: %d != 0 !!!\n\n\n",\ -+ MAX_DOZE_WAITING_TIMES_87B, u2bTFPC); -+ } -+ -+ u1bTmp = read_nic_byte(dev, 0x24E); -+ write_nic_byte(dev, 0x24E, (u1bTmp|BIT5|BIT6));// 070124 SD1 Alex: turn off CCK and OFDM. -+ -+ write_rtl8225(dev, 0x4,0x1FF); // Turn off RF first to prevent BB lock up, suggested by PJ, 2006.03.03. -+ write_nic_byte(dev, 0x085, 0x04); // 061219, SD3 ED: for minicard CCK power leakage issue. -+ -+ write_nic_byte(dev, CONFIG4, (priv->RFProgType|Config4_PowerOff)); -+ -+ write_nic_dword(dev, ANAPARAM, ANAPARM_OFF); -+ write_nic_dword(dev, ANAPARAM2, ANAPARM2_OFF); // 070301, SD1 William: to reduce RF off power consumption to 80 mA. -+ priv->radion = 0; //radion off -+ } -+ // Clear PARM_En in Config3. -+ btConfig3 &= ~(CONFIG3_PARM_En); -+ write_nic_byte(dev, CONFIG3, btConfig3); -+ // Clear EEM0 and EEM1 in 9346CR. -+ btCR9346 &= ~(0xC0); -+ write_nic_byte(dev, CR9346, btCR9346); -+ -+ up(&priv->wx_sem); -+ -+ return 0; -+} -+ -+static int r8180_wx_set_ratadpt (struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ int ratadapt = *extra; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ struct ieee80211_device *ieee = priv->ieee80211; -+ -+ if(priv->ieee80211->bHwRadioOff) -+ return 0; -+ -+ down(&priv->wx_sem); -+ printk("Set rate adaptive %s\n", (ratadapt==0)?"on":"off"); -+ if(ratadapt == 0) { -+ del_timer_sync(&priv->rateadapter_timer); -+ cancel_delayed_work(&priv->ieee80211->rate_adapter_wq); -+ priv->rateadapter_timer.function((unsigned long)dev); -+ } else { -+ del_timer_sync(&priv->rateadapter_timer); -+ cancel_delayed_work(&priv->ieee80211->rate_adapter_wq); -+ printk("force rate to %d\n", ratadapt); -+ ieee->rate = ratadapt; -+ } -+ up(&priv->wx_sem); -+ return 0; -+} -+ -+#ifdef ENABLE_TOSHIBA_CONFIG -+static int r8180_wx_get_tblidx(struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ //extern u8 chan_plan_index; -+ //printk("=========>%s(), %x\n", __FUNCTION__, priv->channel_plan); -+ down(&priv->wx_sem); -+ put_user(priv->channel_plan, (u8*)wrqu->data.pointer); -+ up(&priv->wx_sem); -+ return 0; -+ -+} -+ -+//This func will be called after probe auto -+static int r8180_wx_set_tbl (struct net_device *dev, -+ struct iw_request_info *info, -+ union iwreq_data *wrqu, char *extra) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ u8 len = 0; -+ s8 err = -1; -+ extern CHANNEL_LIST Current_tbl; -+ down(&priv->wx_sem); -+ if (!wrqu->data.pointer) -+ { -+ printk("user data pointer is null\n"); -+ goto exit; -+ } -+ len = wrqu->data.length; -+ //printk("=========>%s(), len:%d\n", __FUNCTION__, len); -+ //memset(&Current_tbl, 0, sizeof(CHANNEL_LIST)); -+ if (copy_from_user((u8*)&Current_tbl, (void*)wrqu->data.pointer, len)) -+ { -+ printk("error copy from user\n"); -+ goto exit; -+ } -+ { -+ int i; -+ Current_tbl.Len = len; -+ //printk("%d\n", Current_tbl.Len); -+ -+ Dot11d_Init(priv->ieee80211); -+ priv->ieee80211->bGlobalDomain = false; -+ priv->ieee80211->bWorldWide13 = false; -+ -+ //lzm add 081205 -+ priv->ieee80211->MinPassiveChnlNum=12; -+ priv->ieee80211->IbssStartChnl= 10; -+ -+ for (i=0; i<Current_tbl.Len; i++){ -+ //printk("%2d ", Current_tbl.Channel[i]); -+ if(priv->channel_plan == COUNTRY_CODE_ETSI) -+ { -+ if(Current_tbl.Channel[i] <= 11) -+ { -+#ifdef ENABLE_DOT11D -+ GET_DOT11D_INFO(priv->ieee80211)->channel_map[Current_tbl.Channel[i]] = 1; -+#else -+ priv->ieee80211->channel_map[Current_tbl.Channel[i]] = 1; -+#endif -+ } -+ else if((Current_tbl.Channel[i] >= 11) && (Current_tbl.Channel[i] <= 13)) -+ { -+#ifdef ENABLE_DOT11D -+ GET_DOT11D_INFO(priv->ieee80211)->channel_map[Current_tbl.Channel[i]] = 2; -+#else -+ priv->ieee80211->channel_map[Current_tbl.Channel[i]] = 2; -+#endif -+ } -+ } -+ else -+ { -+ if(Current_tbl.Channel[i] <= 14) -+ { -+#ifdef ENABLE_DOT11D -+ GET_DOT11D_INFO(priv->ieee80211)->channel_map[Current_tbl.Channel[i]] = 1; -+#else -+ priv->ieee80211->channel_map[Current_tbl.Channel[i]] = 1; -+#endif -+ } -+ } -+ } -+#if 0 -+ printk("\n"); -+ for(i=1; i<MAX_CHANNEL_NUMBER; i++) -+ { -+#ifdef ENABLE_DOT11D -+ printk("%2d ", GET_DOT11D_INFO(priv->ieee80211)->channel_map[i]); -+#else -+ printk("%2d ", priv->ieee80211->channel_map[i]); -+#endif -+ } -+ printk("\n"); -+ -+#endif -+ if(priv->ieee80211->proto_started) -+ {//we need to restart protocol now if it was start before channel map -+ ieee80211_softmac_stop_protocol(priv->ieee80211); -+ //mdelay(1); -+ ieee80211_softmac_start_protocol(priv->ieee80211); -+ } -+ } -+ err = 0; -+exit: -+ up(&priv->wx_sem); -+ return err; -+ -+ -+} -+ -+#endif -+ -+ -+static iw_handler r8180_wx_handlers[] = -+{ -+ NULL, /* SIOCSIWCOMMIT */ -+ r8180_wx_get_name, /* SIOCGIWNAME */ -+ dummy, /* SIOCSIWNWID */ -+ dummy, /* SIOCGIWNWID */ -+ r8180_wx_set_freq, /* SIOCSIWFREQ */ -+ r8180_wx_get_freq, /* SIOCGIWFREQ */ -+ r8180_wx_set_mode, /* SIOCSIWMODE */ -+ r8180_wx_get_mode, /* SIOCGIWMODE */ -+ r8180_wx_set_sens, /* SIOCSIWSENS */ -+ r8180_wx_get_sens, /* SIOCGIWSENS */ -+ NULL, /* SIOCSIWRANGE */ -+ rtl8180_wx_get_range, /* SIOCGIWRANGE */ -+ NULL, /* SIOCSIWPRIV */ -+ NULL, /* SIOCGIWPRIV */ -+ NULL, /* SIOCSIWSTATS */ -+ NULL, /* SIOCGIWSTATS */ -+ dummy, /* SIOCSIWSPY */ -+ dummy, /* SIOCGIWSPY */ -+ NULL, /* SIOCGIWTHRSPY */ -+ NULL, /* SIOCWIWTHRSPY */ -+ r8180_wx_set_wap, /* SIOCSIWAP */ -+ r8180_wx_get_wap, /* SIOCGIWAP */ -+ r8180_wx_set_mlme, //NULL, /* SIOCSIWMLME*/ /* -- hole -- */ -+ dummy, /* SIOCGIWAPLIST -- depricated */ -+ r8180_wx_set_scan, /* SIOCSIWSCAN */ -+ r8180_wx_get_scan, /* SIOCGIWSCAN */ -+ r8180_wx_set_essid, /* SIOCSIWESSID */ -+ r8180_wx_get_essid, /* SIOCGIWESSID */ -+ dummy, /* SIOCSIWNICKN */ -+ dummy, /* SIOCGIWNICKN */ -+ NULL, /* -- hole -- */ -+ NULL, /* -- hole -- */ -+ r8180_wx_set_rate, /* SIOCSIWRATE */ -+ r8180_wx_get_rate, /* SIOCGIWRATE */ -+ dummy, /* SIOCSIWRTS */ -+ dummy, /* SIOCGIWRTS */ -+ r8180_wx_set_frag, /* SIOCSIWFRAG */ -+ r8180_wx_get_frag, /* SIOCGIWFRAG */ -+ dummy, /* SIOCSIWTXPOW */ -+ dummy, /* SIOCGIWTXPOW */ -+ r8180_wx_set_retry, /* SIOCSIWRETRY */ -+ r8180_wx_get_retry, /* SIOCGIWRETRY */ -+ r8180_wx_set_enc, /* SIOCSIWENCODE */ -+ r8180_wx_get_enc, /* SIOCGIWENCODE */ -+ dummy, /* SIOCSIWPOWER */ -+ dummy, /* SIOCGIWPOWER */ -+ NULL, /*---hole---*/ -+ NULL, /*---hole---*/ -+ r8180_wx_set_gen_ie,//NULL, /* SIOCSIWGENIE */ -+ NULL, /* SIOCSIWGENIE */ -+ r8180_wx_set_auth,//NULL, /* SIOCSIWAUTH */ -+ NULL,//r8180_wx_get_auth,//NULL, /* SIOCSIWAUTH */ -+ r8180_wx_set_enc_ext, /* SIOCSIWENCODEEXT */ -+ NULL,//r8180_wx_get_enc_ext,//NULL, /* SIOCSIWENCODEEXT */ -+ NULL, /* SIOCSIWPMKSA */ -+ NULL, /*---hole---*/ -+}; -+ -+ -+static const struct iw_priv_args r8180_private_args[] = { -+ { -+ SIOCIWFIRSTPRIV + 0x0, -+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc" -+ }, -+ -+ { -+ SIOCIWFIRSTPRIV + 0x1, -+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan" -+ -+ }, -+ { -+ SIOCIWFIRSTPRIV + 0x2, -+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx" -+ }, -+#ifdef JOHN_IOCTL -+ { -+ SIOCIWFIRSTPRIV + 0x3, -+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "readRF" -+ } -+ , -+ { -+ SIOCIWFIRSTPRIV + 0x4, -+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "writeRF" -+ } -+ , -+ { -+ SIOCIWFIRSTPRIV + 0x5, -+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "readBB" -+ } -+ , -+ { -+ SIOCIWFIRSTPRIV + 0x6, -+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "writeBB" -+ } -+ , -+ { -+ SIOCIWFIRSTPRIV + 0x7, -+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "readnicb" -+ } -+ , -+ { -+ SIOCIWFIRSTPRIV + 0x8, -+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "writenicb" -+ } -+ , -+ { -+ SIOCIWFIRSTPRIV + 0x9, -+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "apinfo" -+ }, -+#endif -+ { -+ SIOCIWFIRSTPRIV + 0xA, -+ 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED |1, "getradion" -+ }, -+ { -+ SIOCIWFIRSTPRIV + 0xB, -+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "setradion" -+ }, -+ { -+ SIOCIWFIRSTPRIV + 0xC, -+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "ratadpt" -+ }, -+#ifdef ENABLE_TOSHIBA_CONFIG -+ { -+ SIOCIWFIRSTPRIV + 0xD, -+ 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "gettblidx" -+ }, -+ { -+ SIOCIWFIRSTPRIV + 0xE, -+ IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,0, "settblidx" -+ }, -+ -+#endif -+ -+}; -+ -+/* -+ * Private ioctl interface information -+ -+struct iw_priv_args -+{ -+// __u32 cmd; -+// __u16 set_args; -+// __u16 get_args; -+// char name[IFNAMSIZ]; -+//}; -+*/ -+//If get cmd's number is big,there may cause some problemes. -+//So modified by Lawrence,071120 -+ -+static iw_handler r8180_private_handler[] = { -+// r8180_wx_set_monitor, /* SIOCIWFIRSTPRIV */ -+ r8180_wx_set_crcmon, /*SIOCIWSECONDPRIV*/ -+// r8180_wx_set_forceassociate, -+// r8180_wx_set_beaconinterval, -+// r8180_wx_set_monitor_type, -+ r8180_wx_set_scan_type, -+ r8180_wx_set_rawtx, -+ -+#if 0 -+#ifdef _RTL8187_EXT_PATCH_ -+ r8180_wx_get_meshinfo, -+ r8180_wx_enable_mesh, -+ r8180_wx_disable_mesh, -+ r8180_wx_set_channel, -+ r8180_wx_set_meshID, -+ -+// r8180_wx_add_mac_allow, -+// r8180_wx_get_mac_allow, -+// r8180_wx_del_mac_allow, -+ r8180_wx_add_mac_deny, -+ r8180_wx_get_mac_deny, -+ r8180_wx_del_mac_deny, -+ r8180_wx_get_mesh_list, -+ r8180_wx_mesh_scan, -+ r8180_wx_join_mesh, -+#endif -+#endif -+ -+#ifdef JOHN_IOCTL -+ r8180_wx_read_regs, -+ r8180_wx_write_regs, -+ r8180_wx_read_bb, -+ r8180_wx_write_bb, -+ r8180_wx_read_nicb, -+ r8180_wx_write_nicb, -+ r8180_wx_get_ap_status, -+#endif -+ r8180_wx_get_radion, -+ r8180_wx_set_radion, -+ r8180_wx_set_ratadpt, -+#ifdef ENABLE_TOSHIBA_CONFIG -+ r8180_wx_get_tblidx, -+ r8180_wx_set_tbl, -+#endif -+}; -+ -+#if WIRELESS_EXT >= 17 -+//WB modefied to show signal to GUI on 18-01-2008 -+static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ struct ieee80211_device* ieee = priv->ieee80211; -+ struct iw_statistics* wstats = &priv->wstats; -+// struct ieee80211_network* target = NULL; -+ int tmp_level = 0; -+ int tmp_qual = 0; -+ int tmp_noise = 0; -+// unsigned long flag; -+ -+ if (ieee->state < IEEE80211_LINKED) -+ { -+ wstats->qual.qual = 0; -+ wstats->qual.level = 0; -+ wstats->qual.noise = 0; -+ wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; -+ return wstats; -+ } -+#if 0 -+ spin_lock_irqsave(&ieee->lock, flag); -+ list_for_each_entry(target, &ieee->network_list, list) -+ { -+ if (is_same_network(target, &ieee->current_network)) -+ { -+ printk("it's same network:%s\n", target->ssid); -+#if 0 -+ if (!tmp_level) -+ { -+ tmp_level = target->stats.signalstrength; -+ tmp_qual = target->stats.signal; -+ } -+ else -+ { -+ -+ tmp_level = (15*tmp_level + target->stats.signalstrength)/16; -+ tmp_qual = (15*tmp_qual + target->stats.signal)/16; -+ } -+#else -+ tmp_level = target->stats.signal; -+ tmp_qual = target->stats.signalstrength; -+ tmp_noise = target->stats.noise; -+ printk("level:%d, qual:%d, noise:%d\n", tmp_level, tmp_qual, tmp_noise); -+#endif -+ break; -+ } -+ } -+ spin_unlock_irqrestore(&ieee->lock, flag); -+#endif -+ tmp_level = (&ieee->current_network)->stats.signal; -+ tmp_qual = (&ieee->current_network)->stats.signalstrength; -+ tmp_noise = (&ieee->current_network)->stats.noise; -+ //printk("level:%d, qual:%d, noise:%d\n", tmp_level, tmp_qual, tmp_noise); -+ -+ wstats->qual.level = tmp_level; -+ wstats->qual.qual = tmp_qual; -+ wstats->qual.noise = tmp_noise; -+ wstats->qual.updated = IW_QUAL_ALL_UPDATED| IW_QUAL_DBM; -+ return wstats; -+} -+#endif -+ -+ -+struct iw_handler_def r8180_wx_handlers_def={ -+ .standard = r8180_wx_handlers, -+ .num_standard = sizeof(r8180_wx_handlers) / sizeof(iw_handler), -+ .private = r8180_private_handler, -+ .num_private = sizeof(r8180_private_handler) / sizeof(iw_handler), -+ .num_private_args = sizeof(r8180_private_args) / sizeof(struct iw_priv_args), -+#if WIRELESS_EXT >= 17 -+ .get_wireless_stats = r8180_get_wireless_stats, -+#endif -+ .private_args = (struct iw_priv_args *)r8180_private_args, -+}; -+#ifdef _RTL8187_EXT_PATCH_ -+EXPORT_SYMBOL(r8180_wx_set_channel); -+#endif -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8180_wx.h linux-2.6.35/drivers/net/wireless/rtl8187b/r8180_wx.h ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8180_wx.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/r8180_wx.h 2010-08-05 21:12:35.413620698 +0200 -@@ -0,0 +1,21 @@ -+/* -+ This is part of rtl8180 OpenSource driver - v 0.3 -+ Copyright (C) Andrea Merello 2004 <andreamrl@tiscali.it> -+ Released under the terms of GPL (General Public Licence) -+ -+ Parts of this driver are based on the GPL part of the official realtek driver -+ Parts of this driver are based on the rtl8180 driver skeleton from Patric Schenke & Andres Salomon -+ Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver -+ -+ We want to tanks the Authors of such projects and the Ndiswrapper project Authors. -+*/ -+ -+/* this file (will) contains wireless extension handlers*/ -+ -+#ifndef R8180_WX_H -+#define R8180_WX_H -+#include <linux/wireless.h> -+#include "ieee80211/ieee80211.h" -+extern struct iw_handler_def r8180_wx_handlers_def; -+ -+#endif -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8187_core.c linux-2.6.35/drivers/net/wireless/rtl8187b/r8187_core.c ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8187_core.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/r8187_core.c 2010-08-05 21:12:35.453623576 +0200 -@@ -0,0 +1,7042 @@ -+/* -+ This is part of rtl8187 OpenSource driver - v 0.1 -+ Copyright (C) Andrea Merello 2005 <andreamrl@tiscali.it> -+ Released under the terms of GPL (General Public License) -+ -+ -+ Parts of this driver are based on the rtl8180 driver skeleton -+ from Patric Schenke & Andres Salomon. -+ -+ Parts of this driver are based on the Intel Pro Wireless 2*00 GPL drivers. -+ -+ some ideas might be derived from David Young rtl8180 netbsd driver. -+ -+ Parts of the usb code are from the r8150.c driver in linux kernel -+ -+ Some ideas borrowed from the 8139too.c driver included in linux kernel. -+ -+ We (I?) want to thanks the Authors of those projecs and also the -+ Ndiswrapper's project Authors. -+ -+ A special big thanks goes also to Realtek corp. for their help in my -+ attempt to add RTL8187 and RTL8225 support, and to David Young also. -+ -+ - Please note that this file is a modified version from rtl8180-sa2400 -+ drv. So some other people have contributed to this project, and they are -+ thanked in the rtl8180-sa2400 CHANGELOG. -+*/ -+ -+#undef LOOP_TEST -+#undef DUMP_RX -+#undef DUMP_TX -+#undef DEBUG_TX_DESC2 -+#undef RX_DONT_PASS_UL -+#undef DEBUG_EPROM -+#undef DEBUG_RX_VERBOSE -+#undef DUMMY_RX -+#undef DEBUG_ZERO_RX -+#undef DEBUG_RX_SKB -+#undef DEBUG_TX_FRAG -+#undef DEBUG_RX_FRAG -+#undef DEBUG_TX_FILLDESC -+#undef DEBUG_TX -+#undef DEBUG_IRQ -+#undef DEBUG_RX -+#undef DEBUG_RXALLOC -+#undef DEBUG_REGISTERS -+#undef DEBUG_RING -+#undef DEBUG_IRQ_TASKLET -+#undef DEBUG_TX_ALLOC -+#undef DEBUG_TX_DESC -+#undef CONFIG_SOFT_BEACON -+#undef DEBUG_RW_REGISTER -+ -+#define CONFIG_RTL8180_IO_MAP -+//#define CONFIG_SOFT_BEACON -+//#define DEBUG_RW_REGISTER -+ -+#include "r8180_hw.h" -+#include "r8187.h" -+#include "r8180_rtl8225.h" /* RTL8225 Radio frontend */ -+#include "r8180_93cx6.h" /* Card EEPROM */ -+#include "r8180_wx.h" -+#include "r8180_dm.h" -+ -+#include <linux/dmapool.h> -+ -+#include <linux/usb.h> -+// FIXME: check if 2.6.7 is ok -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7)) -+#define usb_kill_urb usb_unlink_urb -+#endif -+ -+#ifdef CONFIG_RTL8180_PM -+#include "r8180_pm.h" -+#endif -+ -+#ifdef ENABLE_DOT11D -+#include "dot11d.h" -+#endif -+ -+#ifndef USB_VENDOR_ID_REALTEK -+#define USB_VENDOR_ID_REALTEK 0x0bda -+#endif -+#ifndef USB_VENDOR_ID_NETGEAR -+#define USB_VENDOR_ID_NETGEAR 0x0846 -+#endif -+ -+#define TXISR_SELECT(priority) ((priority == MANAGE_PRIORITY)?rtl8187_managetx_isr:\ -+ (priority == BEACON_PRIORITY)?rtl8187_beacontx_isr: \ -+ (priority == VO_PRIORITY)?rtl8187_votx_isr: \ -+ (priority == VI_PRIORITY)?rtl8187_vitx_isr:\ -+ (priority == BE_PRIORITY)?rtl8187_betx_isr:rtl8187_bktx_isr) -+ -+static struct usb_device_id rtl8187_usb_id_tbl[] = { -+ {USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x8187)}, -+ {USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x8189)}, -+// {USB_DEVICE_VER(USB_VENDOR_ID_REALTEK, 0x8187,0x0200,0x0200)}, -+ {USB_DEVICE(USB_VENDOR_ID_NETGEAR, 0x6100)}, -+ {USB_DEVICE(USB_VENDOR_ID_NETGEAR, 0x6a00)}, -+ {USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x8197)}, -+ {USB_DEVICE(USB_VENDOR_ID_REALTEK, 0x8198)}, -+ {} -+}; -+ -+static char* ifname = "wlan%d"; -+#if 0 -+static int hwseqnum = 0; -+static int hwwep = 0; -+#endif -+static int channels = 0x3fff; -+//static int channels = 0x7ff;// change by thomas, use 1 - 11 channel 0907-2007 -+#define eqMacAddr(a,b) ( ((a)[0]==(b)[0] && (a)[1]==(b)[1] && (a)[2]==(b)[2] && (a)[3]==(b)[3] && (a)[4]==(b)[4] && (a)[5]==(b)[5]) ? 1:0 ) -+//by amy for rate adaptive -+#define DEFAULT_RATE_ADAPTIVE_TIMER_PERIOD 300 -+//by amy for rate adaptive -+//by amy for ps -+#define IEEE80211_WATCH_DOG_TIME 2000 -+//by amy for ps -+MODULE_LICENSE("GPL"); -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) -+MODULE_VERSION("V 1.1"); -+#endif -+MODULE_DEVICE_TABLE(usb, rtl8187_usb_id_tbl); -+MODULE_AUTHOR("Realsil Wlan"); -+MODULE_DESCRIPTION("Linux driver for Realtek RTL8187 WiFi cards"); -+ -+#if 0 -+MODULE_PARM(ifname,"s"); -+MODULE_PARM_DESC(devname," Net interface name, wlan%d=default"); -+ -+MODULE_PARM(hwseqnum,"i"); -+MODULE_PARM_DESC(hwseqnum," Try to use hardware 802.11 header sequence numbers. Zero=default"); -+ -+MODULE_PARM(hwwep,"i"); -+MODULE_PARM_DESC(hwwep," Try to use hardware WEP support. Still broken and not available on all cards"); -+ -+MODULE_PARM(channels,"i"); -+MODULE_PARM_DESC(channels," Channel bitmask for specific locales. NYI"); -+#endif -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9) -+module_param(ifname, charp, S_IRUGO|S_IWUSR ); -+//module_param(hwseqnum,int, S_IRUGO|S_IWUSR); -+//module_param(hwwep,int, S_IRUGO|S_IWUSR); -+module_param(channels,int, S_IRUGO|S_IWUSR); -+#else -+MODULE_PARM(ifname, "s"); -+//MODULE_PARM(hwseqnum,"i"); -+//MODULE_PARM(hwwep,"i"); -+MODULE_PARM(channels,"i"); -+#endif -+ -+MODULE_PARM_DESC(devname," Net interface name, wlan%d=default"); -+//MODULE_PARM_DESC(hwseqnum," Try to use hardware 802.11 header sequence numbers. Zero=default"); -+//MODULE_PARM_DESC(hwwep," Try to use hardware WEP support. Still broken and not available on all cards"); -+MODULE_PARM_DESC(channels," Channel bitmask for specific locales. NYI"); -+ -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+static int __devinit rtl8187_usb_probe(struct usb_interface *intf, -+ const struct usb_device_id *id); -+static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf); -+#else -+static void *__devinit rtl8187_usb_probe(struct usb_device *udev,unsigned int ifnum, -+ const struct usb_device_id *id); -+static void __devexit rtl8187_usb_disconnect(struct usb_device *udev, void *ptr); -+#endif -+ -+ -+static struct usb_driver rtl8187_usb_driver = { -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 15) -+ .owner = THIS_MODULE, -+#endif -+ .name = RTL8187_MODULE_NAME, /* Driver name */ -+ .id_table = rtl8187_usb_id_tbl, /* PCI_ID table */ -+ .probe = rtl8187_usb_probe, /* probe fn */ -+ .disconnect = rtl8187_usb_disconnect, /* remove fn */ -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0) -+#ifdef CONFIG_RTL8180_PM -+ .suspend = rtl8187_suspend, /* PM suspend fn */ -+ .resume = rtl8187_resume, /* PM resume fn */ -+#else -+ .suspend = NULL, /* PM suspend fn */ -+ .resume = NULL, /* PM resume fn */ -+#endif -+#endif -+}; -+ -+#ifdef JOHN_HWSEC -+void CAM_mark_invalid(struct net_device *dev, u8 ucIndex) -+{ -+ u32 ulContent=0; -+ u32 ulCommand=0; -+ u32 ulEncAlgo=CAM_AES; -+ -+ // keyid must be set in config field -+ ulContent |= (ucIndex&3) | ((u16)(ulEncAlgo)<<2); -+ -+ ulContent |= BIT15; -+ // polling bit, and No Write enable, and address -+ ulCommand= CAM_CONTENT_COUNT*ucIndex; -+ ulCommand= ulCommand | BIT31|BIT16; -+ // write content 0 is equall to mark invalid -+ -+ write_nic_dword(dev, WCAMI, ulContent); //delay_ms(40); -+ //RT_TRACE(COMP_SEC, DBG_LOUD, ("CAM_mark_invalid(): WRITE A4: %x \n",ulContent)); -+ write_nic_dword(dev, RWCAM, ulCommand); //delay_ms(40); -+ //RT_TRACE(COMP_SEC, DBG_LOUD, ("CAM_mark_invalid(): WRITE A0: %x \n",ulCommand)); -+} -+ -+void CAM_empty_entry(struct net_device *dev, u8 ucIndex) -+{ -+ u32 ulCommand=0; -+ u32 ulContent=0; -+ u8 i; -+ u32 ulEncAlgo=CAM_AES; -+ -+ for(i=0;i<6;i++) -+ { -+ -+ // filled id in CAM config 2 byte -+ if( i == 0) -+ { -+ ulContent |=(ucIndex & 0x03) | (ulEncAlgo<<2); -+ ulContent |= BIT15; -+ -+ } -+ else -+ { -+ ulContent = 0; -+ } -+ // polling bit, and No Write enable, and address -+ ulCommand= CAM_CONTENT_COUNT*ucIndex+i; -+ ulCommand= ulCommand | BIT31|BIT16; -+ // write content 0 is equall to mark invalid -+ write_nic_dword(dev, WCAMI, ulContent); //delay_ms(40); -+ //RT_TRACE(COMP_SEC, DBG_LOUD, ("CAM_empty_entry(): WRITE A4: %x \n",ulContent)); -+ write_nic_dword(dev, RWCAM, ulCommand); //delay_ms(40); -+ //RT_TRACE(COMP_SEC, DBG_LOUD, ("CAM_empty_entry(): WRITE A0: %x \n",ulCommand)); -+ } -+} -+ -+void CamResetAllEntry(struct net_device *dev) -+{ -+ u8 ucIndex; -+ -+ //2004/02/11 In static WEP, OID_ADD_KEY or OID_ADD_WEP are set before STA associate to AP. -+ // However, ResetKey is called on OID_802_11_INFRASTRUCTURE_MODE and MlmeAssociateRequest -+ // In this condition, Cam can not be reset because upper layer will not set this static key again. -+ //if(Adapter->EncAlgorithm == WEP_Encryption) -+ // return; -+ //debug -+ //DbgPrint("========================================\n"); -+ //DbgPrint(" Call ResetAllEntry \n"); -+ //DbgPrint("========================================\n\n"); -+ -+ for(ucIndex=0;ucIndex<TOTAL_CAM_ENTRY;ucIndex++) -+ CAM_mark_invalid(dev, ucIndex); -+ for(ucIndex=0;ucIndex<TOTAL_CAM_ENTRY;ucIndex++) -+ CAM_empty_entry(dev, ucIndex); -+ -+} -+ -+ -+void write_cam(struct net_device *dev, u8 addr, u32 data) -+{ -+ write_nic_dword(dev, WCAMI, data); -+ write_nic_dword(dev, RWCAM, BIT31|BIT16|(addr&0xff) ); -+} -+u32 read_cam(struct net_device *dev, u8 addr) -+{ -+ write_nic_dword(dev, RWCAM, 0x80000000|(addr&0xff) ); -+ return read_nic_dword(dev, 0xa8); -+} -+#endif /*JOHN_HWSEC*/ -+ -+#ifdef DEBUG_RW_REGISTER -+//lzm add for write time out test -+void add_into_rw_registers(struct net_device *dev, u32 addr, u32 cont, u8 flag) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ int reg_index = (priv->write_read_register_index % 200) ; -+ -+ priv->write_read_registers[reg_index].address = 0; -+ priv->write_read_registers[reg_index].content = 0; -+ priv->write_read_registers[reg_index].flag = 0; -+ -+ priv->write_read_registers[reg_index].address = addr; -+ priv->write_read_registers[reg_index].content = cont; -+ priv->write_read_registers[reg_index].flag = flag; -+ -+ priv->write_read_register_index = (priv->write_read_register_index + 1) % 200; -+} -+ -+bool print_once = 0; -+ -+void print_rw_registers(struct net_device *dev) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ int reg_index = 0; -+ int watchdog = 0; -+ if(print_once == false) -+ { -+ print_once = true; -+ for(reg_index = ((priv->write_read_register_index + 1) % 200); watchdog <= 199; reg_index++) -+ { -+ watchdog++; -+ printk("====>reg_addr:0x%x, reg_cont:0x%x, read_or_write:0x%d\n", -+ priv->write_read_registers[reg_index].address, -+ priv->write_read_registers[reg_index].content, -+ priv->write_read_registers[reg_index].flag); -+ } -+ } -+} -+//lzm add for write time out test -+#endif -+ -+#ifdef CPU_64BIT -+void write_nic_byte_E(struct net_device *dev, int indx, u8 data) -+{ -+ int status; -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ struct usb_device *udev = priv->udev; -+ -+ status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), -+ RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, -+ indx|0xfe00, 0, &data, 1, HZ / 2); -+ -+//lzm add for write time out test -+#ifdef DEBUG_RW_REGISTER -+ add_into_rw_registers(dev, indx, data, 2); -+#endif -+ -+ if (status < 0) -+ { -+ printk("write_nic_byte_E TimeOut!addr:%x, status:%x\n", indx, status); -+#ifdef DEBUG_RW_REGISTER -+ print_rw_registers(dev); -+#endif -+ } -+} -+ -+u8 read_nic_byte_E(struct net_device *dev, int indx) -+{ -+ int status; -+ u8 data, *buf; -+ dma_addr_t dma_handle; -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ struct usb_device *udev = priv->udev; -+ -+ buf = dma_pool_alloc(priv->usb_pool, GFP_ATOMIC, &dma_handle); -+ if (!buf) { -+ printk("read_nic_byte_E out of memory\n"); -+ return -ENOMEM; -+ } -+ status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), -+ RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, -+ indx|0xfe00, 0, buf, 1, HZ / 2); -+//lzm add for write time out test -+#ifdef DEBUG_RW_REGISTER -+ add_into_rw_registers(dev, indx, buf[0], 1); -+#endif -+ -+ if (status < 0) -+ { -+ printk("read_nic_byte_E TimeOut!addr:%x, status:%x\n",indx, status); -+#ifdef DEBUG_RW_REGISTER -+ print_rw_registers(dev); -+#endif -+ } -+ -+ data = buf[0]; -+ dma_pool_free(priv->usb_pool, buf, dma_handle); -+ return data; -+} -+ -+void write_nic_byte(struct net_device *dev, int indx, u8 data) -+{ -+ int status; -+ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ struct usb_device *udev = priv->udev; -+ -+ status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), -+ RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, -+ (indx&0xff)|0xff00, (indx>>8)&0x03, &data, 1, HZ / 2); -+ -+//lzm add for write time out test -+#ifdef DEBUG_RW_REGISTER -+ add_into_rw_registers(dev, indx, data, 2); -+#endif -+ if (status < 0) -+ { -+ printk("write_nic_byte TimeOut!addr:%x, status:%x\n",indx, status); -+#ifdef DEBUG_RW_REGISTER -+ print_rw_registers(dev); -+#endif -+ } -+ -+ -+} -+ -+void write_nic_word(struct net_device *dev, int indx, u16 data) -+{ -+ -+ int status; -+ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ struct usb_device *udev = priv->udev; -+ -+ status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), -+ RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, -+ (indx&0xff)|0xff00, (indx>>8)&0x03, &data, 2, HZ / 2); -+ -+//lzm add for write time out test -+#ifdef DEBUG_RW_REGISTER -+ add_into_rw_registers(dev, indx, data, 2); -+ -+ if(priv->write_read_register_index == 199) -+ { -+ //print_rw_registers(dev); -+ } -+#endif -+ if (status < 0) -+ { -+ printk("write_nic_word TimeOut!addr:%x, status:%x\n",indx, status); -+#ifdef DEBUG_RW_REGISTER -+ print_rw_registers(dev); -+#endif -+ } -+ -+} -+ -+void write_nic_dword(struct net_device *dev, int indx, u32 data) -+{ -+ -+ int status; -+ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ struct usb_device *udev = priv->udev; -+ -+ status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), -+ RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, -+ (indx&0xff)|0xff00, (indx>>8)&0x03, &data, 4, HZ / 2); -+//lzm add for write time out test -+#ifdef DEBUG_RW_REGISTER -+ add_into_rw_registers(dev, indx, data, 2); -+#endif -+ -+ -+ if (status < 0) -+ { -+ printk("write_nic_dword TimeOut!addr:%x, status:%x\n",indx, status); -+#ifdef DEBUG_RW_REGISTER -+ print_rw_registers(dev); -+#endif -+ } -+ -+} -+ -+ u8 read_nic_byte(struct net_device *dev, int indx) -+{ -+ u8 data, *buf; -+ int status; -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ struct usb_device *udev = priv->udev; -+ dma_addr_t dma_handle; -+ -+ buf = dma_pool_alloc(priv->usb_pool, GFP_ATOMIC, &dma_handle); -+ if (!buf) { -+ printk("read_nic_byte: out of memory\n"); -+ return -ENOMEM; -+ } -+ status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), -+ RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, -+ (indx&0xff)|0xff00, (indx>>8)&0x03, buf, 1, HZ / 2); -+//lzm add for write time out test -+#ifdef DEBUG_RW_REGISTER -+ add_into_rw_registers(dev, indx, buf[0], 1); -+#endif -+ -+ if (status < 0) -+ { -+ printk("read_nic_byte TimeOut!addr:%x, status:%x\n",indx, status); -+#ifdef DEBUG_RW_REGISTER -+ print_rw_registers(dev); -+#endif -+ } -+ -+ data = buf[0]; -+ dma_pool_free(priv->usb_pool, buf, dma_handle); -+ return data; -+} -+ -+u16 read_nic_word(struct net_device *dev, int indx) -+{ -+ u16 data, *buf; -+ int status; -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ struct usb_device *udev = priv->udev; -+ dma_addr_t dma_handle; -+ -+ buf = dma_pool_alloc(priv->usb_pool, GFP_ATOMIC, &dma_handle); -+ if (!buf) { -+ printk("read_nic_word: out of memory\n"); -+ return -ENOMEM; -+ } -+ status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), -+ RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, -+ (indx&0xff)|0xff00, (indx>>8)&0x03, buf, 2, HZ / 2); -+//lzm add for write time out test -+#ifdef DEBUG_RW_REGISTER -+ add_into_rw_registers(dev, indx, buf[0], 1); -+#endif -+ -+ if (status < 0) -+ { -+ printk("read_nic_word TimeOut!addr:%x, status:%x\n",indx, status); -+#ifdef DEBUG_RW_REGISTER -+ print_rw_registers(dev); -+#endif -+ } -+ -+ -+ data = buf[0]; -+ dma_pool_free(priv->usb_pool, buf, dma_handle); -+ return data; -+} -+ -+u32 read_nic_dword(struct net_device *dev, int indx) -+{ -+ u32 data, *buf; -+ int status; -+ dma_addr_t dma_handle; -+// int result; -+ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ struct usb_device *udev = priv->udev; -+ -+ buf = dma_pool_alloc(priv->usb_pool, GFP_ATOMIC, &dma_handle); -+ if (!buf){ -+ printk("read_nic_dword: out of memory\n"); -+ return -ENOMEM; -+ } -+ status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), -+ RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, -+ (indx&0xff)|0xff00, (indx>>8)&0x03, buf, 4, HZ / 2); -+//lzm add for write time out test -+#ifdef DEBUG_RW_REGISTER -+ add_into_rw_registers(dev, indx, buf[0], 1); -+#endif -+ -+ if (status < 0) -+ { -+ printk("read_nic_dword TimeOut!addr:%x, status:%x\n",indx, status); -+#ifdef DEBUG_RW_REGISTER -+ print_rw_registers(dev); -+#endif -+ } -+ -+ -+ -+ data = buf[0]; -+ dma_pool_free(priv->usb_pool, buf, dma_handle); -+ return data; -+} -+#else -+void write_nic_byte_E(struct net_device *dev, int indx, u8 data) -+{ -+ int status; -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ struct usb_device *udev = priv->udev; -+ -+ status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), -+ RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, -+ indx|0xfe00, 0, &data, 1, HZ / 2); -+ -+ if (status < 0) -+ { -+ printk("write_nic_byte_E TimeOut!addr:0x%x,val:0x%x, status:%x\n", indx,data,status); -+ } -+} -+ -+u8 read_nic_byte_E(struct net_device *dev, int indx) -+{ -+ int status; -+ u8 data = 0; -+ u8 buf[64]; -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ struct usb_device *udev = priv->udev; -+ -+ status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), -+ RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, -+ indx|0xfe00, 0, buf, 1, HZ / 2); -+ -+ if (status < 0) -+ { -+ printk("read_nic_byte_E TimeOut!addr:0x%x, status:%x\n", indx, status); -+ } -+ -+ data = *(u8*)buf; -+ return data; -+} -+ -+void write_nic_byte(struct net_device *dev, int indx, u8 data) -+{ -+ int status; -+ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ struct usb_device *udev = priv->udev; -+ -+ status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), -+ RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, -+ (indx&0xff)|0xff00, (indx>>8)&0x03, &data, 1, HZ / 2); -+ -+ if (status < 0) -+ { -+ printk("write_nic_byte TimeOut!addr:0x%x,val:0x%x, status:%x\n", indx,data, status); -+ } -+ -+ -+} -+ -+void write_nic_word(struct net_device *dev, int indx, u16 data) -+{ -+ -+ int status; -+ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ struct usb_device *udev = priv->udev; -+ -+ status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), -+ RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, -+ (indx&0xff)|0xff00, (indx>>8)&0x03, &data, 2, HZ / 2); -+ -+ if (status < 0) -+ { -+ printk("write_nic_word TimeOut!addr:0x%x,val:0x%x, status:%x\n", indx,data, status); -+ } -+ -+} -+ -+void write_nic_dword(struct net_device *dev, int indx, u32 data) -+{ -+ -+ int status; -+ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ struct usb_device *udev = priv->udev; -+ -+ status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), -+ RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE, -+ (indx&0xff)|0xff00, (indx>>8)&0x03, &data, 4, HZ / 2); -+ -+ -+ if (status < 0) -+ { -+ printk("write_nic_dword TimeOut!addr:0x%x,val:0x%x, status:%x\n", indx,data, status); -+ } -+ -+} -+ -+u8 read_nic_byte(struct net_device *dev, int indx) -+{ -+ u8 data = 0; -+ u8 buf[64]; -+ int status; -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ struct usb_device *udev = priv->udev; -+ -+ status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), -+ RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, -+ (indx&0xff)|0xff00, (indx>>8)&0x03, buf, 1, HZ / 2); -+ -+ if (status < 0) -+ { -+ printk("read_nic_byte TimeOut!addr:0x%x,status:%x\n", indx,status); -+ } -+ -+ -+ data = *(u8*)buf; -+ return data; -+} -+ -+u16 read_nic_word(struct net_device *dev, int indx) -+{ -+ u16 data = 0; -+ u8 buf[64]; -+ int status; -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ struct usb_device *udev = priv->udev; -+ -+ status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), -+ RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, -+ (indx&0xff)|0xff00, (indx>>8)&0x03, buf, 2, HZ / 2); -+ -+ if (status < 0) -+ { -+ printk("read_nic_word TimeOut!addr:0x%x,status:%x\n", indx,status); -+ } -+ -+ data = *(u16*)buf; -+ return data; -+} -+ -+u32 read_nic_dword(struct net_device *dev, int indx) -+{ -+ u32 data = 0; -+ u8 buf[64]; -+ int status; -+ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ struct usb_device *udev = priv->udev; -+ -+ status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), -+ RTL8187_REQ_GET_REGS, RTL8187_REQT_READ, -+ (indx&0xff)|0xff00, (indx>>8)&0x03, buf, 4, HZ / 2); -+ -+ if (status < 0) -+ { -+ printk("read_nic_dword TimeOut!addr:0x%x,status:%x\n", indx, status); -+ } -+ -+ -+ data = *(u32*)buf; -+ return data; -+} -+#endif -+ -+ -+u8 read_phy_cck(struct net_device *dev, u8 adr); -+u8 read_phy_ofdm(struct net_device *dev, u8 adr); -+/* this might still called in what was the PHY rtl8185/rtl8187 common code -+ * plans are to possibilty turn it again in one common code... -+ */ -+inline void force_pci_posting(struct net_device *dev) -+{ -+} -+ -+ -+static struct net_device_stats *rtl8180_stats(struct net_device *dev); -+void rtl8180_commit(struct net_device *dev); -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) -+void rtl8180_restart(struct work_struct *work); -+#else -+void rtl8180_restart(struct net_device *dev); -+#endif -+/**************************************************************************** -+ -----------------------------PROCFS STUFF------------------------- -+*****************************************************************************/ -+ -+static struct proc_dir_entry *rtl8180_proc = NULL; -+static int proc_get_stats_ap(char *page, char **start, -+ off_t offset, int count, -+ int *eof, void *data) -+{ -+ struct net_device *dev = data; -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ struct ieee80211_device *ieee = priv->ieee80211; -+ struct ieee80211_network *target; -+ -+ int len = 0; -+ -+ list_for_each_entry(target, &ieee->network_list, list) { -+ -+ len += snprintf(page + len, count - len, -+ "%s ", target->ssid); -+ len += snprintf(page + len, count - len, -+ "%ld ", (jiffies-target->last_scanned)/HZ); -+ -+ -+ -+ if(target->wpa_ie_len>0 || target->rsn_ie_len>0){ -+ len += snprintf(page + len, count - len, -+ "WPA\n"); -+ } -+ else{ -+ len += snprintf(page + len, count - len, -+ "non_WPA\n"); -+ } -+ -+ } -+ -+ *eof = 1; -+ return len; -+} -+ -+static int proc_get_registers(char *page, char **start, -+ off_t offset, int count, -+ int *eof, void *data) -+{ -+ struct net_device *dev = data; -+ -+ int len = 0; -+ int i,n; -+ -+ int max=0xff; -+ -+ /* This dump the current register page */ -+len += snprintf(page + len, count - len, -+ "\n####################page 0##################\n "); -+ -+ for(n=0;n<=max;) -+ { -+ //printk( "\nD: %2x> ", n); -+ len += snprintf(page + len, count - len, -+ "\nD: %2x > ",n); -+ -+ for(i=0;i<16 && n<=max;i++,n++) -+ len += snprintf(page + len, count - len, -+ "%2x ",read_nic_byte(dev,n)); -+ -+ // printk("%2x ",read_nic_byte(dev,n)); -+ } -+ len += snprintf(page + len, count - len,"\n"); -+len += snprintf(page + len, count - len, -+ "\n####################page 1##################\n "); -+ for(n=0;n<=max;) -+ { -+ //printk( "\nD: %2x> ", n); -+ len += snprintf(page + len, count - len, -+ "\nD: %2x > ",n); -+ -+ for(i=0;i<16 && n<=max;i++,n++) -+ len += snprintf(page + len, count - len, -+ "%2x ",read_nic_byte(dev,0x100|n)); -+ -+ // printk("%2x ",read_nic_byte(dev,n)); -+ } -+len += snprintf(page + len, count - len, -+ "\n####################page 2##################\n "); -+ for(n=0;n<=max;) -+ { -+ //printk( "\nD: %2x> ", n); -+ len += snprintf(page + len, count - len, -+ "\nD: %2x > ",n); -+ -+ for(i=0;i<16 && n<=max;i++,n++) -+ len += snprintf(page + len, count - len, -+ "%2x ",read_nic_byte(dev,0x200|n)); -+ -+ // printk("%2x ",read_nic_byte(dev,n)); -+ } -+ -+ -+ -+ *eof = 1; -+ return len; -+ -+} -+ -+ -+static int proc_get_cck_reg(char *page, char **start, -+ off_t offset, int count, -+ int *eof, void *data) -+{ -+ struct net_device *dev = data; -+ -+ int len = 0; -+ int i,n; -+ -+ int max = 0x5F; -+ -+ /* This dump the current register page */ -+ for(n=0;n<=max;) -+ { -+ //printk( "\nD: %2x> ", n); -+ len += snprintf(page + len, count - len, -+ "\nD: %2x > ",n); -+ -+ for(i=0;i<16 && n<=max;i++,n++) -+ len += snprintf(page + len, count - len, -+ "%2x ",read_phy_cck(dev,n)); -+ -+ // printk("%2x ",read_nic_byte(dev,n)); -+ } -+ len += snprintf(page + len, count - len,"\n"); -+ -+ -+ *eof = 1; -+ return len; -+ -+} -+ -+ -+static int proc_get_ofdm_reg(char *page, char **start, -+ off_t offset, int count, -+ int *eof, void *data) -+{ -+ struct net_device *dev = data; -+ -+ int len = 0; -+ int i,n; -+ -+ //int max=0xff; -+ int max = 0x40; -+ -+ /* This dump the current register page */ -+ for(n=0;n<=max;) -+ { -+ //printk( "\nD: %2x> ", n); -+ len += snprintf(page + len, count - len, -+ "\nD: %2x > ",n); -+ -+ for(i=0;i<16 && n<=max;i++,n++) -+ len += snprintf(page + len, count - len, -+ "%2x ",read_phy_ofdm(dev,n)); -+ -+ // printk("%2x ",read_nic_byte(dev,n)); -+ } -+ len += snprintf(page + len, count - len,"\n"); -+ -+ -+ -+ *eof = 1; -+ return len; -+ -+} -+ -+ -+#if 0 -+static int proc_get_stats_hw(char *page, char **start, -+ off_t offset, int count, -+ int *eof, void *data) -+{ -+ struct net_device *dev = data; -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ -+ int len = 0; -+ -+ len += snprintf(page + len, count - len, -+ "NIC int: %lu\n" -+ "Total int: %lu\n", -+ priv->stats.ints, -+ priv->stats.shints); -+ -+ *eof = 1; -+ return len; -+} -+#endif -+ -+static int proc_get_stats_tx(char *page, char **start, -+ off_t offset, int count, -+ int *eof, void *data) -+{ -+ struct net_device *dev = data; -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ -+ int len = 0; -+ -+ len += snprintf(page + len, count - len, -+ "TX VI priority ok int: %lu\n" -+ "TX VI priority error int: %lu\n" -+ "TX VO priority ok int: %lu\n" -+ "TX VO priority error int: %lu\n" -+ "TX BE priority ok int: %lu\n" -+ "TX BE priority error int: %lu\n" -+ "TX BK priority ok int: %lu\n" -+ "TX BK priority error int: %lu\n" -+ "TX MANAGE priority ok int: %lu\n" -+ "TX MANAGE priority error int: %lu\n" -+ "TX BEACON priority ok int: %lu\n" -+ "TX BEACON priority error int: %lu\n" -+// "TX high priority ok int: %lu\n" -+// "TX high priority failed error int: %lu\n" -+ "TX queue resume: %lu\n" -+ "TX queue stopped?: %d\n" -+ "TX fifo overflow: %lu\n" -+// "TX beacon: %lu\n" -+ "TX VI queue: %d\n" -+ "TX VO queue: %d\n" -+ "TX BE queue: %d\n" -+ "TX BK queue: %d\n" -+ "TX BEACON queue: %d\n" -+ "TX MANAGE queue: %d\n" -+// "TX HW queue: %d\n" -+ "TX VI dropped: %lu\n" -+ "TX VO dropped: %lu\n" -+ "TX BE dropped: %lu\n" -+ "TX BK dropped: %lu\n" -+ "TX total data packets %lu\n", -+// "TX beacon aborted: %lu\n", -+ priv->stats.txviokint, -+ priv->stats.txvierr, -+ priv->stats.txvookint, -+ priv->stats.txvoerr, -+ priv->stats.txbeokint, -+ priv->stats.txbeerr, -+ priv->stats.txbkokint, -+ priv->stats.txbkerr, -+ priv->stats.txmanageokint, -+ priv->stats.txmanageerr, -+ priv->stats.txbeaconokint, -+ priv->stats.txbeaconerr, -+// priv->stats.txhpokint, -+// priv->stats.txhperr, -+ priv->stats.txresumed, -+ netif_queue_stopped(dev), -+ priv->stats.txoverflow, -+// priv->stats.txbeacon, -+ atomic_read(&(priv->tx_pending[VI_PRIORITY])), -+ atomic_read(&(priv->tx_pending[VO_PRIORITY])), -+ atomic_read(&(priv->tx_pending[BE_PRIORITY])), -+ atomic_read(&(priv->tx_pending[BK_PRIORITY])), -+ atomic_read(&(priv->tx_pending[BEACON_PRIORITY])), -+ atomic_read(&(priv->tx_pending[MANAGE_PRIORITY])), -+// read_nic_byte(dev, TXFIFOCOUNT), -+ priv->stats.txvidrop, -+ priv->stats.txvodrop, -+ priv->stats.txbedrop, -+ priv->stats.txbkdrop, -+ priv->stats.txdatapkt -+// priv->stats.txbeaconerr -+ ); -+ -+ *eof = 1; -+ return len; -+} -+ -+ -+ -+static int proc_get_stats_rx(char *page, char **start, -+ off_t offset, int count, -+ int *eof, void *data) -+{ -+ struct net_device *dev = data; -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ -+ int len = 0; -+ -+ len += snprintf(page + len, count - len, -+ "RX packets: %lu\n" -+ "RX urb status error: %lu\n" -+ "RX invalid urb error: %lu\n", -+ priv->stats.rxok, -+ priv->stats.rxstaterr, -+ priv->stats.rxurberr); -+ -+ *eof = 1; -+ return len; -+} -+ -+#if WIRELESS_EXT < 17 -+static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ return &priv->wstats; -+} -+#endif -+ -+void rtl8180_proc_module_init(void) -+{ -+ DMESG("Initializing proc filesystem"); -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) -+ rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, proc_net); -+#else -+ rtl8180_proc=create_proc_entry(RTL8187_MODULE_NAME, S_IFDIR, init_net.proc_net); -+#endif -+} -+ -+ -+void rtl8180_proc_module_remove(void) -+{ -+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) -+ remove_proc_entry(RTL8187_MODULE_NAME, proc_net); -+#else -+ remove_proc_entry(RTL8187_MODULE_NAME, init_net.proc_net); -+#endif -+} -+ -+ -+void rtl8180_proc_remove_one(struct net_device *dev) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ if (priv->dir_dev) { -+ // remove_proc_entry("stats-hw", priv->dir_dev); -+ remove_proc_entry("stats-tx", priv->dir_dev); -+ remove_proc_entry("stats-rx", priv->dir_dev); -+ // remove_proc_entry("stats-ieee", priv->dir_dev); -+ remove_proc_entry("stats-ap", priv->dir_dev); -+ remove_proc_entry("registers", priv->dir_dev); -+ remove_proc_entry("cck-registers",priv->dir_dev); -+ remove_proc_entry("ofdm-registers",priv->dir_dev); -+ remove_proc_entry(dev->name, rtl8180_proc); -+ priv->dir_dev = NULL; -+ } -+} -+ -+ -+void rtl8180_proc_init_one(struct net_device *dev) -+{ -+ struct proc_dir_entry *e; -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ priv->dir_dev = create_proc_entry(dev->name, -+ S_IFDIR | S_IRUGO | S_IXUGO, -+ rtl8180_proc); -+ if (!priv->dir_dev) { -+ DMESGE("Unable to initialize /proc/net/rtl8187/%s\n", -+ dev->name); -+ return; -+ } -+ #if 0 -+ e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO, -+ priv->dir_dev, proc_get_stats_hw, dev); -+ -+ if (!e) { -+ DMESGE("Unable to initialize " -+ "/proc/net/rtl8187/%s/stats-hw\n", -+ dev->name); -+ } -+ #endif -+ e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO, -+ priv->dir_dev, proc_get_stats_rx, dev); -+ -+ if (!e) { -+ DMESGE("Unable to initialize " -+ "/proc/net/rtl8187/%s/stats-rx\n", -+ dev->name); -+ } -+ -+ -+ e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO, -+ priv->dir_dev, proc_get_stats_tx, dev); -+ -+ if (!e) { -+ DMESGE("Unable to initialize " -+ "/proc/net/rtl8187/%s/stats-tx\n", -+ dev->name); -+ } -+ #if 0 -+ e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO, -+ priv->dir_dev, proc_get_stats_ieee, dev); -+ -+ if (!e) { -+ DMESGE("Unable to initialize " -+ "/proc/net/rtl8187/%s/stats-ieee\n", -+ dev->name); -+ } -+ -+ #endif -+ -+ e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO, -+ priv->dir_dev, proc_get_stats_ap, dev); -+ -+ if (!e) { -+ DMESGE("Unable to initialize " -+ "/proc/net/rtl8187/%s/stats-ap\n", -+ dev->name); -+ } -+ -+ e = create_proc_read_entry("registers", S_IFREG | S_IRUGO, -+ priv->dir_dev, proc_get_registers, dev); -+ if (!e) { -+ DMESGE("Unable to initialize " -+ "/proc/net/rtl8187/%s/registers\n", -+ dev->name); -+ } -+ -+ e = create_proc_read_entry("cck-registers", S_IFREG | S_IRUGO, -+ priv->dir_dev, proc_get_cck_reg, dev); -+ if (!e) { -+ DMESGE("Unable to initialize " -+ "/proc/net/rtl8187/%s/cck-registers\n", -+ dev->name); -+ } -+ -+ e = create_proc_read_entry("ofdm-registers", S_IFREG | S_IRUGO, -+ priv->dir_dev, proc_get_ofdm_reg, dev); -+ if (!e) { -+ DMESGE("Unable to initialize " -+ "/proc/net/rtl8187/%s/ofdm-registers\n", -+ dev->name); -+ } -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ if( priv->mshobj && priv->mshobj->ext_patch_create_proc ) -+ priv->mshobj->ext_patch_create_proc(priv); -+#endif -+ -+} -+/**************************************************************************** -+ -----------------------------MISC STUFF------------------------- -+*****************************************************************************/ -+ -+/* this is only for debugging */ -+void print_buffer(u32 *buffer, int len) -+{ -+ int i; -+ u8 *buf =(u8*)buffer; -+ -+ printk("ASCII BUFFER DUMP (len: %x):\n",len); -+ -+ for(i=0;i<len;i++) -+ printk("%c",buf[i]); -+ -+ printk("\nBINARY BUFFER DUMP (len: %x):\n",len); -+ -+ for(i=0;i<len;i++) -+ printk("%x",buf[i]); -+ -+ printk("\n"); -+} -+ -+short check_nic_enought_desc(struct net_device *dev, priority_t priority) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ //int used = atomic_read((priority == NORM_PRIORITY) ? -+ // &priv->tx_np_pending : &priv->tx_lp_pending); -+ int used = atomic_read(&priv->tx_pending[priority]); -+ -+ return (used < MAX_TX_URB); -+} -+ -+void tx_timeout(struct net_device *dev) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ //rtl8180_commit(dev); -+ printk("@@@@ Transmit timeout at %ld, latency %ld\n", jiffies, -+ jiffies - dev->trans_start); -+ -+ printk("@@@@ netif_queue_stopped = %d\n", netif_queue_stopped(dev)); -+ -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) -+ schedule_work(&priv->reset_wq); -+#else -+ schedule_task(&priv->reset_wq); -+#endif -+ //DMESG("TXTIMEOUT"); -+} -+ -+ -+/* this is only for debug */ -+void dump_eprom(struct net_device *dev) -+{ -+ int i; -+ for(i=0; i<63; i++) -+ DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i)); -+} -+ -+/* this is only for debug */ -+void rtl8180_dump_reg(struct net_device *dev) -+{ -+ int i; -+ int n; -+ int max=0xff; -+ -+ DMESG("Dumping NIC register map"); -+ -+ for(n=0;n<=max;) -+ { -+ printk( "\nD: %2x> ", n); -+ for(i=0;i<16 && n<=max;i++,n++) -+ printk("%2x ",read_nic_byte(dev,n)); -+ } -+ printk("\n"); -+} -+ -+/**************************************************************************** -+ ------------------------------HW STUFF--------------------------- -+*****************************************************************************/ -+ -+ -+void rtl8180_irq_enable(struct net_device *dev) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ //priv->irq_enabled = 1; -+ -+ //write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW | -+ // INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK | -+ // INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK | -+ // INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT); -+ -+ write_nic_word(dev,INTA_MASK, priv->irq_mask); -+} -+ -+ -+void rtl8180_irq_disable(struct net_device *dev) -+{ -+ write_nic_word(dev,INTA_MASK,0); -+ force_pci_posting(dev); -+// priv->irq_enabled = 0; -+} -+ -+ -+void rtl8180_set_mode(struct net_device *dev,int mode) -+{ -+ u8 ecmd; -+ ecmd=read_nic_byte(dev, EPROM_CMD); -+ ecmd=ecmd &~ EPROM_CMD_OPERATING_MODE_MASK; -+ ecmd=ecmd | (mode<<EPROM_CMD_OPERATING_MODE_SHIFT); -+ ecmd=ecmd &~ (1<<EPROM_CS_SHIFT); -+ ecmd=ecmd &~ (1<<EPROM_CK_SHIFT); -+ write_nic_byte(dev, EPROM_CMD, ecmd); -+} -+ -+ -+void rtl8180_update_msr(struct net_device *dev) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ u8 msr; -+ -+ msr = read_nic_byte(dev, MSR); -+ msr &= ~ MSR_LINK_MASK; -+ -+ /* do not change in link_state != WLAN_LINK_ASSOCIATED. -+ * msr must be updated if the state is ASSOCIATING. -+ * this is intentional and make sense for ad-hoc and -+ * master (see the create BSS/IBSS func) -+ */ -+ if (priv->ieee80211->state == IEEE80211_LINKED){ -+ -+ if (priv->ieee80211->iw_mode == IW_MODE_INFRA) -+ msr |= (MSR_LINK_MANAGED<<MSR_LINK_SHIFT); -+ else if (priv->ieee80211->iw_mode == IW_MODE_ADHOC) -+ msr |= (MSR_LINK_ADHOC<<MSR_LINK_SHIFT); -+ else if (priv->ieee80211->iw_mode == IW_MODE_MASTER) -+ msr |= (MSR_LINK_MASTER<<MSR_LINK_SHIFT); -+ -+ }else -+ msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT); -+ -+ write_nic_byte(dev, MSR, msr); -+} -+ -+void rtl8180_set_chan(struct net_device *dev,short ch) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ u32 tx; -+ -+ priv->chan=ch; -+ #if 0 -+ if(priv->ieee80211->iw_mode == IW_MODE_ADHOC || -+ priv->ieee80211->iw_mode == IW_MODE_MASTER){ -+ -+ priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED; -+ priv->ieee80211->master_chan = ch; -+ rtl8180_update_beacon_ch(dev); -+ } -+ #endif -+ -+ /* this hack should avoid frame TX during channel setting*/ -+ tx = read_nic_dword(dev,TX_CONF); -+ tx &= ~TX_LOOPBACK_MASK; -+ -+#ifndef LOOP_TEST -+ write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT)); -+ priv->rf_set_chan(dev,priv->chan); -+ //mdelay(10); //CPU occupany is too high. LZM 31/10/2008 -+ write_nic_dword(dev,TX_CONF,tx | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT)); -+#endif -+} -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -+void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs); -+#else -+void rtl8187_rx_isr(struct urb* rx_urb); -+#endif -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -+void rtl8187_rx_manage_isr(struct urb *rx_urb, struct pt_regs *regs); -+#else -+void rtl8187_rx_manage_isr(struct urb* rx_urb); -+#endif -+ -+ -+ -+void rtl8187_rx_urbsubmit(struct net_device *dev, struct urb* rx_urb) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ int err; -+ -+ usb_fill_bulk_urb(rx_urb,priv->udev, -+ usb_rcvbulkpipe(priv->udev,(NIC_8187 == priv->card_8187)?0x81:0x83), -+ rx_urb->transfer_buffer, -+ RX_URB_SIZE, -+ rtl8187_rx_isr, -+ dev); -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+ err = usb_submit_urb(rx_urb, GFP_ATOMIC); -+#else -+ err = usb_submit_urb(rx_urb); -+#endif -+ if(err && err != -EPERM){ -+ DMESGE("cannot submit RX command. URB_STATUS %x",rx_urb->status); -+ } -+} -+ -+ -+void rtl8187_rx_manage_urbsubmit(struct net_device *dev, struct urb* rx_urb) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ int err; -+#ifdef THOMAS_BEACON -+ usb_fill_bulk_urb(rx_urb,priv->udev, -+ usb_rcvbulkpipe(priv->udev,0x09), -+ rx_urb->transfer_buffer, -+ rx_urb->transfer_buffer_length, -+ rtl8187_rx_manage_isr, dev); -+#endif -+ -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+ err = usb_submit_urb(rx_urb, GFP_ATOMIC); -+#else -+ err = usb_submit_urb(rx_urb); -+#endif -+ if(err && err != -EPERM){ -+ DMESGE("cannot submit RX command. URB_STATUS %x",rx_urb->status); -+ } -+} -+ -+ -+ -+void rtl8187_rx_initiate(struct net_device *dev) -+{ -+ int i; -+ unsigned long flags; -+ struct urb *purb; -+ -+ struct sk_buff *pskb; -+ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ -+ priv->tx_urb_index = 0; -+ -+ if ((!priv->rx_urb) || (!priv->pp_rxskb)) { -+ -+ DMESGE("Cannot intiate RX urb mechanism"); -+ return; -+ -+ } -+ -+ priv->rx_inx = 0; -+#ifdef THOMAS_TASKLET -+ atomic_set(&priv->irt_counter,0); -+#endif -+ for(i = 0;i < MAX_RX_URB; i++){ -+ -+ purb = priv->rx_urb[i] = usb_alloc_urb(0,GFP_KERNEL); -+ -+ if(!priv->rx_urb[i]) -+ goto destroy; -+ -+ pskb = priv->pp_rxskb[i] = dev_alloc_skb (RX_URB_SIZE); -+ -+ if (pskb == NULL) -+ goto destroy; -+ -+ purb->transfer_buffer_length = RX_URB_SIZE; -+ purb->transfer_buffer = pskb->data; -+ } -+ -+ spin_lock_irqsave(&priv->irq_lock,flags);//added by thomas -+ -+ for(i=0;i<MAX_RX_URB;i++) -+ rtl8187_rx_urbsubmit(dev,priv->rx_urb[i]); -+ -+ spin_unlock_irqrestore(&priv->irq_lock,flags);//added by thomas -+ -+ return; -+ -+destroy: -+ -+ for(i = 0; i < MAX_RX_URB; i++) { -+ -+ purb = priv->rx_urb[i]; -+ -+ if (purb) -+ usb_free_urb(purb); -+ -+ pskb = priv->pp_rxskb[i]; -+ -+ if (pskb) -+ dev_kfree_skb_any(pskb); -+ -+ } -+ -+ return; -+} -+ -+ -+void rtl8187_rx_manage_initiate(struct net_device *dev) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ if(!priv->rx_urb) -+ DMESGE("Cannot intiate RX urb mechanism"); -+ -+ rtl8187_rx_manage_urbsubmit(dev,priv->rx_urb[MAX_RX_URB]); -+ -+} -+ -+ -+void rtl8187_set_rxconf(struct net_device *dev) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ u32 rxconf; -+ -+ rxconf=read_nic_dword(dev,RX_CONF); -+ rxconf = rxconf &~ MAC_FILTER_MASK; -+ rxconf = rxconf | (1<<ACCEPT_MNG_FRAME_SHIFT); -+ rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT); -+ rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT); -+ rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT); -+ //rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT); -+#ifdef SW_ANTE_DIVERSITY -+ rxconf = rxconf | priv->EEPROMCSMethod;//for antenna -+#endif -+ -+ if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode"); -+ -+ if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \ -+ dev->flags & IFF_PROMISC){ -+ rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT); -+ } /*else if(priv->ieee80211->iw_mode == IW_MODE_MASTER){ -+ rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT); -+ rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT); -+ }*/else{ -+ rxconf = rxconf | (1<<ACCEPT_NICMAC_FRAME_SHIFT); -+ rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT); -+ } -+ -+ -+ if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){ -+ rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT); -+ rxconf = rxconf | (1<<ACCEPT_PWR_FRAME_SHIFT); -+ } -+ -+ if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR) -+ rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT); -+ -+ -+ rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK; -+ rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT); -+ rxconf = rxconf &~ MAX_RX_DMA_MASK; -+ rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT); -+ -+ rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT); -+ rxconf = rxconf | RCR_ONLYERLPKT; -+ -+ //rxconf = rxconf &~ RCR_CS_MASK; -+ //rxconf = rxconf | (1<<RCR_CS_SHIFT); -+ -+ write_nic_dword(dev, RX_CONF, rxconf); -+ -+ #ifdef DEBUG_RX -+ DMESG("rxconf: %x %x",rxconf ,read_nic_dword(dev,RX_CONF)); -+ #endif -+} -+ -+void rtl8180_rx_enable(struct net_device *dev) -+{ -+ u8 cmd; -+ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ -+ rtl8187_rx_initiate(dev); -+ rtl8187_set_rxconf(dev); -+ -+ if(NIC_8187 == priv->card_8187) { -+ cmd=read_nic_byte(dev,CMD); -+ write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT)); -+ } else { -+ //write_nic_dword(dev, RCR, priv->ReceiveConfig); -+ } -+} -+ -+ -+void rtl8180_tx_enable(struct net_device *dev) -+{ -+ u8 cmd; -+ u8 byte; -+ u32 txconf = 0; -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ -+ if(NIC_8187B == priv->card_8187){ -+ write_nic_dword(dev, TCR, priv->TransmitConfig); -+ byte = read_nic_byte(dev, MSR); -+ byte |= MSR_LINK_ENEDCA; -+ write_nic_byte(dev, MSR, byte); -+#ifdef LOOP_TEST -+ txconf= read_nic_dword(dev,TX_CONF); -+ txconf = txconf | (TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT); -+ write_nic_dword(dev,TX_CONF,txconf); -+#endif -+ } else { -+ byte = read_nic_byte(dev,CW_CONF); -+ byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT); -+ byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT); -+ write_nic_byte(dev, CW_CONF, byte); -+ -+ byte = read_nic_byte(dev, TX_AGC_CTL); -+ byte &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT); -+ byte &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT); -+ byte &= ~(1<<TX_AGC_CTL_FEEDBACK_ANT); -+ write_nic_byte(dev, TX_AGC_CTL, byte); -+ -+ txconf= read_nic_dword(dev,TX_CONF); -+ -+ -+ txconf = txconf &~ TX_LOOPBACK_MASK; -+ -+#ifndef LOOP_TEST -+ txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT); -+#else -+ txconf = txconf | (TX_LOOPBACK_BASEBAND<<TX_LOOPBACK_SHIFT); -+#endif -+ txconf = txconf &~ TCR_SRL_MASK; -+ txconf = txconf &~ TCR_LRL_MASK; -+ -+ txconf = txconf | (priv->retry_data<<TX_LRLRETRY_SHIFT); // long -+ txconf = txconf | (priv->retry_rts<<TX_SRLRETRY_SHIFT); // short -+ -+ txconf = txconf &~ (1<<TX_NOCRC_SHIFT); -+ -+ txconf = txconf &~ TCR_MXDMA_MASK; -+ txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT); -+ -+ txconf = txconf | TCR_DISReqQsize; -+ txconf = txconf | TCR_DISCW; -+ txconf = txconf &~ TCR_SWPLCPLEN; -+ -+ txconf=txconf | (1<<TX_NOICV_SHIFT); -+ -+ write_nic_dword(dev,TX_CONF,txconf); -+ -+#ifdef DEBUG_TX -+ DMESG("txconf: %x %x",txconf,read_nic_dword(dev,TX_CONF)); -+#endif -+ -+ cmd=read_nic_byte(dev,CMD); -+ write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT)); -+ } -+} -+ -+#if 0 -+void rtl8180_beacon_tx_enable(struct net_device *dev) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT); -+ rtl8180_set_mode(dev,EPROM_CMD_CONFIG); -+ write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask); -+ rtl8180_set_mode(dev,EPROM_CMD_NORMAL); -+} -+ -+ -+void rtl8180_ -+_disable(struct net_device *dev) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT); -+ rtl8180_set_mode(dev,EPROM_CMD_CONFIG); -+ write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask); -+ rtl8180_set_mode(dev,EPROM_CMD_NORMAL); -+} -+ -+#endif -+ -+ -+void rtl8180_rtx_disable(struct net_device *dev) -+{ -+ u8 cmd; -+ int i; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ cmd=read_nic_byte(dev,CMD); -+ write_nic_byte(dev, CMD, cmd &~ \ -+ ((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT))); -+ force_pci_posting(dev); -+ mdelay(10); -+ -+#ifdef THOMAS_BEACON -+ { -+ int index = priv->rx_inx;//0 -+ i=0; -+ if(priv->rx_urb){ -+ while(i<MAX_RX_URB){ -+ if(priv->rx_urb[index]){ -+ usb_kill_urb(priv->rx_urb[index]); -+ } -+ if( index == (MAX_RX_URB-1) ) -+ index=0; -+ else -+ index=index+1; -+ i++; -+ } -+ if(priv->rx_urb[MAX_RX_URB]) -+ usb_kill_urb(priv->rx_urb[MAX_RX_URB]); -+ } -+ } -+#endif -+} -+ -+ -+int alloc_tx_beacon_desc_ring(struct net_device *dev, int count) -+{ -+ #if 0 -+ int i; -+ u32 *tmp; -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ -+ priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev, -+ sizeof(u32)*8*count, -+ &priv->txbeaconringdma); -+ if (!priv->txbeaconring) return -1; -+ for (tmp=priv->txbeaconring,i=0;i<count;i++){ -+ *tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv -+ /* -+ *(tmp+2) = (u32)dma_tmp; -+ *(tmp+3) = bufsize; -+ */ -+ if(i+1<count) -+ *(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4); -+ else -+ *(tmp+4) = (u32)priv->txbeaconringdma; -+ -+ tmp=tmp+8; -+ } -+ #endif -+ return 0; -+} -+ -+long NetgearSignalStrengthTranslate(long LastSS,long CurrSS) -+{ -+ long RetSS; -+ -+ // Step 1. Scale mapping. -+ if(CurrSS >= 71 && CurrSS <= 100){ -+ RetSS = 90 + ((CurrSS - 70) / 3); -+ }else if(CurrSS >= 41 && CurrSS <= 70){ -+ RetSS = 78 + ((CurrSS - 40) / 3); -+ }else if(CurrSS >= 31 && CurrSS <= 40){ -+ RetSS = 66 + (CurrSS - 30); -+ }else if(CurrSS >= 21 && CurrSS <= 30){ -+ RetSS = 54 + (CurrSS - 20); -+ }else if(CurrSS >= 5 && CurrSS <= 20){ -+ RetSS = 42 + (((CurrSS - 5) * 2) / 3); -+ }else if(CurrSS == 4){ -+ RetSS = 36; -+ }else if(CurrSS == 3){ -+ RetSS = 27; -+ }else if(CurrSS == 2){ -+ RetSS = 18; -+ }else if(CurrSS == 1){ -+ RetSS = 9; -+ }else{ -+ RetSS = CurrSS; -+ } -+ //RT_TRACE(COMP_DBG, DBG_LOUD, ("##### After Mapping: LastSS: %d, CurrSS: %d, RetSS: %d\n", LastSS, CurrSS, RetSS)); -+ -+ // Step 2. Smoothing. -+ if(LastSS > 0){ -+ RetSS = ((LastSS * 5) + (RetSS)+ 5) / 6; -+ } -+ //RT_TRACE(COMP_DBG, DBG_LOUD, ("$$$$$ After Smoothing: LastSS: %d, CurrSS: %d, RetSS: %d\n", LastSS, CurrSS, RetSS)); -+ -+ return RetSS; -+} -+ -+extern long TranslateToDbm8187(u8 SignalStrengthIndex); // 0-100 index. -+//long TranslateToDbm8187(u8 SignalStrengthIndex) // 0-100 index. -+//{ -+ // long SignalPower; // in dBm. -+ -+ // Translate to dBm (x=0.5y-95). -+ // SignalPower = (long)((SignalStrengthIndex + 1) >> 1); -+ // SignalPower -= 95; -+ -+ // return SignalPower; -+//} -+ -+ -+void rtl8180_reset(struct net_device *dev) -+{ -+ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ u8 cr; -+ int i; -+ -+ -+ /* make sure the analog power is on before -+ * reset, otherwise reset may fail -+ */ -+ if(NIC_8187 == priv->card_8187) { -+ rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON); -+ rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON); -+ rtl8180_irq_disable(dev); -+ mdelay(200); -+ write_nic_byte_E(dev,0x18,0x10); -+ write_nic_byte_E(dev,0x18,0x11); -+ write_nic_byte_E(dev,0x18,0x00); -+ mdelay(200); -+ } -+ -+ -+ cr=read_nic_byte(dev,CMD); -+ cr = cr & 2; -+ cr = cr | (1<<CMD_RST_SHIFT); -+ write_nic_byte(dev,CMD,cr); -+ -+ //lzm mod for up take too long time 20081201 -+ //force_pci_posting(dev); -+ //mdelay(200); -+ udelay(20); -+ -+ if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT)) -+ DMESGW("Card reset timeout!"); -+ -+ if(NIC_8187 == priv->card_8187) { -+ -+ //printk("This is RTL8187 Reset procedure\n"); -+ rtl8180_set_mode(dev,EPROM_CMD_LOAD); -+ force_pci_posting(dev); -+ mdelay(200); -+ -+ /* after the eeprom load cycle, make sure we have -+ * correct anaparams -+ */ -+ rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON); -+ rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON); -+ } -+ else { -+ //printk("This is RTL8187B Reset procedure\n"); -+ //test pending bug, john 20070815 -+ //initialize tx_pending -+ for(i=0;i<0x10;i++) atomic_set(&(priv->tx_pending[i]), 0); -+ -+ } -+ -+} -+ -+inline u16 ieeerate2rtlrate(int rate) -+{ -+ switch(rate){ -+ case 10: -+ return 0; -+ case 20: -+ return 1; -+ case 55: -+ return 2; -+ case 110: -+ return 3; -+ case 60: -+ return 4; -+ case 90: -+ return 5; -+ case 120: -+ return 6; -+ case 180: -+ return 7; -+ case 240: -+ return 8; -+ case 360: -+ return 9; -+ case 480: -+ return 10; -+ case 540: -+ return 11; -+ default: -+ return 3; -+ -+ } -+} -+static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540,720}; -+inline u16 rtl8180_rate2rate(short rate) -+{ -+ if (rate >12) return 10; -+ return rtl_rate[rate]; -+} -+ -+void rtl8180_irq_rx_tasklet(struct r8180_priv *priv); -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -+void rtl8187_rx_isr(struct urb *rx_urb, struct pt_regs *regs) -+#else -+void rtl8187_rx_isr(struct urb* rx_urb) -+#endif -+{ -+ struct net_device *dev = (struct net_device*)rx_urb->context; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ priv->rxurb_task = rx_urb; -+ -+ -+ //DMESGW("David: Rx tasklet start!"); -+ -+#ifdef THOMAS_TASKLET -+ atomic_inc( &priv->irt_counter ); -+ -+ //if( likely(priv->irt_counter_head+1 != priv->irt_counter_tail) ){ -+ // priv->irt_counter_head = (priv->irt_counter_head+1)&0xffff ; -+ tasklet_schedule(&priv->irq_rx_tasklet); -+ //} else{ -+ //DMESG("error: priv->irt_counter_head is going to pass through priv->irt_counter_tail\n"); -+ /* -+ skb = priv->pp_rxskb[priv->rx_inx]; -+ dev_kfree_skb_any(skb); -+ -+ skb = dev_alloc_skb(RX_URB_SIZE); -+ if (skb == NULL) -+ panic("No Skb For RX!/n"); -+ -+ rx_urb->transfer_buffer = skb->data; -+ -+ priv->pp_rxskb[priv->rx_inx] = skb; -+ if(status == 0) -+ rtl8187_rx_urbsubmit(dev,rx_urb); -+ else { -+ priv->pp_rxskb[priv->rx_inx] = NULL; -+ dev_kfree_skb_any(skb); -+ printk("RX process aborted due to explicit shutdown (%x) ", status); -+ } -+ -+ if (*prx_inx == (MAX_RX_URB -1)) -+ *prx_inx = 0; -+ else -+ *prx_inx = *prx_inx + 1; -+ -+ */ -+ //} -+#endif -+ -+} -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -+void rtl8187_rx_manage_isr(struct urb *rx_urb, struct pt_regs *regs) -+#else -+void rtl8187_rx_manage_isr(struct urb* rx_urb) -+#endif -+{ -+ struct net_device *dev = (struct net_device*)rx_urb->context; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ int status,cmd; -+ struct sk_buff *skb; -+ u32 *desc; -+ int ret; -+ unsigned long flag; -+ -+ //DMESG("RX %d ",rx_urb->status); -+ status = rx_urb->status; -+ if(status == 0){ -+ -+ desc = (u32*)(rx_urb->transfer_buffer); -+ cmd = (desc[0] >> 30) & 0x03; -+ //printk(KERN_ALERT "buffersize = %d, length = %d, pipe = %p\n", -+ //rx_urb->transfer_buffer_length, rx_urb->actual_length, rx_urb->pipe>>15); -+ -+ if(cmd == 0x00) {//beacon interrupt -+ //send beacon packet -+ -+ spin_lock_irqsave(&priv->ieee80211->beaconflag_lock,flag); -+ if(priv->flag_beacon == true){ -+ //printk("rtl8187_rx_manage_isr(): CMD_TYPE0_BCN_INTR\n"); -+ -+ skb = ieee80211_get_beacon(priv->ieee80211); -+ if(!skb){ -+ DMESG("not enought memory for allocating beacon"); -+ return; -+ } -+ //printk(KERN_WARNING "to send beacon packet through beacon endpoint!\n"); -+ ret = rtl8180_tx(dev, (u32*)skb->data, skb->len, BEACON_PRIORITY, -+ 0, ieeerate2rtlrate(priv->ieee80211->basic_rate)); -+ -+ if( ret != 0 ){ -+ printk(KERN_ALERT "tx beacon packet error : %d !\n", ret); -+ } -+ dev_kfree_skb_any(skb); -+ -+ //} else {//0x00 -+ //{ log the device information -+ // At present, It is not implemented just now. -+ //} -+ //} -+ -+ } -+ spin_unlock_irqrestore(&priv->ieee80211->beaconflag_lock,flag); -+ } -+ else if(cmd == 0x01){ -+ //printk("rtl8187_rx_manage_isr(): CMD_TYPE1_TX_CLOSE\n"); -+ priv->CurrRetryCnt += (u16)desc[0]&0x000000ff; -+ //printk("priv->CurrRetryCnt is %d\n",priv->CurrRetryCnt); -+ } -+ else -+ printk("HalUsbInCommandComplete8187B(): unknown Type(%#X) !!!\n", cmd); -+ -+ }else{ -+ priv->stats.rxstaterr++; -+ priv->ieee80211->stats.rx_errors++; -+ } -+ -+ -+ if( status == 0 ) -+ //if(status != -ENOENT) -+ rtl8187_rx_manage_urbsubmit(dev, rx_urb); -+ else -+ ;//DMESG("Mangement RX process aborted due to explicit shutdown"); -+} -+ -+#if 0 -+void rtl8180_tx_queues_stop(struct net_device *dev) -+{ -+ //struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT); -+ dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT); -+ dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT); -+ dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT); -+ -+ rtl8180_set_mode(dev,EPROM_CMD_CONFIG); -+ write_nic_byte(dev,TX_DMA_POLLING,dma_poll_mask); -+ rtl8180_set_mode(dev,EPROM_CMD_NORMAL); -+} -+#endif -+ -+void rtl8180_data_hard_stop(struct net_device *dev) -+{ -+ //FIXME !! -+ #if 0 -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT); -+ rtl8180_set_mode(dev,EPROM_CMD_CONFIG); -+ write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask); -+ rtl8180_set_mode(dev,EPROM_CMD_NORMAL); -+ #endif -+} -+ -+ -+void rtl8180_data_hard_resume(struct net_device *dev) -+{ -+ // FIXME !! -+ #if 0 -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT); -+ rtl8180_set_mode(dev,EPROM_CMD_CONFIG); -+ write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask); -+ rtl8180_set_mode(dev,EPROM_CMD_NORMAL); -+ #endif -+} -+ -+unsigned int PRI2EP[4] = {0x06,0x07,0x05,0x04}; -+// this function TX data frames when the ieee80211 stack requires this. -+// It checks also if we need to stop the ieee tx queue, eventually do it -+void rtl8180_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rate) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ -+ short morefrag = 0; -+ unsigned long flags; -+ struct ieee80211_hdr *h = (struct ieee80211_hdr *) skb->data; -+ -+ unsigned char ep; -+ short ret; //john -+ -+ if (le16_to_cpu(h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS) -+ morefrag = 1; -+ //DMESG("%x %x", h->frame_ctl, h->seq_ctl); -+ /* -+ * This function doesn't require lock because we make -+ * sure it's called with the tx_lock already acquired. -+ * this come from the kernel's hard_xmit callback (trought -+ * the ieee stack, or from the try_wake_queue (again trought -+ * the ieee stack. -+ */ -+ spin_lock_irqsave(&priv->tx_lock,flags); -+ -+ //lzm mod 20081128 for sometimes wlan down but it still have some pkt to tx -+ if((priv->ieee80211->bHwRadioOff)||(!priv->up)) -+ { -+ spin_unlock_irqrestore(&priv->tx_lock,flags); -+ -+ return; -+ } -+ -+ if(NIC_8187B == priv->card_8187){ -+ ep = PRI2EP[skb->priority]; -+ } else { -+ ep = LOW_PRIORITY; -+ } -+ //if (!check_nic_enought_desc(dev, PRI2EP[skb->priority])){ -+ if (!check_nic_enought_desc(dev, ep)){ -+ DMESG("Error: no TX slot "); -+ ieee80211_stop_queue(priv->ieee80211); -+ } -+ -+#ifdef LED_SHIN -+ priv->ieee80211->ieee80211_led_contorl(dev,LED_CTL_TX); -+#endif -+ -+ ret = rtl8180_tx(dev, (u32*)skb->data, skb->len, ep, morefrag,ieeerate2rtlrate(rate)); -+ if(ret!=0) DMESG("Error: rtl8180_tx failed in rtl8180_hard_data_xmit\n");//john -+ -+ priv->stats.txdatapkt++; -+ -+ //if (!check_nic_enought_desc(dev, PRI2EP[skb->priority])){ -+ if (!check_nic_enought_desc(dev, ep)){ -+ ieee80211_stop_queue(priv->ieee80211); -+ } -+ -+ spin_unlock_irqrestore(&priv->tx_lock,flags); -+ -+} -+ -+//This is a rough attempt to TX a frame -+//This is called by the ieee 80211 stack to TX management frames. -+//If the ring is full packet are dropped (for data frame the queue -+//is stopped before this can happen). -+ -+int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ struct ieee80211_device *ieee = priv->ieee80211; -+ int ret; -+ unsigned long flags; -+ spin_lock_irqsave(&priv->tx_lock,flags); -+ -+ //lzm mod 20081128 for sometimes wlan down but it still have some pkt to tx -+ if((priv->ieee80211->bHwRadioOff)||(!priv->up)) -+ { -+ spin_unlock_irqrestore(&priv->tx_lock,flags); -+ return 0; -+ } -+ -+ ret = rtl8180_tx(dev, (u32*)skb->data, skb->len, MANAGE_PRIORITY, 0, ieeerate2rtlrate(ieee->basic_rate)); -+ -+ priv->ieee80211->stats.tx_bytes+=skb->len; -+ priv->ieee80211->stats.tx_packets++; -+ -+ spin_unlock_irqrestore(&priv->tx_lock,flags); -+ -+ return ret; -+} -+ -+ -+#if 0 -+// longpre 144+48 shortpre 72+24 -+u16 rtl8180_len2duration(u32 len, short rate,short* ext) -+{ -+ u16 duration; -+ u16 drift; -+ *ext=0; -+ -+ switch(rate){ -+ case 0://1mbps -+ *ext=0; -+ duration = ((len+4)<<4) /0x2; -+ drift = ((len+4)<<4) % 0x2; -+ if(drift ==0 ) break; -+ duration++; -+ break; -+ -+ case 1://2mbps -+ *ext=0; -+ duration = ((len+4)<<4) /0x4; -+ drift = ((len+4)<<4) % 0x4; -+ if(drift ==0 ) break; -+ duration++; -+ break; -+ -+ case 2: //5.5mbps -+ *ext=0; -+ duration = ((len+4)<<4) /0xb; -+ drift = ((len+4)<<4) % 0xb; -+ if(drift ==0 ) -+ break; -+ duration++; -+ break; -+ -+ default: -+ case 3://11mbps -+ *ext=0; -+ duration = ((len+4)<<4) /0x16; -+ drift = ((len+4)<<4) % 0x16; -+ if(drift ==0 ) -+ break; -+ duration++; -+ if(drift > 6) -+ break; -+ *ext=1; -+ break; -+ } -+ -+ return duration; -+} -+#endif -+ -+void rtl8180_try_wake_queue(struct net_device *dev, int pri); -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -+void rtl8187_lptx_isr(struct urb *tx_urb, struct pt_regs *regs) -+#else -+void rtl8187_lptx_isr(struct urb* tx_urb) -+#endif -+{ -+ struct net_device *dev = (struct net_device*)tx_urb->context; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ if(tx_urb->status == 0){ -+ dev->trans_start = jiffies; //john -+ priv->stats.txlpokint++; -+ priv->txokbytestotal+=tx_urb->actual_length; -+ }else{ -+ priv->stats.txlperr++; -+ } -+ -+ kfree(tx_urb->transfer_buffer); -+ usb_free_urb(tx_urb); -+ -+ if(atomic_read(&priv->tx_pending[LOW_PRIORITY]) >= 1) -+ atomic_dec(&priv->tx_pending[LOW_PRIORITY]); -+ -+ rtl8180_try_wake_queue(dev,LOW_PRIORITY); -+} -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -+void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs) -+#else -+void rtl8187_nptx_isr(struct urb* tx_urb) -+#endif -+{ -+ struct net_device *dev = (struct net_device*)tx_urb->context; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ if(tx_urb->status == 0){ -+ dev->trans_start = jiffies; //john -+ priv->stats.txnpokint++; -+ }else{ -+ priv->stats.txnperr++; -+ } -+ -+ kfree(tx_urb->transfer_buffer); -+ usb_free_urb(tx_urb); -+ -+ if(atomic_read(&priv->tx_pending[NORM_PRIORITY]) >= 1) -+ atomic_dec(&priv->tx_pending[NORM_PRIORITY]); -+ //rtl8180_try_wake_queue(dev,NORM_PRIORITY); -+} -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -+void rtl8187_votx_isr(struct urb *tx_urb, struct pt_regs *regs) -+#else -+void rtl8187_votx_isr(struct urb* tx_urb) -+#endif -+{ -+ struct net_device *dev = (struct net_device*)tx_urb->context; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ if(tx_urb->status == 0){ -+ dev->trans_start = jiffies; //john -+ priv->stats.txvookint++; -+ priv->txokbytestotal+=tx_urb->actual_length; -+ }else{ -+ priv->stats.txvoerr++; -+ } -+ -+ kfree(tx_urb->transfer_buffer); -+ usb_free_urb(tx_urb); -+ -+ if(atomic_read(&priv->tx_pending[VO_PRIORITY]) >= 1) -+ atomic_dec(&priv->tx_pending[VO_PRIORITY]); -+ rtl8180_try_wake_queue(dev,VO_PRIORITY); -+} -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -+void rtl8187_vitx_isr(struct urb *tx_urb, struct pt_regs *regs) -+#else -+void rtl8187_vitx_isr(struct urb* tx_urb) -+#endif -+{ -+ struct net_device *dev = (struct net_device*)tx_urb->context; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ if(tx_urb->status == 0){ -+ dev->trans_start = jiffies; //john -+ priv->stats.txviokint++; -+ priv->txokbytestotal+=tx_urb->actual_length; -+ }else{ -+ priv->stats.txvierr++; -+ } -+ -+ kfree(tx_urb->transfer_buffer); -+ usb_free_urb(tx_urb); -+ -+ if(atomic_read(&priv->tx_pending[VI_PRIORITY]) >= 1) -+ atomic_dec(&priv->tx_pending[VI_PRIORITY]); -+ rtl8180_try_wake_queue(dev,VI_PRIORITY); -+} -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -+void rtl8187_betx_isr(struct urb *tx_urb, struct pt_regs *regs) -+#else -+void rtl8187_betx_isr(struct urb* tx_urb) -+#endif -+{ -+ struct net_device *dev = (struct net_device*)tx_urb->context; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ if(tx_urb->status == 0){ -+ dev->trans_start = jiffies; //john -+ priv->stats.txbeokint++; -+ priv->txokbytestotal+=tx_urb->actual_length; -+ }else{ -+ priv->stats.txbeerr++; -+ } -+ -+ kfree(tx_urb->transfer_buffer); -+ usb_free_urb(tx_urb); -+ -+ if(atomic_read(&priv->tx_pending[BE_PRIORITY]) >= 1) -+ atomic_dec(&priv->tx_pending[BE_PRIORITY]); -+ rtl8180_try_wake_queue(dev, BE_PRIORITY); -+} -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -+void rtl8187_bktx_isr(struct urb *tx_urb, struct pt_regs *regs) -+#else -+void rtl8187_bktx_isr(struct urb* tx_urb) -+#endif -+{ -+ struct net_device *dev = (struct net_device*)tx_urb->context; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ if(tx_urb->status == 0){ -+ dev->trans_start = jiffies; //john -+ priv->stats.txbkokint++; -+ }else{ -+ priv->stats.txbkerr++; -+ } -+ -+ kfree(tx_urb->transfer_buffer); -+ usb_free_urb(tx_urb); -+ -+ if(atomic_read(&priv->tx_pending[BK_PRIORITY]) >= 1) -+ atomic_dec(&priv->tx_pending[BK_PRIORITY]); -+ rtl8180_try_wake_queue(dev,BK_PRIORITY); -+} -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -+void rtl8187_beacontx_isr(struct urb *tx_urb, struct pt_regs *regs) -+#else -+void rtl8187_beacontx_isr(struct urb* tx_urb) -+#endif -+{ -+ struct net_device *dev = (struct net_device*)tx_urb->context; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ if(tx_urb->status == 0){ -+ dev->trans_start = jiffies; //john -+ priv->stats.txbeaconokint++; -+ priv->txokbytestotal+=tx_urb->actual_length; -+ }else{ -+ priv->stats.txbeaconerr++; -+ } -+ -+ kfree(tx_urb->transfer_buffer); -+ usb_free_urb(tx_urb); -+ -+ if(atomic_read(&priv->tx_pending[BEACON_PRIORITY]) >= 1) -+ atomic_dec(&priv->tx_pending[BEACON_PRIORITY]); -+ //rtl8180_try_wake_queue(dev,BEACON_PRIORITY); -+} -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -+void rtl8187_managetx_isr(struct urb *tx_urb, struct pt_regs *regs) -+#else -+void rtl8187_managetx_isr(struct urb* tx_urb) -+#endif -+{ -+ struct net_device *dev = (struct net_device*)tx_urb->context; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ if(tx_urb->status == 0){ -+ dev->trans_start = jiffies; //john -+ priv->stats.txmanageokint++; -+ priv->txokbytestotal+=tx_urb->actual_length; -+ }else{ -+ priv->stats.txmanageerr++; -+ } -+ -+ kfree(tx_urb->transfer_buffer); -+ usb_free_urb(tx_urb); -+ -+ if(atomic_read(&priv->tx_pending[MANAGE_PRIORITY]) >= 1) -+ atomic_dec(&priv->tx_pending[MANAGE_PRIORITY]); -+// rtl8180_try_wake_queue(dev,MANAGE_PRIORITY); -+} -+ -+void rtl8187_beacon_stop(struct net_device *dev) -+{ -+ u8 msr, msrm, msr2; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ unsigned long flag; -+ msr = read_nic_byte(dev, MSR); -+ msrm = msr & MSR_LINK_MASK; -+ msr2 = msr & ~MSR_LINK_MASK; -+ if(NIC_8187B == priv->card_8187) { -+ spin_lock_irqsave(&priv->ieee80211->beaconflag_lock,flag); -+ priv->flag_beacon = false; -+ spin_unlock_irqrestore(&priv->ieee80211->beaconflag_lock,flag); -+ } -+ if ((msrm == (MSR_LINK_ADHOC<<MSR_LINK_SHIFT) || -+ (msrm == (MSR_LINK_MASTER<<MSR_LINK_SHIFT)))){ -+ write_nic_byte(dev, MSR, msr2 | MSR_LINK_NONE); -+ write_nic_byte(dev, MSR, msr); -+ } -+} -+ -+ -+void rtl8187_net_update(struct net_device *dev) -+{ -+ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ struct ieee80211_network *net; -+ net = & priv->ieee80211->current_network; -+ -+ -+ write_nic_dword(dev,BSSID,((u32*)net->bssid)[0]); -+ write_nic_word(dev,BSSID+4,((u16*)net->bssid)[2]); -+ -+ rtl8180_update_msr(dev); -+ -+ //rtl8180_set_mode(dev,EPROM_CMD_CONFIG); -+ write_nic_word(dev, AtimWnd, 2); -+ write_nic_word(dev, AtimtrItv, 100); -+ write_nic_word(dev, BEACON_INTERVAL, net->beacon_interval); -+ //write_nic_word(dev, BcnIntTime, 100); -+ write_nic_word(dev, BcnIntTime, 0x3FF); -+ -+ -+} -+ -+void rtl8187_beacon_tx(struct net_device *dev) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ struct sk_buff *skb; -+ int i = 0; -+ u8 cr; -+ unsigned long flag; -+ rtl8187_net_update(dev); -+ -+ if(NIC_8187B == priv->card_8187) { -+ //Cause TSF timer of MAC reset to 0 -+ cr=read_nic_byte(dev,CMD); -+ cr = cr | (1<<CMD_RST_SHIFT); -+ write_nic_byte(dev,CMD,cr); -+ -+ //lzm mod 20081201 -+ //mdelay(200); -+ mdelay(20); -+ -+ if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT)) -+ DMESGW("Card reset timeout for ad-hoc!"); -+ else -+ DMESG("Card successfully reset for ad-hoc"); -+ -+ write_nic_byte(dev,CMD, (read_nic_byte(dev,CMD)|CR_RE|CR_TE)); -+ spin_lock_irqsave(&priv->ieee80211->beaconflag_lock,flag); -+ priv->flag_beacon = true; -+ spin_unlock_irqrestore(&priv->ieee80211->beaconflag_lock,flag); -+ -+ //rtl8187_rx_manage_initiate(dev); -+ } else { -+ printk(KERN_WARNING "get the beacon!\n"); -+ skb = ieee80211_get_beacon(priv->ieee80211); -+ if(!skb){ -+ DMESG("not enought memory for allocating beacon"); -+ return; -+ } -+ -+ write_nic_byte(dev, BQREQ, read_nic_byte(dev, BQREQ) | (1<<7)); -+ -+ i=0; -+ //while(!read_nic_byte(dev,BQREQ & (1<<7))) -+ while( (read_nic_byte(dev, BQREQ) & (1<<7)) == 0 ) -+ { -+ msleep_interruptible_rtl(HZ/2); -+ if(i++ > 10){ -+ DMESGW("get stuck to wait HW beacon to be ready"); -+ return ; -+ } -+ } -+ //tx -+ rtl8180_tx(dev, (u32*)skb->data, skb->len, NORM_PRIORITY, -+ 0, ieeerate2rtlrate(priv->ieee80211->basic_rate)); -+ if(skb) -+ dev_kfree_skb_any(skb); -+ } -+} -+ -+#if 0 -+void rtl8187_nptx_isr(struct urb *tx_urb, struct pt_regs *regs) -+{ -+ struct net_device *dev = (struct net_device*)tx_urb->context; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ if(tx_urb->status == 0) -+ priv->stats.txnpokint++; -+ else -+ priv->stats.txnperr++; -+ kfree(tx_urb->transfer_buffer); -+ usb_free_urb(tx_urb); -+ atomic_dec(&priv->tx_np_pending); -+ //rtl8180_try_wake_queue(dev,NORM_PRIORITY); -+} -+#endif -+inline u8 rtl8180_IsWirelessBMode(u16 rate) -+{ -+ if( ((rate <= 110) && (rate != 60) && (rate != 90)) || (rate == 220) ) -+ return 1; -+ else return 0; -+} -+ -+u16 N_DBPSOfRate(u16 DataRate); -+ -+u16 ComputeTxTime( -+ u16 FrameLength, -+ u16 DataRate, -+ u8 bManagementFrame, -+ u8 bShortPreamble -+ ) -+{ -+ u16 FrameTime; -+ u16 N_DBPS; -+ u16 Ceiling; -+ -+ if( rtl8180_IsWirelessBMode(DataRate) ) -+ { -+ if( bManagementFrame || !bShortPreamble || DataRate == 10 ){ // long preamble -+ FrameTime = (u16)(144+48+(FrameLength*8/(DataRate/10))); -+ }else{ // Short preamble -+ FrameTime = (u16)(72+24+(FrameLength*8/(DataRate/10))); -+ } -+ if( ( FrameLength*8 % (DataRate/10) ) != 0 ) //Get the Ceilling -+ FrameTime ++; -+ } else { //802.11g DSSS-OFDM PLCP length field calculation. -+ N_DBPS = N_DBPSOfRate(DataRate); -+ Ceiling = (16 + 8*FrameLength + 6) / N_DBPS -+ + (((16 + 8*FrameLength + 6) % N_DBPS) ? 1 : 0); -+ FrameTime = (u16)(16 + 4 + 4*Ceiling + 6); -+ } -+ return FrameTime; -+} -+ -+u16 N_DBPSOfRate(u16 DataRate) -+{ -+ u16 N_DBPS = 24; -+ -+ switch(DataRate) -+ { -+ case 60: -+ N_DBPS = 24; -+ break; -+ -+ case 90: -+ N_DBPS = 36; -+ break; -+ -+ case 120: -+ N_DBPS = 48; -+ break; -+ -+ case 180: -+ N_DBPS = 72; -+ break; -+ -+ case 240: -+ N_DBPS = 96; -+ break; -+ -+ case 360: -+ N_DBPS = 144; -+ break; -+ -+ case 480: -+ N_DBPS = 192; -+ break; -+ -+ case 540: -+ N_DBPS = 216; -+ break; -+ -+ default: -+ break; -+ } -+ -+ return N_DBPS; -+} -+// NOte!!! -+// the rate filled in is the rtl_rate. -+// while the priv->ieee80211->basic_rate,used in the following code is ieee80211 rate. -+ -+#ifdef JUST_FOR_87SEMESH -+#define ActionHeadLen 30 -+#endif -+#define sCrcLng 4 -+#define sAckCtsLng 112 // bits in ACK and CTS frames -+short rtl8180_tx(struct net_device *dev, u32* txbuf, int len, priority_t priority, -+ short morefrag, short rate) -+{ -+ u32 *tx; -+ int pend ; -+ int status; -+ struct urb *tx_urb; -+ int urb_len; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ struct ieee80211_hdr_3addr_QOS *frag_hdr = (struct ieee80211_hdr_3addr_QOS *)txbuf; -+ struct ieee80211_device *ieee;//added for descriptor -+ u8 dest[ETH_ALEN]; -+ -+ bool bUseShortPreamble = false; -+ bool bCTSEnable = false; -+ bool bRTSEnable = false; -+ u16 Duration = 0; -+ u16 RtsDur = 0; -+ u16 ThisFrameTime = 0; -+ u16 TxDescDuration = 0; -+ -+ ieee = priv->ieee80211; -+#if 0 -+//{added by david for filter the packet listed in the filter table -+#ifdef _RTL8187_EXT_PATCH_ -+ if((ieee->iw_mode == ieee->iw_ext_mode) && (ieee->ext_patch_ieee80211_acl_query)) -+ { -+ if(!ieee->ext_patch_ieee80211_acl_query(ieee, frag_hdr->addr1)) { -+ return 0; -+ } -+ } -+#endif -+//} -+#endif -+ -+#ifdef JUST_FOR_87SEMESH -+//#ifdef Lawrence_Mesh -+ u8* meshtype = (u8*)txbuf; -+ if(*meshtype == 0xA8) -+ { -+ //overflow?? -+ //memcpy(meshtype+ActionHeadLen+2,meshtype+ActionHeadLen,Len-ActionHeadLen); -+ //memcpy(meshtype+ActionHeadLen,0,2); -+ u8 actionframe[256]; -+ memset(actionframe,0,256); -+ memcpy(actionframe,meshtype,ActionHeadLen); -+ memcpy(actionframe+ActionHeadLen+2,meshtype+ActionHeadLen,len-ActionHeadLen); -+ txbuf = (u32*)actionframe; -+ len=len+2; -+ frag_hdr = (struct ieee80211_hdr_3addr_QOS *)txbuf; -+ } -+#endif -+ -+ //pend = atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending); -+ pend = atomic_read(&priv->tx_pending[priority]); -+ /* we are locked here so the two atomic_read and inc are executed without interleaves */ -+ if( pend > MAX_TX_URB){ -+ if(NIC_8187 == priv->card_8187) { -+ if(priority == NORM_PRIORITY) -+ priv->stats.txnpdrop++; -+ else -+ priv->stats.txlpdrop++; -+ -+ } else { -+ switch (priority) { -+ case VO_PRIORITY: -+ priv->stats.txvodrop++; -+ break; -+ case VI_PRIORITY: -+ priv->stats.txvidrop++; -+ break; -+ case BE_PRIORITY: -+ priv->stats.txbedrop++; -+ break; -+ case MANAGE_PRIORITY: //lzm for MANAGE_PRIORITY pending -+ if(priv->commit == 0) -+ { -+ priv->commit = 1; -+ printk(KERN_INFO "manage pkt pending will commit now....\n"); -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) -+ schedule_work(&priv->reset_wq); -+#else -+ schedule_task(&priv->reset_wq); -+#endif -+ } -+ break; -+ default://BK_PRIORITY -+ priv->stats.txbkdrop++; -+ break; -+ } -+ } -+ //printk(KERN_INFO "tx_pending: %d > MAX_TX_URB\n", priority); -+ return -1; -+ } -+ -+ urb_len = len + ((NIC_8187 == priv->card_8187)?(4*3):(4*8)); -+ if((0 == (urb_len&63))||(0 == (urb_len&511))) { -+ urb_len += 1; -+ } -+ -+ tx = kmalloc(urb_len, GFP_ATOMIC); -+ if(!tx) return -ENOMEM; -+ memset(tx, 0, sizeof(u32) * 8); -+ -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+ tx_urb = usb_alloc_urb(0,GFP_ATOMIC); -+#else -+ tx_urb = usb_alloc_urb(0); -+#endif -+ -+ if(!tx_urb){ -+ kfree(tx); -+ return -ENOMEM; -+ } -+ -+ // Check multicast/broadcast -+ if (ieee->iw_mode == IW_MODE_INFRA) { -+ /* To DS: Addr1 = BSSID, Addr2 = SA, -+ Addr3 = DA */ -+ //memcpy(&dest, frag_hdr->addr3, ETH_ALEN); -+ memcpy(&dest, frag_hdr->addr1, ETH_ALEN); -+ } else if (ieee->iw_mode == IW_MODE_ADHOC) { -+ /* not From/To DS: Addr1 = DA, Addr2 = SA, -+ Addr3 = BSSID */ -+ memcpy(&dest, frag_hdr->addr1, ETH_ALEN); -+ } -+ -+ if (is_multicast_ether_addr(dest) ||is_broadcast_ether_addr(dest)) -+ { -+ Duration = 0; -+ RtsDur = 0; -+ bRTSEnable = false; -+ bCTSEnable = false; -+ -+ ThisFrameTime = ComputeTxTime(len + sCrcLng, rtl8180_rate2rate(rate), false, bUseShortPreamble); -+ TxDescDuration = ThisFrameTime; -+ } else {// Unicast packet -+ //u8 AckRate; -+ u16 AckTime; -+ -+ // Figure out ACK rate according to BSS basic rate and Tx rate, 2006.03.08 by rcnjko. -+ //AckRate = ComputeAckRate( pMgntInfo->mBrates, (u1Byte)(pTcb->DataRate) ); -+ // Figure out ACK time according to the AckRate and assume long preamble is used on receiver, 2006.03.08, by rcnjko. -+ //AckTime = ComputeTxTime( sAckCtsLng/8, AckRate, FALSE, FALSE); -+ //For simplicity, just use the 1M basic rate -+ AckTime = ComputeTxTime(14, 10,false, false); // AckCTSLng = 14 use 1M bps send -+ //AckTime = ComputeTxTime(14, 2,false, false); // AckCTSLng = 14 use 1M bps send -+ -+ if ( ((len + sCrcLng) > priv->rts) && priv->rts ){ // RTS/CTS. -+ u16 RtsTime, CtsTime; -+ //u16 CtsRate; -+ bRTSEnable = true; -+ bCTSEnable = false; -+ -+ // Rate and time required for RTS. -+ RtsTime = ComputeTxTime( sAckCtsLng/8,priv->ieee80211->basic_rate, false, false); -+ // Rate and time required for CTS. -+ CtsTime = ComputeTxTime(14, 10,false, false); // AckCTSLng = 14 use 1M bps send -+ -+ // Figure out time required to transmit this frame. -+ ThisFrameTime = ComputeTxTime(len + sCrcLng, -+ rtl8180_rate2rate(rate), -+ false, -+ bUseShortPreamble); -+ -+ // RTS-CTS-ThisFrame-ACK. -+ RtsDur = CtsTime + ThisFrameTime + AckTime + 3*aSifsTime; -+ -+ TxDescDuration = RtsTime + RtsDur; -+ }else {// Normal case. -+ bCTSEnable = false; -+ bRTSEnable = false; -+ RtsDur = 0; -+ -+ ThisFrameTime = ComputeTxTime(len + sCrcLng, rtl8180_rate2rate(rate), false, bUseShortPreamble); -+ TxDescDuration = ThisFrameTime + aSifsTime + AckTime; -+ } -+ -+ if(!(frag_hdr->frame_ctl & IEEE80211_FCTL_MOREFRAGS)) { //no more fragment -+ // ThisFrame-ACK. -+ Duration = aSifsTime + AckTime; -+ } else { // One or more fragments remained. -+ u16 NextFragTime; -+ NextFragTime = ComputeTxTime( len + sCrcLng, //pretend following packet length equal current packet -+ rtl8180_rate2rate(rate), -+ false, bUseShortPreamble ); -+ -+ //ThisFrag-ACk-NextFrag-ACK. -+ Duration = NextFragTime + 3*aSifsTime + 2*AckTime; -+ } -+ -+ } // End of Unicast packet -+ -+ -+ //fill the tx desriptor -+ tx[0] |= len & 0xfff; -+#ifdef JOHN_HWSEC -+ if(frag_hdr->frame_ctl & IEEE80211_FCTL_WEP ){ -+ tx[0] &= 0xffff7fff; -+ //group key may be different from pairwise key -+ if( frag_hdr->addr1[0]==0xff && -+ frag_hdr->addr1[0]==0xff && -+ frag_hdr->addr1[0]==0xff && -+ frag_hdr->addr1[0]==0xff && -+ frag_hdr->addr1[0]==0xff && -+ frag_hdr->addr1[0]==0xff ){ -+ if(ieee->broadcast_key_type == KEY_TYPE_CCMP) tx[7] |= 0x2;//ccmp -+ else tx[7] |= 0x1;//wep and tkip -+ } -+ else { -+ if(ieee->pairwise_key_type == KEY_TYPE_CCMP) tx[7] |= 0x2;//CCMP -+ else tx[7] |= 0x1;//WEP and TKIP -+ } -+ } -+ else -+#endif /*JOHN_HWSEC*/ -+ -+ tx[0] |= (1<<15); -+ -+ if (priv->ieee80211->current_network.capability&WLAN_CAPABILITY_SHORT_PREAMBLE){ -+ if (priv->plcp_preamble_mode==1 && rate!=0) { // short mode now, not long! -+ tx[0] |= (1<<16); -+ } // enable short preamble mode. -+ } -+ -+ if(morefrag) tx[0] |= (1<<17); -+ //printk(KERN_WARNING "rtl_rate = %d\n", rate); -+ tx[0] |= (rate << 24); //TX rate -+ frag_hdr->duration_id = Duration; -+ -+ if(NIC_8187B == priv->card_8187) { -+ if(bCTSEnable) { -+ tx[0] |= (1<<18); -+ } -+ -+ if(bRTSEnable) //rts enable -+ { -+ tx[0] |= ((ieeerate2rtlrate(priv->ieee80211->basic_rate))<<19);//RTS RATE -+ tx[0] |= (1<<23);//rts enable -+ tx[1] |= RtsDur;//RTS Duration -+ } -+ tx[3] |= (TxDescDuration<<16); //DURATION -+ if( WLAN_FC_GET_STYPE(le16_to_cpu(frag_hdr->frame_ctl)) == IEEE80211_STYPE_PROBE_RESP ) -+ tx[5] |= (1<<8);//(priv->retry_data<<8); //retry lim ; -+ else -+ tx[5] |= (11<<8);//(priv->retry_data<<8); //retry lim ; -+ -+ //frag_hdr->duration_id = Duration; -+ memcpy(tx+8,txbuf,len); -+ } else { -+ if ( (len>priv->rts) && priv->rts && priority==LOW_PRIORITY){ -+ tx[0] |= (1<<23); //enalbe RTS function -+ tx[1] |= RtsDur; //Need to edit here! ----hikaru -+ } -+ else { -+ tx[1]=0; -+ } -+ tx[0] |= (ieeerate2rtlrate(priv->ieee80211->basic_rate) << 19); /* RTS RATE - should be basic rate */ -+ -+ tx[2] = 3; // CW min -+ tx[2] |= (7<<4); //CW max -+ tx[2] |= (11<<8);//(priv->retry_data<<8); //retry lim -+ -+ // printk("%x\n%x\n",tx[0],tx[1]); -+ -+#ifdef DUMP_TX -+ int i; -+ printk("<Tx pkt>--rate %x---",rate); -+ for (i = 0; i < (len + 3); i++) -+ printk("%2x", ((u8*)tx)[i]); -+ printk("---------------\n"); -+#endif -+ memcpy(tx+3,txbuf,len); -+ } -+ -+#ifdef JOHN_DUMP_TXDESC -+ int i; -+ printk("<Tx descriptor>--rate %x---",rate); -+ for (i = 0; i < 8; i++) -+ printk("%8x ", tx[i]); -+ printk("\n"); -+#endif -+#ifdef JOHN_DUMP_TXPKT -+ { -+ int j; -+ printk("\n---------------------------------------------------------------------\n"); -+ printk("<Tx packet>--rate %x--urb_len in decimal %d",rate, urb_len); -+ for (j = 32; j < (urb_len); j++){ -+ if( ( (j-32)%24 )==0 ) printk("\n"); -+ printk("%2x ", ((u8*)tx)[j]); -+ } -+ printk("\n---------------------------------------------------------------------\n"); -+ -+ } -+#endif -+ -+ if(NIC_8187 == priv->card_8187) { -+ usb_fill_bulk_urb(tx_urb,priv->udev, -+ usb_sndbulkpipe(priv->udev,priority), tx, -+ urb_len, (priority == LOW_PRIORITY)?rtl8187_lptx_isr:rtl8187_nptx_isr, dev); -+ -+ } else { -+ //printk(KERN_WARNING "Tx packet use by submit urb!\n"); -+ /* FIXME check what EP is for low/norm PRI */ -+ usb_fill_bulk_urb(tx_urb,priv->udev, -+ usb_sndbulkpipe(priv->udev,priority), tx, -+ urb_len, TXISR_SELECT(priority), dev); -+ } -+ -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+ status = usb_submit_urb(tx_urb, GFP_ATOMIC); -+#else -+ status = usb_submit_urb(tx_urb); -+#endif -+ -+ if (!status){ -+ //atomic_inc((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending); -+ atomic_inc(&priv->tx_pending[priority]); -+ dev->trans_start = jiffies; -+ //printk("=====> tx_pending[%d]=%d\n", priority, atomic_read(&priv->tx_pending[priority])); -+ return 0; -+ }else{ -+ DMESGE("Error TX URB %d, error pending %d", -+ //atomic_read((priority == NORM_PRIORITY)? &priv->tx_np_pending : &priv->tx_lp_pending), -+ atomic_read(&priv->tx_pending[priority]), -+ status); -+ return -1; -+ } -+} -+ -+ short rtl8187_usb_initendpoints(struct net_device *dev) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * (MAX_RX_URB+1), GFP_KERNEL); -+ -+ memset(priv->rx_urb, 0, sizeof(struct urb*) * MAX_RX_URB); -+ -+#ifdef JACKSON_NEW_RX -+ priv->pp_rxskb = (struct sk_buff **)kmalloc(sizeof(struct sk_buff *) * MAX_RX_URB, GFP_KERNEL); -+ if (priv->pp_rxskb == NULL) -+ goto destroy; -+ -+ memset(priv->pp_rxskb, 0, sizeof(struct sk_buff*) * MAX_RX_URB); -+#endif -+#ifdef THOMAS_BEACON -+ { -+ int align; -+ unsigned long oldaddr,newaddr; //lzm mod for 64bit cpu crash 20081107 -+ priv->rx_urb[MAX_RX_URB] = usb_alloc_urb(0, GFP_KERNEL); -+ priv->oldaddr = kmalloc(16, GFP_KERNEL); -+ oldaddr = (unsigned long)priv->oldaddr; -+ align = oldaddr&3; -+ if(align != 0 ){ -+ newaddr = oldaddr + 4 - align; -+ priv->rx_urb[MAX_RX_URB]->transfer_buffer_length = 16-4+align; -+ } -+ else{ -+ newaddr = oldaddr; -+ priv->rx_urb[MAX_RX_URB]->transfer_buffer_length = 16; -+ } -+ priv->rx_urb[MAX_RX_URB]->transfer_buffer = (u32*)newaddr; -+ } -+#endif -+ -+ -+ goto _middle; -+ -+ -+destroy: -+ -+#ifdef JACKSON_NEW_RX -+ if (priv->pp_rxskb) { -+ kfree(priv->pp_rxskb); -+ priv->pp_rxskb = NULL; -+ -+ } -+#endif -+ if (priv->rx_urb) { -+ kfree(priv->rx_urb); -+ } -+ priv->rx_urb = NULL; -+ -+ DMESGE("Endpoint Alloc Failure"); -+ return -ENOMEM; -+ -+ -+_middle: -+ -+ return 0; -+ -+} -+#ifdef THOMAS_BEACON -+void rtl8187_usb_deleteendpoints(struct net_device *dev) -+{ -+ int i; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ if( in_interrupt() ) -+ printk(KERN_ALERT " %ld in interrupt \n",in_interrupt() ); -+ if(priv->rx_urb){ -+ for(i=0;i<(MAX_RX_URB+1);i++){ -+ if(priv->rx_urb[i]) { -+ usb_kill_urb(priv->rx_urb[i]); -+ usb_free_urb(priv->rx_urb[i]); -+ } -+ } -+ kfree(priv->rx_urb); -+ priv->rx_urb = NULL; -+ } -+ if(priv->oldaddr){ -+ kfree(priv->oldaddr); -+ priv->oldaddr = NULL; -+ } -+ if (priv->pp_rxskb) { -+ kfree(priv->pp_rxskb); -+ priv->pp_rxskb = 0; -+ } -+} -+#endif -+ -+void rtl8187_set_rate(struct net_device *dev) -+{ -+ int i; -+ u16 word; -+ int basic_rate,min_rr_rate,max_rr_rate; -+ -+ //if (ieee80211_is_54g(priv->ieee80211->current_network) && -+ // priv->ieee80211->state == IEEE80211_LINKED){ -+ basic_rate = ieeerate2rtlrate(240); -+ min_rr_rate = ieeerate2rtlrate(60); -+ max_rr_rate = ieeerate2rtlrate(240); -+ -+ /* -+ }else{ -+ basic_rate = ieeerate2rtlrate(20); -+ min_rr_rate = ieeerate2rtlrate(10); -+ max_rr_rate = ieeerate2rtlrate(110); -+ } -+ */ -+ -+ write_nic_byte(dev, RESP_RATE, -+ max_rr_rate<<MAX_RESP_RATE_SHIFT| min_rr_rate<<MIN_RESP_RATE_SHIFT); -+ -+ //word = read_nic_word(dev, BRSR); -+ word = read_nic_word(dev, BRSR_8187); -+ word &= ~BRSR_MBR_8185; -+ -+ -+ for(i=0;i<=basic_rate;i++) -+ word |= (1<<i); -+ -+ //write_nic_word(dev, BRSR, word); -+ write_nic_word(dev, BRSR_8187, word); -+} -+ -+ -+void rtl8187_link_change(struct net_device *dev) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ //write_nic_word(dev, BintrItv, net->beacon_interval); -+ rtl8187_net_update(dev); -+ /*update timing params*/ -+ rtl8180_set_chan(dev, priv->chan); -+ rtl8187_set_rxconf(dev); -+} -+ -+#if LINUX_VERSION_CODE >=KERNEL_VERSION(2,6,20) -+void rtl8180_wmm_param_update(struct work_struct* work) -+{ -+ struct ieee80211_device * ieee = container_of(work, struct ieee80211_device,wmm_param_update_wq); -+ struct net_device *dev = ieee->dev; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+#else -+void rtl8180_wmm_param_update(struct ieee80211_device *ieee) -+{ -+ struct net_device *dev = ieee->dev; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+#endif -+ u8 *ac_param = (u8 *)(ieee->current_network.wmm_param); -+ u8 mode = ieee->current_network.mode; -+ AC_CODING eACI; -+ AC_PARAM AcParam; -+ PAC_PARAM pAcParam; -+ u8 i; -+ -+ //8187 need not to update wmm param, added by David, 2006.9.8 -+ if(NIC_8187 == priv->card_8187) { -+ return; -+ } -+ -+ if(!ieee->current_network.QoS_Enable) -+ { -+ //legacy ac_xx_param update -+ -+ AcParam.longData = 0; -+ AcParam.f.AciAifsn.f.AIFSN = 2; // Follow 802.11 DIFS. -+ AcParam.f.AciAifsn.f.ACM = 0; -+ AcParam.f.Ecw.f.ECWmin = 3; // Follow 802.11 CWmin. -+ AcParam.f.Ecw.f.ECWmax = 7; // Follow 802.11 CWmax. -+ AcParam.f.TXOPLimit = 0; -+ for(eACI = 0; eACI < AC_MAX; eACI++) -+ { -+ AcParam.f.AciAifsn.f.ACI = (u8)eACI; -+ { -+ u8 u1bAIFS; -+ u32 u4bAcParam; -+ -+ -+ pAcParam = (PAC_PARAM)(&AcParam); -+ // Retrive paramters to udpate. -+ u1bAIFS = pAcParam->f.AciAifsn.f.AIFSN *(((mode&IEEE_G) == IEEE_G)?9:20) + aSifsTime; -+ u4bAcParam = ((((u32)(pAcParam->f.TXOPLimit)) << AC_PARAM_TXOP_LIMIT_OFFSET) | -+ (((u32)(pAcParam->f.Ecw.f.ECWmax)) << AC_PARAM_ECW_MAX_OFFSET) | -+ (((u32)(pAcParam->f.Ecw.f.ECWmin)) << AC_PARAM_ECW_MIN_OFFSET) | -+ (((u32)u1bAIFS) << AC_PARAM_AIFS_OFFSET)); -+ -+ switch(eACI) -+ { -+ case AC1_BK: -+ write_nic_dword(dev, AC_BK_PARAM, u4bAcParam); -+ break; -+ -+ case AC0_BE: -+ write_nic_dword(dev, AC_BE_PARAM, u4bAcParam); -+ break; -+ -+ case AC2_VI: -+ write_nic_dword(dev, AC_VI_PARAM, u4bAcParam); -+ break; -+ -+ case AC3_VO: -+ write_nic_dword(dev, AC_VO_PARAM, u4bAcParam); -+ break; -+ -+ default: -+ printk(KERN_WARNING "SetHwReg8185(): invalid ACI: %d !\n", eACI); -+ break; -+ } -+ } -+ } -+ -+ return; -+ } -+ // -+ for(i = 0; i < AC_MAX; i++){ -+ pAcParam = (AC_PARAM * )ac_param; -+ { -+ AC_CODING eACI; -+ u8 u1bAIFS; -+ u32 u4bAcParam; -+ -+ // Retrive paramters to udpate. -+ eACI = pAcParam->f.AciAifsn.f.ACI; -+ //Mode G/A: slotTimeTimer = 9; Mode B: 20 -+ u1bAIFS = pAcParam->f.AciAifsn.f.AIFSN * (((mode&IEEE_G) == IEEE_G)?9:20) + aSifsTime; -+ u4bAcParam = ((((u32)(pAcParam->f.TXOPLimit)) << AC_PARAM_TXOP_LIMIT_OFFSET) | -+ (((u32)(pAcParam->f.Ecw.f.ECWmax)) << AC_PARAM_ECW_MAX_OFFSET) | -+ (((u32)(pAcParam->f.Ecw.f.ECWmin)) << AC_PARAM_ECW_MIN_OFFSET) | -+ (((u32)u1bAIFS) << AC_PARAM_AIFS_OFFSET)); -+ -+ switch(eACI) -+ { -+ case AC1_BK: -+ write_nic_dword(dev, AC_BK_PARAM, u4bAcParam); -+ //printk(KERN_WARNING "[%04x]:0x%08x\n",AC_BK_PARAM,read_nic_dword(dev, AC_BK_PARAM)); -+ break; -+ -+ case AC0_BE: -+ write_nic_dword(dev, AC_BE_PARAM, u4bAcParam); -+ //printk(KERN_WARNING "[%04x]:0x%08x\n",AC_BE_PARAM,read_nic_dword(dev, AC_BE_PARAM)); -+ break; -+ -+ case AC2_VI: -+ write_nic_dword(dev, AC_VI_PARAM, u4bAcParam); -+ //printk(KERN_WARNING "[%04x]:0x%08x\n",AC_VI_PARAM,read_nic_dword(dev, AC_VI_PARAM)); -+ break; -+ -+ case AC3_VO: -+ write_nic_dword(dev, AC_VO_PARAM, u4bAcParam); -+ //printk(KERN_WARNING "[%04x]:0x%08x\n",AC_VO_PARAM,read_nic_dword(dev, AC_VO_PARAM)); -+ break; -+ -+ default: -+ printk(KERN_WARNING "SetHwReg8185(): invalid ACI: %d !\n", eACI); -+ break; -+ } -+ } -+ ac_param += (sizeof(AC_PARAM)); -+ } -+} -+ -+int IncludedInSupportedRates(struct r8180_priv *priv, u8 TxRate ) -+{ -+ u8 rate_len; -+ u8 rate_ex_len; -+ u8 RateMask = 0x7F; -+ u8 idx; -+ unsigned short Found = 0; -+ u8 NaiveTxRate = TxRate&RateMask; -+ -+ rate_len = priv->ieee80211->current_network.rates_len; -+ rate_ex_len = priv->ieee80211->current_network.rates_ex_len; -+ -+ for( idx=0; idx< rate_len; idx++ ){ -+ if( (priv->ieee80211->current_network.rates[idx] & RateMask) == NaiveTxRate ) { -+ Found = 1; -+ goto found_rate; -+ } -+ } -+ -+ for( idx=0; idx< rate_ex_len; idx++ ) { -+ if( (priv->ieee80211->current_network.rates_ex[idx] & RateMask) == NaiveTxRate ) { -+ Found = 1; -+ goto found_rate; -+ } -+ } -+ -+ return Found; -+ found_rate: -+ return Found; -+} -+// -+// Description: -+// Get the Tx rate one degree up form the input rate in the supported rates. -+// Return the upgrade rate if it is successed, otherwise return the input rate. -+// By Bruce, 2007-06-05. -+// -+u8 GetUpgradeTxRate(struct net_device *dev, u8 rate) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ u8 UpRate; -+ -+ // Upgrade 1 degree. -+ switch(rate) -+ { -+ case 108: // Up to 54Mbps. -+ UpRate = 108; -+ break; -+ -+ case 96: // Up to 54Mbps. -+ UpRate = 108; -+ break; -+ -+ case 72: // Up to 48Mbps. -+ UpRate = 96; -+ break; -+ -+ case 48: // Up to 36Mbps. -+ UpRate = 72; -+ break; -+ -+ case 36: // Up to 24Mbps. -+ UpRate = 48; -+ break; -+ -+ case 22: // Up to 18Mbps. -+ UpRate = 36; -+ break; -+ -+ case 11: // Up to 11Mbps. -+ UpRate = 22; -+ break; -+ -+ case 4: // Up to 5.5Mbps. -+ UpRate = 11; -+ break; -+ -+ case 2: // Up to 2Mbps. -+ UpRate = 4; -+ break; -+ -+ default: -+ printk("GetUpgradeTxRate(): Input Tx Rate(%d) is undefined!\n", rate); -+ return rate; -+ } -+ // Check if the rate is valid. -+ if(IncludedInSupportedRates(priv, UpRate)) -+ { -+// printk("GetUpgradeTxRate(): GetUpgrade Tx rate(%d) from %d !\n", UpRate, priv->CurrentOperaRate); -+ return UpRate; -+ } -+ else -+ { -+ printk("GetUpgradeTxRate(): Tx rate (%d) is not in supported rates\n", UpRate); -+ return rate; -+ } -+ return rate; -+} -+// -+// Description: -+// Get the Tx rate one degree down form the input rate in the supported rates. -+// Return the degrade rate if it is successed, otherwise return the input rate. -+// By Bruce, 2007-06-05. -+// -+u8 GetDegradeTxRate( struct net_device *dev, u8 rate) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ u8 DownRate; -+ -+ // Upgrade 1 degree. -+ switch(rate) -+ { -+ case 108: // Down to 48Mbps. -+ DownRate = 96; -+ break; -+ -+ case 96: // Down to 36Mbps. -+ DownRate = 72; -+ break; -+ -+ case 72: // Down to 24Mbps. -+ DownRate = 48; -+ break; -+ -+ case 48: // Down to 18Mbps. -+ DownRate = 36; -+ break; -+ -+ case 36: // Down to 11Mbps. -+ DownRate = 22; -+ break; -+ -+ case 22: // Down to 5.5Mbps. -+ DownRate = 11; -+ break; -+ -+ case 11: // Down to 2Mbps. -+ DownRate = 4; -+ break; -+ -+ case 4: // Down to 1Mbps. -+ DownRate = 2; -+ break; -+ -+ case 2: // Down to 1Mbps. -+ DownRate = 2; -+ break; -+ -+ default: -+ printk("GetDegradeTxRate(): Input Tx Rate(%d) is undefined!\n", rate); -+ return rate; -+ } -+ // Check if the rate is valid. -+ if(IncludedInSupportedRates(priv, DownRate)){ -+// printk("GetDegradeTxRate(): GetDegrade Tx rate(%d) from %d!\n", DownRate, priv->CurrentOperaRate); -+ return DownRate; -+ }else{ -+ printk("GetDegradeTxRate(): Tx rate (%d) is not in supported rates\n", DownRate); -+ return rate; -+ } -+ return rate; -+} -+ -+// -+// Helper function to determine if specified data rate is -+// CCK rate. -+// 2005.01.25, by rcnjko. -+// -+bool MgntIsCckRate(u16 rate ) -+{ -+ bool bReturn = false; -+ -+ if((rate <= 22) && (rate != 12) && (rate != 18)){ -+ bReturn = true; -+ } -+ -+ return bReturn; -+} -+//by amy for rate adaptive -+// -+// Description: -+// Core logic to adjust Tx data rate in STA mode according to -+// OFDM retry count ratio. -+// -+// Note: -+// RTL8187 : pHalData->CurrRetryCnt = TallyCnt -+// RTL8187B : pHalData->CurrRetryCnt = PktRetryCnt in TxClosedCommand -+// -+void sta_rateadaptive8187B(struct net_device *dev) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ unsigned long CurrTxokCnt; -+ u16 CurrRetryCnt; -+ u16 CurrRetryRate; -+ unsigned long CurrRxokCnt; -+ bool bTryUp = false; -+ bool bTryDown = false; -+ u8 TryUpTh = 1; -+ u8 TryDownTh = 2; -+ u32 TxThroughput; -+ long CurrSignalStrength; -+ bool bUpdateInitialGain = false; -+ CurrRetryCnt = priv->CurrRetryCnt; -+ CurrTxokCnt = (priv->stats.txbeaconokint + priv->stats.txmanageokint + -+ priv->stats.txvookint + priv->stats.txviokint + priv->stats.txbeokint)- priv->LastTxokCnt; -+ CurrRxokCnt = priv->stats.rxok - priv->LastRxokCnt; -+ CurrSignalStrength = priv->RecvSignalPower; -+ TxThroughput = (u32)(priv->txokbytestotal - priv->LastTxOKBytes); -+ priv->LastTxOKBytes = priv->txokbytestotal; -+ priv->CurrentOperaRate = priv->ieee80211->rate / 5; -+ //printk("priv->CurrentOperaRate is %d\n",priv->CurrentOperaRate); -+ -+#if 1 -+ //2 Compute retry ratio. -+ if (CurrTxokCnt>0) -+ { -+ CurrRetryRate = (u16)(CurrRetryCnt*100/CurrTxokCnt); -+ } -+ else -+ { // It may be serious retry. To distinguish serious retry or no packets modified by Bruce -+ CurrRetryRate = (u16)(CurrRetryCnt*100/1); -+ } -+#endif -+ -+ -+ //printk("\n(1) priv->LastRetryRate: %d \n",priv->LastRetryRate); -+ //printk("(2) CurrRetryCnt = %d \n", CurrRetryCnt); -+ //printk("(3) TxokCnt = %d \n", CurrTxokCnt); -+ //printk("(4) CurrRetryRate = %d \n", CurrRetryRate); -+ //printk("(5) SignalStrength = %d \n",priv->RecvSignalPower); -+ -+ priv->LastRetryCnt = priv->CurrRetryCnt; -+ priv->LastTxokCnt = (priv->stats.txbeaconokint + priv->stats.txmanageokint + -+ priv->stats.txvookint + priv->stats.txviokint + priv->stats.txbeokint); -+ priv->LastRxokCnt = priv->stats.rxok; -+ priv->CurrRetryCnt = 0; -+ //2No Tx packets, return to init_rate or not? -+ if (CurrRetryRate==0 && CurrTxokCnt == 0) -+ { -+ // -+ // 2007.04.09, by Roger. after 4.5 seconds in this condition, we try to raise rate. -+ // -+ priv->TryupingCountNoData++; -+ -+ //printk("No Tx packets, TryupingCountNoData(%d)\n", priv->TryupingCountNoData); -+ //printk("(6) priv->CurrentOperaRate =%d\n", priv->CurrentOperaRate); -+ -+ if (priv->TryupingCountNoData>15) -+ { -+ priv->TryupingCountNoData = 0; -+ priv->CurrentOperaRate = GetUpgradeTxRate(dev, priv->CurrentOperaRate); -+ // Reset Fail Record -+ priv->LastFailTxRate = 0; -+ priv->LastFailTxRateSS = -200; -+ priv->FailTxRateCount = 0; -+ } -+ goto SetInitialGain; -+ } -+ else -+ { -+ priv->TryupingCountNoData=0; //Reset trying up times. -+ } -+ -+ // -+ // For Netgear case, I comment out the following signal strength estimation, -+ // which can results in lower rate to transmit when sample is NOT enough (e.g. PING request). -+ // 2007.04.09, by Roger. -+ // -+#if 1 -+ // If sample is not enough, we use signalstrength. -+ if ( CurrTxokCnt<10|| CurrRetryCnt<10) -+ { -+ //printk("Sample is not enough, we use signalstrength for rate adaptive\n"); -+ //After 3 sec, and trying up. -+ priv->TryupingCountNoData++; -+ if (priv->TryupingCountNoData>10) -+ { -+ //printk("Sample is not enough and After 3 sec try up\n"); -+ priv->TryupingCountNoData=0; -+ -+ // -+ // Added by Roger, 2007.01.04. -+ // Signal strength plus 3 for air link. -+ // -+ -+ if ( CurrSignalStrength>-68 )//&& IncludedInSupportedRates(Adapter, 108) ) -+ { -+ priv->ieee80211->rate = 540; -+ //pMgntInfo->CurrentOperaRate = 108; -+ } -+ else if (CurrSignalStrength>-70)// && IncludedInSupportedRates(Adapter, 96) ) -+ { -+ priv->ieee80211->rate = 480; -+ //pMgntInfo->CurrentOperaRate = 96; -+ } -+ else if (CurrSignalStrength>-73)// && IncludedInSupportedRates(Adapter, 72) ) -+ { -+ priv->ieee80211->rate = 360; -+ //pMgntInfo->CurrentOperaRate = 72; -+ } -+ else if (CurrSignalStrength>-79)// && IncludedInSupportedRates(Adapter, 48) ) -+ { -+ priv->ieee80211->rate = 240; -+ //pMgntInfo->CurrentOperaRate = 48; -+ } -+ else if (CurrSignalStrength>-81)// && IncludedInSupportedRates(Adapter, 36) ) -+ { -+ priv->ieee80211->rate = 180; -+ //pMgntInfo->CurrentOperaRate = 36; -+ } -+ else if (CurrSignalStrength>-83)// && IncludedInSupportedRates(Adapter, 22) ) -+ { -+ priv->ieee80211->rate = 110; -+ //pMgntInfo->CurrentOperaRate = 22; -+ } -+ else if (CurrSignalStrength>-85)// && IncludedInSupportedRates(Adapter, 11) ) -+ { -+ priv->ieee80211->rate = 55; -+ //pMgntInfo->CurrentOperaRate = 11; -+ } -+ else if (CurrSignalStrength>-89)// && IncludedInSupportedRates(Adapter, 4) ) -+ { -+ priv->ieee80211->rate = 20; -+ //pMgntInfo->CurrentOperaRate = 4; -+ } -+ -+ -+ } -+ -+ //2004.12.23 skip record for 0 -+ //pHalData->LastRetryRate = CurrRetryRate; -+ //printk("pMgntInfo->CurrentOperaRate =%d\n",priv->ieee80211->rate); -+ return; -+ } -+ else -+ { -+ priv->TryupingCountNoData=0; -+ } -+#endif -+ // -+ // Restructure rate adaptive as the following main stages: -+ // (1) Add retry threshold in 54M upgrading condition with signal strength. -+ // (2) Add the mechanism to degrade to CCK rate according to signal strength -+ // and retry rate. -+ // (3) Remove all Initial Gain Updates over OFDM rate. To avoid the complicated -+ // situation, Initial Gain Update is upon on DIG mechanism except CCK rate. -+ // (4) Add the mehanism of trying to upgrade tx rate. -+ // (5) Record the information of upping tx rate to avoid trying upping tx rate constantly. -+ // By Bruce, 2007-06-05. -+ // -+ // -+ -+ // 11Mbps or 36Mbps -+ // Check more times in these rate(key rates). -+ // -+ if(priv->CurrentOperaRate == 22 || priv->CurrentOperaRate == 72) -+ { -+ TryUpTh += 9; -+ } -+ // -+ // Let these rates down more difficult. -+ // -+ if(MgntIsCckRate(priv->CurrentOperaRate) || priv->CurrentOperaRate == 36) -+ { -+ TryDownTh += 1; -+ } -+ -+ //1 Adjust Rate. -+ if (priv->bTryuping == true) -+ { -+ //2 For Test Upgrading mechanism -+ // Note: -+ // Sometimes the throughput is upon on the capability bwtween the AP and NIC, -+ // thus the low data rate does not improve the performance. -+ // We randomly upgrade the data rate and check if the retry rate is improved. -+ -+ // Upgrading rate did not improve the retry rate, fallback to the original rate. -+ if ( (CurrRetryRate > 25) && TxThroughput < priv->LastTxThroughput) -+ { -+ //Not necessary raising rate, fall back rate. -+ bTryDown = true; -+ //printk("Not necessary raising rate, fall back rate....\n"); -+ //printk("(7) priv->CurrentOperaRate =%d, TxThroughput = %d, LastThroughput = %d\n", -+ // priv->CurrentOperaRate, TxThroughput, priv->LastTxThroughput); -+ } -+ else -+ { -+ priv->bTryuping = false; -+ } -+ } -+ else if (CurrSignalStrength > -51 && (CurrRetryRate < 100)) -+ { -+ //2For High Power -+ // -+ // Added by Roger, 2007.04.09. -+ // Return to highest data rate, if signal strength is good enough. -+ // SignalStrength threshold(-50dbm) is for RTL8186. -+ // Revise SignalStrength threshold to -51dbm. -+ // -+ // Also need to check retry rate for safety, by Bruce, 2007-06-05. -+ if(priv->CurrentOperaRate != 108) -+ { -+ bTryUp = true; -+ // Upgrade Tx Rate directly. -+ priv->TryupingCount += TryUpTh; -+ //printk("StaRateAdaptive87B: Power(%d) is high enough!!. \n", CurrSignalStrength); -+ } -+ } -+ // To avoid unstable rate jumping, comment out this condition, by Bruce, 2007-06-26. -+ /* -+ else if(CurrSignalStrength < -86 && CurrRetryRate >= 100) -+ { -+ //2 For Low Power -+ // -+ // Low signal strength and high current tx rate may cause Tx rate to degrade too slowly. -+ // Update Tx rate to CCK rate directly. -+ // By Bruce, 2007-06-05. -+ // -+ if(!MgntIsCckRate(pMgntInfo->CurrentOperaRate)) -+ { -+ if(CurrSignalStrength > -88 && IncludedInSupportedRates(Adapter, 22)) // 11M -+ pMgntInfo->CurrentOperaRate = 22; -+ else if(CurrSignalStrength > -90 && IncludedInSupportedRates(Adapter, 11)) // 5.5M -+ pMgntInfo->CurrentOperaRate = 11; -+ else if(CurrSignalStrength > -92 && IncludedInSupportedRates(Adapter, 4)) // 2M -+ pMgntInfo->CurrentOperaRate = 4; -+ else // 1M -+ pMgntInfo->CurrentOperaRate = 2; -+ } -+ else if(CurrRetryRate >= 200) -+ { -+ pMgntInfo->CurrentOperaRate = GetDegradeTxRate(Adapter, pMgntInfo->CurrentOperaRate); -+ } -+ RT_TRACE(COMP_RATE, DBG_LOUD, ("RA: Low Power(%d), or High Retry Rate(%d), set rate to CCK rate (%d). \n", -+ CurrSignalStrength, CurrRetryRate, pMgntInfo->CurrentOperaRate)); -+ bUpdateInitialGain = TRUE; -+ // Reset Fail Record -+ pHalData->LastFailTxRate = 0; -+ pHalData->LastFailTxRateSS = -200; -+ pHalData->FailTxRateCount = 0; -+ goto SetInitialGain; -+ } -+ */ -+ else if(CurrTxokCnt< 100 && CurrRetryRate >= 600) -+ { -+ //2 For Serious Retry -+ // -+ // Traffic is not busy but our Tx retry is serious. -+ // -+ bTryDown = true; -+ // Let Rate Mechanism to degrade tx rate directly. -+ priv->TryDownCountLowData += TryDownTh; -+ //printk("RA: Tx Retry is serious. Degrade Tx Rate to %d directly...\n", priv->CurrentOperaRate); -+ } -+ else if ( priv->CurrentOperaRate == 108 ) -+ { -+ //2For 54Mbps -+ // if ( (CurrRetryRate>38)&&(pHalData->LastRetryRate>35)) -+ if ( (CurrRetryRate>33)&&(priv->LastRetryRate>32)) -+ { -+ //(30,25) for cable link threshold. (38,35) for air link. -+ //Down to rate 48Mbps. -+ bTryDown = true; -+ } -+ } -+ else if ( priv->CurrentOperaRate == 96 ) -+ { -+ //2For 48Mbps -+ // if ( ((CurrRetryRate>73) && (pHalData->LastRetryRate>72)) && IncludedInSupportedRates(Adapter, 72) ) -+ if ( ((CurrRetryRate>48) && (priv->LastRetryRate>47))) -+ { -+ //(73, 72) for temp used. -+ //(25, 23) for cable link, (60,59) for air link. -+ //CurrRetryRate plus 25 and 26 respectively for air link. -+ //Down to rate 36Mbps. -+ bTryDown = true; -+ } -+ else if ( (CurrRetryRate<8) && (priv->LastRetryRate<8) ) //TO DO: need to consider (RSSI) -+ { -+ bTryUp = true; -+ } -+ } -+ else if ( priv->CurrentOperaRate == 72 ) -+ { -+ //2For 36Mbps -+ //if ( (CurrRetryRate>97) && (pHalData->LastRetryRate>97)) -+ if ( (CurrRetryRate>55) && (priv->LastRetryRate>54)) -+ { -+ //(30,25) for cable link threshold respectively. (103,10) for air link respectively. -+ //CurrRetryRate plus 65 and 69 respectively for air link threshold. -+ //Down to rate 24Mbps. -+ bTryDown = true; -+ } -+ // else if ( (CurrRetryRate<20) && (pHalData->LastRetryRate<20) && IncludedInSupportedRates(Adapter, 96) )//&& (device->LastRetryRate<15) ) //TO DO: need to consider (RSSI) -+ else if ( (CurrRetryRate<15) && (priv->LastRetryRate<16))//&& (device->LastRetryRate<15) ) //TO DO: need to consider (RSSI) -+ { -+ bTryUp = true; -+ } -+ } -+ else if ( priv->CurrentOperaRate == 48 ) -+ { -+ //2For 24Mbps -+ // if ( ((CurrRetryRate>119) && (pHalData->LastRetryRate>119) && IncludedInSupportedRates(Adapter, 36))) -+ if ( ((CurrRetryRate>63) && (priv->LastRetryRate>62))) -+ { -+ //(15,15) for cable link threshold respectively. (119, 119) for air link threshold. -+ //Plus 84 for air link threshold. -+ //Down to rate 18Mbps. -+ bTryDown = true; -+ } -+ // else if ( (CurrRetryRate<14) && (pHalData->LastRetryRate<15) && IncludedInSupportedRates(Adapter, 72)) //TO DO: need to consider (RSSI) -+ else if ( (CurrRetryRate<20) && (priv->LastRetryRate<21)) //TO DO: need to consider (RSSI) -+ { -+ bTryUp = true; -+ } -+ } -+ else if ( priv->CurrentOperaRate == 36 ) -+ { -+ //2For 18Mbps -+ if ( ((CurrRetryRate>109) && (priv->LastRetryRate>109))) -+ { -+ //(99,99) for cable link, (109,109) for air link. -+ //Down to rate 11Mbps. -+ bTryDown = true; -+ } -+ // else if ( (CurrRetryRate<15) && (pHalData->LastRetryRate<16) && IncludedInSupportedRates(Adapter, 48)) //TO DO: need to consider (RSSI) -+ else if ( (CurrRetryRate<25) && (priv->LastRetryRate<26)) //TO DO: need to consider (RSSI) -+ { -+ bTryUp = true; -+ } -+ } -+ else if ( priv->CurrentOperaRate == 22 ) -+ { -+ //2For 11Mbps -+ // if (CurrRetryRate>299 && IncludedInSupportedRates(Adapter, 11)) -+ if (CurrRetryRate>95) -+ { -+ bTryDown = true; -+ } -+ else if (CurrRetryRate<55)//&& (device->LastRetryRate<55) ) //TO DO: need to consider (RSSI) -+ { -+ bTryUp = true; -+ } -+ } -+ else if ( priv->CurrentOperaRate == 11 ) -+ { -+ //2For 5.5Mbps -+ // if (CurrRetryRate>159 && IncludedInSupportedRates(Adapter, 4) ) -+ if (CurrRetryRate>149) -+ { -+ bTryDown = true; -+ } -+ // else if ( (CurrRetryRate<30) && (pHalData->LastRetryRate<30) && IncludedInSupportedRates(Adapter, 22) ) -+ else if ( (CurrRetryRate<60) && (priv->LastRetryRate < 65)) -+ { -+ bTryUp = true; -+ } -+ } -+ else if ( priv->CurrentOperaRate == 4 ) -+ { -+ //2For 2 Mbps -+ if((CurrRetryRate>99) && (priv->LastRetryRate>99)) -+ { -+ bTryDown = true; -+ } -+ // else if ( (CurrRetryRate<50) && (pHalData->LastRetryRate<65) && IncludedInSupportedRates(Adapter, 11) ) -+ else if ( (CurrRetryRate < 65) && (priv->LastRetryRate < 70)) -+ { -+ bTryUp = true; -+ } -+ } -+ else if ( priv->CurrentOperaRate == 2 ) -+ { -+ //2For 1 Mbps -+ // if ( (CurrRetryRate<50) && (pHalData->LastRetryRate<65) && IncludedInSupportedRates(Adapter, 4)) -+ if ( (CurrRetryRate<70) && (priv->LastRetryRate<75)) -+ { -+ bTryUp = true; -+ } -+ } -+ if(bTryUp && bTryDown) -+ printk("StaRateAdaptive87B(): Tx Rate tried upping and downing simultaneously!\n"); -+ -+ //1 Test Upgrading Tx Rate -+ // Sometimes the cause of the low throughput (high retry rate) is the compatibility between the AP and NIC. -+ // To test if the upper rate may cause lower retry rate, this mechanism randomly occurs to test upgrading tx rate. -+ if(!bTryUp && !bTryDown && (priv->TryupingCount == 0) && (priv->TryDownCountLowData == 0) -+ && priv->CurrentOperaRate != 108 && priv->FailTxRateCount < 2) -+ { -+#if 1 -+ if(jiffies% (CurrRetryRate + 101) == 0) -+ { -+ bTryUp = true; -+ priv->bTryuping = true; -+ printk("======================================================>StaRateAdaptive87B(): Randomly try upgrading...\n"); -+ } -+#endif -+ } -+ //1 Rate Mechanism -+ if(bTryUp) -+ { -+ priv->TryupingCount++; -+ priv->TryDownCountLowData = 0; -+ -+ // -+ // Check more times if we need to upgrade indeed. -+ // Because the largest value of pHalData->TryupingCount is 0xFFFF and -+ // the largest value of pHalData->FailTxRateCount is 0x14, -+ // this condition will be satisfied at most every 2 min. -+ // -+ if((priv->TryupingCount > (TryUpTh + priv->FailTxRateCount * priv->FailTxRateCount)) || -+ (CurrSignalStrength > priv->LastFailTxRateSS) || priv->bTryuping) -+ { -+ priv->TryupingCount = 0; -+ // -+ // When transfering from CCK to OFDM, DIG is an important issue. -+ // -+ if(priv->CurrentOperaRate == 22) -+ bUpdateInitialGain = true; -+ // (1)To avoid upgrade frequently to the fail tx rate, add the FailTxRateCount into the threshold. -+ // (2)If the signal strength is increased, it may be able to upgrade. -+ priv->CurrentOperaRate = GetUpgradeTxRate(dev, priv->CurrentOperaRate); -+ //printk("StaRateAdaptive87B(): Upgrade Tx Rate to %d\n", priv->CurrentOperaRate); -+ -+ // Update Fail Tx rate and count. -+ if(priv->LastFailTxRate != priv->CurrentOperaRate) -+ { -+ priv->LastFailTxRate = priv->CurrentOperaRate; -+ priv->FailTxRateCount = 0; -+ priv->LastFailTxRateSS = -200; // Set lowest power. -+ } -+ } -+ } -+ else -+ { -+ if(priv->TryupingCount > 0) -+ priv->TryupingCount --; -+ } -+ -+ if(bTryDown) -+ { -+ priv->TryDownCountLowData++; -+ priv->TryupingCount = 0; -+ -+ -+ //Check if Tx rate can be degraded or Test trying upgrading should fallback. -+ if(priv->TryDownCountLowData > TryDownTh || priv->bTryuping) -+ { -+ priv->TryDownCountLowData = 0; -+ priv->bTryuping = false; -+ // Update fail information. -+ if(priv->LastFailTxRate == priv->CurrentOperaRate) -+ { -+ priv->FailTxRateCount ++; -+ // Record the Tx fail rate signal strength. -+ if(CurrSignalStrength > priv->LastFailTxRateSS) -+ { -+ priv->LastFailTxRateSS = CurrSignalStrength; -+ } -+ } -+ else -+ { -+ priv->LastFailTxRate = priv->CurrentOperaRate; -+ priv->FailTxRateCount = 1; -+ priv->LastFailTxRateSS = CurrSignalStrength; -+ } -+ priv->CurrentOperaRate = GetDegradeTxRate(dev, priv->CurrentOperaRate); -+ // -+ // When it is CCK rate, it may need to update initial gain to receive lower power packets. -+ // -+ if(MgntIsCckRate(priv->CurrentOperaRate)) -+ { -+ bUpdateInitialGain = true; -+ } -+ //printk("StaRateAdaptive87B(): Degrade Tx Rate to %d\n", priv->CurrentOperaRate); -+ } -+ } -+ else -+ { -+ if(priv->TryDownCountLowData > 0) -+ priv->TryDownCountLowData --; -+ } -+ // Keep the Tx fail rate count to equal to 0x15 at most. -+ // Reduce the fail count at least to 10 sec if tx rate is tending stable. -+ if(priv->FailTxRateCount >= 0x15 || -+ (!bTryUp && !bTryDown && priv->TryDownCountLowData == 0 && priv->TryupingCount && priv->FailTxRateCount > 0x6)) -+ { -+ priv->FailTxRateCount --; -+ } -+ -+ // -+ // We need update initial gain when we set tx rate "from OFDM to CCK" or -+ // "from CCK to OFDM". -+ // -+SetInitialGain: -+#if 1 //to be done -+ if(bUpdateInitialGain) -+ { -+ if(MgntIsCckRate(priv->CurrentOperaRate)) // CCK -+ { -+ if(priv->InitialGain > priv->RegBModeGainStage) -+ { -+ if(CurrSignalStrength < -85) // Low power, OFDM [0x17] = 26. -+ { -+ priv->InitialGain = priv->RegBModeGainStage; -+ } -+ else if(priv->InitialGain > priv->RegBModeGainStage + 1) -+ { -+ priv->InitialGain -= 2; -+ } -+ else -+ { -+ priv->InitialGain --; -+ } -+ UpdateInitialGain(dev); -+ } -+ } -+ else // OFDM -+ { -+ if(priv->InitialGain < 4) -+ { -+ priv->InitialGain ++; -+ UpdateInitialGain(dev); -+ } -+ } -+ } -+#endif -+ //Record the related info -+ priv->LastRetryRate = CurrRetryRate; -+ priv->LastTxThroughput = TxThroughput; -+ priv->ieee80211->rate = priv->CurrentOperaRate * 5; -+} -+ -+#if LINUX_VERSION_CODE >=KERNEL_VERSION(2,6,20) -+void rtl8180_rate_adapter(struct work_struct * work) -+{ -+ struct delayed_work *dwork = container_of(work,struct delayed_work,work); -+ struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,rate_adapter_wq); -+ struct net_device *dev = ieee->dev; -+#else -+void rtl8180_rate_adapter(struct net_device *dev) -+{ -+ -+#endif -+ sta_rateadaptive8187B(dev); -+} -+ -+void timer_rate_adaptive(unsigned long data) -+{ -+ struct r8180_priv* priv = ieee80211_priv((struct net_device *)data); -+ //DMESG("---->timer_rate_adaptive()\n"); -+ if(!priv->up) -+ { -+ //DMESG("<----timer_rate_adaptive():driver is not up!\n"); -+ return; -+ } -+ if( (priv->ieee80211->mode != IEEE_B) && -+ (priv->ieee80211->iw_mode != IW_MODE_MASTER) -+ && ((priv->ieee80211->state == IEEE80211_LINKED)||(priv->ieee80211->state == IEEE80211_MESH_LINKED))) -+ { -+ //DMESG("timer_rate_adaptive():schedule rate_adapter_wq\n"); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) -+ queue_delayed_work(priv->ieee80211->wq,&priv->ieee80211->rate_adapter_wq, 0); -+#else -+ queue_work(priv->ieee80211->wq,&priv->ieee80211->rate_adapter_wq); -+#endif -+ } -+ -+ mod_timer(&priv->rateadapter_timer, jiffies + MSECS(DEFAULT_RATE_ADAPTIVE_TIMER_PERIOD)); -+ //DMESG("<----timer_rate_adaptive()\n"); -+} -+//by amy for rate adaptive -+ -+ -+void rtl8180_irq_rx_tasklet_new(struct r8180_priv *priv); -+void rtl8180_irq_rx_tasklet(struct r8180_priv *priv); -+ -+//YJ,add,080828,for KeepAlive -+#if 0 -+static void MgntLinkKeepAlive(struct r8180_priv *priv ) -+{ -+ if (priv->keepAliveLevel == 0) -+ return; -+ -+ if(priv->ieee80211->state == IEEE80211_LINKED) -+ { -+ // -+ // Keep-Alive. -+ // -+ //printk("LastTx:%d Tx:%d LastRx:%d Rx:%ld Idle:%d\n",priv->link_detect.LastNumTxUnicast,priv->NumTxUnicast, priv->link_detect.LastNumRxUnicast, priv->ieee80211->NumRxUnicast, priv->link_detect.IdleCount); -+ -+ if ( (priv->keepAliveLevel== 2) || -+ (priv->link_detect.LastNumTxUnicast == priv->NumTxUnicast && -+ priv->link_detect.LastNumRxUnicast == priv->ieee80211->NumRxUnicast ) -+ ) -+ { -+ priv->link_detect.IdleCount++; -+ -+ // -+ // Send a Keep-Alive packet packet to AP if we had been idle for a while. -+ // -+ if(priv->link_detect.IdleCount >= ((KEEP_ALIVE_INTERVAL / CHECK_FOR_HANG_PERIOD)-1) ) -+ { -+ priv->link_detect.IdleCount = 0; -+ ieee80211_sta_ps_send_null_frame(priv->ieee80211, false); -+ } -+ } -+ else -+ { -+ priv->link_detect.IdleCount = 0; -+ } -+ priv->link_detect.LastNumTxUnicast = priv->NumTxUnicast; -+ priv->link_detect.LastNumRxUnicast = priv->ieee80211->NumRxUnicast; -+ } -+} -+//YJ,add,080828,for KeepAlive,end -+#endif -+void InactivePowerSave(struct net_device *dev) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ -+ // -+ // This flag "bSwRfProcessing", indicates the status of IPS procedure, should be set if the IPS workitem -+ // is really scheduled. -+ // The old code, sets this flag before scheduling the IPS workitem and however, at the same time the -+ // previous IPS workitem did not end yet, fails to schedule the current workitem. Thus, bSwRfProcessing -+ // blocks the IPS procedure of switching RF. -+ // By Bruce, 2007-12-25. -+ // -+ priv->bSwRfProcessing = true; -+ MgntActSet_RF_State(dev, priv->eInactivePowerState, RF_CHANGE_BY_IPS); -+ -+ // -+ // To solve CAM values miss in RF OFF, rewrite CAM values after RF ON. By Bruce, 2007-09-20. -+ // -+#if 0 -+ while( index < 4 ) -+ { -+ if( ( pMgntInfo->SecurityInfo.PairwiseEncAlgorithm == WEP104_Encryption ) || -+ (pMgntInfo->SecurityInfo.PairwiseEncAlgorithm == WEP40_Encryption) ) -+ { -+ if( pMgntInfo->SecurityInfo.KeyLen[index] != 0) -+ pAdapter->HalFunc.SetKeyHandler(pAdapter, index, 0, FALSE, pMgntInfo->SecurityInfo.PairwiseEncAlgorithm, TRUE, FALSE); -+ -+ } -+ index++; -+ } -+#endif -+ priv->bSwRfProcessing = false; -+} -+ -+// -+// Description: -+// Enter the inactive power save mode. RF will be off -+// 2007.08.17, by shien chang. -+// -+void IPSEnter(struct net_device *dev) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ RT_RF_POWER_STATE rtState; -+ -+ if (priv->bInactivePs) -+ { -+ rtState = priv->eRFPowerState; -+ -+ // -+ // Added by Bruce, 2007-12-25. -+ // Do not enter IPS in the following conditions: -+ // (1) RF is already OFF or Sleep -+ // (2) bSwRfProcessing (indicates the IPS is still under going) -+ // (3) Connectted (only disconnected can trigger IPS) -+ // (4) IBSS (send Beacon) -+ // (5) AP mode (send Beacon) -+ // -+ if (rtState == eRfOn && !priv->bSwRfProcessing && (priv->ieee80211->iw_mode != IW_MODE_ADHOC) -+ && (priv->ieee80211->state != IEEE80211_LINKED )) -+ { -+#ifdef CONFIG_RADIO_DEBUG -+ DMESG("IPSEnter(): Turn off RF."); -+#endif -+ priv->eInactivePowerState = eRfOff; -+ InactivePowerSave(dev); -+ //SetRFPowerState(dev, priv->eInactivePowerState); -+ //MgntActSet_RF_State(dev, priv->eInactivePowerState, RF_CHANGE_BY_IPS); -+ } -+ } -+ //printk("priv->eRFPowerState is %d\n",priv->eRFPowerState); -+} -+ -+void IPSLeave(struct net_device *dev) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ RT_RF_POWER_STATE rtState; -+ if (priv->bInactivePs) -+ { -+ rtState = priv->eRFPowerState; -+ if (rtState == eRfOff && (!priv->bSwRfProcessing) && priv->RfOffReason <= RF_CHANGE_BY_IPS) -+ { -+#ifdef CONFIG_RADIO_DEBUG -+ DMESG("ISLeave(): Turn on RF."); -+#endif -+ priv->eInactivePowerState = eRfOn; -+ InactivePowerSave(dev); -+ } -+ } -+// printk("priv->eRFPowerState is %d\n",priv->eRFPowerState); -+} -+//by amy for power save -+ -+//YJ,add,081230 -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) -+void IPSLeave_wq (struct work_struct *work) -+{ -+ struct ieee80211_device *ieee = container_of(work,struct ieee80211_device,ips_leave_wq); -+ struct net_device *dev = ieee->dev; -+#else -+void IPSLeave_wq(struct net_device *dev) -+{ -+#endif -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ down(&priv->ieee80211->ips_sem); -+ IPSLeave(dev); -+ up(&priv->ieee80211->ips_sem); -+} -+ -+void ieee80211_ips_leave(struct net_device *dev) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ if(priv->bInactivePs){ -+ if(priv->eRFPowerState == eRfOff) -+ { -+ //DMESG("%s", __FUNCTION__); -+ queue_work(priv->ieee80211->wq,&priv->ieee80211->ips_leave_wq); -+ } -+ } -+} -+//YJ,add,081230,end -+ -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) -+void rtl8180_watch_dog_wq (struct work_struct *work) -+{ -+ struct delayed_work *dwork = container_of(work,struct delayed_work,work); -+ struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,watch_dog_wq); -+ struct net_device *dev = ieee->dev; -+#else -+void rtl8180_watch_dog_wq(struct net_device *dev) -+{ -+#endif -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ //bool bEnterPS = false; -+ //bool bBusyTraffic = false; -+ u32 TotalRxNum = 0; -+ u16 SlotIndex = 0, i=0; -+ //YJ,add,080828,for link state check -+ if((priv->ieee80211->state == IEEE80211_LINKED) && (priv->ieee80211->iw_mode == IW_MODE_INFRA)){ -+ SlotIndex = (priv->link_detect.SlotIndex++) % priv->link_detect.SlotNum; -+ priv->link_detect.RxFrameNum[SlotIndex] = priv->ieee80211->NumRxDataInPeriod + priv->ieee80211->NumRxBcnInPeriod; -+ for( i=0; i<priv->link_detect.SlotNum; i++ ) -+ TotalRxNum+= priv->link_detect.RxFrameNum[i]; -+#if 0 //for roaming temp del -+ if(TotalRxNum == 0){ -+ priv->ieee80211->state = IEEE80211_ASSOCIATING; -+ printk("=========>turn to another AP\n"); -+ queue_work(priv->ieee80211->wq, &priv->ieee80211->associate_procedure_wq); -+ } -+#endif -+ } -+ priv->link_detect.NumRxOkInPeriod = 0; -+ priv->link_detect.NumTxOkInPeriod = 0; -+ priv->ieee80211->NumRxDataInPeriod = 0; -+ priv->ieee80211->NumRxBcnInPeriod = 0; -+ -+#ifdef CONFIG_IPS -+ if(priv->ieee80211->actscanning == false){ -+ if((priv->ieee80211->iw_mode == IW_MODE_INFRA) && -+ (priv->ieee80211->state == IEEE80211_NOLINK) && -+ (priv->eRFPowerState == eRfOn)) -+ { -+ //printk("actscanning:%d, state:%d, eRFPowerState:%d\n", -+ // priv->ieee80211->actscanning, -+ // priv->ieee80211->state, -+ // priv->eRFPowerState); -+ -+ down(&priv->ieee80211->ips_sem); -+ IPSEnter(dev); -+ up(&priv->ieee80211->ips_sem); -+ } -+ } -+ //queue_delayed_work(priv->ieee80211->wq,&priv->ieee80211->watch_dog_wq,IEEE80211_WATCH_DOG_TIME); -+#endif -+ -+ //printk("========================>leave rtl8180_watch_dog_wq()\n"); -+} -+ -+void watch_dog_adaptive(unsigned long data) -+{ -+ struct net_device* dev = (struct net_device*)data; -+ struct r8180_priv* priv = ieee80211_priv(dev); -+ //DMESG("---->watch_dog_adaptive()\n"); -+ if(!priv->up){ -+ //DMESG("<----watch_dog_adaptive():driver is not up!\n"); -+ return; -+ } -+ // Tx and Rx High Power Mechanism. -+ if(CheckHighPower(dev)){ -+ //printk("===============================> high power!\n"); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) -+ queue_delayed_work(priv->ieee80211->wq,&priv->ieee80211->tx_pw_wq, 0); -+#else -+ queue_work(priv->ieee80211->wq,&priv->ieee80211->tx_pw_wq); -+#endif -+ } -+ -+ // Schedule an workitem to perform DIG -+ if(CheckDig(dev) == true){ -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) -+ queue_delayed_work(priv->ieee80211->wq,&priv->ieee80211->hw_dig_wq,0); -+#else -+ queue_work(priv->ieee80211->wq,&priv->ieee80211->hw_dig_wq); -+#endif -+ } -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) -+ queue_delayed_work(priv->ieee80211->wq,&priv->ieee80211->watch_dog_wq,0); -+#else -+ queue_work(priv->ieee80211->wq,&priv->ieee80211->watch_dog_wq); -+#endif -+ -+ mod_timer(&priv->watch_dog_timer, jiffies + MSECS(IEEE80211_WATCH_DOG_TIME)); -+ //DMESG("<----watch_dog_adaptive()\n"); -+} -+ -+#ifdef ENABLE_DOT11D -+ -+CHANNEL_LIST Current_tbl; -+ -+static CHANNEL_LIST ChannelPlan[] = { -+ {{1,2,3,4,5,6,7,8,9,10,11,36,40,44,48,52,56,60,64},19}, //FCC -+ {{1,2,3,4,5,6,7,8,9,10,11},11}, //IC -+ {{1,2,3,4,5,6,7,8,9,10,11,12,13,36,40,44,48,52,56,60,64},21}, //ETSI -+ {{1,2,3,4,5,6,7,8,9,10,11,12,13,36,40,44,48,52,56,60,64},21}, //Spain. Change to ETSI. -+ {{1,2,3,4,5,6,7,8,9,10,11,12,13,36,40,44,48,52,56,60,64},21}, //France. Change to ETSI. -+ {{14,36,40,44,48,52,56,60,64},9}, //MKK -+ {{1,2,3,4,5,6,7,8,9,10,11,12,13,14, 36,40,44,48,52,56,60,64},22},//MKK1 -+ {{1,2,3,4,5,6,7,8,9,10,11,12,13,36,40,44,48,52,56,60,64},21}, //Israel. -+ {{1,2,3,4,5,6,7,8,9,10,11,12,13,34,38,42,46},17}, // For 11a , TELEC -+ {{1,2,3,4,5,6,7,8,9,10,11,12,13,14},14}, //For Global Domain. 1-11:active scan, 12-14 passive scan. //+YJ, 080626 -+ {{1,2,3,4,5,6,7,8,9,10,11,12,13},13} //world wide 13: ch1~ch11 active scan, ch12~13 passive //lzm add 081205 -+}; -+ -+static void rtl8180_set_channel_map(u8 channel_plan, struct ieee80211_device *ieee) -+{ -+ int i; -+ -+ //lzm add 081205 -+ ieee->MinPassiveChnlNum=MAX_CHANNEL_NUMBER+1; -+ ieee->IbssStartChnl=0; -+ -+ switch (channel_plan) -+ { -+ case COUNTRY_CODE_FCC: -+ case COUNTRY_CODE_IC: -+ case COUNTRY_CODE_ETSI: -+ case COUNTRY_CODE_SPAIN: -+ case COUNTRY_CODE_FRANCE: -+ case COUNTRY_CODE_MKK: -+ case COUNTRY_CODE_MKK1: -+ case COUNTRY_CODE_ISRAEL: -+ case COUNTRY_CODE_TELEC: -+ { -+ Dot11d_Init(ieee); -+ ieee->bGlobalDomain = false; -+ ieee->bWorldWide13 = false; -+ if (ChannelPlan[channel_plan].Len != 0){ -+ // Clear old channel map -+ memset(GET_DOT11D_INFO(ieee)->channel_map, 0, sizeof(GET_DOT11D_INFO(ieee)->channel_map)); -+ // Set new channel map -+ for (i=0;i<ChannelPlan[channel_plan].Len;i++) -+ { -+ if(ChannelPlan[channel_plan].Channel[i] <= 14) -+ GET_DOT11D_INFO(ieee)->channel_map[ChannelPlan[channel_plan].Channel[i]] = 1; -+ } -+ } -+ break; -+ } -+ case COUNTRY_CODE_GLOBAL_DOMAIN: -+ { -+ GET_DOT11D_INFO(ieee)->bEnabled = 0; -+ Dot11d_Reset(ieee); -+ ieee->bGlobalDomain = true; -+ ieee->bWorldWide13 = false; -+ -+ //lzm add 081205 -+ ieee->MinPassiveChnlNum=12; -+ ieee->IbssStartChnl= 10; -+ -+ break; -+ } -+ case COUNTRY_CODE_WORLD_WIDE_13_INDEX://lzm add 081205 -+ { -+ Dot11d_Init(ieee); -+ ieee->bGlobalDomain = false; -+ ieee->bWorldWide13 = true; -+ -+ //lzm add 081205 -+ ieee->MinPassiveChnlNum=12; -+ ieee->IbssStartChnl= 10; -+ -+ if (ChannelPlan[channel_plan].Len != 0){ -+ // Clear old channel map -+ memset(GET_DOT11D_INFO(ieee)->channel_map, 0, sizeof(GET_DOT11D_INFO(ieee)->channel_map)); -+ // Set new channel map -+ for (i=0;i<ChannelPlan[channel_plan].Len;i++) -+ { -+ if(ChannelPlan[channel_plan].Channel[i] <= 11)//ch1~ch11 active scan -+ GET_DOT11D_INFO(ieee)->channel_map[ChannelPlan[channel_plan].Channel[i]] = 1; -+ else//ch12~13 passive scan -+ GET_DOT11D_INFO(ieee)->channel_map[ChannelPlan[channel_plan].Channel[i]] = 2; -+ } -+ } -+ -+ break; -+ } -+ default: -+ { -+ Dot11d_Init(ieee); -+ ieee->bGlobalDomain = false; -+ ieee->bWorldWide13 = false; -+ memset(GET_DOT11D_INFO(ieee)->channel_map, 0, sizeof(GET_DOT11D_INFO(ieee)->channel_map)); -+ for (i=1;i<=14;i++) -+ { -+ GET_DOT11D_INFO(ieee)->channel_map[i] = 1; -+ } -+ break; -+ } -+ } -+} -+#endif -+ -+ -+static void rtl8180_link_detect_init(plink_detect_t plink_detect) -+{ -+ memset(plink_detect, 0, sizeof(link_detect_t)); -+ plink_detect->SlotNum = DEFAULT_SLOT_NUM; -+} -+ -+#ifdef SW_ANTE_DIVERSITY -+static void rtl8187_antenna_diversity_read(struct net_device *dev) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ u16 usValue; -+ -+ //2 Read CustomerID -+ usValue = eprom_read(dev, EEPROM_SW_REVD_OFFSET>>1); -+ priv->EEPROMCustomerID = (u8)( usValue & EEPROM_CID_MASK ); -+ //DMESG("EEPROM Customer ID: %02X\n", priv->EEPROMCustomerID); -+ -+ //2 Read AntennaDiversity -+ // SW Antenna Diversity. -+ if( (usValue & EEPROM_SW_AD_MASK) != EEPROM_SW_AD_ENABLE ){ -+ priv->EEPROMSwAntennaDiversity = false; -+ DMESG("EEPROM Disable SW Antenna Diversity"); -+ }else{ -+ priv->EEPROMSwAntennaDiversity = true; -+ DMESG("EEPROM Enable SW Antenna Diversity"); -+ } -+ // Default Antenna to use. -+ if( (usValue & EEPROM_DEF_ANT_MASK) != EEPROM_DEF_ANT_1 ) { -+ priv->EEPROMDefaultAntenna1 = false; -+ DMESG("EEPROM Default Main Antenna 0"); -+ }else{ -+ priv->EEPROMDefaultAntenna1 = false; -+ DMESG( "EEPROM Default Aux Antenna 1"); -+ } -+ -+ // -+ // Antenna diversity mechanism. Added by Roger, 2007.11.05. -+ // -+ if( priv->RegSwAntennaDiversityMechanism == 0 ) // Auto //set it to 0 when init -+ {// 0: default from EEPROM. -+ priv->bSwAntennaDiverity = priv->EEPROMSwAntennaDiversity; -+ }else{// 1:disable antenna diversity, 2: enable antenna diversity. -+ priv->bSwAntennaDiverity = ((priv->RegSwAntennaDiversityMechanism == 1)? false : true); -+ } -+ //DMESG("bSwAntennaDiverity = %d\n", priv->bSwAntennaDiverity); -+ -+ -+ // -+ // Default antenna settings. Added by Roger, 2007.11.05. -+ // -+ if( priv->RegDefaultAntenna == 0)//set it to 0 when init -+ { // 0: default from EEPROM. -+ priv->bDefaultAntenna1 = priv->EEPROMDefaultAntenna1; -+ }else{// 1: main, 2: aux. -+ priv->bDefaultAntenna1 = ((priv->RegDefaultAntenna== 2) ? true : false); -+ } -+ //DMESG("bDefaultAntenna1 = %d\n", priv->bDefaultAntenna1); -+ -+//by amy for antenna -+} -+#endif -+ -+short rtl8180_init(struct net_device *dev) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ int i, j; -+ u16 word; -+ //int ch; -+ //u16 version; -+ u8 hw_version; -+ //u8 config3; -+ struct usb_device *udev; -+ u16 idProduct; -+ u16 bcdDevice; -+ //u8 chan_plan_index; -+ -+ //FIXME: these constants are placed in a bad pleace. -+ -+ //priv->txbuffsize = 1024; -+ //priv->txringcount = 32; -+ //priv->rxbuffersize = 1024; -+ //priv->rxringcount = 32; -+ //priv->txbeaconcount = 3; -+ //priv->rx_skb_complete = 1; -+ //priv->txnp_pending.ispending=0; -+ /* ^^ the SKB does not containt a partial RXed packet (is empty) */ -+ -+ //memcpy(priv->stats,0,sizeof(struct Stats)); -+ -+ //priv->irq_enabled=0; -+ priv->driver_upping = 0; -+ priv->commit = 0; -+ -+ //priv->stats.rxdmafail=0; -+ priv->stats.txrdu=0; -+ //priv->stats.rxrdu=0; -+ //priv->stats.rxnolast=0; -+ //priv->stats.rxnodata=0; -+ //priv->stats.rxreset=0; -+ //priv->stats.rxwrkaround=0; -+ //priv->stats.rxnopointer=0; -+ priv->stats.txbeerr=0; -+ priv->stats.txbkerr=0; -+ priv->stats.txvierr=0; -+ priv->stats.txvoerr=0; -+ priv->stats.txmanageerr=0; -+ priv->stats.txbeaconerr=0; -+ priv->stats.txresumed=0; -+ //priv->stats.rxerr=0; -+ //priv->stats.rxoverflow=0; -+ //priv->stats.rxint=0; -+ priv->stats.txbeokint=0; -+ priv->stats.txbkokint=0; -+ priv->stats.txviokint=0; -+ priv->stats.txvookint=0; -+ priv->stats.txmanageokint=0; -+ priv->stats.txbeaconokint=0; -+ /*priv->stats.txhpokint=0; -+ priv->stats.txhperr=0;*/ -+ priv->stats.rxurberr=0; -+ priv->stats.rxstaterr=0; -+ priv->stats.txoverflow=0; -+ priv->stats.rxok=0; -+ //priv->stats.txbeaconerr=0; -+ //priv->stats.txlperr=0; -+ //priv->stats.txlpokint=0; -+//john -+ priv->stats.txnpdrop=0; -+ priv->stats.txlpdrop =0; -+ priv->stats.txbedrop =0; -+ priv->stats.txbkdrop =0; -+ priv->stats.txvidrop =0; -+ priv->stats.txvodrop =0; -+ priv->stats.txbeacondrop =0; -+ priv->stats.txmanagedrop =0; -+ -+ // priv->stats.txokbytestotal =0; -+//by amy -+ priv->LastSignalStrengthInPercent=0; -+ priv->SignalStrength=0; -+ priv->SignalQuality=0; -+ priv->antenna_flag=0; -+ priv->flag_beacon = false; -+//by amy -+//david -+ //radion on defaultly -+ priv->radion = 1; -+//david -+//by amy for rate adaptive -+ priv->CurrRetryCnt=0; -+ priv->LastRetryCnt=0; -+ priv->LastTxokCnt=0; -+ priv->LastRxokCnt=0; -+ priv->LastRetryRate=0; -+ priv->bTryuping=0; -+ priv->CurrTxRate=0; -+ priv->CurrRetryRate=0; -+ priv->TryupingCount=0; -+ priv->TryupingCountNoData=0; -+ priv->TryDownCountLowData=0; -+ priv->RecvSignalPower=0; -+ priv->LastTxOKBytes=0; -+ priv->LastFailTxRate=0; -+ priv->LastFailTxRateSS=0; -+ priv->FailTxRateCount=0; -+ priv->LastTxThroughput=0; -+ priv->txokbytestotal=0; -+//by amy for rate adaptive -+//by amy for ps -+ priv->RFChangeInProgress = false; -+ priv->SetRFPowerStateInProgress = false; -+ priv->RFProgType = 0; -+ priv->bInHctTest = false; -+ priv->bInactivePs = true;//false; -+ priv->ieee80211->bInactivePs = priv->bInactivePs; -+ priv->eInactivePowerState = eRfOn;//lzm add for IPS and Polling methord -+ priv->bSwRfProcessing = false; -+ priv->eRFPowerState = eRfOff; -+ priv->RfOffReason = 0; -+ priv->NumRxOkInPeriod = 0; -+ priv->NumTxOkInPeriod = 0; -+ priv->bLeisurePs = true; -+ priv->dot11PowerSaveMode = eActive; -+ priv->RegThreeWireMode=HW_THREE_WIRE_BY_8051; -+ priv->ps_mode = false; -+//by amy for ps -+//by amy for DIG -+ priv->bDigMechanism = 1; -+ priv->bCCKThMechanism = 0; -+ priv->InitialGain = 0; -+ priv->StageCCKTh = 0; -+ priv->RegBModeGainStage = 2; -+//by amy for DIG -+// {by david for DIG, 2008.3.6 -+ priv->RegDigOfdmFaUpTh = 0x0c; -+ priv->RegBModeGainStage = 0x02; -+ priv->DIG_NumberFallbackVote = 0; -+ priv->DIG_NumberUpgradeVote = 0; -+ priv->CCKUpperTh = 0x100; -+ priv->CCKLowerTh = 0x20; -+//} -+//{added by david for High tx power, 2008.3.11 -+ priv->bRegHighPowerMechanism = true; -+ priv->bToUpdateTxPwr = false; -+ -+ priv->Z2HiPwrUpperTh = 77; -+ priv->Z2HiPwrLowerTh = 75; -+ priv->Z2RSSIHiPwrUpperTh = 70; -+ priv->Z2RSSIHiPwrLowerTh = 20; -+ //specify for rtl8187B -+ priv->wMacRegRfPinsOutput = 0x0480; -+ priv->wMacRegRfPinsSelect = 0x2488; -+ // -+ // Note that, we just set TrSwState to TR_HW_CONTROLLED here instead of changing -+ // HW setting because we assume it should be inialized as HW controlled. 061010, by rcnjko. -+ // -+ priv->TrSwitchState = TR_HW_CONTROLLED; -+//} -+ priv->ieee80211->iw_mode = IW_MODE_INFRA; -+//test pending bug, john 20070815 -+ for(i=0;i<0x10;i++) atomic_set(&(priv->tx_pending[i]), 0); -+//by lizhaoming for LED -+#ifdef LED -+ priv->ieee80211->ieee80211_led_contorl = LedControl8187; -+#endif -+#ifdef CONFIG_IPS -+ priv->ieee80211->ieee80211_ips_leave = ieee80211_ips_leave;//IPSLeave; -+#endif -+ -+#ifdef SW_ANTE_DIVERSITY -+ priv->antb=0; -+ priv->diversity=1; -+ priv->LastRxPktAntenna = 0; -+ priv->AdMinCheckPeriod = 5; -+ priv->AdMaxCheckPeriod = 10; -+ // Lower signal strength threshold to fit the HW participation in antenna diversity. +by amy 080312 -+ priv->AdMaxRxSsThreshold = 30;//60->30 -+ priv->AdRxSsThreshold = 20;//50->20 -+ priv->AdCheckPeriod = priv->AdMinCheckPeriod; -+ priv->AdTickCount = 0; -+ priv->AdRxSignalStrength = -1; -+ priv->RegSwAntennaDiversityMechanism = 0; -+ priv->RegDefaultAntenna = 0; -+ priv->SignalStrength = 0; -+ priv->AdRxOkCnt = 0; -+ priv->CurrAntennaIndex = 0; -+ priv->AdRxSsBeforeSwitched = 0; -+ init_timer(&priv->SwAntennaDiversityTimer); -+ priv->SwAntennaDiversityTimer.data = (unsigned long)dev; -+ priv->SwAntennaDiversityTimer.function = (void *)SwAntennaDiversityTimerCallback; -+#endif -+ -+ priv->retry_rts = DEFAULT_RETRY_RTS; -+ priv->retry_data = DEFAULT_RETRY_DATA; -+ priv->ieee80211->rate = 110; //11 mbps -+ priv->CurrentOperaRate=priv->ieee80211->rate/5; -+ priv->ieee80211->short_slot = 1; -+ priv->ieee80211->mode = IEEE_G; -+ priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0; -+ -+ rtl8180_link_detect_init(&priv->link_detect); -+ -+ spin_lock_init(&priv->tx_lock); -+ spin_lock_init(&priv->irq_lock);//added by thomas -+ spin_lock_init(&priv->rf_ps_lock); -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) -+ INIT_WORK(&priv->reset_wq, (void*)rtl8180_restart); -+ INIT_WORK(&priv->ieee80211->ips_leave_wq, (void*)IPSLeave_wq); //YJ,add,081230,for IPS -+ INIT_DELAYED_WORK(&priv->ieee80211->rate_adapter_wq,(void*)rtl8180_rate_adapter); -+ INIT_DELAYED_WORK(&priv->ieee80211->hw_dig_wq,(void*)rtl8180_hw_dig_wq); -+ INIT_DELAYED_WORK(&priv->ieee80211->watch_dog_wq,(void*)rtl8180_watch_dog_wq); -+ INIT_DELAYED_WORK(&priv->ieee80211->tx_pw_wq,(void*)rtl8180_tx_pw_wq); -+ -+#ifdef SW_ANTE_DIVERSITY -+ INIT_DELAYED_WORK(&priv->ieee80211->SwAntennaWorkItem,(void*) SwAntennaWorkItemCallback); -+#endif -+ -+#else -+ INIT_WORK(&priv->reset_wq,(void*) rtl8180_restart,dev); -+ INIT_WORK(&priv->ieee80211->ips_leave_wq, (void*)IPSLeave_wq,dev); //YJ,add,081230,for IPS -+ INIT_WORK(&priv->ieee80211->rate_adapter_wq,(void*)rtl8180_rate_adapter,dev); -+ INIT_WORK(&priv->ieee80211->hw_dig_wq,(void*)rtl8180_hw_dig_wq,dev); -+ INIT_WORK(&priv->ieee80211->watch_dog_wq,(void*)rtl8180_watch_dog_wq,dev); -+ INIT_WORK(&priv->ieee80211->tx_pw_wq,(void*)rtl8180_tx_pw_wq,dev); -+ -+#ifdef SW_ANTE_DIVERSITY -+ INIT_WORK(&priv->ieee80211->SwAntennaWorkItem,(void*) SwAntennaWorkItemCallback, dev); -+#endif -+ -+#endif -+#else -+ tq_init(&priv->reset_wq,(void*) rtl8180_restart,dev); -+#endif -+ sema_init(&priv->wx_sem,1); -+ sema_init(&priv->set_chan_sem,1); -+#ifdef THOMAS_TASKLET -+ tasklet_init(&priv->irq_rx_tasklet, -+ (void(*)(unsigned long))rtl8180_irq_rx_tasklet_new, -+ (unsigned long)priv); -+#else -+ tasklet_init(&priv->irq_rx_tasklet, -+ (void(*)(unsigned long))rtl8180_irq_rx_tasklet, -+ (unsigned long)priv); -+#endif -+//by amy for rate adaptive -+ init_timer(&priv->rateadapter_timer); -+ priv->rateadapter_timer.data = (unsigned long)dev; -+ priv->rateadapter_timer.function = timer_rate_adaptive; -+//by amy for rate adaptive -+//by amy for ps -+ init_timer(&priv->watch_dog_timer); -+ priv->watch_dog_timer.data = (unsigned long)dev; -+ priv->watch_dog_timer.function = watch_dog_adaptive; -+//by amy -+//by amy for ps -+ priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL; -+ priv->ieee80211->iw_mode = IW_MODE_INFRA; -+ priv->ieee80211->softmac_features = IEEE_SOFTMAC_SCAN | -+ IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ | -+#ifdef CONFIG_SOFT_BEACON -+ IEEE_SOFTMAC_BEACONS | //IEEE_SOFTMAC_SINGLE_QUEUE; -+#endif -+ IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE; -+ -+ priv->ieee80211->active_scan = 1; -+ //priv->ieee80211->ch_lock = 0; -+ priv->ieee80211->rate = 110; //11 mbps -+ priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION; -+ priv->ieee80211->host_encrypt = 1; -+ priv->ieee80211->host_decrypt = 1; -+#ifdef CONFIG_SOFT_BEACON -+ priv->ieee80211->start_send_beacons = NULL; -+ priv->ieee80211->stop_send_beacons = NULL; -+#else -+ priv->ieee80211->start_send_beacons = rtl8187_beacon_tx; -+ priv->ieee80211->stop_send_beacons = rtl8187_beacon_stop; -+#endif -+ priv->ieee80211->softmac_hard_start_xmit = rtl8180_hard_start_xmit; -+ priv->ieee80211->set_chan = rtl8180_set_chan; -+ priv->ieee80211->link_change = rtl8187_link_change; -+ priv->ieee80211->softmac_data_hard_start_xmit = rtl8180_hard_data_xmit; -+ priv->ieee80211->data_hard_stop = rtl8180_data_hard_stop; -+ priv->ieee80211->data_hard_resume = rtl8180_data_hard_resume; -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ priv->ieee80211->meshScanMode = 0; -+ priv->mshobj = alloc_mshobj(priv); -+ if(priv->mshobj) -+ { -+ priv->ieee80211->ext_patch_ieee80211_start_protocol = priv->mshobj->ext_patch_ieee80211_start_protocol; -+ priv->ieee80211->ext_patch_ieee80211_stop_protocol = priv->mshobj->ext_patch_ieee80211_stop_protocol; -+//by amy for mesh -+ priv->ieee80211->ext_patch_ieee80211_start_mesh = priv->mshobj->ext_patch_ieee80211_start_mesh; -+//by amy for mesh -+ priv->ieee80211->ext_patch_ieee80211_probe_req_1 = priv->mshobj->ext_patch_ieee80211_probe_req_1; -+ priv->ieee80211->ext_patch_ieee80211_probe_req_2 = priv->mshobj->ext_patch_ieee80211_probe_req_2; -+ priv->ieee80211->ext_patch_ieee80211_association_req_1 = priv->mshobj->ext_patch_ieee80211_association_req_1; -+ priv->ieee80211->ext_patch_ieee80211_association_req_2 = priv->mshobj->ext_patch_ieee80211_association_req_2; -+ priv->ieee80211->ext_patch_ieee80211_assoc_resp_by_net_1 = priv->mshobj->ext_patch_ieee80211_assoc_resp_by_net_1; -+ priv->ieee80211->ext_patch_ieee80211_assoc_resp_by_net_2 = priv->mshobj->ext_patch_ieee80211_assoc_resp_by_net_2; -+ priv->ieee80211->ext_patch_ieee80211_rx_frame_softmac_on_auth = priv->mshobj->ext_patch_ieee80211_rx_frame_softmac_on_auth; -+ priv->ieee80211->ext_patch_ieee80211_rx_frame_softmac_on_deauth = priv->mshobj->ext_patch_ieee80211_rx_frame_softmac_on_deauth; -+ priv->ieee80211->ext_patch_ieee80211_rx_frame_softmac_on_assoc_req = priv->mshobj->ext_patch_ieee80211_rx_frame_softmac_on_assoc_req; -+ priv->ieee80211->ext_patch_ieee80211_rx_frame_softmac_on_assoc_rsp = priv->mshobj->ext_patch_ieee80211_rx_frame_softmac_on_assoc_rsp; -+ priv->ieee80211->ext_patch_ieee80211_ext_stop_scan_wq_set_channel = priv->mshobj->ext_patch_ieee80211_ext_stop_scan_wq_set_channel; -+ priv->ieee80211->ext_patch_ieee80211_process_probe_response_1 = priv->mshobj->ext_patch_ieee80211_process_probe_response_1; -+ priv->ieee80211->ext_patch_ieee80211_rx_mgt_on_probe_req = priv->mshobj->ext_patch_ieee80211_rx_mgt_on_probe_req; -+ priv->ieee80211->ext_patch_ieee80211_rx_mgt_update_expire = priv->mshobj->ext_patch_ieee80211_rx_mgt_update_expire; -+ priv->ieee80211->ext_patch_get_beacon_get_probersp = priv->mshobj->ext_patch_get_beacon_get_probersp; -+ priv->ieee80211->ext_patch_ieee80211_rx_on_rx = priv->mshobj->ext_patch_ieee80211_rx_on_rx; -+ priv->ieee80211->ext_patch_ieee80211_xmit = priv->mshobj->ext_patch_ieee80211_xmit; -+ priv->ieee80211->ext_patch_ieee80211_rx_frame_get_hdrlen = priv->mshobj->ext_patch_ieee80211_rx_frame_get_hdrlen; -+ priv->ieee80211->ext_patch_ieee80211_rx_is_valid_framectl = priv->mshobj->ext_patch_ieee80211_rx_is_valid_framectl; -+ priv->ieee80211->ext_patch_ieee80211_rx_process_dataframe = priv->mshobj->ext_patch_ieee80211_rx_process_dataframe; -+ // priv->ieee80211->ext_patch_is_duplicate_packet = priv->mshobj->ext_patch_is_duplicate_packet; -+ priv->ieee80211->ext_patch_ieee80211_softmac_xmit_get_rate = priv->mshobj->ext_patch_ieee80211_softmac_xmit_get_rate; -+ /* added by david for setting acl dynamically */ -+ priv->ieee80211->ext_patch_ieee80211_acl_query = priv->mshobj->ext_patch_ieee80211_acl_query; -+ } -+ -+#endif // _RTL8187_EXT_PATCH_ -+ -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -+ INIT_WORK(&priv->ieee80211->wmm_param_update_wq,\ -+ (void(*)(void*)) rtl8180_wmm_param_update,\ -+ priv->ieee80211); -+#else -+ INIT_WORK(&priv->ieee80211->wmm_param_update_wq,\ -+ rtl8180_wmm_param_update); -+#endif -+#else -+ tq_init(&priv->ieee80211->wmm_param_update_wq,\ -+ (void(*)(void*)) rtl8180_wmm_param_update,\ -+ priv->ieee80211); -+#endif -+ priv->ieee80211->init_wmmparam_flag = 0; -+ priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD; -+ -+ //priv->card_8185 = 2; -+ priv->phy_ver = 2; -+ priv->card_type = USB; -+//{add for 87B -+ priv->ShortRetryLimit = 7; -+ priv->LongRetryLimit = 7; -+ priv->EarlyRxThreshold = 7; -+ -+ priv->TransmitConfig = -+ TCR_DurProcMode | //for RTL8185B, duration setting by HW -+ TCR_DISReqQsize | -+ (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT)| // Max DMA Burst Size per Tx DMA Burst, 7: reservied. -+ (priv->ShortRetryLimit<<TX_SRLRETRY_SHIFT)| // Short retry limit -+ (priv->LongRetryLimit<<TX_LRLRETRY_SHIFT) | // Long retry limit -+ (false ? TCR_SWPLCPLEN : 0); // FALSE: HW provies PLCP length and LENGEXT, TURE: SW proiveds them -+ -+ priv->ReceiveConfig = -+ RCR_AMF | RCR_ADF | //accept management/data -+ RCR_ACF | //accept control frame for SW AP needs PS-poll, 2005.07.07, by rcnjko. -+ RCR_AB | RCR_AM | RCR_APM | //accept BC/MC/UC -+ //RCR_AICV | RCR_ACRC32 | //accept ICV/CRC error packet -+ RCR_MXDMA | // Max DMA Burst Size per Rx DMA Burst, 7: unlimited. -+ (priv->EarlyRxThreshold<<RX_FIFO_THRESHOLD_SHIFT) | // Rx FIFO Threshold, 7: No Rx threshold. -+ (priv->EarlyRxThreshold == 7 ? RCR_ONLYERLPKT:0); -+ -+ priv->AcmControl = 0; -+//} -+ priv->rf_chip = 0xff & eprom_read(dev,EPROM_RFCHIPID); -+ //DMESG("rf_chip:%x\n", priv->rf_chip); -+ if (!priv->rf_chip) -+ { -+ DMESG("Can't get rf chip ID from EEPROM"); -+ DMESGW("So set rf chip ID to defalut EPROM_RFCHIPID_RTL8225U"); -+ DMESGW("use it with care and at your own risk and"); -+ DMESGW("**PLEASE** REPORT SUCCESS/INSUCCESS TO Realtek"); -+ priv->rf_chip = EPROM_RFCHIPID_RTL8225U; -+ -+ } -+ -+ -+//{put the card to detect different card here, mainly I/O processing -+ udev = priv->udev; -+ idProduct = le16_to_cpu(udev->descriptor.idProduct); -+ //idProduct = 0x8197; -+ bcdDevice = le16_to_cpu(udev->descriptor.bcdDevice); -+ DMESG("idProduct:0x%x, bcdDevice:0x%x", idProduct,bcdDevice); -+ switch (idProduct) { -+ case 0x8189: -+ case 0x8197: -+ case 0x8198: -+ /* check RF frontend chipset */ -+ priv->card_8187 = NIC_8187B; -+ priv->rf_init = rtl8225z2_rf_init; -+ priv->rf_set_chan = rtl8225z2_rf_set_chan; -+ priv->rf_set_sens = NULL; -+ break; -+ -+ case 0x8187: -+ if(bcdDevice == 0x0200){ -+ priv->card_8187 = NIC_8187B; -+ priv->rf_init = rtl8225z2_rf_init; -+ priv->rf_set_chan = rtl8225z2_rf_set_chan; -+ priv->rf_set_sens = NULL; -+ break; -+ }else{ -+ //0x0100 is for 8187 -+ //legacy 8187 NIC -+ //delet -+ ; -+ } -+ default: -+ /* check RF frontend chipset */ -+ priv->ieee80211->softmac_features |= IEEE_SOFTMAC_SINGLE_QUEUE; -+ priv->card_8187 = NIC_8187; -+ switch (priv->rf_chip) { -+ case EPROM_RFCHIPID_RTL8225U: -+ DMESG("Card reports RF frontend Realtek 8225"); -+ DMESGW("This driver has EXPERIMENTAL support for this chipset."); -+ DMESGW("use it with care and at your own risk and"); -+ DMESGW("**PLEASE** REPORT SUCCESS/INSUCCESS TO Realtek"); -+ if(rtl8225_is_V_z2(dev)){ -+ priv->rf_init = rtl8225z2_rf_init; -+ priv->rf_set_chan = rtl8225z2_rf_set_chan; -+ priv->rf_set_sens = NULL; -+ DMESG("This seems a new V2 radio"); -+ }else{ -+ priv->rf_init = rtl8225_rf_init; -+ priv->rf_set_chan = rtl8225_rf_set_chan; -+ priv->rf_set_sens = rtl8225_rf_set_sens; -+ DMESG("This seems a legacy 1st version radio"); -+ } -+ break; -+ -+ case EPROM_RFCHIPID_RTL8225U_VF: -+ priv->rf_init = rtl8225z2_rf_init; -+ priv->rf_set_chan = rtl8225z2_rf_set_chan; -+ priv->rf_set_sens = NULL; -+ DMESG("This seems a new V2 radio"); -+ break; -+ -+ default: -+ DMESGW("Unknown RF module %x",priv->rf_chip); -+ DMESGW("Exiting..."); -+ return -1; -+ } -+ break; -+ } -+ -+ priv->rf_close = rtl8225_rf_close; -+ priv->max_sens = RTL8225_RF_MAX_SENS; -+ priv->sens = RTL8225_RF_DEF_SENS; -+ -+#ifdef ENABLE_DOT11D -+#if 0 -+ for(i=0;i<0xFF;i++) { -+ if(i%16 == 0) -+ printk("\n[%x]: ", i/16); -+ printk("\t%4.4x", eprom_read(dev,i)); -+ } -+#endif -+ priv->channel_plan = eprom_read(dev,EPROM_CHANNEL_PLAN) & 0xFF; -+ //DMESG("EPROM_CHANNEL_PLAN is %x", priv->channel_plan); -+ -+ // lzm add 081205 for Toshiba: -+ // For Toshiba,reading the value from EEPROM 0x6h bit[7] to determine the priority of -+ // channel plan to be defined. -+ // -If bit[7] is true, then the channel plan is defined by EEPROM but no user defined. -+ // -If bit[7] is false, then the channel plan is defined by user first. -+ // -+ if(priv->channel_plan & 0x80) { -+ DMESG("Toshiba channel plan is defined by EEPROM"); -+ priv->channel_plan &= 0xf; -+ } -+ else -+ priv->channel_plan = 0; -+ -+ //if(priv->channel_plan > COUNTRY_CODE_WORLD_WIDE_13_INDEX){ -+ if(priv->channel_plan > COUNTRY_CODE_GLOBAL_DOMAIN){ -+ DMESG("rtl8180_init:Error channel plan! Set to default.\n"); -+ priv->channel_plan = 0; -+ } -+ -+ //priv->channel_plan = 9; //Global Domain -+ //priv->channel_plan = 2; //ETSI -+ -+ -+ DMESG("Channel plan is %d ",priv->channel_plan); -+ -+ //for Toshiba card we read channel plan from ChanPlanBin -+ if((idProduct != 0x8197) && (idProduct != 0x8198)) -+ rtl8180_set_channel_map(priv->channel_plan, priv->ieee80211); -+#else -+ int ch; -+ priv->channel_plan = eprom_read(dev,EPROM_CHANNEL_PLAN) & 0xff; -+ if(priv->channel_plan & 0x80) { -+ priv->channel_plan &= 0x7f; -+ if (ChannelPlan[priv->channel_plan].Len != 0){ -+ // force channel plan map -+ for (i=0;i<ChannelPlan[priv->channel_plan].Len;i++) -+ priv->ieee80211->channel_map[ChannelPlan[priv->channel_plan].Channel[i]] = 1; -+ } else { -+ DMESG("No channels, aborting"); -+ return -1; -+ } -+ } else { -+ //default channel plan setting -+ if(!channels){ -+ DMESG("No channels, aborting"); -+ return -1; -+ } -+ ch=channels; -+ // set channels 1..14 allowed in given locale -+ for (i=1; i<=14; i++) { -+ (priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01); -+ ch >>= 1; -+ } -+ } -+#endif -+ -+ if((idProduct == 0x8197) || (idProduct == 0x8198)) { -+ // lzm add 081205 for Toshiba: -+ // 0x77h bit[0]=1: use GPIO bit[2], bit[0]=0: use GPIO bit[1] -+ priv->EEPROMSelectNewGPIO =((u8)((eprom_read(dev,EPROM_SELECT_GPIO) & 0xff00) >> 8)) ? true : false; -+ DMESG("EPROM_SELECT_GPIO:%d", priv->EEPROMSelectNewGPIO); -+ } else { -+ priv->EEPROMSelectNewGPIO = false; -+ } -+ -+ -+ if (NIC_8187 == priv->card_8187){ -+ hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT; -+ switch (hw_version) { -+ case 0x06: -+ //priv->card_8187_Bversion = VERSION_8187B_B; -+ break; -+ case 0x05: -+ priv->card_8187_Bversion = VERSION_8187_D; -+ break; -+ default: -+ priv->card_8187_Bversion = VERSION_8187_B; -+ break; -+ } -+ }else{ -+ hw_version = read_nic_byte(dev, 0xe1); //87B hw version reg -+ switch (hw_version){ -+ case 0x00: -+ priv->card_8187_Bversion = VERSION_8187B_B; -+ break; -+ case 0x01: -+ priv->card_8187_Bversion = VERSION_8187B_D; -+ break; -+ case 0x02: -+ priv->card_8187_Bversion = VERSION_8187B_E; -+ break; -+ default: -+ priv->card_8187_Bversion = VERSION_8187B_B; //defalt -+ break; -+ } -+ } -+ -+ //printk("=====hw_version:%x\n", priv->card_8187_Bversion); -+ priv->enable_gpio0 = 0; -+ -+ /*the eeprom type is stored in RCR register bit #6 */ -+ if (RCR_9356SEL & read_nic_dword(dev, RCR)){ -+ priv->epromtype=EPROM_93c56; -+ DMESG("Reported EEPROM chip is a 93c56 (2Kbit)"); -+ }else{ -+ priv->epromtype=EPROM_93c46; -+ DMESG("Reported EEPROM chip is a 93c46 (1Kbit)"); -+ } -+ -+ dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff; -+ dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8; -+ dev->dev_addr[2]=eprom_read(dev,MAC_ADR+1) & 0xff; -+ dev->dev_addr[3]=(eprom_read(dev,MAC_ADR+1) & 0xff00)>>8; -+ dev->dev_addr[4]=eprom_read(dev,MAC_ADR+2) & 0xff; -+ dev->dev_addr[5]=((eprom_read(dev,MAC_ADR+2) & 0xff00)>>8)+1; -+ -+ DMESG("Card MAC address is "MAC_FMT, MAC_ARG(dev->dev_addr)); -+ -+ for(i=1,j=0; i<6; i+=2,j++){ -+ -+ word = eprom_read(dev,EPROM_TXPW0 + j); -+ priv->chtxpwr[i]=word & 0xf; -+ priv->chtxpwr_ofdm[i]=(word & 0xf0)>>4; -+ priv->chtxpwr[i+1]=(word & 0xf00)>>8; -+ priv->chtxpwr_ofdm[i+1]=(word & 0xf000)>>12; -+ } -+ -+ for(i=1,j=0; i<4; i+=2,j++){ -+ -+ word = eprom_read(dev,EPROM_TXPW1 + j); -+ priv->chtxpwr[i+6]=word & 0xf; -+ priv->chtxpwr_ofdm[i+6]=(word & 0xf0)>>4; -+ priv->chtxpwr[i+6+1]=(word & 0xf00)>>8; -+ priv->chtxpwr_ofdm[i+6+1]=(word & 0xf000)>>12; -+ } -+ if (priv->card_8187 == NIC_8187){ -+ for(i=1,j=0; i<4; i+=2,j++){ -+ word = eprom_read(dev,EPROM_TXPW2 + j); -+ priv->chtxpwr[i+6+4]=word & 0xf; -+ priv->chtxpwr_ofdm[i+6+4]=(word & 0xf0)>>4; -+ priv->chtxpwr[i+6+4+1]=(word & 0xf00)>>8; -+ priv->chtxpwr_ofdm[i+6+4+1]=(word & 0xf000)>>12; -+ } -+ } else{ -+ word = eprom_read(dev, 0x1B) & 0xff; //channel 11; -+ priv->chtxpwr[11]=word & 0xf; -+ priv->chtxpwr_ofdm[11] = (word & 0xf0)>>4; -+ -+ word = eprom_read(dev, 0xA) & 0xff; //channel 12; -+ priv->chtxpwr[12]=word & 0xf; -+ priv->chtxpwr_ofdm[12] = (word & 0xf0)>>4; -+ -+ word = eprom_read(dev, 0x1c) ; //channel 13 ,14; -+ priv->chtxpwr[13]=word & 0xf; -+ priv->chtxpwr_ofdm[13] = (word & 0xf0)>>4; -+ priv->chtxpwr[14]=(word & 0xf00)>>8; -+ priv->chtxpwr_ofdm[14] = (word & 0xf000)>>12; -+ } -+ -+ word = eprom_read(dev,EPROM_TXPW_BASE); -+ priv->cck_txpwr_base = word & 0xf; -+ priv->ofdm_txpwr_base = (word>>4) & 0xf; -+ -+ //DMESG("PAPE from CONFIG2: %x",read_nic_byte(dev,CONFIG2)&0x7); -+ -+#ifdef SW_ANTE_DIVERSITY -+ rtl8187_antenna_diversity_read(dev); -+#endif -+ -+ if(rtl8187_usb_initendpoints(dev)!=0){ -+ DMESG("Endopoints initialization failed"); -+ return -ENOMEM; -+ } -+#ifdef LED -+ InitSwLeds(dev); -+#endif -+#ifdef DEBUG_EPROM -+ dump_eprom(dev); -+#endif -+ return 0; -+ -+} -+ -+void rtl8185_rf_pins_enable(struct net_device *dev) -+{ -+/* u16 tmp; -+ tmp = read_nic_word(dev, RFPinsEnable);*/ -+ write_nic_word(dev, RFPinsEnable, 0x1ff7);// | tmp); -+} -+ -+ -+void rtl8185_set_anaparam2(struct net_device *dev, u32 a) -+{ -+ u8 conf3; -+ -+ rtl8180_set_mode(dev, EPROM_CMD_CONFIG); -+ -+ conf3 = read_nic_byte(dev, CONFIG3); -+ write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT)); -+ -+ write_nic_dword(dev, ANAPARAM2, a); -+ -+ conf3 = read_nic_byte(dev, CONFIG3); -+ write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT)); -+ -+ rtl8180_set_mode(dev, EPROM_CMD_NORMAL); -+ -+} -+ -+ -+void rtl8180_set_anaparam(struct net_device *dev, u32 a) -+{ -+ u8 conf3; -+ -+ rtl8180_set_mode(dev, EPROM_CMD_CONFIG); -+ -+ conf3 = read_nic_byte(dev, CONFIG3); -+ write_nic_byte(dev, CONFIG3, conf3 | (1<<CONFIG3_ANAPARAM_W_SHIFT)); -+ -+ write_nic_dword(dev, ANAPARAM, a); -+ -+ conf3 = read_nic_byte(dev, CONFIG3); -+ write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT)); -+ -+ rtl8180_set_mode(dev, EPROM_CMD_NORMAL); -+ -+} -+ -+ -+void rtl8185_tx_antenna(struct net_device *dev, u8 ant) -+{ -+ write_nic_byte(dev, ANTSEL, ant); -+ //lzm mod for up take too long time 20081201 -+ //mdelay(1); -+} -+ -+ -+void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data) -+{ -+ u32 phyw; -+ -+ adr |= 0x80; -+ -+ phyw= ((data<<8) | adr); -+ -+ -+ -+ // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register. -+ write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24)); -+ write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16)); -+ write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8)); -+ write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff) )); -+ -+ //read_nic_dword(dev, PHY_ADR); -+#if 0 -+ for(i=0;i<10;i++){ -+ write_nic_dword(dev, PHY_ADR, 0xffffff7f & phyw); -+ phyr = read_nic_byte(dev, PHY_READ); -+ if(phyr == (data&0xff)) break; -+ -+ } -+#endif -+ /* this is ok to fail when we write AGC table. check for AGC table might be -+ * done by masking with 0x7f instead of 0xff */ -+ //if(phyr != (data&0xff)) DMESGW("Phy write timeout %x %x %x", phyr, data, adr); -+ //msdelay(1);//CPU occupany is too high. LZM 31/10/2008 -+} -+ -+u8 rtl8187_read_phy(struct net_device *dev,u8 adr, u32 data) -+{ -+ u32 phyw; -+ -+ adr &= ~0x80; -+ phyw= ((data<<8) | adr); -+ -+ -+ // Note that, we must write 0xff7c after 0x7d-0x7f to write BB register. -+ write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24)); -+ write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16)); -+ write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8)); -+ write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff) )); -+ -+ return(read_nic_byte(dev,0x7e)); -+ -+} -+ -+u8 read_phy_ofdm(struct net_device *dev, u8 adr) -+{ -+ return(rtl8187_read_phy(dev, adr, 0x000000)); -+} -+ -+u8 read_phy_cck(struct net_device *dev, u8 adr) -+{ -+ return(rtl8187_read_phy(dev, adr, 0x10000)); -+} -+ -+inline void write_phy_ofdm (struct net_device *dev, u8 adr, u32 data) -+{ -+ data = data & 0xff; -+ rtl8187_write_phy(dev, adr, data); -+} -+ -+ -+void write_phy_cck (struct net_device *dev, u8 adr, u32 data) -+{ -+ data = data & 0xff; -+ rtl8187_write_phy(dev, adr, data | 0x10000); -+} -+// -+// Description: Change ZEBRA's power state. -+// -+// Assumption: This function must be executed in PASSIVE_LEVEL. -+// -+// 061214, by rcnjko. -+// -+//#define MAX_DOZE_WAITING_TIMES_87B 1000//500 -+#define MAX_DOZE_WAITING_TIMES_87B_MOD 500 -+ -+bool SetZebraRFPowerState8187B(struct net_device *dev,RT_RF_POWER_STATE eRFPowerState) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ u8 btCR9346, btConfig3; -+ bool bResult = true; -+ int i; -+ u16 u2bTFPC = 0; -+ u8 u1bTmp; -+ -+ // Set EEM0 and EEM1 in 9346CR. -+ btCR9346 = read_nic_byte(dev, CR9346); -+ write_nic_byte(dev, CR9346, (btCR9346|0xC0) ); -+ // Set PARM_En in Config3. -+ btConfig3 = read_nic_byte(dev, CONFIG3); -+ write_nic_byte(dev, CONFIG3, (btConfig3|CONFIG3_PARM_En) ); -+ // BB and RF related operations: -+ switch(eRFPowerState) -+ { -+ case eRfOn: -+#ifdef CONFIG_RADIO_DEBUG -+ DMESG("Now Radio ON!"); -+#endif -+ write_nic_dword(dev, ANAPARAM, ANAPARM_ON); -+ write_nic_dword(dev, ANAPARAM2, ANAPARM2_ON); -+ //write_nic_byte(dev, CONFIG4, (priv->RFProgType)); -+ -+ write_nic_byte(dev, 0x085, 0x24); // 061219, SD3 ED: for minicard CCK power leakage issue. -+ write_rtl8225(dev, 0x4, 0x9FF); -+ mdelay(1); -+ // -+ // <Roger_Notes> We reset PLL to reduce power consumption about 30 mA. 2008.01.16. -+ // -+ { -+ u8 Reg62; -+ -+ write_nic_byte(dev, 0x61, 0x10); -+ Reg62 = read_nic_byte(dev, 0x62); -+ write_nic_byte(dev, 0x62, (Reg62 & (~BIT5)) ); -+ write_nic_byte(dev, 0x62, (Reg62 | BIT5) ); // Enable PLL. -+ } -+ -+ u1bTmp = read_nic_byte(dev, 0x24E); -+ write_nic_byte(dev, 0x24E, (u1bTmp & (~(BIT5|BIT6))) );// 070124 SD1 Alex: turn on CCK and OFDM. -+ break; -+ -+ case eRfSleep: -+#ifdef CONFIG_RADIO_DEBUG -+ DMESG("Now Radio Sleep!"); -+#endif -+ for(i = 0; i < MAX_DOZE_WAITING_TIMES_87B_MOD; i++) -+ { // Make sure TX FIFO is empty befor turn off RFE pwoer. -+ u2bTFPC = read_nic_word(dev, TFPC); -+ if(u2bTFPC == 0){ -+ //printk("%d times TFPC: %d == 0 before doze...\n", (i+1), u2bTFPC); -+ break; -+ }else{ -+ //printk("%d times TFPC: %d != 0 before doze!\n", (i+1), u2bTFPC); -+ udelay(10); -+ } -+ } -+ -+ if( i == MAX_DOZE_WAITING_TIMES_87B_MOD ){ -+ //printk("\n\n\n SetZebraRFPowerState8187B(): %d times TFPC: %d != 0 !!!\n\n\n", MAX_DOZE_WAITING_TIMES_87B_MOD, u2bTFPC); -+ } -+ -+ u1bTmp = read_nic_byte(dev, 0x24E); -+ write_nic_byte(dev, 0x24E, (u1bTmp|BIT5|BIT6));// 070124 SD1 Alex: turn off CCK and OFDM. -+ -+ write_rtl8225(dev, 0x4, 0xDFF); // Turn off RF first to prevent BB lock up, suggested by PJ, 2006.03.03. -+ write_nic_byte(dev, 0x085, 0x04); // 061219, SD3 ED: for minicard CCK power leakage issue. -+ -+ //write_nic_byte(dev, CONFIG4, (priv->RFProgType|Config4_PowerOff)); -+ -+ write_nic_dword(dev, ANAPARAM, ANAPARM_OFF); -+ write_nic_dword(dev, ANAPARAM2, 0x72303f70); // 070126, by SD1 William. -+ break; -+ -+ case eRfOff: -+#ifdef CONFIG_RADIO_DEBUG -+ DMESG("Now Radio OFF!"); -+#endif -+ for(i = 0; i < MAX_DOZE_WAITING_TIMES_87B_MOD; i++) -+ { // Make sure TX FIFO is empty befor turn off RFE pwoer. -+ u2bTFPC = read_nic_word(dev, TFPC); -+ if(u2bTFPC == 0) { -+ //printk("%d times TFPC: %d == 0 before doze...\n", (i+1), u2bTFPC); -+ break; -+ }else{ -+ //printk("%d times TFPC: 0x%x != 0 before doze!\n", (i+1), u2bTFPC); -+ udelay(10); -+ } -+ } -+ -+ if( i == MAX_DOZE_WAITING_TIMES_87B_MOD){ -+ //printk("\n\n\nSetZebraRFPowerState8187B(): %d times TFPC: 0x%x != 0 !!!\n\n\n", MAX_DOZE_WAITING_TIMES_87B_MOD, u2bTFPC); -+ } -+ -+ u1bTmp = read_nic_byte(dev, 0x24E); -+ write_nic_byte(dev, 0x24E, (u1bTmp|BIT5|BIT6));// 070124 SD1 Alex: turn off CCK and OFDM. -+ -+ write_rtl8225(dev, 0x4,0x1FF); // Turn off RF first to prevent BB lock up, suggested by PJ, 2006.03.03. -+ write_nic_byte(dev, 0x085, 0x04); // 061219, SD3 ED: for minicard CCK power leakage issue. -+ -+ //write_nic_byte(dev, CONFIG4, (priv->RFProgType|Config4_PowerOff)); -+ -+ write_nic_dword(dev, ANAPARAM, ANAPARM_OFF); -+ write_nic_dword(dev, ANAPARAM2, ANAPARM2_OFF); // 070301, SD1 William: to reduce RF off power consumption to 80 mA. -+ break; -+ -+ default: -+ bResult = false; -+ //printk("SetZebraRFPowerState8187B(): unknow state to set: 0x%X!!!\n", eRFPowerState); -+ break; -+ } -+ -+ // Clear PARM_En in Config3. -+ btConfig3 &= ~(CONFIG3_PARM_En); -+ write_nic_byte(dev, CONFIG3, btConfig3); -+ // Clear EEM0 and EEM1 in 9346CR. -+ btCR9346 &= ~(0xC0); -+ write_nic_byte(dev, CR9346, btCR9346); -+ -+ if(bResult){ -+ // Update current RF state variable. -+ priv->eRFPowerState = eRFPowerState; -+ } -+ -+ return bResult; -+} -+//by amy for ps -+// -+// Description: Chang RF Power State. -+// Note that, only MgntActSet_RF_State() is allowed to set HW_VAR_RF_STATE. -+// -+// Assumption:PASSIVE LEVEL. -+// -+bool SetRFPowerState(struct net_device *dev,RT_RF_POWER_STATE eRFPowerState) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ bool bResult = false; -+ -+ //printk("---------> SetRFPowerState(): eRFPowerState(%d)\n", eRFPowerState); -+ if(eRFPowerState == priv->eRFPowerState) -+ { -+ //printk("<--------- SetRFPowerState(): discard the request for eRFPowerState(%d) is the same.\n", eRFPowerState); -+ return bResult; -+ } -+ -+ switch(priv->rf_chip) -+ { -+ case RF_ZEBRA2: -+ bResult = SetZebraRFPowerState8187B(dev, eRFPowerState); -+ break; -+ -+ default: -+ printk("SetRFPowerState8185(): unknown RFChipID: 0x%X!!!\n", priv->rf_chip); -+ break;; -+ } -+ //printk("<--------- SetRFPowerState(): bResult(%d)\n", bResult); -+ -+ return bResult; -+} -+ -+bool -+MgntActSet_RF_State(struct net_device *dev,RT_RF_POWER_STATE StateToSet,u32 ChangeSource) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ bool bActionAllowed = false; -+ bool bConnectBySSID = false; -+ RT_RF_POWER_STATE rtState; -+ u16 RFWaitCounter = 0; -+ unsigned long flag; -+ // printk("===>MgntActSet_RF_State(): StateToSet(%d), ChangeSource(0x%x)\n",StateToSet, ChangeSource); -+ // -+ // Prevent the race condition of RF state change. By Bruce, 2007-11-28. -+ // Only one thread can change the RF state at one time, and others should wait to be executed. -+ // -+#if 1 -+ while(true) -+ { -+ //down(&priv->rf_state); -+ spin_lock_irqsave(&priv->rf_ps_lock,flag); -+ if(priv->RFChangeInProgress) -+ { -+ //up(&priv->rf_state); -+ //RT_TRACE(COMP_RF, DBG_LOUD, ("MgntActSet_RF_State(): RF Change in progress! Wait to set..StateToSet(%d).\n", StateToSet)); -+ spin_unlock_irqrestore(&priv->rf_ps_lock,flag); -+ // Set RF after the previous action is done. -+ while(priv->RFChangeInProgress) -+ { -+ RFWaitCounter ++; -+ //RT_TRACE(COMP_RF, DBG_LOUD, ("MgntActSet_RF_State(): Wait 1 ms (%d times)...\n", RFWaitCounter)); -+ udelay(1000); // 1 ms -+ -+ // Wait too long, return FALSE to avoid to be stuck here. -+ if(RFWaitCounter > 1000) // 1sec -+ { -+ // DMESG("MgntActSet_RF_State(): Wait too long to set RF"); -+ // TODO: Reset RF state? -+ return false; -+ } -+ } -+ } -+ else -+ { -+ priv->RFChangeInProgress = true; -+// up(&priv->rf_state); -+ spin_unlock_irqrestore(&priv->rf_ps_lock,flag); -+ break; -+ } -+ } -+#endif -+ rtState = priv->eRFPowerState; -+ -+ switch(StateToSet) -+ { -+ case eRfOn: -+ // -+ // Turn On RF no matter the IPS setting because we need to update the RF state to Ndis under Vista, or -+ // the Windows does not allow the driver to perform site survey any more. By Bruce, 2007-10-02. -+ // -+ // leave last reasons and kick this reason till priv->RfOffReason = 0; -+ // if one reason turn radio off check if off->on reason is the same.if so turn, or reject it. -+ // if more than 1 reasons turn radio off we only turn on radio when all reasons turn on radio, -+ // so first turn on trys will reject till priv->RfOffReason = 0; -+ priv->RfOffReason &= (~ChangeSource); -+ -+ if(! priv->RfOffReason) -+ { -+ priv->RfOffReason = 0; -+ bActionAllowed = true; -+ -+ if(rtState == eRfOff && ChangeSource >=RF_CHANGE_BY_HW && !priv->bInHctTest) -+ { -+ bConnectBySSID = true; -+ } -+ } else { -+ ;//lzm must or TX_PENDING 12>MAX_TX_URB -+ //printk("Turn Radio On Reject because RfOffReason= 0x%x, ChangeSource=0x%X\n", priv->RfOffReason, ChangeSource); -+ } -+ break; -+ -+ case eRfOff: -+ // 070125, rcnjko: we always keep connected in AP mode. -+ if (priv->RfOffReason > RF_CHANGE_BY_IPS) -+ { -+ // -+ // 060808, Annie: -+ // Disconnect to current BSS when radio off. Asked by QuanTa. -+ // -+ -+ // -+ // Calling MgntDisconnect() instead of MgntActSet_802_11_DISASSOCIATE(), -+ // because we do NOT need to set ssid to dummy ones. -+ // Revised by Roger, 2007.12.04. -+ // -+//by amy not supported -+ //MgntDisconnect( dev, disas_lv_ss ); -+ -+ // Clear content of bssDesc[] and bssDesc4Query[] to avoid reporting old bss to UI. -+ // 2007.05.28, by shien chang. -+ //PlatformZeroMemory( pMgntInfo->bssDesc, sizeof(RT_WLAN_BSS)*MAX_BSS_DESC ); -+ //pMgntInfo->NumBssDesc = 0; -+ //PlatformZeroMemory( pMgntInfo->bssDesc4Query, sizeof(RT_WLAN_BSS)*MAX_BSS_DESC ); -+ //pMgntInfo->NumBssDesc4Query = 0; -+ } -+ -+ -+ -+ priv->RfOffReason |= ChangeSource; -+ bActionAllowed = true; -+ //printk("Turn Radio Off RfOffReason= 0x%x, ChangeSource=0x%X\n", priv->RfOffReason, ChangeSource); -+ break; -+ -+ case eRfSleep: -+ priv->RfOffReason |= ChangeSource; -+ bActionAllowed = true; -+ break; -+ -+ default: -+ break; -+ } -+ -+ if(bActionAllowed) -+ { -+ // Config HW to the specified mode. -+ //printk("MgntActSet_RF_State(): Action is allowed.... StateToSet(%d), RfOffReason(%#X)\n", StateToSet, priv->RfOffReason); -+ SetRFPowerState(dev, StateToSet); -+ // Turn on RF. -+ if(StateToSet == eRfOn) -+ { -+ //HalEnableRx8185Dummy(dev); -+ if(bConnectBySSID) -+ { -+ // by amy not supported -+ //MgntActSet_802_11_SSID(Adapter, Adapter->MgntInfo.Ssid.Octet, Adapter->MgntInfo.Ssid.Length, TRUE ); -+ } -+ } -+ // Turn off RF. -+ else if(StateToSet == eRfOff) -+ { -+ //HalDisableRx8185Dummy(dev); -+ } -+ } -+ else -+ { -+ //printk("Action is rejected.... StateToSet(%d), ChangeSource(%#X), RfOffReason(%#X)\n", -+ // StateToSet, ChangeSource, priv->RfOffReason); -+ } -+ -+ // Release RF spinlock -+ //down(&priv->rf_state); -+ spin_lock_irqsave(&priv->rf_ps_lock,flag); -+ priv->RFChangeInProgress = false; -+ //up(&priv->rf_state); -+ spin_unlock_irqrestore(&priv->rf_ps_lock,flag); -+ return bActionAllowed; -+} -+//by amy for ps -+ -+void rtl8180_adapter_start(struct net_device *dev) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+// struct ieee80211_device *ieee = priv->ieee80211; -+// u8 InitWirelessMode; -+// u8 SupportedWirelessMode; -+// bool bInvalidWirelessMode = false; -+ -+ -+ if(NIC_8187 == priv->card_8187) { -+ //rtl8180_rtx_disable(dev); -+ rtl8180_reset(dev); -+ -+ write_nic_byte(dev,0x85,0); -+ write_nic_byte(dev,0x91,0); -+ -+ /* light blink! */ -+ write_nic_byte(dev,0x85,4); -+ write_nic_byte(dev,0x91,1); -+ write_nic_byte(dev,0x90,0); -+ -+ //by lizhaoming for LED POWR ON -+ //LedControl8187(dev, LED_CTL_POWER_ON); -+ -+ /* -+ write_nic_byte(dev, CR9346, 0xC0); -+ //LED TYPE -+ write_nic_byte(dev, CONFIG1,((read_nic_byte(dev, CONFIG1)&0x3f)|0x80)); //turn on bit 5:Clkrun_mode -+ write_nic_byte(dev, CR9346, 0x0); // disable config register write -+ */ -+ priv->irq_mask = 0xffff; -+ /* -+ priv->dma_poll_mask = 0; -+ priv->dma_poll_mask|= (1<<TX_DMA_STOP_BEACON_SHIFT); -+ */ -+ // rtl8180_beacon_tx_disable(dev); -+ -+ rtl8180_set_mode(dev, EPROM_CMD_CONFIG); -+ write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]); -+ write_nic_word(dev, MAC4, ((u32*)dev->dev_addr)[1] & 0xffff ); -+ -+ rtl8180_set_mode(dev, EPROM_CMD_NORMAL); -+ rtl8180_update_msr(dev); -+ -+ rtl8180_set_mode(dev, EPROM_CMD_CONFIG); -+ -+ write_nic_word(dev,0xf4,0xffff); -+ write_nic_byte(dev, -+ CONFIG1, (read_nic_byte(dev,CONFIG1) & 0x3f) | 0x80); -+ -+ rtl8180_set_mode(dev,EPROM_CMD_NORMAL); -+ -+ write_nic_dword(dev,INT_TIMEOUT,0); -+ -+#ifdef DEBUG_REGISTERS -+ rtl8180_dump_reg(dev); -+#endif -+ -+ -+ write_nic_byte(dev, WPA_CONFIG, 0); -+ -+ write_nic_byte(dev, RATE_FALLBACK, 0x81); -+ rtl8187_set_rate(dev); -+ -+ priv->rf_init(dev); -+ -+ if(priv->rf_set_sens != NULL) { -+ priv->rf_set_sens(dev,priv->sens); -+ } -+ -+ write_nic_word(dev,0x5e,1); -+ //mdelay(1); -+ write_nic_word(dev,0xfe,0x10); -+ // mdelay(1); -+ write_nic_byte(dev, TALLY_SEL, 0x80);//Set NQ retry count -+ write_nic_byte(dev, 0xff, 0x60); -+ write_nic_word(dev,0x5e,0); -+ -+ rtl8180_irq_enable(dev); -+ } else { -+ /** -+ * IO part migrated from Windows Driver. -+ */ -+ priv->irq_mask = 0xffff; -+ // Enable Config3.PARAM_En. -+ write_nic_byte(dev, CR9346, 0xC0); -+ -+ write_nic_byte(dev, CONFIG3, (read_nic_byte(dev, CONFIG3)| CONFIG3_PARM_En|CONFIG3_GNTSel)); -+ // Turn on Analog power. -+ // setup A/D D/A parameter for 8185 b2 -+ // Asked for by William, otherwise, MAC 3-wire can't work, 2006.06.27, by rcnjko. -+ write_nic_dword(dev, ANA_PARAM2, ANAPARM2_ASIC_ON); -+ write_nic_dword(dev, ANA_PARAM, ANAPARM_ASIC_ON); -+ write_nic_byte(dev, ANA_PARAM3, 0x00); -+ -+ //by lizhaoming for LED POWR ON -+ //LedControl8187(dev, LED_CTL_POWER_ON); -+ -+ {//added for reset PLL -+ u8 bReg62; -+ write_nic_byte(dev, 0x61, 0x10); -+ bReg62 = read_nic_byte(dev, 0x62); -+ write_nic_byte(dev, 0x62, bReg62&(~(0x1<<5))); -+ write_nic_byte(dev, 0x62, bReg62|(0x1<<5)); -+ } -+ write_nic_byte(dev, CONFIG3, (read_nic_byte(dev, CONFIG3)&(~CONFIG3_PARM_En))); -+ write_nic_byte(dev, CR9346, 0x00); -+ -+ //rtl8180_rtx_disable(dev); -+ rtl8180_reset(dev); -+ write_nic_byte(dev, CR9346, 0xc0); // enable config register write -+ priv->rf_init(dev); -+ // Enable tx/rx -+ -+ write_nic_byte(dev, CMD, (CR_RE|CR_TE));// Using HW_VAR_COMMAND instead of writing CMDR directly. Rewrited by Annie, 2006-04-07. -+ -+ //add this is for 8187B Rx stall problem -+ -+ rtl8180_irq_enable(dev); -+ -+ write_nic_byte_E(dev, 0x41, 0xF4); -+ write_nic_byte_E(dev, 0x40, 0x00); -+ write_nic_byte_E(dev, 0x42, 0x00); -+ write_nic_byte_E(dev, 0x42, 0x01); -+ write_nic_byte_E(dev, 0x40, 0x0F); -+ write_nic_byte_E(dev, 0x42, 0x00); -+ write_nic_byte_E(dev, 0x42, 0x01); -+ -+ // 8187B demo board MAC and AFE power saving parameters from SD1 William, 2006.07.20. -+ // Parameter revised by SD1 William, 2006.08.21: -+ // 373h -> 0x4F // Original: 0x0F -+ // 377h -> 0x59 // Original: 0x4F -+ // Victor 2006/8/21: ¬Ù¹q°Ñ¼Æ«Øijµ¥SD3 °ª§C·Å and cable link test OK¤~¥¿¦¡ release,¤£«Øij¤Ó§Ö -+ // 2006/9/5, Victor & ED: it is OK to use. -+ //if(pHalData->RegBoardType == BT_DEMO_BOARD) -+ //{ -+ // AFE. -+ // -+ // Revise the content of Reg0x372, 0x374, 0x378 and 0x37a to fix unusual electronic current -+ // while CTS-To-Self occurs, by DZ's request. -+ // Modified by Roger, 2007.06.22. -+ // -+ write_nic_byte(dev, 0x0DB, (read_nic_byte(dev, 0x0DB)|(BIT2))); -+ write_nic_word(dev, 0x372, 0x59FA); // 0x4FFA-> 0x59FA. -+ write_nic_word(dev, 0x374, 0x59D2); // 0x4FD2-> 0x59D2. -+ write_nic_word(dev, 0x376, 0x59D2); -+ write_nic_word(dev, 0x378, 0x19FA); // 0x0FFA-> 0x19FA. -+ write_nic_word(dev, 0x37A, 0x19FA); // 0x0FFA-> 0x19FA. -+ write_nic_word(dev, 0x37C, 0x00D0); -+ -+ write_nic_byte(dev, 0x061, 0x00); -+ -+ // MAC. -+ write_nic_byte(dev, 0x180, 0x0F); -+ write_nic_byte(dev, 0x183, 0x03); -+ // 061218, lanhsin: for victorh request -+ write_nic_byte(dev, 0x0DA, 0x10); -+ //} -+ -+ // -+ // 061213, rcnjko: -+ // Set MAC.0x24D to 0x00 to prevent cts-to-self Tx/Rx stall symptom. -+ // If we set MAC 0x24D to 0x08, OFDM and CCK will turn off -+ // if not in use, and there is a bug about this action when -+ // we try to send CCK CTS and OFDM data together. -+ // -+ //PlatformEFIOWrite1Byte(Adapter, 0x24D, 0x00); -+ // 061218, lanhsin: for victorh request -+ write_nic_byte(dev, 0x24D, 0x08); -+ -+ // -+ // 061215, rcnjko: -+ // Follow SD3 RTL8185B_87B_MacPhy_Register.doc v0.4. -+ // -+ write_nic_dword(dev, HSSI_PARA, 0x0600321B); -+ // -+ // 061226, rcnjko: -+ // Babble found in HCT 2c_simultaneous test, server with 87B might -+ // receive a packet size about 2xxx bytes. -+ // So, we restrict RMS to 2048 (0x800), while as IC default value is 0xC00. -+ // -+ write_nic_word(dev, RMS, 0x0800); -+ -+ /*****20070321 Resolve HW page bug on system logo test -+ u8 faketemp=read_nic_byte(dev, 0x50);*/ -+ } -+} -+ -+/* this configures registers for beacon tx and enables it via -+ * rtl8180_beacon_tx_enable(). rtl8180_beacon_tx_disable() might -+ * be used to stop beacon transmission -+ */ -+#if 0 -+void rtl8180_start_tx_beacon(struct net_device *dev) -+{ -+ int i; -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ u16 word; -+ DMESG("Enabling beacon TX"); -+ //write_nic_byte(dev, 0x42,0xe6);// TCR -+ //rtl8180_init_beacon(dev); -+ //set_nic_txring(dev); -+// rtl8180_prepare_beacon(dev); -+ rtl8180_irq_disable(dev); -+// rtl8180_beacon_tx_enable(dev); -+ rtl8180_set_mode(dev,EPROM_CMD_CONFIG); -+ //write_nic_byte(dev,0x9d,0x20); //DMA Poll -+ //write_nic_word(dev,0x7a,0); -+ //write_nic_word(dev,0x7a,0x8000); -+ -+ -+ word = read_nic_word(dev, BcnItv); -+ word &= ~BcnItv_BcnItv; // clear Bcn_Itv -+ write_nic_word(dev, BcnItv, word); -+ -+ write_nic_word(dev, AtimWnd, -+ read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd); -+ -+ word = read_nic_word(dev, BintrItv); -+ word &= ~BintrItv_BintrItv; -+ -+ //word |= priv->ieee80211->beacon_interval * -+ // ((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1); -+ // FIXME:FIXME check if correct ^^ worked with 0x3e8; -+ -+ write_nic_word(dev, BintrItv, word); -+ -+ //write_nic_word(dev,0x2e,0xe002); -+ //write_nic_dword(dev,0x30,0xb8c7832e); -+ for(i=0; i<ETH_ALEN; i++) -+ write_nic_byte(dev, BSSID+i, priv->ieee80211->beacon_cell_ssid[i]); -+ -+// rtl8180_update_msr(dev); -+ -+ -+ //write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */ -+ -+ rtl8180_set_mode(dev, EPROM_CMD_NORMAL); -+ -+ rtl8180_irq_enable(dev); -+ -+ /* VV !!!!!!!!!! VV*/ -+ /* -+ rtl8180_set_mode(dev,EPROM_CMD_CONFIG); -+ write_nic_byte(dev,0x9d,0x00); -+ rtl8180_set_mode(dev,EPROM_CMD_NORMAL); -+*/ -+} -+#endif -+/*************************************************************************** -+ -------------------------------NET STUFF--------------------------- -+***************************************************************************/ -+static struct net_device_stats *rtl8180_stats(struct net_device *dev) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ return &priv->ieee80211->stats; -+} -+ -+int _rtl8180_up(struct net_device *dev) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ //int i; -+ -+ priv->driver_upping = 1; -+ priv->up=1; -+ -+#ifdef LED -+ if(priv->ieee80211->bHwRadioOff == false) -+ priv->ieee80211->ieee80211_led_contorl(dev,LED_CTL_POWER_ON); -+#endif -+ MgntActSet_RF_State(dev, eRfOn, RF_CHANGE_BY_SW); -+ -+ rtl8180_adapter_start(dev); -+ rtl8180_rx_enable(dev); -+ rtl8180_tx_enable(dev); -+//by amy for rate adaptive -+ timer_rate_adaptive((unsigned long)dev); -+//by amy for rate adaptive -+ -+#ifdef SW_ANTE_DIVERSITY -+ if(priv->bSwAntennaDiverity){ -+ //DMESG("SW Antenna Diversity Enable!"); -+ SwAntennaDiversityTimerCallback(dev); -+ } -+#endif -+ -+ ieee80211_softmac_start_protocol(priv->ieee80211); -+ -+//by amy for ps -+ watch_dog_adaptive((unsigned long)dev); -+//by amy for ps -+ -+ ieee80211_reset_queue(priv->ieee80211); -+ if(!netif_queue_stopped(dev)) -+ netif_start_queue(dev); -+ else -+ netif_wake_queue(dev); -+ -+#ifndef CONFIG_SOFT_BEACON -+ if(NIC_8187B == priv->card_8187) -+ rtl8187_rx_manage_initiate(dev); -+#endif -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ if(priv->mshobj && priv->mshobj->ext_patch_rtl8180_up ) -+ priv->mshobj->ext_patch_rtl8180_up(priv->mshobj); -+#endif -+ -+ -+ priv->driver_upping = 0; -+ //DMESG("rtl8187_open process complete"); -+ return 0; -+} -+ -+ -+int rtl8180_open(struct net_device *dev) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ int ret; -+//changed by lizhaoming for power on/off -+ if(priv->ieee80211->bHwRadioOff == false){ -+ //DMESG("rtl8187_open process "); -+ down(&priv->wx_sem); -+ ret = rtl8180_up(dev); -+ up(&priv->wx_sem); -+ return ret; -+ }else{ -+ DMESG("rtl8187_open process failed because radio off"); -+ return -1; -+ } -+ -+} -+ -+ -+int rtl8180_up(struct net_device *dev) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ if (priv->up == 1) return -1; -+ -+ return _rtl8180_up(dev); -+} -+ -+ -+int rtl8180_close(struct net_device *dev) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ int ret; -+ -+ if (priv->up == 0) return -1; -+ -+ down(&priv->wx_sem); -+ -+ //DMESG("rtl8187_close process"); -+ ret = rtl8180_down(dev); -+#ifdef LED -+ priv->ieee80211->ieee80211_led_contorl(dev,LED_CTL_POWER_OFF); -+#endif -+ up(&priv->wx_sem); -+ -+ return ret; -+ -+} -+ -+int rtl8180_down(struct net_device *dev) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ if (priv->up == 0) return -1; -+ -+ priv->up=0; -+ -+/* FIXME */ -+ if (!netif_queue_stopped(dev)) -+ netif_stop_queue(dev); -+ -+ //DMESG("rtl8180_down process"); -+ rtl8180_rtx_disable(dev); -+ rtl8180_irq_disable(dev); -+//by amy for rate adaptive -+ del_timer_sync(&priv->rateadapter_timer); -+ cancel_delayed_work(&priv->ieee80211->rate_adapter_wq); -+//by amy for rate adaptive -+ del_timer_sync(&priv->watch_dog_timer); -+ cancel_delayed_work(&priv->ieee80211->watch_dog_wq); -+ cancel_delayed_work(&priv->ieee80211->hw_dig_wq); -+ cancel_delayed_work(&priv->ieee80211->tx_pw_wq); -+ -+#ifdef SW_ANTE_DIVERSITY -+ del_timer_sync(&priv->SwAntennaDiversityTimer); -+ cancel_delayed_work(&priv->ieee80211->SwAntennaWorkItem); -+#endif -+ -+ ieee80211_softmac_stop_protocol(priv->ieee80211); -+ MgntActSet_RF_State(dev, eRfOff, RF_CHANGE_BY_SW); -+ //amy,081212 -+ memset(&(priv->ieee80211->current_network),0,sizeof(struct ieee80211_network)); -+ return 0; -+} -+ -+bool SetZebraRFPowerState8187B(struct net_device *dev,RT_RF_POWER_STATE eRFPowerState); -+ -+void rtl8180_commit(struct net_device *dev) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ int i; -+ -+ if (priv->up == 0) return ; -+ printk("==========>%s()\n", __FUNCTION__); -+ -+ /* FIXME */ -+ if (!netif_queue_stopped(dev)) -+ netif_stop_queue(dev); -+ -+//by amy for rate adaptive -+ del_timer_sync(&priv->rateadapter_timer); -+ cancel_delayed_work(&priv->ieee80211->rate_adapter_wq); -+//by amy for rate adaptive -+ del_timer_sync(&priv->watch_dog_timer); -+ cancel_delayed_work(&priv->ieee80211->watch_dog_wq); -+ cancel_delayed_work(&priv->ieee80211->hw_dig_wq); -+ cancel_delayed_work(&priv->ieee80211->tx_pw_wq); -+ -+#ifdef SW_ANTE_DIVERSITY -+ del_timer_sync(&priv->SwAntennaDiversityTimer); -+ cancel_delayed_work(&priv->ieee80211->SwAntennaWorkItem); -+#endif -+ ieee80211_softmac_stop_protocol(priv->ieee80211); -+ -+#if 0 -+ if(priv->ieee80211->bHwRadioOff == false){ -+ MgntActSet_RF_State(dev, eRfOff, RF_CHANGE_BY_HW); -+ mdelay(10); -+ MgntActSet_RF_State(dev, eRfOn, RF_CHANGE_BY_HW); -+ } -+#endif -+ -+ rtl8180_irq_disable(dev); -+ rtl8180_rtx_disable(dev); -+ -+ //test pending bug, john 20070815 -+ //initialize tx_pending -+ for(i=0;i<0x10;i++) atomic_set(&(priv->tx_pending[i]), 0); -+ -+ _rtl8180_up(dev); -+ priv->commit = 0; -+} -+ -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) -+void rtl8180_restart(struct work_struct *work) -+{ -+ struct r8180_priv *priv = container_of(work, struct r8180_priv, reset_wq); -+ struct ieee80211_device* ieee = priv->ieee80211;//for commit crash -+ struct net_device *dev = ieee->dev;//for commit crash -+#else -+void rtl8180_restart(struct net_device *dev) -+{ -+ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+#endif -+ -+ down(&priv->wx_sem); -+ -+ rtl8180_commit(dev); -+ -+ up(&priv->wx_sem); -+} -+ -+static void r8180_set_multicast(struct net_device *dev) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ short promisc; -+ -+ //down(&priv->wx_sem); -+ -+ /* FIXME FIXME */ -+ -+ promisc = (dev->flags & IFF_PROMISC) ? 1:0; -+ -+ if (promisc != priv->promisc) -+ // rtl8180_commit(dev); -+ -+ priv->promisc = promisc; -+ -+ //schedule_work(&priv->reset_wq); -+ //up(&priv->wx_sem); -+} -+ -+ -+int r8180_set_mac_adr(struct net_device *dev, void *mac) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ struct sockaddr *addr = mac; -+ -+ down(&priv->wx_sem); -+ -+ memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); -+ -+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) -+ schedule_work(&priv->reset_wq); -+#else -+ schedule_task(&priv->reset_wq); -+#endif -+ up(&priv->wx_sem); -+ -+ return 0; -+} -+ -+struct ipw_param { -+ u32 cmd; -+ u8 sta_addr[ETH_ALEN]; -+ union { -+ struct { -+ u8 name; -+ u32 value; -+ } wpa_param; -+ struct { -+ u32 len; -+ u8 reserved[32]; -+ u8 data[0]; -+ } wpa_ie; -+ struct{ -+ u32 command; -+ u32 reason_code; -+ } mlme; -+ struct { -+ u8 alg[16]; -+ u8 set_tx; -+ u32 err; -+ u8 idx; -+ u8 seq[8]; -+ u16 key_len; -+ u8 key[0]; -+ } crypt; -+ -+ } u; -+}; -+ -+ -+/* based on ipw2200 driver */ -+int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ struct iwreq *wrq = (struct iwreq *)rq; -+ int ret=-1; -+ -+#ifdef JOHN_TKIP -+ u8 broadcast_addr[6] = {0xff,0xff,0xff,0xff,0xff,0xff}; -+ -+ struct ieee80211_device *ieee = priv->ieee80211; -+ struct ipw_param *ipw = (struct ipw_param *)wrq->u.data.pointer; -+ u32 key[4]; -+ -+#endif -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ if(priv->mshobj && (priv->ieee80211->iw_mode == priv->ieee80211->iw_ext_mode) && priv->mshobj->ext_patch_rtl8180_ioctl) -+ { -+ // DO NOT put the belowing function in critical section, due to it uses "spin lock" -+ if((ret = priv->mshobj->ext_patch_rtl8180_ioctl(dev, rq, cmd)) != -EOPNOTSUPP) -+ return ret; -+ } -+#endif -+ -+ down(&priv->wx_sem); -+ -+ switch (cmd) { -+ case RTL_IOCTL_WPA_SUPPLICANT: -+#ifdef JOHN_TKIP -+ -+//the following code is specified for ipw driver in wpa_supplicant -+ if( ((u32*)wrq->u.data.pointer)[0]==3 ){ -+ -+ -+ if( ((u32*)wrq->u.data.pointer)[7] && -+ ( ((u32*)wrq->u.data.pointer)[3]==0x504d4343 || -+ ((u32*)wrq->u.data.pointer)[3]==0x50494b54 )) {//50494b54 tkip and 504d4343 ccmp -+ -+ //enable HW security of TKIP and CCMP -+ write_nic_byte(dev, WPA_CONFIG, SCR_TxSecEnable | SCR_RxSecEnable ); -+ -+ //copy key from wpa_supplicant ioctl info -+ key[0] = ((u32*)wrq->u.data.pointer)[12]; -+ key[1] = ((u32*)wrq->u.data.pointer)[13]; -+ key[2] = ((u32*)wrq->u.data.pointer)[14]; -+ key[3] = ((u32*)wrq->u.data.pointer)[15]; -+ switch (ieee->pairwise_key_type){ -+ case KEY_TYPE_TKIP: -+ setKey( dev, -+ 0, //EntryNo -+ ipw->u.crypt.idx, //KeyIndex -+ KEY_TYPE_TKIP, //KeyType -+ (u8*)ieee->ap_mac_addr, //MacAddr -+ 0, //DefaultKey -+ key); //KeyContent -+ break; -+ -+ case KEY_TYPE_CCMP: -+ setKey( dev, -+ 0, //EntryNo -+ ipw->u.crypt.idx, //KeyIndex -+ KEY_TYPE_CCMP, //KeyType -+ (u8*)ieee->ap_mac_addr, //MacAddr -+ 0, //DefaultKey -+ key); //KeyContent -+ break -+; -+ default: -+ printk("error on key_type: %d\n", ieee->pairwise_key_type); -+ break; -+ } -+ } -+ -+ //group key for broadcast -+ if( ((u32*)wrq->u.data.pointer)[9] ) { -+ -+ key[0] = ((u32*)wrq->u.data.pointer)[12]; -+ key[1] = ((u32*)wrq->u.data.pointer)[13]; -+ key[2] = ((u32*)wrq->u.data.pointer)[14]; -+ key[3] = ((u32*)wrq->u.data.pointer)[15]; -+ -+ if( ((u32*)wrq->u.data.pointer)[3]==0x50494b54 ){//50494b54 is the ASCII code of TKIP in reversed order -+ setKey( dev, -+ 1, //EntryNo -+ ipw->u.crypt.idx,//KeyIndex -+ KEY_TYPE_TKIP, //KeyType -+ broadcast_addr, //MacAddr -+ 0, //DefaultKey -+ key); //KeyContent -+ } -+ else if( ((u32*)wrq->u.data.pointer)[3]==0x504d4343 ){//CCMP -+ setKey( dev, -+ 1, //EntryNo -+ ipw->u.crypt.idx,//KeyIndex -+ KEY_TYPE_CCMP, //KeyType -+ broadcast_addr, //MacAddr -+ 0, //DefaultKey -+ key); //KeyContent -+ } -+ else if( ((u32*)wrq->u.data.pointer)[3]==0x656e6f6e ){//none -+ //do nothing -+ } -+ else if( ((u32*)wrq->u.data.pointer)[3]==0x504557 ){//WEP -+ setKey( dev, -+ 1, //EntryNo -+ ipw->u.crypt.idx,//KeyIndex -+ KEY_TYPE_WEP40, //KeyType -+ broadcast_addr, //MacAddr -+ 0, //DefaultKey -+ key); //KeyContent -+ } -+ else printk("undefine group key type: %8x\n", ((u32*)wrq->u.data.pointer)[3]); -+ } -+ -+ } -+#endif /*JOHN_TKIP*/ -+ -+ -+#ifdef JOHN_HWSEC_DEBUG -+ { -+ int i; -+ //john's test 0711 -+ printk("@@ wrq->u pointer = "); -+ for(i=0;i<wrq->u.data.length;i++){ -+ if(i%10==0) printk("\n"); -+ printk( "%8x|", ((u32*)wrq->u.data.pointer)[i] ); -+ } -+ printk("\n"); -+ } -+#endif /*JOHN_HWSEC_DEBUG*/ -+ ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data); -+ break; -+ -+ default: -+ ret = -EOPNOTSUPP; -+ break; -+ } -+ -+ up(&priv->wx_sem); -+ -+ return ret; -+} -+ -+ -+struct tx_desc { -+ -+#ifdef _LINUX_BYTEORDER_LITTLE_ENDIAN_H -+ -+ -+//dword 0 -+unsigned int tpktsize:12; -+unsigned int rsvd0:3; -+unsigned int no_encrypt:1; -+unsigned int splcp:1; -+unsigned int morefrag:1; -+unsigned int ctsen:1; -+unsigned int rtsrate:4; -+unsigned int rtsen:1; -+unsigned int txrate:4; -+unsigned int last:1; -+unsigned int first:1; -+unsigned int dmaok:1; -+unsigned int own:1; -+ -+//dword 1 -+unsigned short rtsdur; -+unsigned short length:15; -+unsigned short l_ext:1; -+ -+//dword 2 -+unsigned int bufaddr; -+ -+ -+//dword 3 -+unsigned short rxlen:12; -+unsigned short rsvd1:3; -+unsigned short miccal:1; -+unsigned short dur; -+ -+//dword 4 -+unsigned int nextdescaddr; -+ -+//dword 5 -+unsigned char rtsagc; -+unsigned char retrylimit; -+unsigned short rtdb:1; -+unsigned short noacm:1; -+unsigned short pifs:1; -+unsigned short rsvd2:4; -+unsigned short rtsratefallback:4; -+unsigned short ratefallback:5; -+ -+//dword 6 -+unsigned short delaybound; -+unsigned short rsvd3:4; -+unsigned short agc:8; -+unsigned short antenna:1; -+unsigned short spc:2; -+unsigned short rsvd4:1; -+ -+//dword 7 -+unsigned char len_adjust:2; -+unsigned char rsvd5:1; -+unsigned char tpcdesen:1; -+unsigned char tpcpolarity:2; -+unsigned char tpcen:1; -+unsigned char pten:1; -+ -+unsigned char bckey:6; -+unsigned char enbckey:1; -+unsigned char enpmpd:1; -+unsigned short fragqsz; -+ -+ -+#else -+ -+#error "please modify tx_desc to your own\n" -+ -+#endif -+ -+ -+} __attribute__((packed)); -+ -+struct rx_desc_rtl8187b { -+ -+#ifdef _LINUX_BYTEORDER_LITTLE_ENDIAN_H -+ -+//dword 0 -+unsigned int rxlen:12; -+unsigned int icv:1; -+unsigned int crc32:1; -+unsigned int pwrmgt:1; -+unsigned int res:1; -+unsigned int bar:1; -+unsigned int pam:1; -+unsigned int mar:1; -+unsigned int qos:1; -+unsigned int rxrate:4; -+unsigned int trsw:1; -+unsigned int splcp:1; -+unsigned int fovf:1; -+unsigned int dmafail:1; -+unsigned int last:1; -+unsigned int first:1; -+unsigned int eor:1; -+unsigned int own:1; -+ -+ -+//dword 1 -+unsigned int tsftl; -+ -+ -+//dword 2 -+unsigned int tsfth; -+ -+ -+//dword 3 -+unsigned char sq; -+unsigned char rssi:7; -+unsigned char antenna:1; -+ -+unsigned char agc; -+unsigned char decrypted:1; -+unsigned char wakeup:1; -+unsigned char shift:1; -+unsigned char rsvd0:5; -+ -+//dword 4 -+unsigned int num_mcsi:4; -+unsigned int snr_long2end:6; -+unsigned int cfo_bias:6; -+ -+int pwdb_g12:8; -+unsigned int fot:8; -+ -+ -+ -+ -+#else -+ -+#error "please modify tx_desc to your own\n" -+ -+#endif -+ -+}__attribute__((packed)); -+ -+ -+ -+struct rx_desc_rtl8187 { -+ -+#ifdef _LINUX_BYTEORDER_LITTLE_ENDIAN_H -+ -+//dword 0 -+unsigned int rxlen:12; -+unsigned int icv:1; -+unsigned int crc32:1; -+unsigned int pwrmgt:1; -+unsigned int res:1; -+unsigned int bar:1; -+unsigned int pam:1; -+unsigned int mar:1; -+unsigned int qos:1; -+unsigned int rxrate:4; -+unsigned int trsw:1; -+unsigned int splcp:1; -+unsigned int fovf:1; -+unsigned int dmafail:1; -+unsigned int last:1; -+unsigned int first:1; -+unsigned int eor:1; -+unsigned int own:1; -+ -+//dword 1 -+unsigned char sq; -+unsigned char rssi:7; -+unsigned char antenna:1; -+ -+unsigned char agc; -+unsigned char decrypted:1; -+unsigned char wakeup:1; -+unsigned char shift:1; -+unsigned char rsvd0:5; -+ -+//dword 2 -+unsigned int tsftl; -+ -+//dword 3 -+unsigned int tsfth; -+ -+ -+ -+#else -+ -+#error "please modify tx_desc to your own\n" -+ -+#endif -+ -+ -+}__attribute__((packed)); -+ -+ -+ -+union rx_desc { -+ -+struct rx_desc_rtl8187b desc_87b; -+struct rx_desc_rtl8187 desc_87; -+ -+}__attribute__((packed)); -+ -+// -+// Description: -+// Perform signal smoothing for dynamic mechanism. -+// This is different with PerformSignalSmoothing8187 in smoothing fomula. -+// No dramatic adjustion is apply because dynamic mechanism need some degree -+// of correctness. -+// 2007.01.23, by shien chang. -+// -+void PerformUndecoratedSignalSmoothing8187(struct net_device *dev, struct ieee80211_rx_stats *stats) -+{ -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ bool bCckRate = rtl8180_IsWirelessBMode(rtl8180_rate2rate(stats->rate)); -+ -+ if(NIC_8187 == priv->card_8187) { -+ if(priv->UndecoratedSmoothedSS >= 0) { -+ priv->UndecoratedSmoothedSS = ((priv->UndecoratedSmoothedSS * 50) + (stats->signalstrength * 11)) / 60; -+ }else{ -+ priv->UndecoratedSmoothedSS = stats->signalstrength; -+ } -+ } else { -+ // Determin the current packet is CCK rate, by Bruce, 2007-04-12. -+ priv->bCurCCKPkt = bCckRate; -+ -+ // Tesing for SD3 DZ, by Bruce, 2007-04-11. -+ if(priv->UndecoratedSmoothedSS >= 0) { -+ priv->UndecoratedSmoothedSS = ((priv->UndecoratedSmoothedSS * 5) + (stats->signalstrength * 10)) / 6; -+ }else{ -+ priv->UndecoratedSmoothedSS = stats->signalstrength * 10; -+ } -+ -+ // -+ // Bacause the AGC parameter is not exactly correct under high power (AGC saturation), we need to record the RSSI value to be -+ // referenced by DoRxHighPower. It is not necessary to record this value when this packet is sent by OFDM rate. -+ // Advised by SD3 DZ, by Bruce, 2007-04-12. -+ // -+ if(bCckRate){ -+ priv->CurCCKRSSI = stats->signal; -+ }else{ -+ priv->CurCCKRSSI = 0; -+ } -+ } -+ //printk("Sommthing SignalSterngth (%d) => UndecoratedSmoothedSS (%d)\n", stats->signalstrength, priv->UndecoratedSmoothedSS); -+} -+ -+#ifdef THOMAS_SKB -+void rtl8180_irq_rx_tasklet(struct r8180_priv *priv) -+{ -+ int status,len,flen; -+ -+#ifdef SW_ANTE_DIVERSITY -+ u8 Antenna = 0; -+#endif -+ u32 SignalStrength = 0; -+ u32 quality = 0; -+ bool bCckRate = false; -+ char RX_PWDB = 0; -+ long RecvSignalPower=0; -+ struct sk_buff *skb; -+ struct sk_buff *skb2;//skb for check out of memory -+ union rx_desc *desc; -+ //struct urb *rx_urb = priv->rxurb_task; -+ struct ieee80211_hdr *hdr;//by amy -+ u16 fc,type; -+ u8 bHwError=0,bCRC=0,bICV=0; -+ long SignalStrengthIndex = 0; -+ struct ieee80211_rx_stats stats = { -+ .signal = 0, -+ .noise = -98, -+ .rate = 0, -+ //.mac_time = jiffies, -+ .freq = IEEE80211_24GHZ_BAND, -+ }; -+ -+ int *prx_inx=&priv->rx_inx; -+ struct urb *rx_urb=priv->rx_urb[*prx_inx]; //changed by jackson -+ struct net_device *dev = (struct net_device*)rx_urb->context; -+ //DMESG("=====>RX %x ",rx_urb->status); -+ -+ skb = priv->pp_rxskb[*prx_inx]; -+ status = rx_urb->status; -+ skb2 = dev_alloc_skb(RX_URB_SIZE); -+ -+ if (skb2 == NULL){ -+ printk(KERN_ALERT "No Skb For RX!/n"); -+ //rx_urb->transfer_buffer = skb->data; -+ //priv->pp_rxskb[*prx_inx] = skb; -+ } else { -+ -+ if(status == 0) -+ { -+ if(NIC_8187B == priv->card_8187) -+ { -+ stats.nic_type = NIC_8187B; -+ len = rx_urb->actual_length; -+ len -= sizeof (struct rx_desc_rtl8187b); -+ desc = (union rx_desc *)(rx_urb->transfer_buffer + len); -+ flen = desc->desc_87b.rxlen ; -+ -+ if( flen <= rx_urb->actual_length){ -+#if 1 -+#ifdef SW_ANTE_DIVERSITY -+ Antenna = desc->desc_87b.antenna; -+#endif -+ stats.mac_time[0] = desc->desc_87b.tsftl; -+ stats.mac_time[1] = desc->desc_87b.tsfth; -+ -+ stats.signal = desc->desc_87b.rssi; -+ //stats.noise = desc->desc_87b.sq; -+ quality = desc->desc_87b.sq; -+ stats.rate = desc->desc_87b.rxrate; -+ bCckRate = rtl8180_IsWirelessBMode(rtl8180_rate2rate(stats.rate)); -+ -+ if(!bCckRate) { // OFDM rate. -+ if(desc->desc_87b.pwdb_g12 < -106) -+ SignalStrength = 0; -+ else -+ SignalStrength = desc->desc_87b.pwdb_g12 + 106; -+ RX_PWDB = (desc->desc_87b.pwdb_g12)/2 -42; -+ } else { // CCK rate. -+ if(desc->desc_87b.agc> 174) -+ SignalStrength = 0; -+ else -+ SignalStrength = 174 - desc->desc_87b.agc; -+ RX_PWDB = ((desc->desc_87b.agc)/2)*(-1) - 8; -+ } -+ -+ //lzm mod 081028 based on windows driver -+ //compensate SignalStrength when switch TR to SW controled -+ if(priv->TrSwitchState == TR_SW_TX) { -+ SignalStrength = SignalStrength + 54; -+ RX_PWDB = RX_PWDB + 27; -+ } -+ -+ if(SignalStrength > 100) -+ SignalStrength = 100; -+ SignalStrength = (SignalStrength * 70) / 100 + 30; -+ -+ if(SignalStrength > 50) -+ SignalStrength = SignalStrength + 10; -+ if(SignalStrength > 100) -+ SignalStrength = 100; -+ -+ RecvSignalPower = RX_PWDB; -+ //printk("SignalStrength = %d \n",SignalStrength); -+ bHwError = (desc->desc_87b.fovf | desc->desc_87b.icv | desc->desc_87b.crc32); -+ bCRC = desc->desc_87b.crc32; -+ bICV = desc->desc_87b.icv; -+ priv->wstats.qual.level = (u8)SignalStrength; -+ -+ if(!bCckRate){ -+ if (quality > 127) -+ quality = 0; -+ else if (quality <27) -+ quality = 100; -+ else -+ quality = 127 - quality; -+ } else { -+ if(quality > 64) -+ quality = 0; -+ else -+ quality = ((64-quality)*100)/64; -+ } -+ -+ -+ priv ->wstats.qual.qual = quality; -+ priv->wstats.qual.noise = 100 - priv ->wstats.qual.qual; -+ -+ stats.signalstrength = (u8)SignalStrength; -+ stats.signal = (u8)quality; -+ stats.noise = desc->desc_87b.snr_long2end; -+ -+ skb_put(skb,flen-4); -+ -+ priv->stats.rxok++; -+ //by amy -+ hdr = (struct ieee80211_hdr *)skb->data; -+ fc = le16_to_cpu(hdr->frame_ctl); -+ type = WLAN_FC_GET_TYPE(fc); -+ -+ if((IEEE80211_FTYPE_CTL != type) && -+ (eqMacAddr(priv->ieee80211->current_network.bssid, (fc & IEEE80211_FCTL_TODS)? hdr->addr1 : (fc & IEEE80211_FCTL_FROMDS )? hdr->addr2 : hdr->addr3)) && (!bHwError) && (!bCRC)&& (!bICV)) -+ { -+ // Perform signal smoothing for dynamic mechanism on demand. -+ // This is different with PerformSignalSmoothing8187 in smoothing fomula. -+ // No dramatic adjustion is apply because dynamic mechanism need some degree -+ // of correctness. 2007.01.23, by shien chang. -+ PerformUndecoratedSignalSmoothing8187(dev, &stats); -+ -+ //Update signal strength and realted into private RxStats for UI query. -+ SignalStrengthIndex = NetgearSignalStrengthTranslate(priv->LastSignalStrengthInPercent, priv->wstats.qual.level); -+ priv->LastSignalStrengthInPercent = SignalStrengthIndex; -+ priv->SignalStrength = TranslateToDbm8187((u8)SignalStrengthIndex); -+ priv->SignalQuality = (priv->SignalQuality*5+quality+5)/6; -+ priv->RecvSignalPower = (priv->RecvSignalPower * 5 + RecvSignalPower - 1) / 6; -+#ifdef SW_ANTE_DIVERSITY -+ priv->LastRxPktAntenna = Antenna ? 1:0; -+ SwAntennaDiversityRxOk8185(dev, SignalStrength); -+#endif -+ } -+ //by amy -+#endif -+ if(!ieee80211_rx(priv->ieee80211,skb, &stats)) { -+ dev_kfree_skb_any(skb); -+ } -+ }else { -+ priv->stats.rxurberr++; -+ printk("URB Error flen:%d actual_length:%d\n", flen , rx_urb->actual_length); -+ dev_kfree_skb_any(skb); -+ } -+ } else { -+ stats.nic_type = NIC_8187; -+ len = rx_urb->actual_length; -+ len -= sizeof (struct rx_desc_rtl8187); -+ desc = (union rx_desc *)(rx_urb->transfer_buffer + len); -+ flen = desc->desc_87.rxlen ; -+ -+ if(flen <= rx_urb->actual_length){ -+ stats.signal = desc->desc_87.rssi; -+ stats.noise = desc->desc_87.sq; -+ stats.rate = desc->desc_87.rxrate; -+ stats.mac_time[0] = desc->desc_87.tsftl; -+ stats.mac_time[1] = desc->desc_87.tsfth; -+ SignalStrength = (desc->desc_87.agc&0xfe) >> 1; -+ if( ((stats.rate <= 22) && (stats.rate != 12) && (stats.rate != 18)) || (stats.rate == 44) )//need to translate to real rate here -+ bCckRate= TRUE; -+ if (!bCckRate) -+ { -+ if (SignalStrength > 90) SignalStrength = 90; -+ else if (SignalStrength < 25) SignalStrength = 25; -+ SignalStrength = ((90 - SignalStrength)*100)/65; -+ } -+ else -+ { -+ if (SignalStrength >95) SignalStrength = 95; -+ else if (SignalStrength < 30) SignalStrength = 30; -+ SignalStrength = ((95 - SignalStrength)*100)/65; -+ } -+ stats.signalstrength = (u8)SignalStrength; -+ -+ skb_put(skb,flen-4); -+ -+ priv->stats.rxok++; -+ -+ if(!ieee80211_rx(priv->ieee80211,skb, &stats)) -+ dev_kfree_skb_any(skb); -+ -+ -+ }else { -+ priv->stats.rxurberr++; -+ printk("URB Error flen:%d actual_length:%d\n", flen , rx_urb->actual_length); -+ dev_kfree_skb_any(skb); -+ } -+ } -+ }else{ -+ -+ //printk("RX Status Error!\n"); -+ priv->stats.rxstaterr++; -+ priv->ieee80211->stats.rx_errors++; -+ dev_kfree_skb_any(skb); -+ -+ } -+ -+ rx_urb->transfer_buffer = skb2->data; -+ -+ priv->pp_rxskb[*prx_inx] = skb2; -+ } -+ -+ if(status != -ENOENT ){ -+ rtl8187_rx_urbsubmit(dev,rx_urb); -+ } else { -+ priv->pp_rxskb[*prx_inx] = NULL; -+ dev_kfree_skb_any(skb2); -+ //printk("RX process %d aborted due to explicit shutdown (%x)(%d)\n ", *prx_inx, status, status); -+ } -+ -+ if (*prx_inx == (MAX_RX_URB -1)) -+ *prx_inx = 0; -+ else -+ *prx_inx = *prx_inx + 1; -+} -+#endif -+ -+#ifdef THOMAS_TASKLET -+void rtl8180_irq_rx_tasklet_new(struct r8180_priv *priv){ -+ unsigned long flags; -+ while( atomic_read( &priv->irt_counter ) ){ -+ spin_lock_irqsave(&priv->irq_lock,flags);//added by thomas -+ rtl8180_irq_rx_tasklet(priv); -+ spin_unlock_irqrestore(&priv->irq_lock,flags);//added by thomas -+ if(atomic_read(&priv->irt_counter) >= 1) -+ atomic_dec( &priv->irt_counter ); -+ } -+} -+#endif -+/**************************************************************************** -+ ---------------------------- USB_STUFF--------------------------- -+*****************************************************************************/ -+ -+static const struct net_device_ops rtl8187_netdev_ops = { -+ .ndo_open = rtl8180_open, -+ .ndo_stop = rtl8180_close, -+ .ndo_tx_timeout = tx_timeout, -+ .ndo_do_ioctl = rtl8180_ioctl, -+ .ndo_set_multicast_list = r8180_set_multicast, -+ .ndo_set_mac_address = r8180_set_mac_adr, -+ .ndo_validate_addr = eth_validate_addr, -+ .ndo_change_mtu = eth_change_mtu, -+ .ndo_start_xmit = ieee80211_xmit, -+ .ndo_get_stats = rtl8180_stats, -+}; -+ -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+static int __devinit rtl8187_usb_probe(struct usb_interface *intf, -+ const struct usb_device_id *id) -+#else -+static void * __devinit rtl8187_usb_probe(struct usb_device *udev, -+ unsigned int ifnum, -+ const struct usb_device_id *id) -+#endif -+{ -+ struct net_device *dev = NULL; -+ struct r8180_priv *priv= NULL; -+ -+ -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+ struct usb_device *udev = interface_to_usbdev(intf); -+#endif -+ -+ dev = alloc_ieee80211(sizeof(struct r8180_priv)); -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) -+ SET_MODULE_OWNER(dev); -+#endif -+ -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+ usb_set_intfdata(intf, dev); -+ SET_NETDEV_DEV(dev, &intf->dev); -+#endif -+ priv = ieee80211_priv(dev); -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+ priv->ieee80211 = netdev_priv(dev); -+#else -+ priv->ieee80211 = (struct net_device *)dev->priv; -+#endif -+ priv->udev=udev; -+#ifdef CPU_64BIT -+ priv->usb_buf = kmalloc(0x200, GFP_KERNEL); -+ priv->usb_pool = dma_pool_create("rtl8187b", NULL, 64, 64, 0); -+#endif -+//lzm add for write time out test -+#ifdef DEBUG_RW_REGISTER -+ { -+ int reg_index = 0; -+ for(reg_index = 0; reg_index <= 199; reg_index++) -+ { -+ priv->write_read_registers[reg_index].address = 0; -+ priv->write_read_registers[reg_index].content = 0; -+ priv->write_read_registers[reg_index].flag = 0; -+ } -+ priv->write_read_register_index = 0; -+ } -+#endif -+ //init netdev_ops, added by falcon.... -+ dev->netdev_ops = &rtl8187_netdev_ops; -+ -+ dev->wireless_handlers = &r8180_wx_handlers_def; -+#if WIRELESS_EXT >= 12 -+#if WIRELESS_EXT < 17 -+ dev->get_wireless_stats = r8180_get_wireless_stats; -+#endif -+ dev->wireless_handlers = (struct iw_handler_def *) &r8180_wx_handlers_def; -+#endif -+ -+ dev->type=ARPHRD_ETHER; -+ dev->watchdog_timeo = HZ*3; //modified by john, 0805 -+ -+ if (dev_alloc_name(dev, ifname) < 0){ -+ DMESG("Oops: devname already taken! Trying wlan%%d...\n"); -+ ifname = "wlan%d"; -+ dev_alloc_name(dev, ifname); -+ } -+ -+ if(rtl8180_init(dev)!=0){ -+ DMESG("Initialization failed"); -+ goto fail; -+ } -+ -+ netif_carrier_off(dev); -+ netif_stop_queue(dev); -+ -+ register_netdev(dev); -+ -+ rtl8180_proc_init_one(dev); -+ -+ /* init rfkill */ -+ r8187b_rfkill_init(dev); -+ -+ DMESG("Driver probe completed"); -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) -+ return dev; -+#else -+ return 0; -+#endif -+ -+ -+fail: -+ free_ieee80211(dev); -+ -+ DMESG("wlan driver load failed\n"); -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) -+ return NULL; -+#else -+ return -ENODEV; -+#endif -+ -+} -+ -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+static void __devexit rtl8187_usb_disconnect(struct usb_interface *intf) -+#else -+static void __devexit rtl8187_usb_disconnect(struct usb_device *udev, void *ptr) -+#endif -+{ -+ struct r8180_priv *priv = NULL; -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+ struct net_device *dev = usb_get_intfdata(intf); -+#else -+ struct net_device *dev = (struct net_device *)ptr; -+#endif -+ if(dev){ -+ unregister_netdev(dev); -+ -+ priv=ieee80211_priv(dev); -+ -+ MgntActSet_RF_State(dev, eRfOff, RF_CHANGE_BY_SW); -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ if(priv && priv->mshobj) -+ { -+ if(priv->mshobj->ext_patch_remove_proc) -+ priv->mshobj->ext_patch_remove_proc(priv); -+ priv->ieee80211->ext_patch_ieee80211_start_protocol = 0; -+ priv->ieee80211->ext_patch_ieee80211_stop_protocol = 0; -+ priv->ieee80211->ext_patch_ieee80211_probe_req_1 = 0; -+ priv->ieee80211->ext_patch_ieee80211_probe_req_2 = 0; -+ priv->ieee80211->ext_patch_ieee80211_association_req_1 = 0; -+ priv->ieee80211->ext_patch_ieee80211_association_req_2 = 0; -+ priv->ieee80211->ext_patch_ieee80211_assoc_resp_by_net_1 = 0; -+ priv->ieee80211->ext_patch_ieee80211_assoc_resp_by_net_2 = 0; -+ priv->ieee80211->ext_patch_ieee80211_rx_frame_softmac_on_auth =0; -+ priv->ieee80211->ext_patch_ieee80211_rx_frame_softmac_on_deauth =0; -+ priv->ieee80211->ext_patch_ieee80211_rx_frame_softmac_on_assoc_req = 0; -+ priv->ieee80211->ext_patch_ieee80211_rx_frame_softmac_on_assoc_rsp = 0; -+ priv->ieee80211->ext_patch_ieee80211_ext_stop_scan_wq_set_channel = 0; -+ priv->ieee80211->ext_patch_ieee80211_process_probe_response_1 = 0; -+ priv->ieee80211->ext_patch_ieee80211_rx_mgt_on_probe_req = 0; -+ priv->ieee80211->ext_patch_ieee80211_rx_mgt_update_expire = 0; -+ priv->ieee80211->ext_patch_ieee80211_rx_on_rx = 0; -+ priv->ieee80211->ext_patch_get_beacon_get_probersp = 0; -+ priv->ieee80211->ext_patch_ieee80211_xmit = 0; -+ priv->ieee80211->ext_patch_ieee80211_rx_frame_get_hdrlen = 0; -+ priv->ieee80211->ext_patch_ieee80211_rx_is_valid_framectl = 0; -+ priv->ieee80211->ext_patch_ieee80211_rx_process_dataframe = 0; -+ // priv->ieee80211->ext_patch_is_duplicate_packet = 0; -+ priv->ieee80211->ext_patch_ieee80211_softmac_xmit_get_rate = 0; -+ free_mshobj(&priv->mshobj); -+ } -+#endif // _RTL8187_EXT_PATCH_ -+ -+ rtl8180_proc_remove_one(dev); -+ -+ rtl8180_down(dev); -+ priv->rf_close(dev); -+ -+ //rtl8180_rtx_disable(dev); -+ rtl8187_usb_deleteendpoints(dev); -+#ifdef LED -+ DeInitSwLeds(dev); -+#endif -+ rtl8180_irq_disable(dev); -+ rtl8180_reset(dev); -+ mdelay(10); -+ -+ } -+ -+#ifdef CPU_64BIT -+ if(priv->usb_buf) -+ kfree(priv->usb_buf); -+ if(priv->usb_pool) { -+ dma_pool_destroy(priv->usb_pool); -+ priv->usb_pool = NULL; -+ } -+#endif -+ free_ieee80211(dev); -+ DMESG("wlan driver removed"); -+} -+ -+/* fun with the built-in ieee80211 stack... */ -+extern int ieee80211_crypto_init(void); -+extern void ieee80211_crypto_deinit(void); -+extern int ieee80211_crypto_tkip_init(void); -+extern void ieee80211_crypto_tkip_exit(void); -+extern int ieee80211_crypto_ccmp_init(void); -+extern void ieee80211_crypto_ccmp_exit(void); -+extern int ieee80211_crypto_wep_init(void); -+extern void ieee80211_crypto_wep_exit(void); -+ -+static int __init rtl8187_usb_module_init(void) -+{ -+ int ret; -+ -+ ret = ieee80211_crypto_init(); -+ if (ret) { -+ printk(KERN_ERR "ieee80211_crypto_init() failed %d\n", ret); -+ return ret; -+ } -+ ret = ieee80211_crypto_tkip_init(); -+ if (ret) { -+ printk(KERN_ERR "ieee80211_crypto_tkip_init() failed %d\n", ret); -+ return ret; -+ } -+ ret = ieee80211_crypto_ccmp_init(); -+ if (ret) { -+ printk(KERN_ERR "ieee80211_crypto_ccmp_init() failed %d\n", ret); -+ return ret; -+ } -+ ret = ieee80211_crypto_wep_init(); -+ if (ret) { -+ printk(KERN_ERR "ieee80211_crypto_wep_init() failed %d\n", ret); -+ return ret; -+ } -+ -+ printk("\nLinux kernel driver for RTL8187/RTL8187B based WLAN cards\n"); -+ printk("Copyright (c) 2004-2008, Realsil Wlan\n"); -+ DMESG("Initializing module"); -+ DMESG("Wireless extensions version %d", WIRELESS_EXT); -+ rtl8180_proc_module_init(); -+ return usb_register(&rtl8187_usb_driver); -+} -+ -+static void __exit rtl8187_usb_module_exit(void) -+{ -+ r8187b_rfkill_exit(); -+ usb_deregister(&rtl8187_usb_driver); -+ rtl8180_proc_module_remove(); -+ ieee80211_crypto_tkip_exit(); -+ ieee80211_crypto_ccmp_exit(); -+ ieee80211_crypto_wep_exit(); -+ ieee80211_crypto_deinit(); -+ -+ DMESG("Exiting\n"); -+} -+ -+ -+void rtl8180_try_wake_queue(struct net_device *dev, int pri) -+{ -+ unsigned long flags; -+ short enough_desc; -+ struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); -+ -+ spin_lock_irqsave(&priv->tx_lock,flags); -+ enough_desc = check_nic_enought_desc(dev,pri); -+ spin_unlock_irqrestore(&priv->tx_lock,flags); -+ -+ if(enough_desc) -+ ieee80211_wake_queue(priv->ieee80211); -+} -+ -+#ifdef JOHN_HWSEC -+void EnableHWSecurityConfig8187(struct net_device *dev) -+{ -+ u8 SECR_value = 0x0; -+ SECR_value = SCR_TxSecEnable | SCR_RxSecEnable; -+ { -+ write_nic_byte(dev, WPA_CONFIG, 0x7);//SECR_value | SCR_UseDK ); -+ } -+} -+ -+void setKey(struct net_device *dev, -+ u8 EntryNo, -+ u8 KeyIndex, -+ u16 KeyType, -+ u8 *MacAddr, -+ u8 DefaultKey, -+ u32 *KeyContent ) -+{ -+ u32 TargetCommand = 0; -+ u32 TargetContent = 0; -+ u16 usConfig = 0; -+ int i; -+ usConfig |= BIT15 | (KeyType<<2) | (DefaultKey<<5) | KeyIndex; -+ -+ -+ for(i=0 ; i<6 ; i++){ -+ TargetCommand = i+6*EntryNo; -+ TargetCommand |= BIT31|BIT16; -+ -+ if(i==0){//MAC|Config -+ TargetContent = (u32)(*(MacAddr+0)) << 16| -+ (u32)(*(MacAddr+1)) << 24| -+ (u32)usConfig; -+ -+ write_nic_dword(dev, WCAMI, TargetContent); -+ write_nic_dword(dev, RWCAM, TargetCommand); -+ //printk("setkey cam =%8x\n", read_cam(dev, i+6*EntryNo)); -+ } else if(i==1){//MAC -+ TargetContent = (u32)(*(MacAddr+2)) | -+ (u32)(*(MacAddr+3)) << 8| -+ (u32)(*(MacAddr+4)) << 16| -+ (u32)(*(MacAddr+5)) << 24; -+ write_nic_dword(dev, WCAMI, TargetContent); -+ write_nic_dword(dev, RWCAM, TargetCommand); -+ } else { //Key Material -+ write_nic_dword(dev, WCAMI, (u32)(*(KeyContent+i-2)) ); -+ write_nic_dword(dev, RWCAM, TargetCommand); -+ } -+ } -+ -+} -+#endif -+ -+/**************************************************************************** -+ --------------------------- RF power on/power off ----------------- -+*****************************************************************************/ -+ -+/* -+ * the interface for changing the rfkill state -+ * @dev: the device of r8187b -+ * @eRfPowerStateToSet: the state we need to change, -+ * eRfOn: power on -+ * eRfOff: power off -+ * -+ * This function should be called by the SCI interrupt handler when the -+ * KEY_WLAN event happen(or install to the notify function of the SCI -+ * interrupt) or called in the wifi_set function of the rfkill interface for -+ * user-space, and also, it can be called to initialize the wifi state, and -+ * called when suspend/resume. -+ */ -+ -+void r8187b_wifi_change_rfkill_state(struct net_device *dev, RT_RF_POWER_STATE eRfPowerStateToSet) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ if (eRfPowerStateToSet == eRfOn) -+ priv->ieee80211->bHwRadioOff = false; -+ else -+ priv->ieee80211->bHwRadioOff = true; -+ -+#ifdef CONFIG_RADIO_DEBUG -+ DMESG("SCI interrupt Methord Will Turn Radio %s", -+ (priv->ieee80211->bHwRadioOff == true) ? "Off" : "On"); -+#endif -+ -+#ifdef LED //by lizhaoming -+ if (priv->ieee80211->bHwRadioOff) -+ priv->ieee80211->ieee80211_led_contorl(dev, LED_CTL_POWER_OFF); -+ else -+ priv->ieee80211->ieee80211_led_contorl(dev, LED_CTL_POWER_ON); -+#endif -+ -+ MgntActSet_RF_State(dev, eRfPowerStateToSet, RF_CHANGE_BY_HW); -+ -+ /* report the rfkill state to the user-space via uevent interface */ -+ r8187b_wifi_report_state(priv); -+} -+ -+/*************************************************************************** -+ ------------------- module init / exit stubs ---------------- -+****************************************************************************/ -+module_init(rtl8187_usb_module_init); -+module_exit(rtl8187_usb_module_exit); -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8187.h linux-2.6.35/drivers/net/wireless/rtl8187b/r8187.h ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8187.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/r8187.h 2010-08-05 21:12:35.503620434 +0200 -@@ -0,0 +1,811 @@ -+/* -+ This is part of rtl8187 OpenSource driver. -+ Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it> -+ Released under the terms of GPL (General Public Licence) -+ -+ Parts of this driver are based on the GPL part of the -+ official realtek driver -+ -+ Parts of this driver are based on the rtl8180 driver skeleton -+ from Patric Schenke & Andres Salomon -+ -+ Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver -+ -+ We want to tanks the Authors of those projects and the Ndiswrapper -+ project Authors. -+*/ -+ -+#ifndef R8180H -+#define R8180H -+ -+ -+#define RTL8187_MODULE_NAME "rtl8187" -+#define DMESG(x,a...) printk(KERN_INFO RTL8187_MODULE_NAME ": " x "\n", ## a) -+#define DMESGW(x,a...) printk(KERN_WARNING RTL8187_MODULE_NAME ": WW:" x "\n", ## a) -+#define DMESGE(x,a...) printk(KERN_WARNING RTL8187_MODULE_NAME ": EE:" x "\n", ## a) -+ -+#include <linux/module.h> -+#include <linux/kernel.h> -+//#include <linux/config.h> -+#include <linux/init.h> -+#include <linux/ioport.h> -+#include <linux/sched.h> -+#include <linux/types.h> -+#include <linux/slab.h> -+#include <linux/netdevice.h> -+//#include <linux/pci.h> -+#include <linux/usb.h> -+#include <linux/etherdevice.h> -+#include <linux/delay.h> -+#include <linux/rtnetlink.h> //for rtnl_lock() -+#include <linux/wireless.h> -+#include <linux/timer.h> -+#include <linux/proc_fs.h> // Necessary because we use the proc fs -+#include <linux/if_arp.h> -+#include <linux/random.h> -+#include <linux/version.h> -+#include <asm/io.h> -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) -+#include <asm/semaphore.h> -+#endif -+#include "ieee80211/ieee80211.h" -+#ifdef _RTL8187_EXT_PATCH_ -+#include "msh_class.h" -+#endif -+#ifdef LED -+#include "r8187_led.h" -+#endif -+ -+//added for HW security, john.0629 -+#define FALSE 0 -+#define TRUE 1 -+#define MAX_KEY_LEN 61 -+#define KEY_BUF_SIZE 5 -+ -+#define BIT0 0x00000001 -+#define BIT1 0x00000002 -+#define BIT2 0x00000004 -+#define BIT3 0x00000008 -+#define BIT4 0x00000010 -+#define BIT5 0x00000020 -+#define BIT6 0x00000040 -+#define BIT7 0x00000080 -+#define BIT8 0x00000100 -+#define BIT9 0x00000200 -+#define BIT10 0x00000400 -+#define BIT11 0x00000800 -+#define BIT12 0x00001000 -+#define BIT13 0x00002000 -+#define BIT14 0x00004000 -+#define BIT15 0x00008000 -+#define BIT16 0x00010000 -+#define BIT17 0x00020000 -+#define BIT18 0x00040000 -+#define BIT19 0x00080000 -+#define BIT20 0x00100000 -+#define BIT21 0x00200000 -+#define BIT22 0x00400000 -+#define BIT23 0x00800000 -+#define BIT24 0x01000000 -+#define BIT25 0x02000000 -+#define BIT26 0x04000000 -+#define BIT27 0x08000000 -+#define BIT28 0x10000000 -+#define BIT29 0x20000000 -+#define BIT30 0x40000000 -+#define BIT31 0x80000000 -+ -+//8187B Security -+#define RWCAM 0xA0 // Software read/write CAM config -+#define WCAMI 0xA4 // Software write CAM input content -+#define RCAMO 0xA8 // Output value from CAM according to 0xa0 setting -+#define DCAM 0xAC // Debug CAM Interface -+#define SECR 0xB0 // Security configuration register -+#define AESMSK_FC 0xB2 // AES Mask register for frame control (0xB2~0xB3). Added by Annie, 2006-03-06. -+#define AESMSK_SC 0x1FC // AES Mask for Sequence Control (0x1FC~0X1FD). Added by Annie, 2006-03-06. -+#define AESMSK_QC 0x1CE // AES Mask register for QoS Control when computing AES MIC, default = 0x000F. (2 bytes) -+ -+#define AESMSK_FC_DEFAULT 0xC78F // default value of AES MASK for Frame Control Field. (2 bytes) -+#define AESMSK_SC_DEFAULT 0x000F // default value of AES MASK for Sequence Control Field. (2 bytes) -+#define AESMSK_QC_DEFAULT 0x000F // default value of AES MASK for QoS Control Field. (2 bytes) -+ -+#define CAM_CONTENT_COUNT 6 -+#define CFG_DEFAULT_KEY BIT5 -+#define CFG_VALID BIT15 -+ -+//---------------------------------------------------------------------------- -+// 8187B WPA Config Register (offset 0xb0, 1 byte) -+//---------------------------------------------------------------------------- -+#define SCR_UseDK 0x01 -+#define SCR_TxSecEnable 0x02 -+#define SCR_RxSecEnable 0x04 -+ -+//---------------------------------------------------------------------------- -+// 8187B CAM Config Setting (offset 0xb0, 1 byte) -+//---------------------------------------------------------------------------- -+#define CAM_VALID 0x8000 -+#define CAM_NOTVALID 0x0000 -+#define CAM_USEDK 0x0020 -+ -+ -+#define CAM_NONE 0x0 -+#define CAM_WEP40 0x01 -+#define CAM_TKIP 0x02 -+#define CAM_AES 0x04 -+#define CAM_WEP104 0x05 -+ -+ -+//#define CAM_SIZE 16 -+#define TOTAL_CAM_ENTRY 16 -+#define CAM_ENTRY_LEN_IN_DW 6 // 6, unit: in u4byte. Added by Annie, 2006-05-25. -+#define CAM_ENTRY_LEN_IN_BYTE (CAM_ENTRY_LEN_IN_DW*sizeof(u4Byte)) // 24, unit: in u1byte. Added by Annie, 2006-05-25. -+ -+#define CAM_CONFIG_USEDK 1 -+#define CAM_CONFIG_NO_USEDK 0 -+ -+#define CAM_WRITE 0x00010000 -+#define CAM_READ 0x00000000 -+#define CAM_POLLINIG 0x80000000 -+ -+//================================================================= -+//================================================================= -+ -+#define EPROM_93c46 0 -+#define EPROM_93c56 1 -+ -+#define DEFAULT_FRAG_THRESHOLD 2342U -+#define MIN_FRAG_THRESHOLD 256U -+#define DEFAULT_BEACONINTERVAL 0x64U -+#define DEFAULT_BEACON_ESSID "Rtl8187" -+ -+#define DEFAULT_SSID "" -+#define DEFAULT_RETRY_RTS 7 -+#define DEFAULT_RETRY_DATA 7 -+#define PRISM_HDR_SIZE 64 -+ -+typedef enum _WIRELESS_MODE { -+ WIRELESS_MODE_UNKNOWN = 0x00, -+ WIRELESS_MODE_A = 0x01, -+ WIRELESS_MODE_B = 0x02, -+ WIRELESS_MODE_G = 0x04, -+ WIRELESS_MODE_AUTO = 0x08, -+} WIRELESS_MODE; -+ -+typedef enum _TR_SWITCH_STATE{ -+ TR_HW_CONTROLLED = 0, -+ TR_SW_TX = 1, -+}TR_SWITCH_STATE, *PTR_SWITCH_STATE; -+ -+ -+#define RTL_IOCTL_WPA_SUPPLICANT SIOCIWFIRSTPRIV+30 -+ -+typedef struct buffer -+{ -+ struct buffer *next; -+ u32 *buf; -+ -+} buffer; -+ -+typedef struct rtl_reg_debug{ -+ unsigned int cmd; -+ struct { -+ unsigned char type; -+ unsigned char addr; -+ unsigned char page; -+ unsigned char length; -+ } head; -+ unsigned char buf[0xff]; -+}rtl_reg_debug; -+typedef struct _CHANNEL_LIST{ -+ u8 Channel[MAX_CHANNEL_NUMBER + 1]; -+ u8 Len; -+}CHANNEL_LIST, *PCHANNEL_LIST; -+ -+#define MAX_LD_SLOT_NUM 10 -+#define DEFAULT_SLOT_NUM 2 -+#define KEEP_ALIVE_INTERVAL 20 // in seconds. -+#define CHECK_FOR_HANG_PERIOD 2 //be equal to watchdog check time -+#define DEFAULT_KEEP_ALIVE_LEVEL 1 -+ -+typedef struct _link_detect_t -+{ -+ u32 RxFrameNum[MAX_LD_SLOT_NUM]; // number of Rx Frame / CheckForHang_period to determine link status -+ u16 SlotNum; // number of CheckForHang period to determine link status, default is 2 -+ u16 SlotIndex; -+ -+ u32 NumTxOkInPeriod; //number of packet transmitted during CheckForHang -+ u32 NumRxOkInPeriod; //number of packet received during CheckForHang -+ -+ u8 IdleCount; // (KEEP_ALIVE_INTERVAL / CHECK_FOR_HANG_PERIOD) -+ u32 LastNumTxUnicast; -+ u32 LastNumRxUnicast; -+ -+ bool bBusyTraffic; //when it is set to 1, UI cann't scan at will. -+}link_detect_t, *plink_detect_t; -+ -+#if 0 -+ -+typedef struct tx_pendingbuf -+{ -+ struct ieee80211_txb *txb; -+ short ispending; -+ short descfrag; -+} tx_pendigbuf; -+ -+#endif -+ -+typedef struct Stats -+{ -+ unsigned long txrdu; -+// unsigned long rxrdu; -+ //unsigned long rxnolast; -+ //unsigned long rxnodata; -+// unsigned long rxreset; -+// unsigned long rxwrkaround; -+// unsigned long rxnopointer; -+ unsigned long rxok; -+ unsigned long rxurberr; -+ unsigned long rxstaterr; -+ unsigned long txnperr; -+ unsigned long txnpdrop; -+ unsigned long txresumed; -+// unsigned long rxerr; -+// unsigned long rxoverflow; -+// unsigned long rxint; -+ unsigned long txnpokint; -+// unsigned long txhpokint; -+// unsigned long txhperr; -+// unsigned long ints; -+// unsigned long shints; -+ unsigned long txoverflow; -+// unsigned long rxdmafail; -+// unsigned long txbeacon; -+// unsigned long txbeaconerr; -+ unsigned long txlpokint; -+ unsigned long txlpdrop; -+ unsigned long txlperr; -+ unsigned long txbeokint; -+ unsigned long txbedrop; -+ unsigned long txbeerr; -+ unsigned long txbkokint; -+ unsigned long txbkdrop; -+ unsigned long txbkerr; -+ unsigned long txviokint; -+ unsigned long txvidrop; -+ unsigned long txvierr; -+ unsigned long txvookint; -+ unsigned long txvodrop; -+ unsigned long txvoerr; -+ unsigned long txbeaconokint; -+ unsigned long txbeacondrop; -+ unsigned long txbeaconerr; -+ unsigned long txmanageokint; -+ unsigned long txmanagedrop; -+ unsigned long txmanageerr; -+ unsigned long txdatapkt; -+} Stats; -+ -+typedef struct ChnlAccessSetting { -+ u16 SIFS_Timer; -+ u16 DIFS_Timer; -+ u16 SlotTimeTimer; -+ u16 EIFS_Timer; -+ u16 CWminIndex; -+ u16 CWmaxIndex; -+}*PCHANNEL_ACCESS_SETTING,CHANNEL_ACCESS_SETTING; -+ -+ -+typedef enum _RT_RF_POWER_STATE -+{ -+ eRfOn, -+ eRfSleep, -+ eRfOff -+}RT_RF_POWER_STATE; -+typedef enum _RT_PS_MODE -+{ -+ eActive, // Active/Continuous access. -+ eMaxPs, // Max power save mode. -+ eFastPs // Fast power save mode. -+}RT_PS_MODE; -+// -+// Three wire mode. -+// -+#define IC_DEFAULT_THREE_WIRE 0 -+#define SW_THREE_WIRE 1 -+//RTL818xB -+#define SW_THREE_WIRE_BY_8051 2 -+#define HW_THREE_WIRE 3 -+#define HW_THREE_WIRE_BY_8051 4 -+//lzm add for write time out test -+typedef struct write_read_register -+{ -+ u32 address; -+ u32 content; -+ u32 flag; -+} write_read_register; -+//lzm add for write time out test -+typedef struct r8180_priv -+{ -+//lzm add for write time out test -+ struct write_read_register write_read_registers[200]; -+ u8 write_read_register_index; -+//lzm add for write time out test -+ -+ struct usb_device *udev; -+ short epromtype; -+ int irq; -+ struct ieee80211_device *ieee80211; -+ -+ short card_8187; /* O: rtl8180, 1:rtl8185 V B/C, 2:rtl8185 V D */ -+ short card_8187_Bversion; /* if TCR reports card V B/C this discriminates */ -+ short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */ -+ short enable_gpio0; -+ enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type; -+ short hw_plcp_len; -+ short plcp_preamble_mode; -+ -+ spinlock_t irq_lock; -+// spinlock_t irq_th_lock; -+ spinlock_t tx_lock; -+//by amy for ps -+ spinlock_t rf_ps_lock; -+//by amy for ps -+ -+ u16 irq_mask; -+// short irq_enabled; -+ struct net_device *dev; -+ short chan; -+ short sens; -+ short max_sens; -+ u8 chtxpwr[15]; //channels from 1 to 14, 0 not used -+ u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used -+ u8 cck_txpwr_base; -+ u8 ofdm_txpwr_base; -+ u8 challow[15]; //channels from 1 to 14, 0 not used -+ short up; -+ short crcmon; //if 1 allow bad crc frame reception in monitor mode -+// short prism_hdr; -+ -+// struct timer_list scan_timer; -+ /*short scanpending; -+ short stopscan;*/ -+// spinlock_t scan_lock; -+// u8 active_probe; -+ //u8 active_scan_num; -+ struct semaphore wx_sem; -+ struct semaphore set_chan_sem; -+// short hw_wep; -+ -+// short digphy; -+// short antb; -+// short diversity; -+// u8 cs_treshold; -+// short rcr_csense; -+ short rf_chip; -+// u32 key0[4]; -+ short (*rf_set_sens)(struct net_device *dev,short sens); -+ void (*rf_set_chan)(struct net_device *dev,short ch); -+ void (*rf_close)(struct net_device *dev); -+ void (*rf_init)(struct net_device *dev); -+ //short rate; -+ short promisc; -+ /*stats*/ -+ struct Stats stats; -+ struct _link_detect_t link_detect; //added on 1016.2008 -+ struct iw_statistics wstats; -+ struct proc_dir_entry *dir_dev; -+ -+ /*RX stuff*/ -+// u32 *rxring; -+// u32 *rxringtail; -+// dma_addr_t rxringdma; -+ struct urb **rx_urb; -+#ifdef THOMAS_BEACON -+ unsigned long *oldaddr; //lzm for 64bit CPU crash -+#endif -+ -+#ifdef THOMAS_TASKLET -+ atomic_t irt_counter;//count for irq_rx_tasklet -+#endif -+#ifdef JACKSON_NEW_RX -+ struct sk_buff **pp_rxskb; -+ int rx_inx; -+#endif -+ -+ short tx_urb_index; -+ -+ //struct buffer *rxbuffer; -+ //struct buffer *rxbufferhead; -+ //int rxringcount; -+ //u16 rxbuffersize; -+ -+ //struct sk_buff *rx_skb; -+ -+ //short rx_skb_complete; -+ -+ //u32 rx_prevlen; -+ //atomic_t tx_lp_pending; -+ //atomic_t tx_np_pending; -+ atomic_t tx_pending[0x10];//UART_PRIORITY+1 -+ -+#if 0 -+ /*TX stuff*/ -+ u32 *txlpring; -+ u32 *txhpring; -+ u32 *txnpring; -+ dma_addr_t txlpringdma; -+ dma_addr_t txhpringdma; -+ dma_addr_t txnpringdma; -+ u32 *txlpringtail; -+ u32 *txhpringtail; -+ u32 *txnpringtail; -+ u32 *txlpringhead; -+ u32 *txhpringhead; -+ u32 *txnpringhead; -+ struct buffer *txlpbufs; -+ struct buffer *txhpbufs; -+ struct buffer *txnpbufs; -+ struct buffer *txlpbufstail; -+ struct buffer *txhpbufstail; -+ struct buffer *txnpbufstail; -+ int txringcount; -+ int txbuffsize; -+ -+ //struct tx_pendingbuf txnp_pending; -+ struct tasklet_struct irq_tx_tasklet; -+#endif -+ struct tasklet_struct irq_rx_tasklet; -+ struct urb *rxurb_task; -+// u8 dma_poll_mask; -+ //short tx_suspend; -+ -+ /* adhoc/master mode stuff */ -+#if 0 -+ u32 *txbeacontail; -+ dma_addr_t txbeaconringdma; -+ u32 *txbeaconring; -+ int txbeaconcount; -+#endif -+// struct ieee_tx_beacon *beacon_buf; -+ //char *master_essid; -+// dma_addr_t beacondmabuf; -+ //u16 master_beaconinterval; -+// u32 master_beaconsize; -+ //u16 beacon_interval; -+ -+ //2 Tx Related variables -+ u16 ShortRetryLimit; -+ u16 LongRetryLimit; -+ u32 TransmitConfig; -+ u8 RegCWinMin; // For turbo mode CW adaptive. Added by Annie, 2005-10-27. -+ -+ //2 Rx Related variables -+ u16 EarlyRxThreshold; -+ u32 ReceiveConfig; -+ u8 AcmControl; -+ -+ u8 RFProgType; -+ -+ u8 retry_data; -+ u8 retry_rts; -+ u16 rts; -+ -+//by amy -+ long LastSignalStrengthInPercent; -+ long SignalStrength; -+ long SignalQuality; -+ u8 antenna_flag; -+ bool flag_beacon; -+//by amy -+//by amy for rate adaptive -+ struct timer_list rateadapter_timer; -+ u16 LastRetryCnt; -+ u16 LastRetryRate; -+ unsigned long LastTxokCnt; -+ unsigned long LastRxokCnt; -+ u16 CurrRetryCnt; -+ long RecvSignalPower; -+ unsigned long LastTxOKBytes; -+ u8 LastFailTxRate; -+ long LastFailTxRateSS; -+ u8 FailTxRateCount; -+ u32 LastTxThroughput; -+ unsigned long txokbytestotal; -+ //for up rate -+ unsigned short bTryuping; -+ u8 CurrTxRate; //the rate before up -+ u16 CurrRetryRate; -+ u16 TryupingCount; -+ u8 TryDownCountLowData; -+ u8 TryupingCountNoData; -+ -+ u8 CurrentOperaRate; -+//by amy for rate adaptive -+//by amy for power save -+ struct timer_list watch_dog_timer; -+ bool bInactivePs; -+ bool bSwRfProcessing; -+ RT_RF_POWER_STATE eInactivePowerState; -+ RT_RF_POWER_STATE eRFPowerState; -+ u32 RfOffReason; -+ bool RFChangeInProgress; -+ bool bInHctTest; -+ bool SetRFPowerStateInProgress; -+ //u8 RFProgType; -+ bool bLeisurePs; -+ RT_PS_MODE dot11PowerSaveMode; -+ u32 NumRxOkInPeriod; -+ u32 NumTxOkInPeriod; -+ u8 RegThreeWireMode; -+ bool ps_mode; -+//by amy for power save -+//by amy for DIG -+ bool bDigMechanism; -+ bool bCCKThMechanism; -+ u8 InitialGain; -+ u8 StageCCKTh; -+ u8 RegBModeGainStage; -+ u8 RegDigOfdmFaUpTh; //added by david, 2008.3.6 -+ u8 DIG_NumberFallbackVote; -+ u8 DIG_NumberUpgradeVote; -+ u16 CCKUpperTh; -+ u16 CCKLowerTh; -+ u32 FalseAlarmRegValue; //added by david, 2008.3.6 -+//by amy for DIG -+//{ added by david for high power, 2008.3.11 -+ int UndecoratedSmoothedSS; -+ bool bRegHighPowerMechanism; -+ bool bToUpdateTxPwr; -+ u8 Z2HiPwrUpperTh; -+ u8 Z2HiPwrLowerTh; -+ u8 Z2RSSIHiPwrUpperTh; -+ u8 Z2RSSIHiPwrLowerTh; -+ // Current CCK RSSI value to determine CCK high power, asked by SD3 DZ, by Bruce, 2007-04-12. -+ u8 CurCCKRSSI; -+ bool bCurCCKPkt; -+ u32 wMacRegRfPinsOutput; -+ u32 wMacRegRfPinsSelect; -+ TR_SWITCH_STATE TrSwitchState; -+//} -+//{added by david for radio on/off -+ u8 radion; -+//} -+ struct ChnlAccessSetting ChannelAccessSetting; -+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) -+ struct work_struct reset_wq; -+#else -+ struct tq_struct reset_wq; -+#endif -+ -+#ifdef _RTL8187_EXT_PATCH_ -+ struct mshclass *mshobj; -+#endif -+ -+#ifdef LED -+ /* add for led controll */ -+ u8 EEPROMCustomerID; -+ RT_CID_TYPE CustomerID; -+ LED_8187 Gpio0Led; -+ LED_8187 SwLed0; -+ LED_8187 SwLed1; -+ u8 bEnableLedCtrl; -+ LED_STRATEGY_8187 LedStrategy; -+ u8 PsrValue; -+ struct work_struct Gpio0LedWorkItem; -+ struct work_struct SwLed0WorkItem; -+ struct work_struct SwLed1WorkItem; -+#endif -+ u8 driver_upping; -+#ifdef CPU_64BIT -+ u8 *usb_buf; -+ struct dma_pool *usb_pool; -+#endif -+ -+ -+#ifdef SW_ANTE_DIVERSITY -+ -+//#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) -+// struct delayed_work SwAntennaWorkItem; -+//#else -+// struct work_struct SwAntennaWorkItem; -+//#endif -+ -+ bool bAntennaDiversityTimerIssued; -+ short antb; -+ short diversity; -+ bool AutoloadFailFlag; -+ u16 EEPROMVersion; -+ u8 EEPROMAntennaDiversity; -+ u16 EEPROMCSThreshold; -+ u8 EEPROMDefaultAntennaB; -+ u8 EEPROMDigitalPhy; -+ u32 EEPROMCSMethod; -+ u8 EEPROMGEPRFOffState; -+ // For HW antenna diversity, added by Roger, 2008.01.30. -+ u32 AdMainAntennaRxOkCnt; // Main antenna Rx OK count. -+ u32 AdAuxAntennaRxOkCnt; // Aux antenna Rx OK count. -+ bool bHWAdSwitched; // TRUE if we has switched default antenna by HW evaluation. -+ u8 EEPROMSwAntennaDiversity; -+ bool EEPROMDefaultAntenna1; -+ u8 RegSwAntennaDiversityMechanism;// 0:default from EEPROM, 1: disable, 2: enable. -+ bool bSwAntennaDiverity; -+ u8 RegDefaultAntenna;// 0: default from EEPROM, 1: main, 2: aux. Added by Roger, 2007.11.05. -+ bool bDefaultAntenna1; -+ //long SignalStrength; -+ long Stats_SignalStrength; -+ //long LastSignalStrengthInPercent; // In percentange, used for smoothing, e.g. Moving Average. -+ //long SignalQuality; // in 0-100 index. -+ long Stats_SignalQuality; -+ //long RecvSignalPower; // in dBm. -+ long Stats_RecvSignalPower; -+ u8 LastRxPktAntenna; // +by amy 080312 Antenn which received the lasted packet. 0: Aux, 1:Main. Added by Roger, 2008.01.25. -+ u32 AdRxOkCnt; -+ long AdRxSignalStrength; // Rx signal strength for Antenna Diversity, which had been smoothing, its valid range is [0,100]. -+ u8 CurrAntennaIndex; // Index to current Antenna (both Tx and Rx). -+ u8 AdTickCount; // Times of SwAntennaDiversityTimer happened. -+ u8 AdCheckPeriod; // # of period SwAntennaDiversityTimer to check Rx signal strength for SW Antenna Diversity. -+ u8 AdMinCheckPeriod; // Min value of AdCheckPeriod. -+ u8 AdMaxCheckPeriod; // Max value of AdCheckPeriod. -+ long AdRxSsThreshold; // Signal strength threshold to switch antenna. -+ long AdMaxRxSsThreshold; // Max value of AdRxSsThreshold. -+ bool bAdSwitchedChecking; // TRUE if we shall shall check Rx signal strength for last time switching antenna. -+ long AdRxSsBeforeSwitched; // Rx signal strength before we swithed antenna. -+ struct timer_list SwAntennaDiversityTimer; -+#endif -+ u8 commit; -+ -+//#ifdef ENABLE_DOT11D -+ u8 channel_plan; -+//#endif -+ u8 EEPROMSelectNewGPIO; -+}r8180_priv; -+ -+// for rtl8187 -+// now mirging to rtl8187B -+/* -+typedef enum{ -+ LOW_PRIORITY = 0x02, -+ NORM_PRIORITY -+ } priority_t; -+*/ -+//for rtl8187B -+typedef enum{ -+ BULK_PRIORITY = 0x01, -+ //RSVD0, -+ //RSVD1, -+ LOW_PRIORITY, -+ NORM_PRIORITY, -+ VO_PRIORITY, -+ VI_PRIORITY, //0x05 -+ BE_PRIORITY, -+ BK_PRIORITY, -+ RSVD2, -+ RSVD3, -+ BEACON_PRIORITY, //0x0A -+ HIGH_PRIORITY, -+ MANAGE_PRIORITY, -+ RSVD4, -+ RSVD5, -+ UART_PRIORITY //0x0F -+} priority_t; -+ -+typedef enum{ -+ NIC_8187 = 1, -+ NIC_8187B -+ } nic_t; -+ -+ -+typedef u32 AC_CODING; -+#define AC0_BE 0 // ACI: 0x00 // Best Effort -+#define AC1_BK 1 // ACI: 0x01 // Background -+#define AC2_VI 2 // ACI: 0x10 // Video -+#define AC3_VO 3 // ACI: 0x11 // Voice -+#define AC_MAX 4 // Max: define total number; Should not to be used as a real enum. -+ -+// -+// ECWmin/ECWmax field. -+// Ref: WMM spec 2.2.2: WME Parameter Element, p.13. -+// -+typedef union _ECW{ -+ u8 charData; -+ struct -+ { -+ u8 ECWmin:4; -+ u8 ECWmax:4; -+ }f; // Field -+}ECW, *PECW; -+ -+// -+// ACI/AIFSN Field. -+// Ref: WMM spec 2.2.2: WME Parameter Element, p.12. -+// -+typedef union _ACI_AIFSN{ -+ u8 charData; -+ -+ struct -+ { -+ u8 AIFSN:4; -+ u8 ACM:1; -+ u8 ACI:2; -+ u8 Reserved:1; -+ }f; // Field -+}ACI_AIFSN, *PACI_AIFSN; -+ -+// -+// AC Parameters Record Format. -+// Ref: WMM spec 2.2.2: WME Parameter Element, p.12. -+// -+typedef union _AC_PARAM{ -+ u32 longData; -+ u8 charData[4]; -+ -+ struct -+ { -+ ACI_AIFSN AciAifsn; -+ ECW Ecw; -+ u16 TXOPLimit; -+ }f; // Field -+}AC_PARAM, *PAC_PARAM; -+ -+#ifdef JOHN_HWSEC -+struct ssid_thread { -+ struct net_device *dev; -+ u8 name[IW_ESSID_MAX_SIZE + 1]; -+}; -+#endif -+ -+short rtl8180_tx(struct net_device *dev,u32* skbuf, int len,priority_t priority,short morefrag,short rate); -+ -+#ifdef JOHN_TKIP -+u32 read_cam(struct net_device *dev, u8 addr); -+void write_cam(struct net_device *dev, u8 addr, u32 data); -+#endif -+u8 read_nic_byte(struct net_device *dev, int x); -+u8 read_nic_byte_E(struct net_device *dev, int x); -+u32 read_nic_dword(struct net_device *dev, int x); -+u16 read_nic_word(struct net_device *dev, int x) ; -+void write_nic_byte(struct net_device *dev, int x,u8 y); -+void write_nic_byte_E(struct net_device *dev, int x,u8 y); -+void write_nic_word(struct net_device *dev, int x,u16 y); -+void write_nic_dword(struct net_device *dev, int x,u32 y); -+void force_pci_posting(struct net_device *dev); -+ -+void rtl8180_rtx_disable(struct net_device *); -+void rtl8180_rx_enable(struct net_device *); -+void rtl8180_tx_enable(struct net_device *); -+ -+void rtl8180_disassociate(struct net_device *dev); -+//void fix_rx_fifo(struct net_device *dev); -+void rtl8185_set_rf_pins_enable(struct net_device *dev,u32 a); -+ -+void rtl8180_set_anaparam(struct net_device *dev,u32 a); -+void rtl8185_set_anaparam2(struct net_device *dev,u32 a); -+void rtl8180_update_msr(struct net_device *dev); -+int rtl8180_down(struct net_device *dev); -+int rtl8180_up(struct net_device *dev); -+void rtl8180_commit(struct net_device *dev); -+void rtl8180_set_chan(struct net_device *dev,short ch); -+void write_phy(struct net_device *dev, u8 adr, u8 data); -+void write_phy_cck(struct net_device *dev, u8 adr, u32 data); -+void write_phy_ofdm(struct net_device *dev, u8 adr, u32 data); -+void rtl8185_tx_antenna(struct net_device *dev, u8 ant); -+void rtl8187_set_rxconf(struct net_device *dev); -+bool MgntActSet_RF_State(struct net_device *dev,RT_RF_POWER_STATE StateToSet,u32 ChangeSource); -+void IPSEnter(struct net_device *dev); -+void IPSLeave(struct net_device *dev); -+int r8187b_rfkill_init(struct net_device *dev); -+void r8187b_rfkill_exit(void); -+int r8187b_wifi_report_state(r8180_priv *priv); -+void r8187b_wifi_change_rfkill_state(struct net_device *dev, RT_RF_POWER_STATE eRfPowerStateToSet); -+bool SetRFPowerState(struct net_device *dev,RT_RF_POWER_STATE eRFPowerState); -+void rtl8180_patch_ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee); -+#ifdef _RTL8187_EXT_PATCH_ -+extern int r8180_wx_set_channel(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra); -+#endif -+#ifdef JOHN_TKIP -+void EnableHWSecurityConfig8187(struct net_device *dev); -+void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, u8 *MacAddr, u8 DefaultKey, u32 *KeyContent ); -+ -+#endif -+ -+#endif -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8187_led.c linux-2.6.35/drivers/net/wireless/rtl8187b/r8187_led.c ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8187_led.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/r8187_led.c 2010-08-05 21:12:35.543617952 +0200 -@@ -0,0 +1,1629 @@ -+/*++ -+Copyright (c) Realtek Semiconductor Corp. All rights reserved. -+ -+Module Name: -+ r8187_led.c -+ -+Abstract: -+ RTL8187 LED control functions -+ -+Major Change History: -+ When Who What -+ ---------- --------------- ------------------------------- -+ 2006-09-07 Xiong Created -+ -+Notes: -+ -+--*/ -+ -+/*--------------------------Include File------------------------------------*/ -+#include "ieee80211/ieee80211.h" -+#include "r8180_hw.h" -+#include "r8187.h" -+#include "r8180_93cx6.h" -+#include "r8187_led.h" -+ -+/** -+* -+* Initialization function for Sw Leds controll. -+* -+* \param dev The net device for this driver. -+* \return void. -+* -+* Note: -+* -+*/ -+ -+void -+InitSwLeds( -+ struct net_device *dev -+ ) -+{ -+ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ u16 usValue; -+// printk("========>%s()\n", __FUNCTION__); -+ -+// priv->CustomerID = RT_CID_87B_DELL; //by lizhaoming for DELL 2008.6.3 -+ priv->CustomerID = RT_CID_DEFAULT; //just set to default now -+ priv->bEnableLedCtrl = 1; -+ priv->PsrValue = read_nic_byte(dev, PSR); -+ usValue = eprom_read(dev, EEPROM_SW_REVD_OFFSET >> 1); -+ priv->EEPROMCustomerID = (u8)( usValue & EEPROM_CID_MASK ); -+ DMESG("EEPROM Customer ID: %02X", priv->EEPROMCustomerID); -+ -+ if(priv->CustomerID == RT_CID_DEFAULT) -+ { // If we have not yet change priv->CustomerID in register, -+ // we initialzie it from that of EEPROM with proper translation, 2006.07.03, by rcnjko. -+ switch(priv->EEPROMCustomerID) -+ { -+ case EEPROM_CID_RSVD0: -+ case EEPROM_CID_RSVD1: -+ priv->CustomerID = RT_CID_DEFAULT; -+ break; -+ -+ case EEPROM_CID_ALPHA0: -+ priv->CustomerID = RT_CID_8187_ALPHA0; -+ break; -+ -+ case EEPROM_CID_SERCOMM_PS: -+ priv->CustomerID = RT_CID_8187_SERCOMM_PS; -+ break; -+ -+ case EEPROM_CID_HW_LED: -+ priv->CustomerID = RT_CID_8187_HW_LED; -+ break; -+ -+ case EEPROM_CID_QMI: -+ priv->CustomerID = RT_CID_87B_QMI; -+ break; -+ -+ case EEPROM_CID_DELL: -+ priv->CustomerID = RT_CID_87B_DELL; -+ break; -+ -+ default: -+ // Invalid value, so, we use default value instead. -+ priv->CustomerID = RT_CID_DEFAULT; -+ break; -+ } -+ } -+ switch(priv->CustomerID) -+ { -+ case RT_CID_DEFAULT: -+ priv->LedStrategy = SW_LED_MODE0; -+ break; -+ -+ case RT_CID_8187_ALPHA0: -+ priv->LedStrategy = SW_LED_MODE1; -+ break; -+ -+ case RT_CID_8187_SERCOMM_PS: -+ priv->LedStrategy = SW_LED_MODE3; -+ break; -+ -+ case RT_CID_87B_QMI: -+ priv->LedStrategy = SW_LED_MODE4; -+ break; -+ -+ case RT_CID_87B_DELL: -+ priv->LedStrategy = SW_LED_MODE5; -+ break; -+ -+ case RT_CID_8187_HW_LED: -+ priv->LedStrategy = HW_LED; -+ break; -+ -+ default: -+ priv->LedStrategy = SW_LED_MODE0; -+ break; -+ } -+ -+ InitLed8187(dev, -+ &(priv->Gpio0Led), -+ LED_PIN_GPIO0, -+ Gpio0LedBlinkTimerCallback); -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -+ INIT_WORK(&priv->Gpio0LedWorkItem, -+ (void(*)(void*))Gpio0LedWorkItemCallback, dev); -+ -+ InitLed8187(dev, -+ &(priv->SwLed0), -+ LED_PIN_LED0, -+ SwLed0BlinkTimerCallback); -+ INIT_WORK(&priv->SwLed0WorkItem, -+ (void(*)(void*))SwLed0WorkItemCallback, dev); -+ -+ InitLed8187(dev, -+ &(priv->SwLed1), -+ LED_PIN_LED1, -+ SwLed1BlinkTimerCallback); -+ INIT_WORK(&priv->SwLed1WorkItem, -+ (void(*)(void*))SwLed1WorkItemCallback, dev); -+#else -+INIT_WORK(&priv->Gpio0LedWorkItem, -+ Gpio0LedWorkItemCallback); -+ -+ InitLed8187(dev, -+ &(priv->SwLed0), -+ LED_PIN_LED0, -+ SwLed0BlinkTimerCallback); -+ INIT_WORK(&priv->SwLed0WorkItem, -+ SwLed0WorkItemCallback); -+ -+ InitLed8187(dev, -+ &(priv->SwLed1), -+ LED_PIN_LED1, -+ SwLed1BlinkTimerCallback); -+ INIT_WORK(&priv->SwLed1WorkItem, -+ SwLed1WorkItemCallback); -+#endif -+} -+ -+void -+DeInitSwLeds( -+ struct net_device *dev -+ ) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+// printk("=========>%s In\n", __FUNCTION__); -+ DeInitLed8187(dev, &(priv->Gpio0Led)); -+ DeInitLed8187(dev, &(priv->SwLed0)); -+ DeInitLed8187(dev, &(priv->SwLed1)); -+} -+ -+void -+InitLed8187( -+ struct net_device *dev, -+ PLED_8187 pLed, -+ LED_PIN_8187 LedPin, -+ void * BlinkCallBackFunc) -+{ -+// printk("=========>%s In\n", __FUNCTION__); -+ pLed->LedPin = LedPin; -+ -+ pLed->bLedOn = 0; -+ pLed->CurrLedState = LED_OFF; -+ -+ pLed->bLedBlinkInProgress = 0; -+ pLed->BlinkTimes = 0; -+ pLed->BlinkingLedState = LED_OFF; -+ -+ init_timer(&(pLed->BlinkTimer)); -+ pLed->BlinkTimer.data = (unsigned long)dev; -+ pLed->BlinkTimer.function = BlinkCallBackFunc; -+ //PlatformInitializeTimer(dev, &(pLed->BlinkTimer), BlinkCallBackFunc); -+} -+ -+void -+DeInitLed8187( -+ struct net_device *dev, -+ PLED_8187 pLed) -+{ -+ //printk("=========>%s In\n", __FUNCTION__); -+ //PlatformCancelTimer(dev, &(pLed->BlinkTimer)); -+ del_timer_sync(&(pLed->BlinkTimer)); -+ // We should reset bLedBlinkInProgress if we cancel the LedControlTimer, 2005.03.10, by rcnjko. -+ pLed->bLedBlinkInProgress = 0; -+} -+ -+void -+LedControl8187( -+ struct net_device *dev, -+ LED_CTL_MODE LedAction -+) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+// printk("=========>%s In\n", __FUNCTION__); -+ if( priv->bEnableLedCtrl == 0) -+ return; -+ -+ -+ if( priv->eRFPowerState != eRfOn && -+ (LedAction == LED_CTL_TX || LedAction == LED_CTL_RX || -+ LedAction == LED_CTL_SITE_SURVEY || -+ LedAction == LED_CTL_LINK || -+ LedAction == LED_CTL_NO_LINK) ) -+ { -+ return; -+ } -+ -+ -+ switch(priv->LedStrategy) -+ { -+ case SW_LED_MODE0: -+ SwLedControlMode0(dev, LedAction); -+ break; -+ -+ case SW_LED_MODE1: -+ SwLedControlMode1(dev, LedAction); -+ break; -+ -+ case SW_LED_MODE2: -+ SwLedControlMode2(dev, LedAction); -+ break; -+ -+ case SW_LED_MODE3: -+ SwLedControlMode3(dev, LedAction); -+ break; -+ case SW_LED_MODE4: -+ SwLedControlMode4(dev, LedAction); -+ break; -+ -+ case SW_LED_MODE5: -+ SwLedControlMode5(dev, LedAction); -+ break; -+ -+ default: -+ break; -+ } -+} -+ -+ -+// -+// Description: -+// Implement each led action for SW_LED_MODE0. -+// This is default strategy. -+// -+void -+SwLedControlMode0( -+ struct net_device *dev, -+ LED_CTL_MODE LedAction -+) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ PLED_8187 pLed = &(priv->Gpio0Led); -+ -+// printk("===+++++++++++++++======>%s In\n", __FUNCTION__); -+ // Decide led state -+ switch(LedAction) -+ { -+ case LED_CTL_TX: -+ case LED_CTL_RX: -+ if( pLed->bLedBlinkInProgress == 0 ) -+ { -+ pLed->CurrLedState = LED_BLINK_NORMAL; -+ pLed->BlinkTimes = 2; -+ // printk("===========>LED_CTL_TX/RX \n"); -+ } -+ else -+ { -+ return; -+ } -+ break; -+ -+ case LED_CTL_SITE_SURVEY: -+ if( pLed->bLedBlinkInProgress == 0 ) -+ { -+ pLed->CurrLedState = LED_BLINK_SLOWLY; -+ // pLed->BlinkTimes = 10; -+ //printk("===========>LED_CTL_SURVEY \n"); -+ } -+ else -+ { -+ return; -+ } -+ break; -+ -+ case LED_CTL_LINK: -+ // printk("===========>associate commplite LED_CTL_LINK\n"); -+ pLed->CurrLedState = LED_ON; -+ break; -+ -+ case LED_CTL_NO_LINK: -+ pLed->CurrLedState = LED_OFF; -+ break; -+ -+ case LED_CTL_POWER_ON: -+ // printk("===========>LED_CTL_POWER_ON\n"); -+ pLed->CurrLedState = LED_POWER_ON_BLINK; -+ break; -+ -+ case LED_CTL_POWER_OFF: -+ pLed->CurrLedState = LED_OFF; -+ break; -+ -+ default: -+ return; -+ break; -+ } -+ -+ // Change led state. -+ switch(pLed->CurrLedState) -+ { -+ case LED_ON: -+ if( pLed->bLedBlinkInProgress == 0 ) -+ { -+ SwLedOn(dev, pLed); -+ } -+ break; -+ -+ case LED_OFF://modified by lizhaoming 2008.6.23 -+ // if( pLed->bLedBlinkInProgress == 0 ) -+ // { -+ // SwLedOff(dev, pLed); -+ // } -+ -+ if(pLed->bLedBlinkInProgress )/////////lizhaoming -+ { -+ del_timer_sync(&(pLed->BlinkTimer)); -+ pLed->bLedBlinkInProgress = FALSE; -+ } -+ SwLedOff(dev, pLed); -+ break; -+ -+ case LED_BLINK_NORMAL: -+ if( pLed->bLedBlinkInProgress == 0 ) -+ { -+ pLed->bLedBlinkInProgress = 1; -+ if( pLed->bLedOn ) -+ pLed->BlinkingLedState = LED_OFF; -+ else -+ pLed->BlinkingLedState = LED_ON; -+ -+ //pLed->BlinkTimer.expires = jiffies + LED_BLINK_NORMAL_INTERVAL; -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_BLINK_NORMAL_INTERVAL)); -+ //PlatformSetTimer(dev, &(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); -+ } -+ break; -+ -+ case LED_BLINK_SLOWLY: -+ if( pLed->bLedBlinkInProgress == 0 ) -+ { -+ //printk("=======>%s SLOWLY\n", __func__); -+ pLed->bLedBlinkInProgress = 1; -+ // if( pLed->bLedOn ) -+ pLed->BlinkingLedState = LED_OFF;//for LED_SHIN is LED on -+ // else -+ // pLed->BlinkingLedState = LED_ON; -+ -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_BLINK_SLOWLY_INTERVAL)); -+ } -+ break; -+ -+ case LED_POWER_ON_BLINK: -+ SwLedOn(dev, pLed); -+#ifdef LED_SHIN -+ mdelay(100); -+ SwLedOff(dev, pLed); -+#endif -+ break; -+ -+ default: -+ break; -+ } -+} -+ -+// -+// Description: -+// Implement each led action for SW_LED_MODE1. -+// For example, this is applied by ALPHA. -+// -+void -+SwLedControlMode1( -+ struct net_device *dev, -+ LED_CTL_MODE LedAction -+) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ PLED_8187 pLed0 = &(priv->SwLed0); -+ PLED_8187 pLed1 = &(priv->SwLed1); -+// printk("=====++++++++++++++++++++++====>%s In\n", __FUNCTION__); -+ -+ switch(LedAction) -+ { -+ case LED_CTL_TX: -+ if( pLed0->bLedBlinkInProgress == 0 ) -+ { -+ pLed0->CurrLedState = LED_BLINK_NORMAL; -+ pLed0->BlinkTimes = 2; -+ pLed0->bLedBlinkInProgress = 1; -+ if( pLed0->bLedOn ) -+ pLed0->BlinkingLedState = LED_OFF; -+ else -+ pLed0->BlinkingLedState = LED_ON; -+ -+ //pLed0->BlinkTimer.expires = jiffies + LED_BLINK_NORMAL_INTERVAL; -+ //add_timer(&(pLed0->BlinkTimer)); -+ mod_timer(&pLed0->BlinkTimer, jiffies + MSECS(LED_BLINK_NORMAL_INTERVAL)); -+ //PlatformSetTimer(dev, &(pLed0->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); -+ } -+ break; -+ -+ case LED_CTL_LINK: -+ pLed0->CurrLedState = LED_ON; -+ if( pLed0->bLedBlinkInProgress == 0 ) -+ { -+ SwLedOn(dev, pLed0); -+ } -+ break; -+ -+ case LED_CTL_NO_LINK: -+ pLed0->CurrLedState = LED_OFF; -+ if( pLed0->bLedBlinkInProgress == 0 ) -+ { -+ SwLedOff(dev, pLed0); -+ } -+ break; -+ -+ case LED_CTL_POWER_ON: -+ pLed0->CurrLedState = LED_OFF; -+ SwLedOff(dev, pLed0); -+ -+ pLed1->CurrLedState = LED_ON; -+ SwLedOn(dev, pLed1); -+ -+ break; -+ -+ case LED_CTL_POWER_OFF: -+ pLed0->CurrLedState = LED_OFF; -+ SwLedOff(dev, pLed0); -+ -+ pLed1->CurrLedState = LED_OFF; -+ SwLedOff(dev, pLed1); -+ break; -+ -+ case LED_CTL_SITE_SURVEY: -+ if( pLed0->bLedBlinkInProgress == 0 ) -+ { -+ pLed0->CurrLedState = LED_BLINK_SLOWLY;; -+ pLed0->BlinkTimes = 10; -+ pLed0->bLedBlinkInProgress = 1; -+ if( pLed0->bLedOn ) -+ pLed0->BlinkingLedState = LED_OFF; -+ else -+ pLed0->BlinkingLedState = LED_ON; -+ -+ //pLed0->BlinkTimer.expires = jiffies + LED_BLINK_SLOWLY_INTERVAL; -+ //add_timer(&(pLed0->BlinkTimer)); -+ mod_timer(&pLed0->BlinkTimer, jiffies + MSECS(LED_BLINK_SLOWLY_INTERVAL)); -+ //PlatformSetTimer(dev, &(pLed0->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL); -+ } -+ break; -+ -+ default: -+ break; -+ } -+} -+ -+// -+// Description: -+// Implement each led action for SW_LED_MODE2, -+// which is customized for AzWave 8187 minicard. -+// 2006.04.03, by rcnjko. -+// -+void -+SwLedControlMode2( -+ struct net_device *dev, -+ LED_CTL_MODE LedAction -+) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ PLED_8187 pLed = &(priv->Gpio0Led); -+ -+// printk("====+++++++++++++++++++++=====>%s In\n", __FUNCTION__); -+ // Decide led state -+ switch(LedAction) -+ { -+ case LED_CTL_TX: -+ case LED_CTL_RX: -+ if( pLed->bLedBlinkInProgress == 0 ) -+ { -+ pLed->bLedBlinkInProgress = 1; -+ -+ pLed->CurrLedState = LED_BLINK_NORMAL; -+ pLed->BlinkTimes = 2; -+ -+ if( pLed->bLedOn ) -+ pLed->BlinkingLedState = LED_OFF; -+ else -+ pLed->BlinkingLedState = LED_ON; -+ -+ //pLed->BlinkTimer.expires = jiffies + LED_BLINK_NORMAL_INTERVAL; -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_BLINK_NORMAL_INTERVAL)); -+ //PlatformSetTimer(dev, &(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); -+ } -+ break; -+ -+ case LED_CTL_SITE_SURVEY: -+ if( pLed->bLedBlinkInProgress == 0 ) -+ { -+ pLed->bLedBlinkInProgress = 1; -+ -+ //if( dev->MgntInfo.mAssoc || -+ // dev->MgntInfo.mIbss ) -+ //{ -+ pLed->CurrLedState = LED_SCAN_BLINK; -+ pLed->BlinkTimes = 4; -+ //} -+ //else -+ //{ -+ // pLed->CurrLedState = LED_NO_LINK_BLINK; -+ // pLed->BlinkTimes = 24; -+ //} -+ -+ if( pLed->bLedOn ) -+ { -+ pLed->BlinkingLedState = LED_OFF; -+ //pLed->BlinkTimer.expires = jiffies + LED_CM2_BLINK_ON_INTERVAL; -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_CM2_BLINK_ON_INTERVAL)); -+ //PlatformSetTimer(dev, &(pLed->BlinkTimer), LED_CM2_BLINK_ON_INTERVAL); -+ } -+ else -+ { -+ pLed->BlinkingLedState = LED_ON; -+ //pLed->BlinkTimer.expires = jiffies + LED_CM2_BLINK_OFF_INTERVAL; -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_CM2_BLINK_OFF_INTERVAL)); -+ //PlatformSetTimer(dev, &(pLed->BlinkTimer), LED_CM2_BLINK_OFF_INTERVAL); -+ } -+ } -+ else -+ { -+ if(pLed->CurrLedState != LED_NO_LINK_BLINK) -+ { -+ pLed->CurrLedState = LED_SCAN_BLINK; -+ /* -+ if( dev->MgntInfo.mAssoc || -+ dev->MgntInfo.mIbss ) -+ { -+ pLed->CurrLedState = LED_SCAN_BLINK; -+ } -+ else -+ { -+ pLed->CurrLedState = LED_NO_LINK_BLINK; -+ } -+ */ -+ } -+ } -+ break; -+ -+ case LED_CTL_NO_LINK: -+ if( pLed->bLedBlinkInProgress == 0 ) -+ { -+ pLed->bLedBlinkInProgress = 1; -+ -+ pLed->CurrLedState = LED_NO_LINK_BLINK; -+ pLed->BlinkTimes = 24; -+ -+ if( pLed->bLedOn ) -+ { -+ pLed->BlinkingLedState = LED_OFF; -+ //pLed->BlinkTimer.expires = jiffies + LED_CM2_BLINK_ON_INTERVAL; -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_CM2_BLINK_ON_INTERVAL)); -+ //PlatformSetTimer(dev, &(pLed->BlinkTimer), LED_CM2_BLINK_ON_INTERVAL); -+ } -+ else -+ { -+ pLed->BlinkingLedState = LED_ON; -+ //pLed->BlinkTimer.expires = jiffies + LED_CM2_BLINK_OFF_INTERVAL; -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_CM2_BLINK_OFF_INTERVAL)); -+ //PlatformSetTimer(dev, &(pLed->BlinkTimer), LED_CM2_BLINK_OFF_INTERVAL); -+ } -+ } -+ else -+ { -+ pLed->CurrLedState = LED_NO_LINK_BLINK; -+ } -+ break; -+ -+ case LED_CTL_LINK: -+ pLed->CurrLedState = LED_ON; -+ if( pLed->bLedBlinkInProgress == 0 ) -+ { -+ SwLedOn(dev, pLed); -+ } -+ break; -+ -+ case LED_CTL_POWER_OFF: -+ pLed->CurrLedState = LED_OFF; -+ if( pLed->bLedBlinkInProgress == 0 ) -+ { -+ SwLedOff(dev, pLed); -+ } -+ break; -+ -+ default: -+ break; -+ } -+} -+ -+ -+// -+// Description: -+// Implement each led action for SW_LED_MODE3, -+// which is customized for Sercomm Printer Server case. -+// 2006.04.21, by rcnjko. -+// -+void -+SwLedControlMode3( -+ struct net_device *dev, -+ LED_CTL_MODE LedAction -+) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ PLED_8187 pLed = &(priv->Gpio0Led); -+ -+// printk("=====+++++++++++++++++++====>%s In\n", __FUNCTION__); -+ // Decide led state -+ switch(LedAction) -+ { -+ case LED_CTL_TX: -+ case LED_CTL_RX: -+ if( pLed->bLedBlinkInProgress == 0 ) -+ { -+ pLed->bLedBlinkInProgress = 1; -+ -+ pLed->CurrLedState = LED_BLINK_CM3; -+ pLed->BlinkTimes = 2; -+ -+ if( pLed->bLedOn ) -+ pLed->BlinkingLedState = LED_OFF; -+ else -+ pLed->BlinkingLedState = LED_ON; -+ -+ //pLed->BlinkTimer.expires = jiffies + LED_CM3_BLINK_INTERVAL; -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_CM3_BLINK_INTERVAL)); -+ //PlatformSetTimer(dev, &(pLed->BlinkTimer), LED_CM3_BLINK_INTERVAL); -+ } -+ break; -+ -+ case LED_CTL_SITE_SURVEY: -+ if( pLed->bLedBlinkInProgress == 0 ) -+ { -+ pLed->bLedBlinkInProgress = 1; -+ -+ pLed->CurrLedState = LED_BLINK_CM3; -+ pLed->BlinkTimes = 10; -+ -+ if( pLed->bLedOn ) -+ pLed->BlinkingLedState = LED_OFF; -+ else -+ pLed->BlinkingLedState = LED_ON; -+ -+ //pLed->BlinkTimer.expires = jiffies + LED_CM3_BLINK_INTERVAL; -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_CM3_BLINK_INTERVAL)); -+ //PlatformSetTimer(dev, &(pLed->BlinkTimer), LED_CM3_BLINK_INTERVAL); -+ } -+ break; -+ -+ case LED_CTL_LINK: -+ pLed->CurrLedState = LED_ON; -+ if( pLed->bLedBlinkInProgress == 0 ) -+ { -+ SwLedOn(dev, pLed); -+ } -+ break; -+ -+ case LED_CTL_NO_LINK: -+ pLed->CurrLedState = LED_OFF; -+ if( pLed->bLedBlinkInProgress == 0 ) -+ { -+ SwLedOff(dev, pLed); -+ } -+ break; -+ -+ case LED_CTL_POWER_ON: -+ pLed->CurrLedState = LED_POWER_ON_BLINK; -+ SwLedOn(dev, pLed); -+ mdelay(100); -+ SwLedOff(dev, pLed); -+ break; -+ -+ case LED_CTL_POWER_OFF: -+ pLed->CurrLedState = LED_OFF; -+ if( pLed->bLedBlinkInProgress == 0 ) -+ { -+ SwLedOff(dev, pLed); -+ } -+ break; -+ -+ default: -+ break; -+ } -+} -+ -+// added by lizhaoming 2008.6.2 -+// -+// Description: -+// Implement each led action for SW_LED_MODE4, -+// which is customized for QMI 8187B minicard. -+// 2008.04.21, by chiyokolin. -+// -+void -+SwLedControlMode4( -+ struct net_device *dev, -+ LED_CTL_MODE LedAction -+ ) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ PLED_8187 pLed = &(priv->Gpio0Led); -+ -+ //printk("=====+++++++++++++++++++++====>%s In\n", __FUNCTION__); -+ // Decide led state -+ switch(LedAction) -+ { -+ case LED_CTL_TX: -+ case LED_CTL_RX: -+ //if( pLed->bLedBlinkInProgress == false && !priv->bScanInProgress)//????? -+ if( pLed->bLedBlinkInProgress == 0) -+ { -+ pLed->bLedBlinkInProgress = 1; -+ -+ pLed->CurrLedState = LED_BLINK_NORMAL; -+ pLed->BlinkTimes = 2; -+ -+ if( pLed->bLedOn ) -+ pLed->BlinkingLedState = LED_OFF; -+ else -+ pLed->BlinkingLedState = LED_ON; -+ -+ //pLed->BlinkTimer.expires = jiffies + LED_BLINK_NORMAL_INTERVAL; -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_BLINK_NORMAL_INTERVAL)); -+ //PlatformSetTimer(Adapter, &(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); -+ } -+ else -+ //printk("----->LED_CTL_RX/TX bLedBlinkInProgress\n"); -+ -+ break; -+ -+ case LED_CTL_SITE_SURVEY: -+ if( pLed->bLedBlinkInProgress == 0 ) -+ { -+ -+ pLed->bLedBlinkInProgress = 1; -+ //if( priv->MgntInfo.mAssoc || priv->MgntInfo.mIbss )//////////?????? -+ //{ -+ pLed->CurrLedState = LED_SCAN_BLINK; -+ pLed->BlinkTimes = 10; -+ -+ pLed->BlinkingLedState = LED_ON; -+ -+ //pLed->BlinkTimer.expires = jiffies + LED_BLINK_NORMAL_INTERVAL; -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_BLINK_NORMAL_INTERVAL)); -+ //PlatformSetTimer(Adapter, &(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); -+ //} -+ //else -+ //{ -+ // pLed->CurrLedState = LED_NO_LINK_BLINK; -+ // pLed->BlinkTimes = 24; -+ // -+ // if( pLed->bLedOn ) -+ // { -+ // pLed->BlinkingLedState = LED_OFF; -+ // -+ // pLed->BlinkTimer.expires = jiffies + LED_CM4_BLINK_ON_INTERVAL; -+ // add_timer(&(pLed->BlinkTimer)); -+ // //PlatformSetTimer(Adapter, &(pLed->BlinkTimer), LED_CM4_BLINK_ON_INTERVAL); -+ // } -+ // else -+ // { -+ // pLed->BlinkingLedState = LED_ON; -+ -+ // pLed->BlinkTimer.expires = jiffies + LED_CM4_BLINK_OFF_INTERVAL; -+ // add_timer(&(pLed->BlinkTimer)); -+ // //PlatformSetTimer(Adapter, &(pLed->BlinkTimer), LED_CM4_BLINK_OFF_INTERVAL); -+ // } -+ //} -+ } -+ else -+ { -+ if(pLed->CurrLedState != LED_NO_LINK_BLINK) -+ { -+ //if( priv->MgntInfo.mAssoc || priv->MgntInfo.mIbss )//??????????? -+ //{ -+ //} -+ //else -+ //{ -+ // pLed->CurrLedState = LED_NO_LINK_BLINK; -+ //} -+ } -+ -+ //printk("----->LED_CTL_SITE_SURVEY bLedBlinkInProgress\n"); -+ } -+ break; -+ -+ case LED_CTL_NO_LINK: -+ if( pLed->bLedBlinkInProgress == 0 ) -+ { -+ pLed->bLedBlinkInProgress = 1; -+ -+ pLed->CurrLedState = LED_NO_LINK_BLINK; -+ pLed->BlinkTimes = 24; -+ -+ if( pLed->bLedOn ) -+ { -+ pLed->BlinkingLedState = LED_OFF; -+ -+ //pLed->BlinkTimer.expires = jiffies + LED_CM4_BLINK_ON_INTERVAL; -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_CM4_BLINK_ON_INTERVAL)); -+ //PlatformSetTimer(Adapter, &(pLed->BlinkTimer), LED_CM4_BLINK_ON_INTERVAL); -+ } -+ else -+ { -+ pLed->BlinkingLedState = LED_ON; -+ -+ //pLed->BlinkTimer.expires = jiffies + LED_CM4_BLINK_OFF_INTERVAL; -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_CM4_BLINK_OFF_INTERVAL)); -+ //PlatformSetTimer(Adapter, &(pLed->BlinkTimer), LED_CM4_BLINK_OFF_INTERVAL); -+ } -+ } -+ else -+ { -+ pLed->CurrLedState = LED_NO_LINK_BLINK; -+ //printk("----->LED_CTL_NO_LINK bLedBlinkInProgress\n"); -+ } -+ break; -+ -+ case LED_CTL_LINK: -+ pLed->CurrLedState = LED_ON; -+ if( pLed->bLedBlinkInProgress == 0) -+ { -+ SwLedOn(dev, pLed); -+ } -+ else -+ ;//printk("----->LED_CTL_LINK bLedBlinkInProgress\n"); -+ -+ break; -+ -+ case LED_CTL_POWER_OFF: -+ pLed->CurrLedState = LED_OFF; -+ if(pLed->bLedBlinkInProgress) -+ { -+ printk("----->LED_CTL_POWER_OFF bLedBlinkInProgress\n"); -+ -+ //PlatformCancelTimer(Adapter, &(pLed->BlinkTimer)); -+ del_timer_sync(&(pLed->BlinkTimer)); -+ pLed->bLedBlinkInProgress = 0; -+ } -+ SwLedOff(dev, pLed); -+ break; -+ -+ default: -+ break; -+ } -+} -+ -+ -+ -+//added by lizhaoming 2008.6.3 -+// -+// Description: -+// Implement each led action for SW_LED_MODE5, -+// which is customized for DELL 8187B minicard. -+// 2008.04.24, by chiyokolin. -+// -+void -+SwLedControlMode5( -+ struct net_device *dev, -+ LED_CTL_MODE LedAction -+ ) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ PLED_8187 pLed = &(priv->Gpio0Led); -+ -+ // Decide led state -+ //printk("====++++++++++++++++++++++=====>%s In\n", __FUNCTION__); -+ switch(LedAction) -+ { -+ case LED_CTL_TX: -+ case LED_CTL_RX: -+ case LED_CTL_SITE_SURVEY: -+ case LED_CTL_POWER_ON: -+ case LED_CTL_NO_LINK: -+ case LED_CTL_LINK: -+ pLed->CurrLedState = LED_ON; -+ if( pLed->bLedBlinkInProgress == 0 ) -+ { -+ pLed->bLedBlinkInProgress = 1; -+ if(! pLed->bLedOn ) -+ pLed->BlinkingLedState = LED_ON; -+ else -+ break; -+ -+ //printk("====++++++++++++++++++++++=====>%s In LED:%d\n", __FUNCTION__, pLed->bLedOn); -+ //pLed->BlinkTimer.expires = jiffies + LED_BLINK_NORMAL_INTERVAL; -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_BLINK_NORMAL_INTERVAL)); -+ // SwLedOn(dev, pLed); -+ } -+ else -+ ;//printk("----->LED_CTL_LINK bLedBlinkInProgress\n"); -+ -+ break; -+ -+ case LED_CTL_POWER_OFF: -+ pLed->CurrLedState = LED_OFF; -+ // printk("<====++++++++++++++++++++++=====%s In LED:%d\n", __FUNCTION__, pLed->bLedOn); -+ if(pLed->bLedBlinkInProgress) -+ { -+ // printk("----->LED_CTL_POWER_OFF bLedBlinkInProgress\n"); -+ -+ //PlatformCancelTimer(Adapter, &(pLed->BlinkTimer)); -+ del_timer_sync(&(pLed->BlinkTimer)); -+ pLed->bLedBlinkInProgress = 0; -+ } -+ SwLedOff(dev, pLed); -+ break; -+ -+ default: -+ break; -+ } -+} -+ -+// -+// Callback fuction of the timer, Gpio0Led.BlinkTimer. -+// -+void -+Gpio0LedBlinkTimerCallback( -+ unsigned long data -+ ) -+{ -+ struct net_device *dev = (struct net_device *)data; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+// printk("=========>%s In\n", __FUNCTION__); -+ PlatformSwLedBlink(dev, &(priv->Gpio0Led)); -+} -+ -+ -+ -+// -+// Callback fuction of the timer, SwLed0.BlinkTimer. -+// -+void -+SwLed0BlinkTimerCallback( -+ unsigned long data -+ ) -+{ -+ struct net_device *dev = (struct net_device *)data; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+// printk("=========>%s In\n", __FUNCTION__); -+ PlatformSwLedBlink(dev, &(priv->SwLed0)); -+} -+ -+ -+ -+// -+// Callback fuction of the timer, SwLed1.BlinkTimer. -+// -+void -+SwLed1BlinkTimerCallback( -+ unsigned long data -+ ) -+{ -+ struct net_device *dev = (struct net_device *)data; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+// printk("=========>%s In\n", __FUNCTION__); -+ PlatformSwLedBlink(dev, &(priv->SwLed1)); -+} -+ -+void -+PlatformSwLedBlink( -+ struct net_device *dev, -+ PLED_8187 pLed -+ ) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+// printk("=========>%s In\n", __FUNCTION__); -+ switch(pLed->LedPin) -+ { -+ case LED_PIN_GPIO0: -+ schedule_work(&(priv->Gpio0LedWorkItem)); -+ break; -+ -+ case LED_PIN_LED0: -+ schedule_work(&(priv->SwLed0WorkItem)); -+ break; -+ -+ case LED_PIN_LED1: -+ schedule_work(&(priv->SwLed1WorkItem)); -+ break; -+ -+ default: -+ break; -+ } -+} -+ -+// -+// Callback fucntion of the workitem for SW LEDs. -+// 2006.03.01, by rcnjko. -+// -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) -+void Gpio0LedWorkItemCallback(struct work_struct *work) -+{ -+ struct r8180_priv *priv = container_of(work, struct r8180_priv,Gpio0LedWorkItem); -+ struct net_device *dev = priv->ieee80211->dev; -+#else -+void -+Gpio0LedWorkItemCallback( -+ void * Context -+ ) -+{ -+ struct net_device *dev = (struct net_device *)Context; -+ struct r8180_priv *priv = ieee80211_priv(dev); -+#endif -+ PLED_8187 pLed = &(priv->Gpio0Led); -+ if (priv == NULL || dev == NULL){ -+// printk("=========>%s In\n", __FUNCTION__); -+ //printk("ft=====================>%s()\n", __FUNCTION__); -+ } -+ -+#if 0 // by lizahoming 2008.6.3 -+ if(priv->LedStrategy == SW_LED_MODE2) -+ SwLedCm2Blink(dev, pLed); -+ else -+ SwLedBlink(dev, pLed); -+#endif -+ -+#if 1 // by lizahoming 2008.6.3 -+ switch(priv->LedStrategy) -+ { -+ case SW_LED_MODE2: -+ SwLedCm2Blink(dev, pLed); -+ break; -+ case SW_LED_MODE4: -+ SwLedCm4Blink(dev, pLed); -+ break; -+ default: -+ SwLedBlink(dev, pLed); -+ break; -+ } -+#endif -+ -+ //LeaveCallbackOfRtWorkItem( &(usbdevice->Gpio0LedWorkItem) ); -+} -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) -+void SwLed0WorkItemCallback(struct work_struct *work) -+{ -+ //struct r8180_priv *priv = container_of(work, struct r8180_priv, SwLed0WorkItem); -+ //struct net_device *dev = priv->dev; -+#else -+void SwLed0WorkItemCallback(void * Context) -+{ -+ //struct net_device *dev = (struct net_device *)Context; -+ //struct r8180_priv *priv = ieee80211_priv(dev); -+#endif -+ //SwLedBlink(dev, &(priv->SwLed0)); -+// printk("=========>%s In\n", __FUNCTION__); -+ -+ //LeaveCallbackOfRtWorkItem( &(usbdevice->SwLed0WorkItem) ); -+} -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) -+void SwLed1WorkItemCallback(struct work_struct *work) -+{ -+ //struct r8180_priv *priv = container_of(work, struct r8180_priv, SwLed1WorkItem); -+// struct net_device *dev = priv->dev; -+#else -+void -+SwLed1WorkItemCallback( -+ void * Context -+ ) -+{ -+ //struct net_device *dev = (struct net_device *)Context; -+ //struct r8180_priv *priv = ieee80211_priv(dev); -+#endif -+// printk("=========>%s In\n", __FUNCTION__); -+ //SwLedBlink(dev, &(priv->SwLed1)); -+ -+ //LeaveCallbackOfRtWorkItem( &(usbdevice->SwLed1WorkItem) ); -+} -+ -+// -+// Implementation of LED blinking behavior. -+// It toggle off LED and schedule corresponding timer if necessary. -+// -+void -+SwLedBlink( -+ struct net_device *dev, -+ PLED_8187 pLed -+ ) -+{ -+ u8 bStopBlinking = 0; -+ -+ //printk("=========>%s In state:%d\n", __FUNCTION__, pLed->CurrLedState); -+ // Change LED according to BlinkingLedState specified. -+ if( pLed->BlinkingLedState == LED_ON ) -+ { -+ SwLedOn(dev, pLed); -+// printk("Blinktimes (%d): turn on\n", pLed->BlinkTimes); -+ } -+ else -+ { -+ SwLedOff(dev, pLed); -+// printk("Blinktimes (%d): turn off\n", pLed->BlinkTimes); -+ } -+ -+ // Determine if we shall change LED state again. -+//by lizhaoming for LED BLINK SLOWLY -+ if(pLed->CurrLedState == LED_BLINK_SLOWLY) -+ { -+ bStopBlinking = 0; -+ } else { -+ pLed->BlinkTimes--; -+ if( pLed->BlinkTimes == 0 ) -+ { -+ bStopBlinking = 1; -+ } -+ else -+ { -+ if( pLed->CurrLedState != LED_BLINK_NORMAL && -+ pLed->CurrLedState != LED_BLINK_SLOWLY && -+ pLed->CurrLedState != LED_BLINK_CM3 ) -+ { -+ bStopBlinking = 1; -+ } -+ } -+ } -+ -+ if(bStopBlinking) -+ { -+ if( pLed->CurrLedState == LED_ON && pLed->bLedOn == 0) -+ { -+ SwLedOn(dev, pLed); -+ } -+ else if(pLed->CurrLedState == LED_OFF && pLed->bLedOn == 1) -+ { -+ SwLedOff(dev, pLed); -+ } -+ -+ pLed->BlinkTimes = 0; -+ pLed->bLedBlinkInProgress = 0; -+ } -+ else -+ { -+ // Assign LED state to toggle. -+ if( pLed->BlinkingLedState == LED_ON ) -+ pLed->BlinkingLedState = LED_OFF; -+ else -+ pLed->BlinkingLedState = LED_ON; -+ -+ // Schedule a timer to toggle LED state. -+ switch( pLed->CurrLedState ) -+ { -+ case LED_BLINK_NORMAL: -+ //printk("LED_BLINK_NORMAL:Blinktimes (%d): turn off\n", pLed->BlinkTimes+1); -+ //pLed->BlinkTimer.expires = jiffies + LED_BLINK_NORMAL_INTERVAL; -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_BLINK_NORMAL_INTERVAL)); -+ //PlatformSetTimer(dev, &(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); -+ break; -+ -+ case LED_BLINK_SLOWLY: -+ if( pLed->bLedOn == 1 ) -+ { -+ //printk("LED_BLINK_SLOWLY:turn off\n"); -+ //pLed->BlinkTimer.expires = jiffies + LED_BLINK_SLOWLY_INTERVAL+50;//for pcie mini card spec page 33, 250ms -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_BLINK_SLOWLY_INTERVAL+50)); -+ pLed->BlinkingLedState = LED_OFF; -+ } else { -+ //printk("LED_BLINK_SLOWLY:turn on\n"); -+ //pLed->BlinkTimer.expires = jiffies + 5000;//for pcie mini card spec page 33, 5s -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(5000)); -+ pLed->BlinkingLedState = LED_ON; -+ } -+ break; -+ -+ case LED_BLINK_CM3: -+ //printk("LED_BLINK_CM3:Blinktimes (%d): turn off\n", pLed->BlinkTimes+1); -+ //pLed->BlinkTimer.expires = jiffies + LED_CM3_BLINK_INTERVAL; -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_CM3_BLINK_INTERVAL)); -+ //PlatformSetTimer(dev, &(pLed->BlinkTimer), LED_CM3_BLINK_INTERVAL); -+ break; -+ -+ default: -+ //printk("LED_BLINK_default:Blinktimes (%d): turn off\n", pLed->BlinkTimes+1); -+ //pLed->BlinkTimer.expires = jiffies + LED_BLINK_SLOWLY_INTERVAL; -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_BLINK_SLOWLY_INTERVAL)); -+ //PlatformSetTimer(dev, &(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL); -+ break; -+ } -+ } -+} -+ -+ -+ -+// -+// Implementation of LED blinking behavior for SwLedControlMode2. -+// -+void -+SwLedCm2Blink( -+ struct net_device *dev, -+ PLED_8187 pLed -+ ) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ //PMGNT_INFO priv = &(dev->MgntInfo); -+ u8 bStopBlinking = 0; -+ -+ //printk("========+++++++++++++=>%s In\n", __FUNCTION__); -+ //To avoid LED blinking when rf is off, add by lizhaoming 2008.6.2 -+ if((priv->eRFPowerState == eRfOff) && (priv->RfOffReason>RF_CHANGE_BY_IPS)) -+ { -+ SwLedOff(dev, pLed); -+ -+ //pLed->BlinkTimer.expires = jiffies + LED_CM2_BLINK_ON_INTERVAL; -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_CM2_BLINK_ON_INTERVAL)); -+ //PlatformSetTimer(Adapter, &(pLed->BlinkTimer), LED_CM2_BLINK_ON_INTERVAL); -+ //printk(" Hw/Soft Radio Off, turn off Led\n"); -+ return; -+ } -+ -+ // Change LED according to BlinkingLedState specified. -+ if( pLed->BlinkingLedState == LED_ON ) -+ { -+ SwLedOn(dev, pLed); -+ //DMESG("Blinktimes (%d): turn on\n", pLed->BlinkTimes); -+ } -+ else -+ { -+ SwLedOff(dev, pLed); -+ //DMESG("Blinktimes (%d): turn off\n", pLed->BlinkTimes); -+ } -+ -+ //Add by lizhaoming for avoid BlinkTimers <0, 2008.6.2 -+ if(pLed->BlinkTimes > 0) -+ {//by lizhaoming 2008.6.2 -+ // Determine if we shall change LED state again. -+ pLed->BlinkTimes--; -+ }//by lizhaoming 2008.6.2 -+ -+ switch(pLed->CurrLedState) -+ { -+ case LED_BLINK_NORMAL: -+ if(pLed->BlinkTimes == 0) -+ { -+ bStopBlinking = 1; -+ } -+ break; -+/* CM2 scan blink and no link blind now not be supported -+ case LED_SCAN_BLINK: -+ if( (priv->mAssoc || priv->mIbss) && // Linked. -+ (!priv->bScanInProgress) && // Not in scan stage. -+ (pLed->BlinkTimes % 2 == 0)) // Even -+ { -+ bStopBlinking = 1; -+ } -+ break; -+ -+ case LED_NO_LINK_BLINK: -+ //Revised miniCard Ad-hoc mode "Slow Blink" by Isaiah 2006-08-03 -+ //if( (priv->mAssoc || priv->mIbss) ) // Linked. -+ if( priv->mAssoc) -+ { -+ bStopBlinking = 1; -+ } -+ else if(priv->mIbss && priv->bMediaConnect ) -+ { -+ bStopBlinking = 1; -+ } -+ break; -+*/ -+ default: -+ bStopBlinking = 1; -+ break; -+ } -+ -+ if(bStopBlinking) -+ { -+/* -+ if( priv->eRFPowerState != eRfOn ) -+ { -+ SwLedOff(dev, pLed); -+ } -+ else if( priv->bMediaConnect == 1 && pLed->bLedOn == 0) -+ { -+ SwLedOn(dev, pLed); -+ } -+ else if( priv->bMediaConnect == 0 && pLed->bLedOn == 1) -+ { -+ SwLedOff(dev, pLed); -+ } -+*/ -+ pLed->BlinkTimes = 0; -+ pLed->bLedBlinkInProgress = 0; -+ } -+ else -+ { -+ // Assign LED state to toggle. -+ if( pLed->BlinkingLedState == LED_ON ) -+ pLed->BlinkingLedState = LED_OFF; -+ else -+ pLed->BlinkingLedState = LED_ON; -+ -+ // Schedule a timer to toggle LED state. -+ switch( pLed->CurrLedState ) -+ { -+ case LED_BLINK_NORMAL: -+ //pLed->BlinkTimer.expires = jiffies + LED_BLINK_NORMAL_INTERVAL; -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_BLINK_NORMAL_INTERVAL)); -+ //PlatformSetTimer(dev, &(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); -+ break; -+ -+ case LED_BLINK_SLOWLY: -+ //pLed->BlinkTimer.expires = jiffies + LED_BLINK_SLOWLY_INTERVAL; -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_BLINK_SLOWLY_INTERVAL)); -+ //PlatformSetTimer(dev, &(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL); -+ break; -+ -+ case LED_SCAN_BLINK: -+ case LED_NO_LINK_BLINK: -+ if( pLed->bLedOn ) { -+ //pLed->BlinkTimer.expires = jiffies + LED_CM2_BLINK_ON_INTERVAL; -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_CM2_BLINK_ON_INTERVAL)); -+ //PlatformSetTimer(dev, &(pLed->BlinkTimer), LED_CM2_BLINK_ON_INTERVAL); -+ } else { -+ //pLed->BlinkTimer.expires = jiffies + LED_CM2_BLINK_OFF_INTERVAL; -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_CM2_BLINK_OFF_INTERVAL)); -+ //PlatformSetTimer(dev, &(pLed->BlinkTimer), LED_CM2_BLINK_OFF_INTERVAL); -+ } -+ break; -+ -+ default: -+ //RT_ASSERT(0, ("SwLedCm2Blink(): unexpected state!\n")); -+ //pLed->BlinkTimer.expires = jiffies + LED_BLINK_SLOWLY_INTERVAL; -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_BLINK_SLOWLY_INTERVAL)); -+ //PlatformSetTimer(dev, &(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL); -+ break; -+ } -+ } -+} -+ -+// added by lizhaoming 2008.6.2 -+// -+// Description: -+// Implement LED blinking behavior for SW_LED_MODE4. -+// -+void -+SwLedCm4Blink( -+ struct net_device *dev, -+ PLED_8187 pLed -+ ) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ u8 bStopBlinking = 0; -+ -+ printk("======++++++++++++++++++======>%s In\n", __FUNCTION__); -+ //To avoid LED blinking when rf is off, add by Maddest 20080307 -+ if((priv->eRFPowerState == eRfOff) && (priv->RfOffReason>RF_CHANGE_BY_IPS)) -+ { -+ SwLedOff(dev, pLed); -+ -+ //pLed->BlinkTimer.expires = jiffies + LED_CM4_BLINK_ON_INTERVAL; -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_CM4_BLINK_ON_INTERVAL)); -+ //PlatformSetTimer(Adapter, &(pLed->BlinkTimer), LED_CM4_BLINK_ON_INTERVAL); -+ printk(" Hw/Soft Radio Off, turn off Led\n"); -+ return; -+ } -+ // Change LED according to BlinkingLedState specified. -+ if( pLed->BlinkingLedState == LED_ON ) -+ { -+ if(!pLed->bLedOn) -+ { -+ SwLedOn(dev, pLed); -+ } -+ printk("Blinktimes (%d): turn on\n", pLed->BlinkTimes); -+ } -+ else -+ { -+ SwLedOff(dev, pLed); -+ printk("Blinktimes (%d): turn off\n", pLed->BlinkTimes); -+ } -+ -+ //Add by Maddest for avoid BlinkTimers <0, 20080307; -+ if(pLed->BlinkTimes > 0) -+ { -+ // Determine if we shall change LED state again. -+ pLed->BlinkTimes--; -+ } -+ printk("pLed->CurrLedState %d pLed->BlinkTimes %d\n", pLed->CurrLedState,pLed->BlinkTimes); -+ switch(pLed->CurrLedState) -+ { -+ case LED_BLINK_NORMAL: -+ if(pLed->BlinkTimes == 0) -+ { -+ bStopBlinking = 1; -+ } -+ break; -+ -+/* CM2 scan blink and no link blind now not be supported -+ case LED_SCAN_BLINK: -+ if( (priv->mAssoc || priv->mIbss) && // Linked.//???????????? -+ (!priv->bScanInProgress) && // Not in scan stage.//???????????? -+ (pLed->BlinkTimes % 2 == 0)) // Even -+ { -+ bStopBlinking = 1; -+ } -+ break; -+ -+ case LED_NO_LINK_BLINK: -+ //Revised miniCard Ad-hoc mode "Slow Blink" by Isaiah 2006-08-03 -+ //if( (pMgntInfo->mAssoc || pMgntInfo->mIbss) ) // Linked. -+ if( priv->mAssoc) //???????????? -+ { -+ bStopBlinking = 1; -+ } -+ else if(priv->mIbss && priv->bMediaConnect )//???????????? -+ { -+ bStopBlinking = 1; -+ } -+ break; -+*/ -+ -+ default: -+ bStopBlinking = 1; -+ break; -+ } -+ -+ if(bStopBlinking) -+ { -+ /* -+ if( priv->eRFPowerState != eRfOn ) -+ { -+ SwLedOff(dev, pLed); -+ } -+ else if( priv->bMediaConnect == true && pLed->bLedOn == false)//???????????? -+ { -+ SwLedOn(dev, pLed); -+ } -+ else if( priv->bMediaConnect == false && pLed->bLedOn == true)//???????????? -+ { -+ SwLedOff(dev, pLed); -+ } -+ */ -+ -+ pLed->BlinkTimes = 0; -+ pLed->bLedBlinkInProgress = 0; -+ } -+ else -+ { -+ // Assign LED state to toggle. -+ if( pLed->BlinkingLedState == LED_ON ) -+ pLed->BlinkingLedState = LED_OFF; -+ else -+ pLed->BlinkingLedState = LED_ON; -+ -+ // Schedule a timer to toggle LED state. -+ switch( pLed->CurrLedState ) -+ { -+ case LED_BLINK_NORMAL: -+ //pLed->BlinkTimer.expires = jiffies + LED_BLINK_NORMAL_INTERVAL; -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_BLINK_NORMAL_INTERVAL)); -+ //PlatformSetTimer(Adapter, &(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); -+ break; -+ -+ case LED_BLINK_SLOWLY: -+ //pLed->BlinkTimer.expires = jiffies + LED_BLINK_SLOWLY_INTERVAL; -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_BLINK_SLOWLY_INTERVAL)); -+ //PlatformSetTimer(Adapter, &(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL); -+ break; -+ -+ case LED_SCAN_BLINK: -+ pLed->BlinkingLedState = LED_ON; -+ //pLed->BlinkTimer.expires = jiffies + LED_BLINK_NORMAL_INTERVAL; -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_BLINK_NORMAL_INTERVAL)); -+ //PlatformSetTimer(Adapter, &(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL); -+ -+ case LED_NO_LINK_BLINK: -+ if( pLed->bLedOn ){ -+ //pLed->BlinkTimer.expires = jiffies + LED_CM4_BLINK_ON_INTERVAL; -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_CM4_BLINK_ON_INTERVAL)); -+ //PlatformSetTimer(Adapter, &(pLed->BlinkTimer), LED_CM4_BLINK_ON_INTERVAL); -+ }else{ -+ //pLed->BlinkTimer.expires = jiffies + LED_CM4_BLINK_OFF_INTERVAL; -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_CM4_BLINK_OFF_INTERVAL)); -+ //PlatformSetTimer(Adapter, &(pLed->BlinkTimer), LED_CM4_BLINK_OFF_INTERVAL); -+ } -+ break; -+ -+ default: -+ printk("SwLedCm2Blink(): unexpected state!\n"); -+ //pLed->BlinkTimer.expires = jiffies + LED_BLINK_SLOWLY_INTERVAL; -+ //add_timer(&(pLed->BlinkTimer)); -+ mod_timer(&pLed->BlinkTimer, jiffies + MSECS(LED_BLINK_SLOWLY_INTERVAL)); -+ //PlatformSetTimer(Adapter, &(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL); -+ break; -+ } -+ } -+} -+ -+void -+SwLedOn( -+ struct net_device *dev, -+ PLED_8187 pLed -+) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+// printk("=========>%s(), pin:%d\n", __FUNCTION__, pLed->LedPin); -+ switch(pLed->LedPin) -+ { -+ case LED_PIN_GPIO0: -+ write_nic_byte(dev,0x0091,0x01); -+ write_nic_byte(dev,0x0090,0x00); // write 0 : LED on -+ break; -+ -+ case LED_PIN_LED0: -+ priv->PsrValue &= ~(0x01 << 4); -+ write_nic_byte(dev, PSR, priv->PsrValue); -+ break; -+ -+ case LED_PIN_LED1: -+ priv->PsrValue &= ~(0x01 << 5); -+ write_nic_byte(dev, PSR, priv->PsrValue); -+ break; -+ -+ default: -+ break; -+ } -+ -+ pLed->bLedOn = 1; -+} -+ -+void -+SwLedOff( -+ struct net_device *dev, -+ PLED_8187 pLed -+) -+{ -+ struct r8180_priv *priv = ieee80211_priv(dev); -+ -+ -+ //printk("=========>%s(), pin:%d\n", __FUNCTION__, pLed->LedPin); -+ switch(pLed->LedPin) -+ { -+ case LED_PIN_GPIO0: -+ write_nic_byte(dev,0x0091,0x01); -+ write_nic_byte(dev,0x0090,0x01); // write 1 : LED off -+ break; -+ -+ case LED_PIN_LED0: -+ priv->PsrValue |= (0x01 << 4); -+ write_nic_byte(dev, PSR, priv->PsrValue); -+ break; -+ -+ case LED_PIN_LED1: -+ priv->PsrValue |= (0x01 << 5); -+ write_nic_byte(dev, PSR, priv->PsrValue); -+ break; -+ -+ default: -+ break; -+ } -+ -+ pLed->bLedOn = 0; -+} -+ -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8187_led.h linux-2.6.35/drivers/net/wireless/rtl8187b/r8187_led.h ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8187_led.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/r8187_led.h 2010-08-05 21:12:35.583623547 +0200 -@@ -0,0 +1,276 @@ -+/*++ -+ -+Copyright (c) Microsoft Corporation. All rights reserved. -+ -+Module Name: -+ r8187_led.h -+ -+Abstract: -+ definitions and stuctures for rtl8187 led control. -+ -+Major Change History: -+ When Who What -+ ---------- ------ ---------------------------------------------- -+ 2006-09-07 Xiong Created -+ -+Notes: -+ -+--*/ -+ -+#ifndef R8187_LED_H -+#define R8187_LED_H -+ -+#include <linux/types.h> -+#include <linux/timer.h> -+ -+ -+/*--------------------------Define -------------------------------------------*/ -+// -+// 0x7E-0x7F is reserved for SW customization. 2006.04.21, by rcnjko. -+// -+// BIT[0-7] is for CustomerID where value 0x00 and 0xFF is reserved for Realtek. -+#define EEPROM_SW_REVD_OFFSET 0x7E -+ -+#define EEPROM_CID_MASK 0x00FF -+#define EEPROM_CID_RSVD0 0x00 -+#define EEPROM_CID_RSVD1 0xFF -+#define EEPROM_CID_ALPHA0 0x01 -+#define EEPROM_CID_SERCOMM_PS 0x02 -+#define EEPROM_CID_HW_LED 0x03 -+ -+#define EEPROM_CID_QMI 0x07 //Added by lizhaoming 2008.6.3 -+#define EEPROM_CID_DELL 0x08 //Added by lizhaoming 2008.6.3 -+ -+#define LED_BLINK_NORMAL_INTERVAL 100 //by lizhaoming 50 -> 100 -+#define LED_BLINK_SLOWLY_INTERVAL 200 -+ -+// Customized for AzWave, 2006.04.03, by rcnjko. -+#define LED_CM2_BLINK_ON_INTERVAL 250 -+#define LED_CM2_BLINK_OFF_INTERVAL 4750 -+// -+ -+// Customized for Sercomm Printer Server case, 2006.04.21, by rcnjko. -+#define LED_CM3_BLINK_INTERVAL 1500 -+ -+// by lizhaoming 2008.6.3: Customized for QMI. -+// -+#define LED_CM4_BLINK_ON_INTERVAL 500 -+#define LED_CM4_BLINK_OFF_INTERVAL 4500 -+ -+ -+/*--------------------------Define MACRO--------------------------------------*/ -+ -+ -+/*------------------------------Define Struct---------------------------------*/ -+typedef enum _LED_STATE_8187{ -+ LED_UNKNOWN = 0, -+ LED_ON = 1, -+ LED_OFF = 2, -+ LED_BLINK_NORMAL = 3, -+ LED_BLINK_SLOWLY = 4, -+ LED_POWER_ON_BLINK = 5, -+ LED_SCAN_BLINK = 6, // LED is blinking during scanning period, the # of times to blink is depend on time for scanning. -+ LED_NO_LINK_BLINK = 7, // LED is blinking during no link state. -+ LED_BLINK_CM3 = 8, // Customzied for Sercomm Printer Server case -+}LED_STATE_8187; -+ -+typedef enum _RT_CID_TYPE { -+ RT_CID_DEFAULT, -+ RT_CID_8187_ALPHA0, -+ RT_CID_8187_SERCOMM_PS, -+ RT_CID_8187_HW_LED, -+ -+ RT_CID_87B_QMI , //Added by lizhaoming 2008.6.3 -+ RT_CID_87B_DELL, //Added by lizhaoming 2008.6.3 -+ -+} RT_CID_TYPE; -+ -+typedef enum _LED_STRATEGY_8187{ -+ SW_LED_MODE0, // SW control 1 LED via GPIO0. It is default option. -+ SW_LED_MODE1, // 2 LEDs, through LED0 and LED1. For ALPHA. -+ SW_LED_MODE2, // SW control 1 LED via GPIO0, customized for AzWave 8187 minicard. -+ SW_LED_MODE3, // SW control 1 LED via GPIO0, customized for Sercomm Printer Server case. -+ SW_LED_MODE4, //added by lizhaoming for bluetooth 2008.6.3 -+ SW_LED_MODE5, //added by lizhaoming for bluetooth 2008.6.3 -+ HW_LED, // HW control 2 LEDs, LED0 and LED1 (there are 4 different control modes, see MAC.CONFIG1 for details.) -+}LED_STRATEGY_8187, *PLED_STRATEGY_8187; -+ -+typedef enum _LED_PIN_8187{ -+ LED_PIN_GPIO0, -+ LED_PIN_LED0, -+ LED_PIN_LED1 -+}LED_PIN_8187; -+ -+//by lizhaoming for LED 2008.6.23 into ieee80211.h -+//typedef enum _LED_CTL_MODE { -+// LED_CTL_POWER_ON, -+// LED_CTL_POWER_OFF, -+// LED_CTL_LINK, -+// LED_CTL_NO_LINK, -+// LED_CTL_TX, -+// LED_CTL_RX, -+// LED_CTL_SITE_SURVEY, -+//} LED_CTL_MODE; -+ -+typedef struct _LED_8187{ -+ LED_PIN_8187 LedPin; // Identify how to implement this SW led. -+ -+ LED_STATE_8187 CurrLedState; // Current LED state. -+ u8 bLedOn; // TRUE if LED is ON, FALSE if LED is OFF. -+ -+ u8 bLedBlinkInProgress; // TRUE if it is blinking, FALSE o.w.. -+ u32 BlinkTimes; // Number of times to toggle led state for blinking. -+ LED_STATE_8187 BlinkingLedState; // Next state for blinking, either LED_ON or LED_OFF are. -+ struct timer_list BlinkTimer; // Timer object for led blinking. -+} LED_8187, *PLED_8187; -+ -+ -+ -+/*------------------------Export global variable------------------------------*/ -+ -+ -+/*------------------------------Funciton declaration--------------------------*/ -+void -+InitSwLeds( -+ struct net_device *dev -+ ); -+ -+void -+DeInitSwLeds( -+ struct net_device *dev -+ ); -+ -+void -+InitLed8187( -+ struct net_device *dev, -+ PLED_8187 pLed, -+ LED_PIN_8187 LedPin, -+ void * BlinkCallBackFunc); -+ -+void -+DeInitLed8187( -+ struct net_device *dev, -+ PLED_8187 pLed); -+ -+void -+LedControl8187( -+ struct net_device *dev, -+ LED_CTL_MODE LedAction -+); -+ -+void -+SwLedControlMode0( -+ struct net_device *dev, -+ LED_CTL_MODE LedAction -+); -+ -+void -+SwLedControlMode1( -+ struct net_device *dev, -+ LED_CTL_MODE LedAction -+); -+ -+void -+SwLedControlMode2( -+ struct net_device *dev, -+ LED_CTL_MODE LedAction -+); -+ -+void -+SwLedControlMode3( -+ struct net_device *dev, -+ LED_CTL_MODE LedAction -+); -+ -+ -+void -+SwLedControlMode4( -+ struct net_device *dev, -+ LED_CTL_MODE LedAction -+); -+ -+ -+void -+SwLedControlMode5( -+ struct net_device *dev, -+ LED_CTL_MODE LedAction -+); -+ -+void -+Gpio0LedBlinkTimerCallback( -+ unsigned long data -+ ); -+ -+void -+SwLed0BlinkTimerCallback( -+ unsigned long data -+ ); -+ -+void -+SwLed1BlinkTimerCallback( -+ unsigned long data -+ ); -+ -+void -+PlatformSwLedBlink( -+ struct net_device *dev, -+ PLED_8187 pLed -+ ); -+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -+void -+Gpio0LedWorkItemCallback( -+ void * Context -+ ); -+ -+void -+SwLed0WorkItemCallback( -+ void * Context -+ ); -+ -+void -+SwLed1WorkItemCallback( -+ void * Context -+ ); -+#else -+void -+Gpio0LedWorkItemCallback(struct work_struct *work); -+ -+void -+SwLed0WorkItemCallback(struct work_struct *work); -+ -+void -+SwLed1WorkItemCallback(struct work_struct *work); -+ -+#endif -+void -+SwLedBlink( -+ struct net_device *dev, -+ PLED_8187 pLed -+ ); -+ -+void -+SwLedCm2Blink( -+ struct net_device *dev, -+ PLED_8187 pLed -+ ); -+ -+void -+SwLedCm4Blink( -+ struct net_device *dev, -+ PLED_8187 pLed -+ ); -+ -+void -+SwLedOn( -+ struct net_device *dev, -+ PLED_8187 pLed -+); -+ -+void -+SwLedOff( -+ struct net_device *dev, -+ PLED_8187 pLed -+); -+ -+ -+#endif -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8187_rfkill.c linux-2.6.35/drivers/net/wireless/rtl8187b/r8187_rfkill.c ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/r8187_rfkill.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/r8187_rfkill.c 2010-08-05 21:12:35.633623528 +0200 -@@ -0,0 +1,157 @@ -+/* -+ * rtl8187b specific rfkill support -+ * -+ * NOTE: we only concern about two states -+ * eRfOff: RFKILL_STATE_SOFT_BLOCKED -+ * eRfOn: RFKILL_STATE_UNBLOCKED -+ * TODO: move led controlling source code to rfkill framework -+ * -+ * Copyright (C) 2009 Lemote Inc. -+ * Author: Wu Zhangjin <wuzhangjin@gmail.com> -+ */ -+ -+#include <linux/module.h> -+#include <linux/rfkill.h> -+#include <linux/device.h> -+ -+/* LED macros are defined in r8187.h and rfkill.h, we not use any of them here -+ * just avoid compiling erros here. -+ */ -+#undef LED -+ -+#include "r8187.h" -+#include "ieee80211/ieee80211.h" -+#include "linux/netdevice.h" -+ -+static struct rfkill *r8187b_rfkill; -+static struct work_struct r8187b_rfkill_task; -+static int initialized; -+/* turn off by default */ -+int r8187b_rfkill_state = RFKILL_USER_STATE_SOFT_BLOCKED; -+struct net_device *r8187b_dev = NULL; -+RT_RF_POWER_STATE eRfPowerStateToSet; -+ -+/* These two mutexes are used to ensure the relative rfkill status are accessed -+ * by different tasks exclusively */ -+DEFINE_MUTEX(statetoset_lock); -+DEFINE_MUTEX(state_lock); -+ -+static void r8187b_wifi_rfkill_task(struct work_struct *work) -+{ -+ if (r8187b_dev) { -+ mutex_lock(&statetoset_lock); -+ r8187b_wifi_change_rfkill_state(r8187b_dev, eRfPowerStateToSet); -+ mutex_unlock(&statetoset_lock); -+ } -+} -+ -+static int r8187b_wifi_update_rfkill_state(int status) -+{ -+ /* ensure r8187b_rfkill is initialized if dev is not initialized, means -+ * wifi driver is not start, the status is eRfOff be default. -+ */ -+ if (!r8187b_dev) -+ return eRfOff; -+ -+ if (initialized == 0) { -+ /* init the rfkill work task */ -+ INIT_WORK(&r8187b_rfkill_task, r8187b_wifi_rfkill_task); -+ initialized = 1; -+ } -+ -+ mutex_lock(&statetoset_lock); -+ if (status == 1) -+ eRfPowerStateToSet = eRfOn; -+ else if (status == 0) -+ eRfPowerStateToSet = eRfOff; -+ else if (status == 2) { -+ /* if the KEY_WLAN is pressed, just switch it! */ -+ mutex_lock(&state_lock); -+ if (r8187b_rfkill_state == RFKILL_USER_STATE_UNBLOCKED) -+ eRfPowerStateToSet = eRfOff; -+ else if (r8187b_rfkill_state == RFKILL_USER_STATE_SOFT_BLOCKED) -+ eRfPowerStateToSet = eRfOn; -+ mutex_unlock(&state_lock); -+ } -+ mutex_unlock(&statetoset_lock); -+ -+ schedule_work(&r8187b_rfkill_task); -+ -+ return eRfPowerStateToSet; -+} -+ -+static int r8187b_rfkill_set(void *data, bool blocked) -+{ -+ r8187b_wifi_update_rfkill_state(!blocked); -+ -+ return 0; -+} -+ -+static void r8187b_rfkill_query(struct rfkill *rfkill, void *data) -+{ -+ static bool blocked; -+ -+ mutex_lock(&state_lock); -+ if (r8187b_rfkill_state == RFKILL_USER_STATE_UNBLOCKED) -+ blocked = 0; -+ else if (r8187b_rfkill_state == RFKILL_USER_STATE_SOFT_BLOCKED) -+ blocked = 1; -+ mutex_unlock(&state_lock); -+ -+ rfkill_set_hw_state(rfkill, blocked); -+} -+ -+int r8187b_wifi_report_state(r8180_priv *priv) -+{ -+ mutex_lock(&state_lock); -+ r8187b_rfkill_state = RFKILL_USER_STATE_UNBLOCKED; -+ if (priv->ieee80211->bHwRadioOff && priv->eRFPowerState == eRfOff) -+ r8187b_rfkill_state = RFKILL_USER_STATE_SOFT_BLOCKED; -+ mutex_unlock(&state_lock); -+ -+ r8187b_rfkill_query(r8187b_rfkill, NULL); -+ -+ return 0; -+} -+ -+static const struct rfkill_ops r8187b_rfkill_ops = { -+ .set_block = r8187b_rfkill_set, -+ .query = r8187b_rfkill_query, -+}; -+ -+int r8187b_rfkill_init(struct net_device *dev) -+{ -+ int ret; -+ -+ /* init the r8187b device */ -+ r8187b_dev = dev; -+ -+ /* init the rfkill struct */ -+ r8187b_rfkill = rfkill_alloc("r8187b-wifi", &dev->dev, -+ RFKILL_TYPE_WLAN, &r8187b_rfkill_ops, -+ (void *)1); -+ -+ if (!r8187b_rfkill) { -+ rfkill_destroy(r8187b_rfkill); -+ printk(KERN_WARNING "r8187b: Unable to allocate rfkill\n"); -+ return -ENOMEM; -+ } -+ ret = rfkill_register(r8187b_rfkill); -+ if (ret) { -+ rfkill_destroy(r8187b_rfkill); -+ return ret; -+ } -+ -+ /* The default status is passed to the rfkill module */ -+ -+ return 0; -+} -+ -+void r8187b_rfkill_exit(void) -+{ -+ if (r8187b_rfkill) { -+ rfkill_unregister(r8187b_rfkill); -+ rfkill_destroy(r8187b_rfkill); -+ } -+ r8187b_rfkill = NULL; -+} -diff -Nur linux-2.6.35.orig/drivers/net/wireless/rtl8187b/readme linux-2.6.35/drivers/net/wireless/rtl8187b/readme ---- linux-2.6.35.orig/drivers/net/wireless/rtl8187b/readme 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.35/drivers/net/wireless/rtl8187b/readme 2010-08-05 21:12:35.663623736 +0200 -@@ -0,0 +1,124 @@ -+rtl8187 Linux kernel driver -+Released under the terms of GNU General Public Licence (GPL) -+Copyright(c) Andrea Merello - 2004,2005 -+ -+Portions of this driver are based on other projects, please see the notes -+in the source files for detail. -+A special thanks go to Realtek corp for their support and to David Young -+------------------------------------------------------------------------------ -+ -+This is an attempt to write somethig that can make rtl8187 usb dongle wifi card -+on Linux using only opensource stuff. -+The rtl8225 radio is supported. -+ -+It's in early development stage so don't expect too much from it -+(also use it at your own risk!) -+This should be considered just a fragment of code.. using it on your(any) -+system is at your own risk! Please note that I never supported the idea to -+use it in any way, so i cannot be considered responsible in any way for -+anything deriving by it usage. -+ -+Anyway for now we have monitor mode and managed mode -+basically working! This isn't necessary stable, but seems to work.. -+ -+This driver is still under development and very far from perfect. It should work on x86, -+Other archs are untested.. -+ -+To compile the driver simply run make. -+ -+The driver contains also the ieee80211.h and ieee80211_crypt.h from the ieee stack. -+Note that for some reasons this stack is NOT the same that will be included in newer -+2.6 kernel. I will try to port to this stack as soon as it will have enought features -+to support 8187 cards. -+Please note that you will have to make sure the two .h files are the same of the ieee -+stack. -+In other words when you download from the CVS this driver and the ieee80211 stack a good -+idea is to copy the ieee80211.h and ieee80211_crypt.h from the ieee directory to the drv -+directory -+ -+Warning during compile are OK -+ -+To wake up the nic run: -+ -+ ifconfig <ifacename> up -+ -+(where <ifacename> is your network device for wlan card). -+ -+Please note that the default interface name is wlanX. -+ -+Please note thet this will take several seconds.. -+ -+If you would like to set the interface name to something else you may use the -+'devname=' module parameter. For example: -+ -+ insmod r8187.ko ifname=eth%d -+ -+will set the interface name of this device to something like eth0. -+ -+Once the nic is up it can be put in a monitor mode by running: -+ -+ iwconfig <ifacename> mode monitor -+ -+and channel number may be changed by running: -+ -+ iwconfig <ifacename> channel XX -+ -+ -+In monitor mode a choice may be made via iwpriv if the nic should pass packets -+with bad crc or drop them. -+ -+To put the nic in managed mode run: -+ -+ iwconfig <ifacename> mode managed -+ -+In managed mode there is support for -+ -+ iwlist scan -+ -+that should report the currently available networks. -+Please note that in managed mode channels cannot be changed manually. -+ -+To associate with a network -+ -+ iwconfig <ifacename> essid XXXXX -+ -+where XXXXX is the network essid (name) reported by 'iwlist scan'. Please -+note that essid is case sensitive. -+ -+If your network is not broadcasting the ESSID, then you need to specify *also* -+the AP MAC address -+ -+ iwconfig <ifacename> ap XX:XX:XX:XX:XX:XX -+ -+The driver accepts another boolean parameter: hwseqnum -+If set to 1 it lets the card HW take care of the sequence number of the TXed -+frames. Altought in managed mode I can't see an important reason to use HW to -+do that, when we'll start to TX beacons in master (AP) and ad-hoc modes most -+probably it will be extremely useful (since most probably we will use two HW -+queues). -+ -+I'm unsure if it will work correctly on all NICs.. reports are *VERY, VERY* apreciated.. -+ -+ -+ WEP -+ === -+ -+WEP encryption should work. For now it's done by host, not by the nic. Key can be set with: -+Key can be set with -+ -+ iwconfig <ifacename> key 12345... -+ -+WEP is supported via software thanks to the ipw stack. -+ -+Shared and open authentication are supported -+ -+ IWPRIV -+ ====== -+ -+This driver supports some private handlers: -+-badcrc: let you choose to kill or to pass to the upper layer frames with bad crc in monitor mode -+-activescan: if 0 the driver will avoid to send probe requests, sanning will be only on beacon basis -+ -+ -+If you have some question/comments please feel free to write me. -+ diff -Nur linux-2.6.35.orig/drivers/platform/Kconfig linux-2.6.35/drivers/platform/Kconfig --- linux-2.6.35.orig/drivers/platform/Kconfig 2010-08-02 00:11:14.000000000 +0200 +++ linux-2.6.35/drivers/platform/Kconfig 2010-08-05 21:12:35.693620642 +0200 diff --git a/target/linux/Config.in b/target/linux/Config.in index 263b17a45..d840e9014 100644 --- a/target/linux/Config.in +++ b/target/linux/Config.in @@ -6,7 +6,6 @@ source target/linux/config/Config.in.input source target/linux/config/Config.in.pcmcia source target/linux/config/Config.in.network source target/linux/config/Config.in.netfilter -source target/linux/config/Config.in.ipvs source target/linux/config/Config.in.multimedia source target/linux/config/Config.in.crypto source target/linux/config/Config.in.bluetooth diff --git a/target/linux/config/Config.in.multimedia b/target/linux/config/Config.in.multimedia index 76d35c39f..8d232448f 100644 --- a/target/linux/config/Config.in.multimedia +++ b/target/linux/config/Config.in.multimedia @@ -94,7 +94,7 @@ config ADK_KPACKAGE_KMOD_SND_CS5535AUDIO prompt "kmod-sound-alsa-cs5535......... ALSA AMD CS5535 driver" depends on ADK_KPACKAGE_KMOD_SND select ADK_KPACKAGE_KMOD_SND_AC97_CODEC - depends on ADK_LINUX_X86_ALIX1C || ADK_LINUX_MIPS64_LEMOTE + depends on ADK_LINUX_X86_ALIX1C || ADK_LINUX_MIPS64_LEMOTE || ADK_NATIVE tristate default n help diff --git a/target/linux/config/Config.in.netdevice b/target/linux/config/Config.in.netdevice index 368b66d49..7f1b1d584 100644 --- a/target/linux/config/Config.in.netdevice +++ b/target/linux/config/Config.in.netdevice @@ -237,14 +237,13 @@ config ADK_KPACKAGE_KMOD_B43 help Driver for Broadcom B43xx wireless chips. -config ADK_KPACKAGE_KMOD_RTL8187B - prompt "kmod-rtl8187b................ Realtek RTL8187B wireless cards" +config ADK_KPACKAGE_KMOD_RTL8187 + prompt "kmod-rtl8187................. Realtek RTL8187/RTL8187B wireless cards" tristate depends on ADK_KPACKAGE_KMOD_MAC80211 - depends on ADK_LINUX_MIPS64_LEMOTE - default y + default n help - Driver for Realtek RTL8187B wireless chips. + Driver for Realtek RTL8187/RTL8187B wireless chips. config ADK_KPACKAGE_KMOD_P54_USB prompt "kmod-p54-usb................. Prism54 USB support" diff --git a/target/linux/config/Config.in.network b/target/linux/config/Config.in.network index 812a7073c..71176417f 100644 --- a/target/linux/config/Config.in.network +++ b/target/linux/config/Config.in.network @@ -265,6 +265,7 @@ config ADK_KPACKAGE_KMOD_BONDING source target/linux/config/Config.in.sched source target/linux/config/Config.in.ipsec +source target/linux/config/Config.in.ipvs endmenu diff --git a/target/linux/config/Config.in.usb b/target/linux/config/Config.in.usb index 8f2f5cf1b..dc25cb4b8 100644 --- a/target/linux/config/Config.in.usb +++ b/target/linux/config/Config.in.usb @@ -26,10 +26,9 @@ config ADK_KERNEL_USB_UHCI_HCD default n config ADK_KPACKAGE_KMOD_USB - prompt "kmod-usb-core..................... USB support" + prompt "kmod-usb......................... USB support" tristate default y if ADK_LINUX_ALIX - default y if ADK_LINUX_MIPS64_LEMOTE default n depends on !(ADK_LINUX_CRIS_FOXBOARD || ADK_LINUX_ARM_FOXG20 || ADK_KERNEL_USB) select ADK_KERNEL_NLS @@ -82,7 +81,6 @@ config ADK_KPACKAGE_KMOD_USB_OHCI_HCD prompt "kmod-usb-ohci................... Support for OHCI controllers" tristate default y if ADK_LINUX_ALIX - default y if ADK_LINUX_MIPS64_LEMOTE default n depends on !ADK_LINUX_CRIS_FOXBOARD depends on ADK_KPACKAGE_KMOD_USB @@ -129,7 +127,6 @@ config ADK_KPACKAGE_KMOD_USB_EHCI_HCD tristate depends on !(ADK_LINUX_CRIS_FOXBOARD || ADK_KERNEL_USB_EHCI_HCD) default y if ADK_LINUX_ALIX - default y if ADK_LINUX_MIPS64_LEMOTE default n depends on ADK_KPACKAGE_KMOD_USB select ADK_PACKAGE_KMOD_USB_CONTROLLER diff --git a/target/linux/kernel.control b/target/linux/kernel.control index c456fa8f4..df2c18ad9 100644 --- a/target/linux/kernel.control +++ b/target/linux/kernel.control @@ -1,5 +1,5 @@ Package: kernel Priority: optional Section: sys -Description: Virtual package for the Kernel +Description: package for the Linux Kernel diff --git a/target/native/Makefile b/target/native/Makefile index 63eeb1842..0904cb491 100644 --- a/target/native/Makefile +++ b/target/native/Makefile @@ -8,7 +8,11 @@ include $(TOPDIR)/mk/modules.mk include $(TOPDIR)/mk/kernel-build.mk include $(TOPDIR)/mk/image.mk +ifeq ($(CPU_ARCH),i686) +KERNEL:=$(LINUX_DIR)/arch/x86/boot/bzImage +else KERNEL:=$(LINUX_DIR)/vmlinuz +endif ifeq ($(FS),initramfs) imageinstall: $(BIN_DIR)/$(INITRAMFS) diff --git a/target/native/target.mk b/target/native/target.mk index e0af34dba..bc6beb034 100644 --- a/target/native/target.mk +++ b/target/native/target.mk @@ -1,6 +1,18 @@ ARCH:= $(shell uname -m|sed -e "s/i.*86/x86/" -e "s/_\?64//") -CPU_ARCH:= $(shell uname -m) -KERNEL_VERSION:= 2.6.34 +CPU_ARCH:= $(shell gcc -dumpmachine | sed -e s'/-.*//' \ + -e 's/sparc.*/sparc/' \ + -e 's/arm.*/arm/g' \ + -e 's/m68k.*/m68k/' \ + -e 's/ppc/powerpc/g' \ + -e 's/v850.*/v850/g' \ + -e 's/sh[234]/sh/' \ + -e 's/mips-.*/mips/' \ + -e 's/mipsel-.*/mipsel/' \ + -e 's/cris.*/cris/' \ + -e 's/i[3-9]86/i686/' \ + ) +KERNEL_VERSION:= 2.6.35 KERNEL_RELEASE:= 1 -KERNEL_MD5SUM:= 10eebcb0178fb4540e2165bfd7efc7ad +KERNEL_MD5SUM:= 091abeb4684ce03d1d936851618687b6 TARGET_OPTIMIZATION:= -Os -pipe +TARGET_CFLAGS_ARCH:= -march=native diff --git a/target/target.lst b/target/target.lst index 00c245c6a..490f36eca 100644 --- a/target/target.lst +++ b/target/target.lst @@ -1,16 +1,16 @@ -native ADK_LINUX_NATIVE -alix1c ADK_LINUX_X86_ALIX1C -alix2d ADK_LINUX_X86_ALIX2D +native ADK_LINUX_NATIVE +alix1c ADK_LINUX_X86_ALIX1C +alix2d ADK_LINUX_X86_ALIX2D alix2d13 ADK_LINUX_X86_ALIX2D13 -alix ADK_LINUX_X86_ALIX1C || ADK_LINUX_X86_ALIX2D || ADK_LINUX_X86_ALIX2D13 -wrap ADK_LINUX_X86_WRAP -ibmx40 ADK_LINUX_X86_IBMX40 +alix ADK_LINUX_X86_ALIX1C ADK_LINUX_X86_ALIX2D ADK_LINUX_X86_ALIX2D13 +wrap ADK_LINUX_X86_WRAP +ibmx40 ADK_LINUX_X86_IBMX40 foxboard ADK_LINUX_CRIS_FOXBOARD -foxg20 ADK_LINUX_ARM_FOXG20 -lemote ADK_LINUX_MIPS64_LEMOTE -ag241 ADK_LINUX_MIPS_AG241 -zaurus ADK_LINUX_XSCALE_ZAURUS -shuttle ADK_LINUX_X86_64_SHUTTLE +foxg20 ADK_LINUX_ARM_FOXG20 +lemote ADK_LINUX_MIPS64_LEMOTE +ag241 ADK_LINUX_MIPS_AG241 +zaurus ADK_LINUX_XSCALE_ZAURUS +shuttle ADK_LINUX_X86_64_SHUTTLE x86_64_rescue ADK_LINUX_X86_64_RESCUE x86_rescue ADK_LINUX_X86_RESCUE mipsel_rescue ADK_LINUX_MIPSEL_RESCUE @@ -23,7 +23,7 @@ ppc_toolchain ADK_LINUX_PPC_TOOLCHAIN sparc_toolchain ADK_LINUX_SPARC_TOOLCHAIN x86_toolchain ADK_LINUX_X86_TOOLCHAIN x86_64_toolchain ADK_LINUX_X86_64_TOOLCHAIN -toolchain ADK_LINUX_ARM_TOOLCHAIN || ADK_LINUX_ARMEL_TOOLCHAIN || ADK_LINUX_MIPS_TOOLCHAIN || ADK_LINUX_MIPSEL_TOOLCHAIN || ADK_LINUX_PPC_TOOLCHAIN || ADK_LINUX_SPARC_TOOLCHAIN || ADK_LINUX_X86_64_TOOLCHAIN || ADK_LINUX_X86_TOOLCHAIN +toolchain ADK_LINUX_ARM_TOOLCHAIN ADK_LINUX_ARMEL_TOOLCHAIN ADK_LINUX_MIPS_TOOLCHAIN ADK_LINUX_MIPSEL_TOOLCHAIN ADK_LINUX_PPC_TOOLCHAIN ADK_LINUX_SPARC_TOOLCHAIN ADK_LINUX_X86_64_TOOLCHAIN ADK_LINUX_X86_TOOLCHAIN arm_qemu ADK_LINUX_ARM_QEMU mips_qemu ADK_LINUX_MIPS_QEMU mipsel_qemu ADK_LINUX_MIPSEL_QEMU @@ -32,9 +32,9 @@ mips64el_qemu ADK_LINUX_MIPS64EL_QEMU cris_qemu ADK_LINUX_CRIS_QEMU x86_qemu ADK_LINUX_X86_QEMU x86_64_qemu ADK_LINUX_X86_64_QEMU -qemu ADK_LINUX_ARM_QEMU || ADK_LINUX_MIPS_QEMU || ADK_LINUX_MIPSEL_QEMU || ADK_LINUX_MIPS64_QEMU || ADK_LINUX_MIPS64EL_QEMU || ADK_LINUX_CRIS_QEMU || ADK_LINUX_X86_QEMU || ADK_LINUX_X86_64_QEMU -rb4xx ADK_LINUX_MIPS_RB4XX -rb532 ADK_LINUX_MIPS_RB532 -routerboard ADK_LINUX_MIPS_RB4XX || ADK_LINUX_MIPS_RB532 -x86 ADK_LINUX_X86_QEMU || ADK_LINUX_X86_RESCUE || ADK_LINUX_X86_ALIX1C || ADK_LINUX_X86_ALIX2D || ADK_LINUX_X86_WRAP || ADK_LINUX_X86_ALIX2D13 || ADK_LINUX_X86_IBMX40 -x86_64 ADK_LINUX_X86_64_QEMU || ADK_LINUX_X86_64_RESCUE || ADK_LINUX_X86_64_SHUTTLE +qemu ADK_LINUX_ARM_QEMU ADK_LINUX_MIPS_QEMU ADK_LINUX_MIPSEL_QEMU ADK_LINUX_MIPS64_QEMU ADK_LINUX_MIPS64EL_QEMU ADK_LINUX_CRIS_QEMU ADK_LINUX_X86_QEMU ADK_LINUX_X86_64_QEMU +rb4xx ADK_LINUX_MIPS_RB4XX +rb532 ADK_LINUX_MIPS_RB532 +routerboard ADK_LINUX_MIPS_RB4XX ADK_LINUX_MIPS_RB532 +x86 ADK_LINUX_X86_QEMU ADK_LINUX_X86_RESCUE ADK_LINUX_X86_ALIX1C ADK_LINUX_X86_ALIX2D ADK_LINUX_X86_WRAP ADK_LINUX_X86_ALIX2D13 ADK_LINUX_X86_IBMX40 +x86_64 ADK_LINUX_X86_64_QEMU ADK_LINUX_X86_64_RESCUE ADK_LINUX_X86_64_SHUTTLE diff --git a/tools/Makefile b/tools/Makefile index 7c5931319..5d0f91872 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -3,7 +3,7 @@ include $(TOPDIR)/rules.mk -TARGETS:=mkcrypt cpio +TARGETS:=adk mkcrypt cpio TARGETS_INSTALL:=$(patsubst %,%-install,$(TARGETS)) TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS)) @@ -12,13 +12,6 @@ compile: install: $(TARGETS_INSTALL) clean: $(TARGETS_CLEAN) -$(TOOLS_BUILD_DIR): - mkdir -p $(TOOLS_BUILD_DIR) - -%-download: - $(TRACE) "tools/$(patsubst %-download,%,$@)/download " - $(MAKE) -C $(patsubst %-download,%,$@) fetch - %-compile: $(TOOLS_BUILD_DIR) $(TRACE) "tools/$(patsubst %-compile,%,$@)/compile " $(MAKE) -C $(patsubst %-compile,%,$@) compile diff --git a/tools/adk/Makefile b/tools/adk/Makefile new file mode 100644 index 000000000..3f2048e68 --- /dev/null +++ b/tools/adk/Makefile @@ -0,0 +1,14 @@ +# This file is part of the OpenADK project. OpenADK is copyrighted +# material, please see the LICENCE file in the top-level directory. + +include $(TOPDIR)/rules.mk + +${TOPDIR}/bin/tools/depmaker: + $(HOSTCC) -o $(TOPDIR)/bin/tools/depmaker depmaker.c + +${TOPDIR}/bin/tools/pkgrebuild: + $(HOSTCC) -o $(TOPDIR)/bin/tools/pkgrebuild pkgrebuild.c strmap.c + +install: ${TOPDIR}/bin/tools/depmaker ${TOPDIR}/bin/tools/pkgrebuild + +include $(TOPDIR)/mk/tools.mk diff --git a/tools/adk/depmaker.c b/tools/adk/depmaker.c new file mode 100644 index 000000000..c0e434590 --- /dev/null +++ b/tools/adk/depmaker.c @@ -0,0 +1,233 @@ +/* + * depmaker - create package/Depends.mk for OpenADK buildsystem + * + * Copyright (C) 2010 Waldemar Brodkorb <wbx@openadk.org> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <ctype.h> +#include <dirent.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <sys/types.h> + +#define MAXLINE 512 +#define MAXPATH 128 + +static int prefix = 0; + +static int check_symbol(char *symbol) { + + FILE *config; + char buf[MAXLINE]; + char *sym; + int ret; + + if ((sym = malloc(strlen(symbol) + 2)) != NULL) + memset(sym, 0, strlen(symbol) + 2); + else { + perror("Can not allocate memory."); + exit(EXIT_FAILURE); + } + + strncat(sym, symbol, strlen(symbol)); + strncat(sym, "=", 1); + if ((config = fopen(".config", "r")) == NULL) { + perror("Can not open file \".config\"."); + exit(EXIT_FAILURE); + } + + ret = 1; + while (fgets(buf, MAXLINE, config) != NULL) { + if (strncmp(buf, sym, strlen(sym)) == 0) + ret = 0; + } + + free(sym); + if (fclose(config) != 0) + perror("Closing file stream failed"); + + return(ret); +} + +/*@null@*/ +static char *parse_line(char *package, char *pkgvar, char *string, int checksym) { + + char *key, *value, *dep, *key_sym, *pkgdeps; + char temp[MAXLINE]; + + string[strlen(string)-1] = '\0'; + if ((key = strtok(string, ":=")) == NULL) { + perror("Can not get key from string."); + exit(EXIT_FAILURE); + } + + if (checksym == 1) { + /* extract symbol */ + if ((key_sym = malloc(MAXLINE)) != NULL) + memset(key_sym, 0, MAXLINE); + else { + perror("Can not allocate memory."); + exit(EXIT_FAILURE); + } + if (snprintf(key_sym, MAXLINE, "ADK_PACKAGE_%s_", pkgvar) < 0) + perror("Can not create string variable."); + + strncat(key_sym, key+6, strlen(key)-6); + if (check_symbol(key_sym) != 0) { + free(key_sym); + return(NULL); + } + free(key_sym); + } + + if ((pkgdeps = malloc(MAXLINE)) != NULL) + memset(pkgdeps, 0, MAXLINE); + else { + perror("Can not allocate memory."); + exit(EXIT_FAILURE); + } + + value = strtok(NULL, "=\t"); + dep = strtok(value, " "); + while (dep != NULL) { + if (prefix == 0) { + prefix = 1; + if (snprintf(temp, MAXLINE, "%s-compile: %s-compile", package, dep) < 0) + perror("Can not create string variable."); + } else { + if (snprintf(temp, MAXLINE, " %s-compile", dep) < 0) + perror("Can not create string variable."); + } + strncat(pkgdeps, temp, strlen(temp)); + dep = strtok(NULL, " "); + } + return(pkgdeps); +} + +int main() { + + DIR *pkgdir; + struct dirent *pkgdirp; + FILE *pkg; + char buf[MAXLINE]; + char path[MAXPATH]; + char *string, *pkgvar, *pkgdeps, *tmp; + int i; + + /* read Makefile's for all packages */ + pkgdir = opendir("package"); + while ((pkgdirp = readdir(pkgdir)) != NULL) { + /* skip dotfiles */ + if (strncmp(pkgdirp->d_name, ".", 1) > 0) { + if (snprintf(path, MAXLINE, "package/%s/Makefile", pkgdirp->d_name) < 0) + perror("Can not create string variable."); + pkg = fopen(path, "r"); + if (pkg == NULL) + continue; + + /* transform to uppercase variable name */ + pkgvar = strndup(pkgdirp->d_name, strlen(pkgdirp->d_name)); + for (i=0; i<(int)strlen(pkgvar); i++) { + if (pkgvar[i] == '+') + pkgvar[i] = 'X'; + if (pkgvar[i] == '-') + pkgvar[i] = '_'; + pkgvar[i] = toupper(pkgvar[i]); + } + + /* exclude manual maintained packages from package/Makefile */ + if (!(strncmp(pkgdirp->d_name, "eglibc", 6) == 0) && + !(strncmp(pkgdirp->d_name, "libc", 4) == 0) && + !(strncmp(pkgdirp->d_name, "libpthread", 10) == 0) && + !(strncmp(pkgdirp->d_name, "uclibc++", 8) == 0) && + !(strncmp(pkgdirp->d_name, "uclibc", 6) == 0) && + !(strncmp(pkgdirp->d_name, "glibc", 5) == 0)) { + /* print result to stdout */ + printf("package-$(ADK_COMPILE_%s) += %s\n", pkgvar, pkgdirp->d_name); + } + + if ((pkgdeps = malloc(MAXLINE)) != NULL) + memset(pkgdeps, 0, MAXLINE); + else { + perror("Can not allocate memory."); + exit(EXIT_FAILURE); + } + prefix = 0; + + /* generate build dependencies */ + while (fgets(buf, MAXLINE, pkg) != NULL) { + if ((tmp = malloc(MAXLINE)) != NULL) + memset(tmp, 0 , MAXLINE); + else { + perror("Can not allocate memory."); + exit(EXIT_FAILURE); + } + + /* just read variables prefixed with PKG */ + if (strncmp(buf, "PKG", 3) == 0) { + + string = strstr(buf, "PKG_BUILDDEP:="); + if (string != NULL) { + tmp = parse_line(pkgdirp->d_name, pkgvar, string, 0); + if (tmp != NULL) { + strncat(pkgdeps, tmp, strlen(tmp)); + } + } + + string = strstr(buf, "PKG_BUILDDEP+="); + if (string != NULL) { + tmp = parse_line(pkgdirp->d_name, pkgvar, string, 0); + if (tmp != NULL) + strncat(pkgdeps, tmp, strlen(tmp)); + } + + string = strstr(buf, "PKGFB_"); + if (string != NULL) { + tmp = parse_line(pkgdirp->d_name, pkgvar, string, 1); + if (tmp != NULL) + strncat(pkgdeps, tmp, strlen(tmp)); + } + + string = strstr(buf, "PKGCB_"); + if (string != NULL) { + tmp = parse_line(pkgdirp->d_name, pkgvar, string, 1); + if (tmp != NULL) + strncat(pkgdeps, tmp, strlen(tmp)); + } + + string = strstr(buf, "PKGSB_"); + if (string != NULL) { + tmp = parse_line(pkgdirp->d_name, pkgvar, string, 1); + if (tmp != NULL) + strncat(pkgdeps, tmp, strlen(tmp)); + } + } + free(tmp); + } + if (strlen(pkgdeps) != 0) + printf("%s\n", pkgdeps); + free(pkgdeps); + free(pkgvar); + if (fclose(pkg) != 0) + perror("Closing file stream failed"); + } + } + if (closedir(pkgdir) != 0) + perror("Closing directory stream failed"); + + return(0); +} diff --git a/tools/adk/pkgmaker.c b/tools/adk/pkgmaker.c new file mode 100644 index 000000000..667707d0b --- /dev/null +++ b/tools/adk/pkgmaker.c @@ -0,0 +1,797 @@ +/* + * pkgmaker - create package meta-data for OpenADK buildsystem + * + * Copyright (C) 2010 Waldemar Brodkorb <wbx@openadk.org> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <ctype.h> +#include <dirent.h> +#include <fcntl.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> +#include <sys/stat.h> +#include <sys/types.h> +#include "sortfile.h" +#include "strmap.h" + +#define MAXLINE 4096 +#define MAXVALUE 168 +#define MAXVAR 64 +#define MAXPATH 320 +#define HASHSZ 32 + +static int nobinpkgs; + +static void fatal_error(const char *message) { + + fprintf(stderr, "Fatal error. %s\n", message); + exit(1); +} + +static int parse_var_hash(char *buf, const char *varname, StrMap *strmap) { + + char *key, *value, *string; + + string = strstr(buf, varname); + if (string != NULL) { + string[strlen(string)-1] = '\0'; + key = strtok(string, ":="); + value = strtok(NULL, "=\t"); + if (value != NULL) + strmap_put(strmap, key, value); + return(0); + } + return(1); +} + +static int parse_var(char *buf, const char *varname, char *pvalue, char **result) { + + char *pkg_var; + char *key, *value, *string; + char pkg_str[MAXVAR]; + + if ((pkg_var = malloc(MAXLINE)) != NULL) + memset(pkg_var, 0, MAXLINE); + else { + perror("Can not allocate memory"); + exit(EXIT_FAILURE); + } + + if (snprintf(pkg_str, MAXVAR, "%s:=", varname) < 0) + perror("can not create path variable."); + string = strstr(buf, pkg_str); + if (string != NULL) { + string[strlen(string)-1] = '\0'; + key = strtok(string, ":="); + value = strtok(NULL, "=\t"); + if (value != NULL) { + strncat(pkg_var, value, strlen(value)); + *result = strdup(pkg_var); + } else { + nobinpkgs = 1; + *result = NULL; + } + free(pkg_var); + return(0); + } else { + if (snprintf(pkg_str, MAXVAR, "%s+=", varname) < 0) + perror("can not create path variable."); + string = strstr(buf, pkg_str); + if (string != NULL) { + string[strlen(string)-1] = '\0'; + key = strtok(string, "+="); + value = strtok(NULL, "=\t"); + if (pvalue != NULL) + strncat(pkg_var, pvalue, strlen(pvalue)); + strncat(pkg_var, " ", 1); + if (value != NULL) + strncat(pkg_var, value, strlen(value)); + *result = strdup(pkg_var); + free(pkg_var); + return(0); + } + } + free(pkg_var); + return(1); +} + +/* +static void iter_debug(const char *key, const char *value, const void *obj) { + fprintf(stderr, "HASHMAP key: %s value: %s\n", key, value); +} +*/ + +static int hash_str(char *string) { + + int i; + int hash; + + hash = 0; + for (i=0; i<(int)strlen(string); i++) { + hash += string[i]; + } + return(hash); +} + +static void iter(const char *key, const char *value, const void *obj) { + + FILE *config, *section; + int hash; + char *valuestr, *pkg, *subpkg; + char buf[MAXPATH]; + char infile[MAXPATH]; + char outfile[MAXPATH]; + + valuestr = strdup(value); + config = fopen("package/Config.in.auto", "a"); + if (config == NULL) + fatal_error("Can not open file package/Config.in.auto"); + + hash = hash_str(valuestr); + snprintf(infile, MAXPATH, "package/pkglist.d/sectionlst.%d", hash); + snprintf(outfile, MAXPATH, "package/pkglist.d/sectionlst.%d.sorted", hash); + + if (access(infile, F_OK) == 0) { + valuestr[strlen(valuestr)-1] = '\0'; + fprintf(config, "menu \"%s\"\n", valuestr); + sortfile(infile, outfile); + /* avoid duplicate section entries */ + unlink(infile); + section = fopen(outfile, "r"); + while (fgets(buf, MAXPATH, section) != NULL) { + buf[strlen(buf)-1] = '\0'; + if (buf[strlen(buf)-1] == '@') { + buf[strlen(buf)-1] = '\0'; + fprintf(config, "source \"package/%s/Config.in.manual\"\n", buf); + } else { + subpkg = strtok(buf, "|"); + pkg = strtok(NULL, "|"); + fprintf(config, "source \"package/pkgconfigs.d/%s/Config.in.%s\"\n", pkg, subpkg); + } + } + fprintf(config, "endmenu\n\n"); + fclose(section); + } + fclose(config); +} + +static char *print_target_depline(char *value, int neg, char *sp, FILE *cfg) { + + char *val; + char *np; + char *sptr; + + sptr = NULL; + np = ""; + val = strdup(value); + /* strtok_r is required here */ + val = strtok_r(val, " ", &sptr); + while (val != NULL) { + if (neg == 1) np = "!"; + fprintf(cfg, "%s%s%s", sp, np, val); + val = strtok_r(NULL, " ", &sptr); + if (neg == 1) + sp = " && "; + else + sp = " || "; + } + return(val); +} + +static char *tolowerstr(char *string) { + + int i; + char *str; + + /* transform to lowercase variable name */ + str = strdup(string); + for (i=0; i<(int)strlen(str); i++) { + if (str[i] == '_') + str[i] = '-'; + str[i] = tolower(str[i]); + } + return(str); +} + +static char *toupperstr(char *string) { + + int i; + char *str; + + /* transform to uppercase variable name */ + str = strdup(string); + for (i=0; i<(int)strlen(str); i++) { + if (str[i] == '+') + str[i] = 'X'; + if (str[i] == '-') + str[i] = '_'; + /* remove negation here, useful for package host depends */ + if (str[i] == '!') + str[i] = '_'; + str[i] = toupper(str[i]); + } + return(str); +} + + +int main() { + + DIR *pkgdir, *pkglistdir; + struct dirent *pkgdirp; + FILE *pkg, *cfg, *target, *menuglobal, *section; + char hvalue[MAXVALUE]; + char buf[MAXPATH]; + char tbuf[MAXPATH]; + char path[MAXPATH]; + char spath[MAXPATH]; + char dir[MAXPATH]; + char variable[2*MAXVAR]; + char *key, *value, *token, *cftoken, *sp, *hkey, *val, *pkg_fd; + char *pkg_name, *pkg_depends, *pkg_section, *pkg_descr, *pkg_url; + char *pkg_cxx, *pkg_subpkgs, *pkg_cfline, *pkg_dflt, *pkg_multi; + char *pkg_host_depends, *pkg_target_depends, *pkg_flavours, *pkg_choices, *pseudo_name; + char *packages, *pkg_name_u, *pkgs; + char *saveptr, *p_ptr, *s_ptr; + int result, neg; + StrMap *pkgmap, *targetmap, *sectionmap; + + pkg_name = NULL; + pkg_descr = NULL; + pkg_section = NULL; + pkg_url = NULL; + pkg_depends = NULL; + pkg_flavours = NULL; + pkg_choices = NULL; + pkg_subpkgs = NULL; + pkg_target_depends = NULL; + pkg_host_depends = NULL; + pkg_cxx = NULL; + pkg_dflt = NULL; + pkg_cfline = NULL; + pkg_multi = NULL; + + p_ptr = NULL; + s_ptr = NULL; + + unlink("package/Config.in.auto"); + /* open global sectionfile */ + menuglobal = fopen("package/Config.in.auto.global", "w"); + if (menuglobal == NULL) + fatal_error("global section file not writable."); + + /* read section list and create a hash table */ + section = fopen("package/section.lst", "r"); + if (section == NULL) + fatal_error("section listfile is missing"); + + sectionmap = strmap_new(HASHSZ); + while (fgets(tbuf, MAXPATH, section) != NULL) { + key = strtok(tbuf, "\t"); + value = strtok(NULL, "\t"); + strmap_put(sectionmap, key, value); + } + fclose(section); + + /* read target list and create a hash table */ + target = fopen("target/target.lst", "r"); + if (target == NULL) + fatal_error("target listfile is missing."); + + targetmap = strmap_new(HASHSZ); + while (fgets(tbuf, MAXPATH, target) != NULL) { + key = strtok(tbuf, "\t"); + value = strtok(NULL, "\t"); + strmap_put(targetmap, key, value); + } + fclose(target); + + if (mkdir("package/pkgconfigs.d", S_IRWXU) > 0) + fatal_error("creation of package/pkgconfigs.d failed."); + if (mkdir("package/pkglist.d", S_IRWXU) > 0) + fatal_error("creation of package/pkglist.d failed."); + + /* read Makefile's for all packages */ + pkgdir = opendir("package"); + while ((pkgdirp = readdir(pkgdir)) != NULL) { + /* skip dotfiles */ + if (strncmp(pkgdirp->d_name, ".", 1) > 0) { + if (snprintf(path, MAXPATH, "package/%s/Makefile", pkgdirp->d_name) < 0) + fatal_error("can not create path variable."); + pkg = fopen(path, "r"); + if (pkg == NULL) + continue; + + /* skip manually maintained packages */ + if (snprintf(path, MAXPATH, "package/%s/Config.in.manual", pkgdirp->d_name) < 0) + fatal_error("can not create path variable."); + if (!access(path, F_OK)) { + while (fgets(buf, MAXPATH, pkg) != NULL) { + if ((parse_var(buf, "PKG_SECTION", NULL, &pkg_section)) == 0) + continue; + } + + memset(hvalue, 0 , MAXVALUE); + result = strmap_get(sectionmap, pkg_section, hvalue, sizeof(hvalue)); + if (result == 1) { + if (snprintf(spath, MAXPATH, "package/pkglist.d/sectionlst.%d", hash_str(hvalue)) < 0) + fatal_error("can not create path variable."); + section = fopen(spath, "a"); + if (section != NULL) { + fprintf(section, "%s@\n", pkgdirp->d_name); + fclose(section); + } + } else + fatal_error("Can not find section description for package."); + + fclose(pkg); + continue; + } + + nobinpkgs = 0; + + /* create output directories */ + if (snprintf(dir, MAXPATH, "package/pkgconfigs.d/%s", pkgdirp->d_name) < 0) + fatal_error("can not create dir variable."); + if (mkdir(dir, S_IRWXU) > 0) + fatal_error("can not create directory."); + + /* allocate memory */ + hkey = malloc(MAXVAR); + memset(hkey, 0, MAXVAR); + memset(variable, 0, 2*MAXVAR); + + pkgmap = strmap_new(HASHSZ); + + /* parse package Makefile */ + while (fgets(buf, MAXPATH, pkg) != NULL) { + /* just read variables prefixed with PKG */ + if (strncmp(buf, "PKG", 3) == 0) { + if ((parse_var(buf, "PKG_NAME", NULL, &pkg_name)) == 0) + continue; + if (pkg_name != NULL) + pkg_name_u = toupperstr(pkg_name); + else + pkg_name_u = toupperstr(pkgdirp->d_name); + + snprintf(variable, MAXVAR, "PKG_CFLINE_%s", pkg_name_u); + if ((parse_var(buf, variable, pkg_cfline, &pkg_cfline)) == 0) + continue; + snprintf(variable, MAXVAR, "PKG_DFLT_%s", pkg_name_u); + if ((parse_var(buf, variable, NULL, &pkg_dflt)) == 0) + continue; + if ((parse_var(buf, "PKG_HOST_DEPENDS", NULL, &pkg_host_depends)) == 0) + continue; + if ((parse_var(buf, "PKG_TARGET_DEPENDS", NULL, &pkg_target_depends)) == 0) + continue; + if ((parse_var(buf, "PKG_DESCR", NULL, &pkg_descr)) == 0) + continue; + if ((parse_var(buf, "PKG_SECTION", NULL, &pkg_section)) == 0) + continue; + if ((parse_var(buf, "PKG_URL", NULL, &pkg_url)) == 0) + continue; + if ((parse_var(buf, "PKG_CXX", NULL, &pkg_cxx)) == 0) + continue; + if ((parse_var(buf, "PKG_MULTI", NULL, &pkg_multi)) == 0) + continue; + if ((parse_var(buf, "PKG_DEPENDS", pkg_depends, &pkg_depends)) == 0) + continue; + if ((parse_var(buf, "PKG_FLAVOURS", pkg_flavours, &pkg_flavours)) == 0) + continue; + if ((parse_var_hash(buf, "PKGFD_", pkgmap)) == 0) + continue; + if ((parse_var_hash(buf, "PKGFS_", pkgmap)) == 0) + continue; + if ((parse_var(buf, "PKG_CHOICES", pkg_choices, &pkg_choices)) == 0) + continue; + if ((parse_var_hash(buf, "PKGCD_", pkgmap)) == 0) + continue; + if ((parse_var_hash(buf, "PKGCS_", pkgmap)) == 0) + continue; + if ((parse_var(buf, "PKG_SUBPKGS", pkg_subpkgs, &pkg_subpkgs)) == 0) + continue; + if ((parse_var_hash(buf, "PKGSD_", pkgmap)) == 0) + continue; + if ((parse_var_hash(buf, "PKGSS_", pkgmap)) == 0) + continue; + if ((parse_var_hash(buf, "PKGSC_", pkgmap)) == 0) + continue; + } + } + + /* end of package Makefile parsing */ + if (fclose(pkg) != 0) + perror("Failed to close file stream for Makefile"); + + /* + if (pkg_name != NULL) + fprintf(stderr, "Package name is %s\n", pkg_name); + if (pkg_section != NULL) + fprintf(stderr, "Package section is %s\n", pkg_section); + if (pkg_descr != NULL) + fprintf(stderr, "Package description is %s\n", pkg_descr); + if (pkg_depends != NULL) + fprintf(stderr, "Package dependencies are %s\n", pkg_depends); + if (pkg_subpkgs != NULL) + fprintf(stderr, "Package subpackages are %s\n", pkg_subpkgs); + if (pkg_flavours != NULL) + fprintf(stderr, "Package flavours are %s\n", pkg_flavours); + if (pkg_choices != NULL) + fprintf(stderr, "Package choices are %s\n", pkg_choices); + if (pkg_url != NULL) + fprintf(stderr, "Package homepage is %s\n", pkg_url); + if (pkg_cfline != NULL) + fprintf(stderr, "Package cfline is %s\n", pkg_cfline); + if (pkg_multi != NULL) + fprintf(stderr, "Package multi is %s\n", pkg_multi); + + strmap_enum(pkgmap, iter_debug, NULL); + */ + + /* generate master source Config.in file */ + if (snprintf(path, MAXPATH, "package/pkgconfigs.d/%s/Config.in", pkgdirp->d_name) < 0) + fatal_error("path variable creation failed."); + fprintf(menuglobal, "source \"%s\"\n", path); + /* recreating file is faster than truncating with w+ */ + unlink(path); + cfg = fopen(path, "w"); + if (cfg == NULL) + continue; + + pkgs = NULL; + if (pkg_subpkgs != NULL) + pkgs = strdup(pkg_subpkgs); + + fprintf(cfg, "config ADK_COMPILE_%s\n", toupperstr(pkgdirp->d_name)); + fprintf(cfg, "\ttristate\n"); + if (nobinpkgs == 0) { + fprintf(cfg, "\tdepends on "); + if (pkgs != NULL) { + if (pkg_multi != NULL) + if (strncmp(pkg_multi, "1", 1) == 0) + fprintf(cfg, "ADK_HAVE_DOT_CONFIG || "); + token = strtok(pkgs, " "); + fprintf(cfg, "ADK_PACKAGE_%s", token); + token = strtok(NULL, " "); + while (token != NULL) { + fprintf(cfg, " || ADK_PACKAGE_%s", token); + token = strtok(NULL, " "); + } + fprintf(cfg, "\n"); + } else { + fprintf(cfg, "ADK_PACKAGE_%s\n", toupperstr(pkgdirp->d_name)); + } + } + //else { + // fprintf(cfg, "\tprompt \"%s\"\n", pkgdirp->d_name); + //} + fprintf(cfg, "\tdefault n\n"); + fclose(cfg); + free(pkgs); + + /* skip packages without binary package output */ + if (nobinpkgs == 1) + continue; + + /* generate binary package specific Config.in files */ + if (pkg_subpkgs != NULL) + packages = tolowerstr(pkg_subpkgs); + else + packages = strdup(pkgdirp->d_name); + + token = strtok_r(packages, " ", &p_ptr); + while (token != NULL) { + strncat(hkey, "PKGSC_", 6); + strncat(hkey, toupperstr(token), strlen(token)); + memset(hvalue, 0 , MAXVALUE); + result = strmap_get(pkgmap, hkey, hvalue, sizeof(hvalue)); + memset(hkey, 0 , MAXVAR); + if (result == 1) + pkg_section = strdup(hvalue); + + strncat(hkey, "PKGSD_", 6); + strncat(hkey, toupperstr(token), strlen(token)); + memset(hvalue, 0 , MAXVALUE); + result = strmap_get(pkgmap, hkey, hvalue, sizeof(hvalue)); + memset(hkey, 0 , MAXVAR); + if (result == 1) + pkg_descr = strdup(hvalue); + + pseudo_name = malloc(MAXLINE); + memset(pseudo_name, 0, MAXLINE); + strncat(pseudo_name, token, strlen(token)); + while (strlen(pseudo_name) < 20) + strncat(pseudo_name, ".", 1); + + if (snprintf(path, MAXPATH, "package/pkgconfigs.d/%s/Config.in.%s", pkgdirp->d_name, token) < 0) + fatal_error("failed to create path variable."); + + /* create temporary section files */ + memset(hvalue, 0 , MAXVALUE); + result = strmap_get(sectionmap, pkg_section, hvalue, sizeof(hvalue)); + if (result == 1) { + if (snprintf(spath, MAXPATH, "package/pkglist.d/sectionlst.%d", hash_str(hvalue)) < 0) + fatal_error("failed to create path variable."); + section = fopen(spath, "a"); + if (section != NULL) { + fprintf(section, "%s|%s\n", token, pkgdirp->d_name); + fclose(section); + } + } else + fatal_error("Can not find section description for package"); + + unlink(path); + cfg = fopen(path, "w"); + if (cfg == NULL) + perror("Can not open Config.in file"); + + fprintf(cfg, "config ADK_PACKAGE_%s\n", toupperstr(token)); + fprintf(cfg, "\tprompt \"%s... %s\"\n", pseudo_name, pkg_descr); + fprintf(cfg, "\ttristate\n"); + + free(pseudo_name); + + /* print custom cf line */ + if (pkg_cfline != NULL) { + cftoken = strtok_r(pkg_cfline, "@", &saveptr); + while (cftoken != NULL) { + fprintf(cfg, "\t%s\n", cftoken); + cftoken = strtok_r(NULL, "@", &saveptr); + } + } + + /* add sub package dependencies */ + strncat(hkey, "PKGSS_", 6); + strncat(hkey, toupperstr(token), strlen(token)); + memset(hvalue, 0, MAXVALUE); + result = strmap_get(pkgmap, hkey, hvalue, sizeof(hvalue)); + if (result == 1) { + val = strtok_r(hvalue, " ", &saveptr); + while (val != NULL) { + fprintf(cfg, "\tselect ADK_PACKAGE_%s\n", toupperstr(val)); + val = strtok_r(NULL, " ", &saveptr); + } + } + memset(hkey, 0, MAXVAR); + + /* create package host dependency information */ + if (pkg_host_depends != NULL) { + token = strtok(pkg_host_depends, " "); + fprintf(cfg, "\tdepends on "); + sp = ""; + while (token != NULL) { + if(strncmp(token, "!", 1) == 0) { + fprintf(cfg, "%s!ADK_HOST%s", sp, toupperstr(token)); + sp = " && "; + } else { + fprintf(cfg, "%sADK_HOST%s", sp, toupperstr(token)); + sp = " || "; + } + token = strtok(NULL, " "); + } + fprintf(cfg, "\n"); + } + + /* create package target dependency information */ + if (pkg_target_depends != NULL) { + token = strtok(pkg_target_depends, " "); + neg = 0; + sp = ""; + fprintf(cfg, "\tdepends on "); + memset(hvalue, 0, MAXVALUE); + while (token != NULL) { + if (strncmp(token, "!", 1) == 0) { + result = strmap_get(targetmap, token+1, hvalue, sizeof(hvalue)); + neg = 1; + } else { + result = strmap_get(targetmap, token, hvalue, sizeof(hvalue)); + } + hvalue[strlen(hvalue)-1] = '\0'; + print_target_depline(hvalue, neg, sp, cfg); + if (neg == 1) + sp = " && "; + else + sp = " || "; + token = strtok(NULL, " "); + } + fprintf(cfg, "\n"); + } + + /* create package dependency information */ + if (pkg_depends != NULL) { + token = strtok(pkg_depends, " "); + while (token != NULL) { + if (strncmp(token, "kmod", 4) == 0) + fprintf(cfg, "\tselect ADK_KPACKAGE_%s\n", toupperstr(token)); + else + fprintf(cfg, "\tselect ADK_PACKAGE_%s\n", toupperstr(token)); + token = strtok(NULL, " "); + } + free(pkg_depends); + pkg_depends = NULL; + } + + fprintf(cfg, "\tselect ADK_COMPILE_%s\n", toupperstr(pkgdirp->d_name)); + + if (pkg_dflt != NULL) + fprintf(cfg, "\tdefault %s\n", pkg_dflt); + else + fprintf(cfg, "\tdefault n\n"); + + fprintf(cfg, "\thelp\n"); + fprintf(cfg, "\t %s\n\n", pkg_descr); + if (pkg_url != NULL) + fprintf(cfg, "\t WWW: %s\n", pkg_url); + + /* handle special C++ packages */ + if (pkg_cxx != NULL) { + fprintf(cfg, "\nchoice\n"); + fprintf(cfg, "prompt \"C++ library to use\"\n"); + fprintf(cfg, "depends on ADK_COMPILE_%s\n\n", toupperstr(pkgdirp->d_name)); + fprintf(cfg, "default ADK_COMPILE_%s_WITH_STDCXX if ADK_TARGET_LIB_GLIBC || ADK_TARGET_LIB_EGLIBC\n", pkg_cxx); + fprintf(cfg, "default ADK_COMPILE_%s_WITH_UCLIBCXX if ADK_TARGET_LIB_UCLIBC\n\n", pkg_cxx); + fprintf(cfg, "config ADK_COMPILE_%s_WITH_STDCXX\n", pkg_cxx); + fprintf(cfg, "\tbool \"GNU C++ library\"\n"); + fprintf(cfg, "\tselect ADK_PACKAGE_LIBSTDCXX\n\n"); + fprintf(cfg, "config ADK_COMPILE_%s_WITH_UCLIBCXX\n", pkg_cxx); + fprintf(cfg, "\tbool \"uClibc++ library\"\n"); + fprintf(cfg, "\tselect ADK_PACKAGE_UCLIBCXX\n\n"); + fprintf(cfg, "endchoice\n"); + free(pkg_cxx); + pkg_cxx = NULL; + } + + /* package flavours */ + if (pkg_flavours != NULL) { + token = strtok(pkg_flavours, " "); + while (token != NULL) { + fprintf(cfg, "\nconfig ADK_PACKAGE_%s_%s\n", toupperstr(pkgdirp->d_name), + toupperstr(token)); + fprintf(cfg, "\tbool "); + strncat(hkey, "PKGFD_", 6); + strncat(hkey, token, strlen(token)); + memset(hvalue, 0 , MAXVALUE); + strmap_get(pkgmap, hkey, hvalue, sizeof(hvalue)); + memset(hkey, 0 , MAXVAR); + pkg_fd = strdup(hvalue); + + fprintf(cfg, "\"%s\"\n", pkg_fd); + fprintf(cfg, "\tdefault n\n"); + fprintf(cfg, "\tdepends on ADK_COMPILE_%s\n", toupperstr(pkgdirp->d_name)); + strncat(hkey, "PKGFS_", 6); + strncat(hkey, token, strlen(token)); + + result = strmap_get(pkgmap, hkey, hvalue, sizeof(hvalue)); + if (result == 1) { + val = strtok_r(hvalue, " ", &saveptr); + while (val != NULL) { + fprintf(cfg, "\tselect ADK_PACKAGE_%s\n", toupperstr(val)); + val = strtok_r(NULL, " ", &saveptr); + } + } + memset(hkey, 0, MAXVAR); + fprintf(cfg, "\thelp\n"); + fprintf(cfg, "\t %s\n", pkg_fd); + token = strtok(NULL, " "); + } + free(pkg_flavours); + pkg_flavours = NULL; + } + + /* package choices */ + if (pkg_choices != NULL) { + fprintf(cfg, "\nchoice\n"); + fprintf(cfg, "prompt \"Package flavour choice\"\n"); + fprintf(cfg, "depends on ADK_COMPILE_%s\n\n", toupperstr(pkgdirp->d_name)); + token = strtok(pkg_choices, " "); + while (token != NULL) { + fprintf(cfg, "config ADK_PACKAGE_%s_%s\n", toupperstr(pkgdirp->d_name), + toupperstr(token)); + + fprintf(cfg, "\tbool "); + strncat(hkey, "PKGCD_", 6); + strncat(hkey, token, strlen(token)); + memset(hvalue, 0 , MAXVALUE); + strmap_get(pkgmap, hkey, hvalue, sizeof(hvalue)); + memset(hkey, 0 , MAXVAR); + fprintf(cfg, "\"%s\"\n", hvalue); + + strncat(hkey, "PKGCS_", 6); + strncat(hkey, token, strlen(token)); + memset(hvalue, 0, MAXVALUE); + result = strmap_get(pkgmap, hkey, hvalue, sizeof(hvalue)); + if (result == 1) { + val = strtok_r(hvalue, " ", &saveptr); + while (val != NULL) { + fprintf(cfg, "\tselect ADK_PACKAGE_%s\n", toupperstr(val)); + val = strtok_r(NULL, " ", &saveptr); + } + } + memset(hkey, 0, MAXVAR); + token = strtok(NULL, " "); + } + fprintf(cfg, "\nendchoice\n"); + free(pkg_choices); + pkg_choices = NULL; + } + /* close file descriptor, parse next package */ + fclose(cfg); + token = strtok_r(NULL, " ", &p_ptr); + } + + /* end of package output generation */ + free(packages); + packages = NULL; + + /* reset flags, free memory */ + free(pkg_name); + free(pkg_descr); + free(pkg_section); + free(pkg_url); + free(pkg_depends); + free(pkg_flavours); + free(pkg_choices); + free(pkg_subpkgs); + free(pkg_target_depends); + free(pkg_host_depends); + free(pkg_cxx); + free(pkg_dflt); + free(pkg_cfline); + free(pkg_multi); + pkg_name = NULL; + pkg_descr = NULL; + pkg_section = NULL; + pkg_url = NULL; + pkg_depends = NULL; + pkg_flavours = NULL; + pkg_choices = NULL; + pkg_subpkgs = NULL; + pkg_target_depends = NULL; + pkg_host_depends = NULL; + pkg_cxx = NULL; + pkg_dflt = NULL; + pkg_cfline = NULL; + pkg_multi = NULL; + + strmap_delete(pkgmap); + nobinpkgs = 0; + free(hkey); + } + } + + + /* create Config.in.auto */ + strmap_enum(sectionmap, iter, NULL); + + strmap_delete(targetmap); + strmap_delete(sectionmap); + fclose(menuglobal); + closedir(pkgdir); + + /* remove temporary section files */ + pkglistdir = opendir("package/pkglist.d"); + while ((pkgdirp = readdir(pkglistdir)) != NULL) { + if (strncmp(pkgdirp->d_name, "sectionlst.", 11) == 0) { + if (snprintf(path, MAXPATH, "package/pkglist.d/%s", pkgdirp->d_name) < 0) + fatal_error("creating path variable failed."); + if (unlink(path) < 0) + fatal_error("removing file failed."); + } + } + closedir(pkglistdir); + return(0); +} diff --git a/tools/adk/pkgrebuild.c b/tools/adk/pkgrebuild.c new file mode 100644 index 000000000..5a8f438c1 --- /dev/null +++ b/tools/adk/pkgrebuild.c @@ -0,0 +1,234 @@ +/* + * pkgrebuild - recognize required package rebuilds in OpenADK + * + * Copyright (C) 2010 Waldemar Brodkorb <wbx@openadk.org> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <ctype.h> +#include <dirent.h> +#include <fcntl.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> +#include <sys/stat.h> +#include <sys/types.h> + +#include "strmap.h" + +StrMap *configmap, *configoldmap, *pkgmap; + +static void iter(const char *key, const char *value, const void *obj) { + fprintf(stderr, "key: %s value: %s\n", key, value); +} + +static void iter_disabled(const char *key, const char *value, const void *obj) { + + char hvalue[256]; + char tfile[256]; + int fd; + + memset(hvalue, 0, 256); + if (strmap_exists(configmap, key) == 0) { + //fprintf(stderr, "disabled variables: %s\n", key); + if (strmap_get(pkgmap, key, hvalue, sizeof(hvalue)) == 1) { + //fprintf(stderr, "Symbol is a flavour/choice: %s\n", hvalue); + if (snprintf(tfile, 256, ".rebuild.%s", hvalue) < 0) + perror("can not create file variable."); + fd = open(tfile, O_RDWR | O_CREAT); + close(fd); + } + } + +} + +static void iter_enabled(const char *key, const char *value, const void *obj) { + + char hvalue[256]; + char tfile[256]; + int fd; + + memset(hvalue, 0, 256); + if (strmap_exists(configoldmap, key) == 0) { + //fprintf(stderr, "enabled variables: %s\n", key); + if (strmap_get(pkgmap, key, hvalue, sizeof(hvalue)) == 1) { + //fprintf(stderr, "Symbol is a flavour/choice\n"); + if (snprintf(tfile, 256, ".rebuild.%s", hvalue) < 0) + perror("can not create file variable."); + fd = open(tfile, O_RDWR | O_CREAT); + close(fd); + } + } +} + +static char *toupperstr(char *string) { + + int i; + char *str; + + /* transform to uppercase variable name */ + str = strdup(string); + for (i=0; i<(int)strlen(str); i++) { + if (str[i] == '+') + str[i] = 'X'; + if (str[i] == '-') + str[i] = '_'; + str[i] = toupper(str[i]); + } + return(str); +} + + + +int main() { + + FILE *config, *configold, *pkg; + char *key, *value, *string, *token; + char *pkg_name, *keystr; + char buf[128]; + char path[320]; + char pbuf[320]; + DIR *pkgdir; + struct dirent *pkgdirp; + + pkg_name = NULL; + /* read Makefile's for all packages */ + pkgmap = strmap_new(1024); + pkgdir = opendir("package"); + while ((pkgdirp = readdir(pkgdir)) != NULL) { + /* skip dotfiles */ + if (strncmp(pkgdirp->d_name, ".", 1) > 0) { + if (snprintf(path, 320, "package/%s/Makefile", pkgdirp->d_name) < 0) + perror("can not create path variable."); + pkg = fopen(path, "r"); + if (pkg == NULL) + continue; + + while (fgets(pbuf, 320, pkg) != NULL) { + if (strncmp(pbuf, "PKG", 3) == 0) { + string = strstr(pbuf, "PKG_NAME:="); + if (string != NULL) { + string[strlen(string)-1] = '\0'; + key = strtok(string, ":="); + value = strtok(NULL, "=\t"); + if (value != NULL) + pkg_name = strdup(value); + } + string = strstr(pbuf, "PKG_FLAVOURS:="); + if (string != NULL) { + string[strlen(string)-1] = '\0'; + key = strtok(string, ":="); + value = strtok(NULL, "=\t"); + token = strtok(value, " "); + while (token != NULL) { + keystr = malloc(256); + memset(keystr, 0, 256); + strncat(keystr, "ADK_PACKAGE_", 12); + strncat(keystr, toupperstr(pkg_name), strlen(pkg_name)); + strncat(keystr, "_", 1); + strncat(keystr, token, strlen(token)); + strmap_put(pkgmap, keystr, pkgdirp->d_name); + token = strtok(NULL, " "); + free(keystr); + keystr = NULL; + } + } + string = strstr(pbuf, "PKG_CHOICES:="); + if (string != NULL) { + string[strlen(string)-1] = '\0'; + key = strtok(string, ":="); + value = strtok(NULL, "=\t"); + token = strtok(value, " "); + while (token != NULL) { + keystr = malloc(256); + memset(keystr, 0, 256); + strncat(keystr, "ADK_PACKAGE_", 12); + strncat(keystr, toupperstr(pkg_name), strlen(pkg_name)); + strncat(keystr, "_", 1); + strncat(keystr, token, strlen(token)); + strmap_put(pkgmap, keystr, pkgdirp->d_name); + token = strtok(NULL, " "); + free(keystr); + keystr = NULL; + } + } + string = strstr(pbuf, "PKG_FLAVOURS+="); + if (string != NULL) { + string[strlen(string)-1] = '\0'; + key = strtok(string, "+="); + value = strtok(NULL, "=\t"); + token = strtok(value, " "); + while (token != NULL) { + keystr = malloc(256); + memset(keystr, 0, 256); + strncat(keystr, "ADK_PACKAGE_", 12); + strncat(keystr, toupperstr(pkg_name), strlen(pkg_name)); + strncat(keystr, "_", 1); + strncat(keystr, token, strlen(token)); + strmap_put(pkgmap, keystr, pkgdirp->d_name); + token = strtok(NULL, " "); + free(keystr); + keystr = NULL; + } + } + } + } + fclose(pkg); + } + } + closedir(pkgdir); + + config = fopen(".config", "r"); + if (config == NULL) + perror(".config is missing."); + + configmap = strmap_new(1024); + while (fgets(buf, 128, config) != NULL) { + if (strncmp(buf, "ADK_PACKAGE", 11) == 0) { + key = strtok(buf, "="); + value = strtok(NULL, "="); + strmap_put(configmap, key, value); + } + } + fclose(config); + + configold = fopen(".config.old", "r"); + if (configold == NULL) + perror(".config.old is missing."); + + configoldmap = strmap_new(1024); + while (fgets(buf, 128, configold) != NULL) { + if (strncmp(buf, "ADK_PACKAGE", 11) == 0) { + key = strtok(buf, "="); + value = strtok(NULL, "="); + strmap_put(configoldmap, key, value); + } + } + fclose(configold); + + //fprintf(stdout, "Config Count: %d\n", strmap_get_count(configmap)); + //fprintf(stdout, "Config Old Count: %d\n", strmap_get_count(configoldmap)); + + strmap_enum(configoldmap, iter_disabled, NULL); + strmap_enum(configmap, iter_enabled, NULL); + //strmap_enum(pkgmap, iter, NULL); + + strmap_delete(pkgmap); + strmap_delete(configmap); + strmap_delete(configoldmap); + + return(0); +} diff --git a/tools/adk/sortfile.c b/tools/adk/sortfile.c new file mode 100644 index 000000000..1e9fc9623 --- /dev/null +++ b/tools/adk/sortfile.c @@ -0,0 +1,153 @@ +/*- + * Copyright (c) 2010 + * Thorsten Glaser <tg@mirbsd.org> + * + * Provided that these terms and disclaimer and all copyright notices + * are retained or reproduced in an accompanying document, permission + * is granted to deal in this work without restriction, including un- + * limited rights to use, publicly perform, distribute, sell, modify, + * merge, give away, or sublicence. + * + * This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to + * the utmost extent permitted by applicable law, neither express nor + * implied; without malicious intent or gross negligence. In no event + * may a licensor, author or contributor be held liable for indirect, + * direct, other damage, loss, or other issues arising in any way out + * of dealing in the work, even if advised of the possibility of such + * damage or existence of a defect, except proven that it results out + * of said person's immediate fault when using the work as intended. + */ + +#include <sys/types.h> +#include <sys/mman.h> +#include <sys/stat.h> +#include <err.h> +#include <fcntl.h> +#include <limits.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +struct ptrsize { + const char *ptr; + size_t size; +}; + +static void *xrecalloc(void *, size_t, size_t); +static int cmpfn(const void *, const void *); + +#define MUL_NO_OVERFLOW (1UL << (sizeof (size_t) * 8 / 2)) + +#ifndef SIZE_MAX +#ifdef SIZE_T_MAX +#define SIZE_MAX SIZE_T_MAX +#else +#define SIZE_MAX ((size_t)-1) +#endif +#endif + +#if !defined(MAP_FAILED) +/* XXX imake style */ +# if defined(__linux) +#define MAP_FAILED ((void *)-1) +# elif defined(__bsdi__) || defined(__osf__) || defined(__ultrix) +#define MAP_FAILED ((caddr_t)-1) +# endif +#endif + +static void * +xrecalloc(void *ptr, size_t nmemb, size_t size) +{ + void *rv; + + if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && + nmemb > 0 && SIZE_MAX / nmemb < size) + errx(1, "attempted integer overflow: %zu * %zu", nmemb, size); + size *= nmemb; + if ((rv = realloc(ptr, size)) == NULL) + err(1, "cannot allocate %zu bytes", size); + return (rv); +} + +int +sortfile(char *infile, char *outfile) +{ + int fd, fdout; + size_t fsz, asz, anents; + char *cp, *thefile, *endfile; + struct ptrsize *thearray; + + if ((fd = open(infile, O_RDONLY)) < 0) + err(1, "open: %s", infile); + else { + struct stat sb; + + /* reasonable maximum size: 3/4 of SIZE_MAX */ + fsz = (SIZE_MAX / 2) + (SIZE_MAX / 4); + + if (fstat(fd, &sb)) + err(1, "stat: %s", infile); + if (sb.st_size > fsz) + errx(1, "file %s too big, %llu > %zu", infile, + (unsigned long long)sb.st_size, fsz); + fsz = (size_t)sb.st_size; + } + + if ((thefile = mmap(NULL, fsz, PROT_READ, MAP_FILE | MAP_PRIVATE, + fd, (off_t)0)) == MAP_FAILED) + err(1, "mmap %zu bytes from %s", fsz, infile); + /* last valid byte in the file, must be newline anyway */ + endfile = thefile + fsz - 1; + + thearray = xrecalloc(NULL, (asz = 8), sizeof(thearray[0])); + thearray[(anents = 0)].ptr = cp = thefile; + + while ((cp = memchr(cp, '\n', endfile - cp)) != NULL) { + /* byte after the \n */ + if (++cp > endfile) + /* end of file */ + break; + thearray[anents].size = cp - thearray[anents].ptr; + if (++anents == asz) + /* resize array */ + thearray = xrecalloc(thearray, (asz <<= 1), + sizeof(thearray[0])); + thearray[anents].ptr = cp; + } + thearray[anents].size = endfile - thearray[anents].ptr + 1; + + qsort(thearray, ++anents, sizeof(thearray[0]), cmpfn); + + if ((fdout = open(outfile, O_WRONLY | O_CREAT, S_IRWXU)) < 0) + err(1, "open: %s", outfile); + else { + for (asz = 0; asz < anents; ++asz) + if ((size_t)write(fdout, thearray[asz].ptr, + thearray[asz].size) != thearray[asz].size) + err(1, "write %zu bytes", thearray[asz].size); + } + + if (munmap(thefile, fsz)) + warn("munmap"); + + free(thearray); + close(fd); + + return (0); +} + +static int +cmpfn(const void *p1, const void *p2) +{ + int rv; + const struct ptrsize *a1 = (const struct ptrsize *)p1; + const struct ptrsize *a2 = (const struct ptrsize *)p2; + + if ((rv = memcmp(a1->ptr, a2->ptr, (a1->size > a2->size ? + a2->size : a1->size) - /* '\n' */ 1)) != 0) + /* unequal in the common part */ + return (rv); + + /* shorter string is smaller */ + return (a1->size > a2->size ? 1 : a1->size == a2->size ? 0 : -1); +} diff --git a/tools/adk/sortfile.h b/tools/adk/sortfile.h new file mode 100644 index 000000000..c54294e69 --- /dev/null +++ b/tools/adk/sortfile.h @@ -0,0 +1 @@ +int sortfile(char *infile, char *outfile); diff --git a/tools/adk/strmap.c b/tools/adk/strmap.c new file mode 100644 index 000000000..f2c660e1f --- /dev/null +++ b/tools/adk/strmap.c @@ -0,0 +1,510 @@ +/*
+ * strmap version 1.0.0
+ *
+ * ANSI C hash table for strings.
+ *
+ * strmap.c
+ *
+ * Copyright (c) 2009 Per Ola Kristensson.
+ *
+ * Per Ola Kristensson <pok21@cam.ac.uk>
+ * Inference Group, Department of Physics
+ * University of Cambridge
+ * Cavendish Laboratory
+ * JJ Thomson Avenue
+ * CB3 0HE Cambridge
+ * United Kingdom
+ *
+ * strmap is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * strmap is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with strmap. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "strmap.h"
+
+typedef struct Pair Pair;
+
+typedef struct Bucket Bucket;
+
+struct Pair {
+ char *key;
+ char *value;
+};
+
+struct Bucket {
+ unsigned int count;
+ Pair *pairs;
+};
+
+struct StrMap {
+ unsigned int count;
+ Bucket *buckets;
+};
+
+static Pair * get_pair(Bucket *bucket, const char *key);
+static unsigned long hash(const char *str);
+
+StrMap * strmap_new(unsigned int capacity)
+{
+ StrMap *map;
+
+ map = malloc(sizeof(StrMap));
+ if (map == NULL) {
+ return NULL;
+ }
+ map->count = capacity;
+ map->buckets = malloc(map->count * sizeof(Bucket));
+ if (map->buckets == NULL) {
+ free(map);
+ return NULL;
+ }
+ memset(map->buckets, 0, map->count * sizeof(Bucket));
+ return map;
+}
+
+void strmap_delete(StrMap *map)
+{
+ unsigned int i, j, n, m;
+ Bucket *bucket;
+ Pair *pair;
+
+ if (map == NULL) {
+ return;
+ }
+ n = map->count;
+ bucket = map->buckets;
+ i = 0;
+ while (i < n) {
+ m = bucket->count;
+ pair = bucket->pairs;
+ j = 0;
+ while(j < m) {
+ free(pair->key);
+ free(pair->value);
+ pair++;
+ j++;
+ }
+ free(bucket->pairs);
+ bucket++;
+ i++;
+ }
+ free(map->buckets);
+ free(map);
+}
+
+int strmap_get(const StrMap *map, const char *key, char *out_buf, unsigned int n_out_buf)
+{
+ unsigned int index;
+ Bucket *bucket;
+ Pair *pair;
+
+ if (map == NULL) {
+ return 0;
+ }
+ if (key == NULL) {
+ return 0;
+ }
+ index = hash(key) % map->count;
+ bucket = &(map->buckets[index]);
+ pair = get_pair(bucket, key);
+ if (pair == NULL) {
+ return 0;
+ }
+ if (out_buf == NULL && n_out_buf == 0) {
+ return strlen(pair->value) + 1;
+ }
+ if (out_buf == NULL) {
+ return 0;
+ }
+ if (strlen(pair->value) >= n_out_buf) {
+ return 0;
+ }
+ strcpy(out_buf, pair->value);
+ return 1;
+}
+
+int strmap_exists(const StrMap *map, const char *key)
+{
+ unsigned int index;
+ Bucket *bucket;
+ Pair *pair;
+
+ if (map == NULL) {
+ return 0;
+ }
+ if (key == NULL) {
+ return 0;
+ }
+ index = hash(key) % map->count;
+ bucket = &(map->buckets[index]);
+ pair = get_pair(bucket, key);
+ if (pair == NULL) {
+ return 0;
+ }
+ return 1;
+}
+
+int strmap_put(StrMap *map, const char *key, const char *value)
+{
+ unsigned int key_len, value_len, index;
+ Bucket *bucket;
+ Pair *tmp_pairs, *pair;
+ char *tmp_value;
+ char *new_key, *new_value;
+
+ if (map == NULL) {
+ return 0;
+ }
+ if (key == NULL || value == NULL) {
+ return 0;
+ }
+ key_len = strlen(key);
+ value_len = strlen(value);
+ /* Get a pointer to the bucket the key string hashes to */
+ index = hash(key) % map->count;
+ bucket = &(map->buckets[index]);
+ /* Check if we can handle insertion by simply replacing
+ * an existing value in a key-value pair in the bucket.
+ */
+ if ((pair = get_pair(bucket, key)) != NULL) {
+ /* The bucket contains a pair that matches the provided key,
+ * change the value for that pair to the new value.
+ */
+ if (strlen(pair->value) < value_len) {
+ /* If the new value is larger than the old value, re-allocate
+ * space for the new larger value.
+ */
+ tmp_value = realloc(pair->value, (value_len + 1) * sizeof(char));
+ if (tmp_value == NULL) {
+ return 0;
+ }
+ pair->value = tmp_value;
+ }
+ /* Copy the new value into the pair that matches the key */
+ strcpy(pair->value, value);
+ return 1;
+ }
+ /* Allocate space for a new key and value */
+ new_key = malloc((key_len + 1) * sizeof(char));
+ if (new_key == NULL) {
+ return 0;
+ }
+ new_value = malloc((value_len + 1) * sizeof(char));
+ if (new_value == NULL) {
+ free(new_key);
+ return 0;
+ }
+ /* Create a key-value pair */
+ if (bucket->count == 0) {
+ /* The bucket is empty, lazily allocate space for a single
+ * key-value pair.
+ */
+ bucket->pairs = malloc(sizeof(Pair));
+ if (bucket->pairs == NULL) {
+ free(new_key);
+ free(new_value);
+ return 0;
+ }
+ bucket->count = 1;
+ }
+ else {
+ /* The bucket wasn't empty but no pair existed that matches the provided
+ * key, so create a new key-value pair.
+ */
+ tmp_pairs = realloc(bucket->pairs, (bucket->count + 1) * sizeof(Pair));
+ if (tmp_pairs == NULL) {
+ free(new_key);
+ free(new_value);
+ return 0;
+ }
+ bucket->pairs = tmp_pairs;
+ bucket->count++;
+ }
+ /* Get the last pair in the chain for the bucket */
+ pair = &(bucket->pairs[bucket->count - 1]);
+ pair->key = new_key;
+ pair->value = new_value;
+ /* Copy the key and its value into the key-value pair */
+ strcpy(pair->key, key);
+ strcpy(pair->value, value);
+ return 1;
+}
+
+int strmap_get_count(const StrMap *map)
+{
+ unsigned int i, j, n, m;
+ unsigned int count;
+ Bucket *bucket;
+ Pair *pair;
+
+ if (map == NULL) {
+ return 0;
+ }
+ bucket = map->buckets;
+ n = map->count;
+ i = 0;
+ count = 0;
+ while (i < n) {
+ pair = bucket->pairs;
+ m = bucket->count;
+ j = 0;
+ while (j < m) {
+ count++;
+ pair++;
+ j++;
+ }
+ bucket++;
+ i++;
+ }
+ return count;
+}
+
+int strmap_enum(const StrMap *map, strmap_enum_func enum_func, const void *obj)
+{
+ unsigned int i, j, n, m;
+ Bucket *bucket;
+ Pair *pair;
+
+ if (map == NULL) {
+ return 0;
+ }
+ if (enum_func == NULL) {
+ return 0;
+ }
+ bucket = map->buckets;
+ n = map->count;
+ i = 0;
+ while (i < n) {
+ pair = bucket->pairs;
+ m = bucket->count;
+ j = 0;
+ while (j < m) {
+ enum_func(pair->key, pair->value, obj);
+ pair++;
+ j++;
+ }
+ bucket++;
+ i++;
+ }
+ return 1;
+}
+
+/*
+ * Returns a pair from the bucket that matches the provided key,
+ * or null if no such pair exist.
+ */
+static Pair * get_pair(Bucket *bucket, const char *key)
+{
+ unsigned int i, n;
+ Pair *pair;
+
+ n = bucket->count;
+ if (n == 0) {
+ return NULL;
+ }
+ pair = bucket->pairs;
+ i = 0;
+ while (i < n) {
+ if (pair->key != NULL && pair->value != NULL) {
+ if (strcmp(pair->key, key) == 0) {
+ return pair;
+ }
+ }
+ pair++;
+ i++;
+ }
+ return NULL;
+}
+
+/*
+ * Returns a hash code for the provided string.
+ */
+static unsigned long hash(const char *str)
+{
+ unsigned long hash = 5381;
+ int c;
+ c = 0;
+
+ while (c == *str++) {
+ hash = ((hash << 5) + hash) + c;
+ }
+ return hash;
+}
+
+/*
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
+
+*/
diff --git a/tools/adk/strmap.h b/tools/adk/strmap.h new file mode 100644 index 000000000..99687b236 --- /dev/null +++ b/tools/adk/strmap.h @@ -0,0 +1,350 @@ +/*
+ * strmap version 1.0.0
+ *
+ * ANSI C hash table for strings.
+ *
+ * strmap.h
+ *
+ * Copyright (c) 2009 Per Ola Kristensson.
+ *
+ * Per Ola Kristensson <pok21@cam.ac.uk>
+ * Inference Group, Department of Physics
+ * University of Cambridge
+ * Cavendish Laboratory
+ * JJ Thomson Avenue
+ * CB3 0HE Cambridge
+ * United Kingdom
+ *
+ * strmap is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * strmap is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with strmap. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef _STRMAP_H_
+#define _STRMAP_H_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+
+typedef struct StrMap StrMap;
+
+/*
+ * This callback function is called once per key-value when enumerating
+ * all keys associated to values.
+ *
+ * Parameters:
+ *
+ * key: A pointer to a null-terminated C string. The string must not
+ * be modified by the client.
+ *
+ * value: A pointer to a null-terminated C string. The string must
+ * not be modified by the client.
+ *
+ * obj: A pointer to a client-specific object. This parameter may be
+ * null.
+ *
+ * Return value: None.
+ */
+typedef void(*strmap_enum_func)(const char *key, const char *value, const void *obj);
+
+/*
+ * Creates a string map.
+ *
+ * Parameters:
+ *
+ * capacity: The number of top-level slots this string map
+ * should allocate. This parameter must be > 0.
+ *
+ * Return value: A pointer to a string map object,
+ * or null if a new string map could not be allocated.
+ */
+StrMap * strmap_new(unsigned int capacity);
+
+/*
+ * Releases all memory held by a string map object.
+ *
+ * Parameters:
+ *
+ * map: A pointer to a string map. This parameter cannot be null.
+ * If the supplied string map has been previously released, the
+ * behaviour of this function is undefined.
+ *
+ * Return value: None.
+ */
+void strmap_delete(StrMap *map);
+
+/*
+ * Returns the value associated with the supplied key.
+ *
+ * Parameters:
+ *
+ * map: A pointer to a string map. This parameter cannot be null.
+ *
+ * key: A pointer to a null-terminated C string. This parameter cannot
+ * be null.
+ *
+ * out_buf: A pointer to an output buffer which will contain the value,
+ * if it exists and fits into the buffer.
+ *
+ * n_out_buf: The size of the output buffer in bytes.
+ *
+ * Return value: If out_buf is set to null and n_out_buf is set to 0 the return
+ * value will be the number of bytes required to store the value (if it exists)
+ * and its null-terminator. For all other parameter configurations the return value
+ * is 1 if an associated value was found and completely copied into the output buffer,
+ * 0 otherwise.
+ */
+int strmap_get(const StrMap *map, const char *key, char *out_buf, unsigned int n_out_buf);
+
+/*
+ * Queries the existence of a key.
+ *
+ * Parameters:
+ *
+ * map: A pointer to a string map. This parameter cannot be null.
+ *
+ * key: A pointer to a null-terminated C string. This parameter cannot
+ * be null.
+ *
+ * Return value: 1 if the key exists, 0 otherwise.
+ */
+int strmap_exists(const StrMap *map, const char *key);
+
+/*
+ * Associates a value with the supplied key. If the key is already
+ * associated with a value, the previous value is replaced.
+ *
+ * Parameters:
+ *
+ * map: A pointer to a string map. This parameter cannot be null.
+ *
+ * key: A pointer to a null-terminated C string. This parameter
+ * cannot be null. The string must have a string length > 0. The
+ * string will be copied.
+ *
+ * value: A pointer to a null-terminated C string. This parameter
+ * cannot be null. The string must have a string length > 0. The
+ * string will be copied.
+ *
+ * Return value: 1 if the association succeeded, 0 otherwise.
+ */
+int strmap_put(StrMap *map, const char *key, const char *value);
+
+/*
+ * Returns the number of associations between keys and values.
+ *
+ * Parameters:
+ *
+ * map: A pointer to a string map. This parameter cannot be null.
+ *
+ * Return value: The number of associations between keys and values.
+ */
+int strmap_get_count(const StrMap *map);
+
+/*
+ * Enumerates all associations between keys and values.
+ *
+ * Parameters:
+ *
+ * map: A pointer to a string map. This parameter cannot be null.
+ *
+ * enum_func: A pointer to a callback function that will be
+ * called by this procedure once for every key associated
+ * with a value. This parameter cannot be null.
+ *
+ * obj: A pointer to a client-specific object. This parameter will be
+ * passed back to the client's callback function. This parameter can
+ * be null.
+ *
+ * Return value: 1 if enumeration completed, 0 otherwise.
+ */
+int strmap_enum(const StrMap *map, strmap_enum_func enum_func, const void *obj);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/*
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
+
+*/
diff --git a/tools/cpio/Makefile b/tools/cpio/Makefile index d14fb56df..142f65b70 100644 --- a/tools/cpio/Makefile +++ b/tools/cpio/Makefile @@ -27,9 +27,9 @@ SRCS+= \ src/nonpax.c \ src/cpio.c -${STAGING_TOOLS}/bin/cpio: ${SRCS} - ${HOSTCC} ${HOSTCFLAGS} -D_GNU_SOURCE -Isrc -o $@ $^ +${TOPDIR}/bin/tools/cpio: ${SRCS} + @${HOSTCC} ${HOSTCFLAGS} -D_GNU_SOURCE -Isrc -o $@ $^ -install: ${STAGING_TOOLS}/bin/cpio +install: ${TOPDIR}/bin/tools/cpio include $(TOPDIR)/mk/tools.mk diff --git a/tools/cpio/src/cpio.c b/tools/cpio/src/cpio.c index d91f25dc1..cf9cb0ef8 100644 --- a/tools/cpio/src/cpio.c +++ b/tools/cpio/src/cpio.c @@ -1000,7 +1000,7 @@ main(int argc, char **argv) prdot(1); if (pax != PAX_TYPE_CPIO) pax_onexit(); - fprintf(stderr, "%llu blocks\n", blocks + ((bytes + 0777) >> 9)); + //fprintf(stderr, "%llu blocks\n", blocks + ((bytes + 0777) >> 9)); mclose(); if (errcnt && sysv3 == 0) fprintf(stderr, "%llu error(s)\n", errcnt); diff --git a/tools/mkcrypt/Makefile b/tools/mkcrypt/Makefile index 3b1924c5b..4baf56c44 100644 --- a/tools/mkcrypt/Makefile +++ b/tools/mkcrypt/Makefile @@ -3,9 +3,9 @@ include $(TOPDIR)/rules.mk -${STAGING_TOOLS}/bin/mkcrypt: - $(HOSTCC) -o $(STAGING_TOOLS)/bin/mkcrypt mkcrypt.c +${TOPDIR}/bin/tools/mkcrypt: + $(HOSTCC) -o $(TOPDIR)/bin/tools/mkcrypt mkcrypt.c -install: ${STAGING_TOOLS}/bin/mkcrypt +install: ${TOPDIR}/bin/tools/mkcrypt include $(TOPDIR)/mk/tools.mk |