├── README.md ├── build.prop ├── colours ├── README.md ├── blk111inc.png ├── blu001inc.png ├── grn010inc.png └── red100inc.png ├── copy ├── delete ├── fs ├── JournalingDisabler.zip ├── JournalingDisabler │ ├── META-INF │ │ └── com │ │ │ └── google │ │ │ └── android │ │ │ ├── update-binary │ │ │ └── updater-script │ └── tools │ │ ├── journaldisable │ │ └── tune2fs ├── JournalingEnabler.zip ├── JournalingEnabler │ ├── META-INF │ │ └── com │ │ │ └── google │ │ │ └── android │ │ │ ├── update-binary │ │ │ └── updater-script │ └── tools │ │ ├── enablejournal │ │ └── tune2fs └── README.md ├── ftxxxx_ts.idc ├── init ├── 31devices.sh ├── 81log.sh ├── 98sdcard_perm.sh └── README.md ├── keyboard ├── README.md ├── keyboard_arrows ├── keyboard_fn └── keyboard_theme ├── monitor ├── README.md ├── bcmdhd_enable_monitor.patch ├── chanswitch.sh ├── dismon.sh ├── monitor.sh ├── nexmon.patch └── rfa_bcmon │ ├── bcmon_scripts_activate.sh │ ├── bcmon_scripts_stop.sh │ └── bcmon_scripts_warmup.sh ├── virt_key ├── README.md ├── filters ├── virt-key └── virtual_keyboard2.c └── zooper ├── README.md ├── background ├── batterybar.zw ├── clockbar.zw ├── ip.zw ├── screenshot.png └── sysinfo.zw /README.md: -------------------------------------------------------------------------------- 1 | # misc 2 | Random bits and pieces from random sources. 3 | More or less a backup of the things I always lose or forget 4 | -------------------------------------------------------------------------------- /build.prop: -------------------------------------------------------------------------------- 1 | debug.sf.nobootanimation=1 -------------------------------------------------------------------------------- /colours/README.md: -------------------------------------------------------------------------------- 1 | test images -------------------------------------------------------------------------------- /colours/blk111inc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruleh/misc/195da372ce3cfd15f1ba61ce8d02a1b8cf8d9941/colours/blk111inc.png -------------------------------------------------------------------------------- /colours/blu001inc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruleh/misc/195da372ce3cfd15f1ba61ce8d02a1b8cf8d9941/colours/blu001inc.png -------------------------------------------------------------------------------- /colours/grn010inc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruleh/misc/195da372ce3cfd15f1ba61ce8d02a1b8cf8d9941/colours/grn010inc.png -------------------------------------------------------------------------------- /colours/red100inc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruleh/misc/195da372ce3cfd15f1ba61ce8d02a1b8cf8d9941/colours/red100inc.png -------------------------------------------------------------------------------- /copy: -------------------------------------------------------------------------------- 1 | #copy files from one directory into another one 2 | export ORIG= 3 | export DEST= 4 | 5 | #cp 6 | cp -al $ORIG/* -t $DEST 7 | cp -alr $ORIG/* -t $DEST 8 | 9 | #rsync 10 | rsync -av $ORIG/ $DEST 11 | rsync -avz $ORIG/ $DEST 12 | 13 | #tar 14 | cd $ORIG 15 | bsdtar cf - . | 16 | pv -trab -B 500M | 17 | (cd $DEST && bsdtar xpSf -) 18 | -------------------------------------------------------------------------------- /delete: -------------------------------------------------------------------------------- 1 | #delete files in a directory 2 | export DELDIR= 3 | export TMPDIR=tmp 4 | 5 | #rm 6 | rm -rf ./$DELDIR 7 | 8 | #rsync 9 | mkdir $TMPDIR 10 | rsync -a --delete $TMPDIR/ $DELDIR/ 11 | rm $TMPDIR 12 | 13 | #perl 14 | cd $DELDIR 15 | perl -e 'for(<*>){((stat)[9]<(unlink))}' 16 | cd .. 17 | rm $DELDIR 18 | -------------------------------------------------------------------------------- /fs/JournalingDisabler.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruleh/misc/195da372ce3cfd15f1ba61ce8d02a1b8cf8d9941/fs/JournalingDisabler.zip -------------------------------------------------------------------------------- /fs/JournalingDisabler/META-INF/com/google/android/update-binary: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruleh/misc/195da372ce3cfd15f1ba61ce8d02a1b8cf8d9941/fs/JournalingDisabler/META-INF/com/google/android/update-binary -------------------------------------------------------------------------------- /fs/JournalingDisabler/META-INF/com/google/android/updater-script: -------------------------------------------------------------------------------- 1 | ui_print("Disabling Journaling.."); 2 | ui_print("Extracting tools..."); 3 | mount("ext4", "EMMC", "/dev/block/stl12", "/system"); 4 | mount("ext4", "EMMC", "/dev/block/stl13", "/data"); 5 | mount("ext4", "EMMC", "/dev/block/stl14", "/cache"); 6 | package_extract_file("tools/tune2fs", "/data/tune2fs"); 7 | package_extract_file("tools/journaldisable", "/data/journaldisable"); 8 | set_perm(0, 0, 0755, "/data/tune2fs"); 9 | set_perm(0, 0, 0755, "/data/journaldisable"); 10 | run_program("/sbin/busybox", "sh", "/data/journaldisable"); 11 | ui_print("Journaling is disabled..."); 12 | ui_print("Please Reboot"); -------------------------------------------------------------------------------- /fs/JournalingDisabler/tools/journaldisable: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo ***************Log Start*************** 3 | mkdir /sdcard/tmp 4 | cp /data/tune2fs /sdcard/tmp 5 | cp /data/journaldisable /sdcard/tmp 6 | /sbin/busybox mount -o remount,rw rootfs / 7 | /sbin/busybox rm /sdcard/journaldisable.log 8 | /sbin/busybox mkdir /etc 9 | cat /proc/mounts > /etc/mtab 10 | /tmp/busybox mount -o remount,ro rootfs / 11 | echo ***************Begin System Partition*************** 12 | /sbin/busybox umount -l /system 13 | /sdcard/tmp/tune2fs -O ^has_journal -c 1 -i 1d -m 0 /dev/block/stl12 14 | fsck.ext4 -Dfy /dev/block/stl12 15 | /sbin/busybox mount -t ext4 -o nosuid,nodev,noatime,nodiratime,barrier=0,nobh ,data=ordered,noauto_da_alloc /dev/block/stl12 /system 16 | echo ***************System Partition Done*************** 17 | # Cache partition 18 | echo ***************Begin Cache Partition*************** 19 | /sbin/busybox umount -l /cache 20 | /sdcard/tmp/tune2fs -O ^has_journal -c 1 -i 1d -m 0 /dev/block/stl14 21 | fsck.ext4 -Dfy /dev/block/stl14 22 | /sbin/busybox mount -t ext4 -o nosuid,nodev,noatime,nodiratime,barrier=0,nobh,data=ordered,noauto_da_alloc /dev/block/stl14 /cache 23 | echo ***************Cache Partition Done*************** 24 | # Data partition 25 | echo ***************Begin Data Partion*************** 26 | /sbin/busybox umount -l /data 27 | /sdcard/tmp/tune2fs -O ^has_journal -c 1 -i 1d -m 0 /dev/block/stl13 28 | fsck.ext4 -Dfy /dev/block/stl13 29 | /sbin/busybox mount -t ext4 -o nosuid,nodev,noatime,nodiratime,barrier=0,nobh,data=ordered,noauto_da_alloc /dev/block/stl13 /data 30 | sync 31 | echo ***************Data Partion Done*************** 32 | echo ***************Finished No Journaling Partions*************** 33 | -------------------------------------------------------------------------------- /fs/JournalingDisabler/tools/tune2fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruleh/misc/195da372ce3cfd15f1ba61ce8d02a1b8cf8d9941/fs/JournalingDisabler/tools/tune2fs -------------------------------------------------------------------------------- /fs/JournalingEnabler.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruleh/misc/195da372ce3cfd15f1ba61ce8d02a1b8cf8d9941/fs/JournalingEnabler.zip -------------------------------------------------------------------------------- /fs/JournalingEnabler/META-INF/com/google/android/update-binary: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruleh/misc/195da372ce3cfd15f1ba61ce8d02a1b8cf8d9941/fs/JournalingEnabler/META-INF/com/google/android/update-binary -------------------------------------------------------------------------------- /fs/JournalingEnabler/META-INF/com/google/android/updater-script: -------------------------------------------------------------------------------- 1 | ui_print("Enabling Journaling.."); 2 | ui_print("Extracting tools..."); 3 | mount("ext4", "EMMC", "/dev/block/stl12", "/system"); 4 | mount("ext4", "EMMC", "/dev/block/stl13", "/data"); 5 | mount("ext4", "EMMC", "/dev/block/stl14", "/cache"); 6 | package_extract_file("tools/tune2fs", "/data/tune2fs"); 7 | package_extract_file("tools/enablejournal", "/data/enablejournal"); 8 | set_perm(0, 0, 0755, "/data/tune2fs"); 9 | set_perm(0, 0, 0755, "/data/enablejournal"); 10 | run_program("/sbin/busybox", "sh", "/data/enablejournal"); 11 | ui_print("Journaling is enabled..."); 12 | ui_print("Please Reboot"); -------------------------------------------------------------------------------- /fs/JournalingEnabler/tools/enablejournal: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo ***************Log Start*************** 3 | mkdir /sdcard/tmp 4 | cp /data/tune2fs /sdcard/tmp 5 | cp /data/enablejournal /sdcard/tmp 6 | /sbin/busybox mount -o remount,rw rootfs / 7 | /sbin/busybox rm /sdcard/enablejournal.log 8 | /sbin/busybox mkdir /etc 9 | cat /proc/mounts > /etc/mtab 10 | /sbin/busybox mount -o remount,ro rootfs / 11 | echo ***************Begin System Partition*************** 12 | /sbin/busybox umount -l /system 13 | /sdcard/tmp/tune2fs -O +has_journal -c 5 -i 5d -m 0 -o journal_data_ordered /dev/block/stl12 14 | fsck.ext4 -Dfy /dev/block/stl14 15 | /sbin/busybox mount -t ext4 -o nosuid,nodev,noatime,nodiratime,barrier=0,nobh,data=ordered,noauto_da_alloc /dev/block/stl14 /system 16 | echo ***************System Partition Done*************** 17 | # Cache partition 18 | echo ***************Begin Cache Partition*************** 19 | /sbin/busybox umount -l /cache 20 | /sdcard/tmp/tune2fs -O +has_journal -c 100 -i 100d -m 0 -o journal_data_writeback /dev/block/stl14 21 | fsck.ext4 -Dfy /dev/block/stl14 22 | /sbin/busybox mount -t ext4 -o nosuid,nodev,noatime,nodiratime,barrier=0,nobh,data=ordered,noauto_da_alloc /dev/block/stl14 /cache 23 | echo ***************Cache Partition Done*************** 24 | # Data partition 25 | echo ***************Begin Data Partion*************** 26 | /sbin/busybox umount -l /data 27 | /sdcard/tmp/tune2fs -O +has_journal -c 5 -i 5d -m 0 -o journal_data_ordered /dev/block/stl13 28 | fsck.ext4 -Dfy /dev/block/stl13 29 | /sbin/busybox mount -t ext4 -o nosuid,nodev,noatime,nodiratime,barrier=0,nobh,data=ordered,noauto_da_alloc /dev/block/stl13 /data 30 | sync 31 | echo ***************Data Partion Done*************** 32 | echo ***************Finished Journaling Partions*************** 33 | -------------------------------------------------------------------------------- /fs/JournalingEnabler/tools/tune2fs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruleh/misc/195da372ce3cfd15f1ba61ce8d02a1b8cf8d9941/fs/JournalingEnabler/tools/tune2fs -------------------------------------------------------------------------------- /fs/README.md: -------------------------------------------------------------------------------- 1 | filesystem related -------------------------------------------------------------------------------- /ftxxxx_ts.idc: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2010 The Android Open Source Project 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # 16 | # These calibration values are derived from empirical measurements 17 | # and may not be appropriate for use with other touch screens. 18 | # Refer to the input device configuration documentation for more details. 19 | # 20 | # Settings pulled from Samsung Galaxy S2 21 | # 22 | 23 | # Basic Parameters 24 | #touch.deviceType = touchscreen 25 | touch.deviceType = pointer 26 | touch.orientationAware = 1 27 | touch.gestureMode = spots 28 | # Touch Size 29 | #touch.touchSize.calibration = pressure 30 | 31 | # Tool Size 32 | # Driver reports tool size as an area measurement. 33 | # 34 | # Based on empirical measurements, we estimate the size of the tool 35 | # using size = sqrt(22 * rawToolArea + 0) * 6 + 0. 36 | #touch.toolSize.calibration = area 37 | #touch.toolSize.areaScale = 22 38 | #touch.toolSize.areaBias = 0 39 | #touch.toolSize.linearScale = 6 40 | #touch.toolSize.linearBias = 0 41 | #touch.toolSize.isSummed = 0 42 | 43 | # Pressure 44 | # Driver reports signal strength as pressure. 45 | # 46 | # A normal index finger touch typically registers about 80 signal strength 47 | # units although we don't expect these values to be accurate. 48 | #touch.pressure.calibration = amplitude 49 | #touch.pressure.source = default 50 | #touch.pressure.scale = 0.0125 51 | 52 | # Size 53 | #touch.size.calibration = normalized 54 | 55 | # Orientation 56 | #touch.orientation.calibration = vector 57 | 58 | -------------------------------------------------------------------------------- /init/31devices.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | 3 | #su -c "echo /system/xbin/mdev > /proc/sys/kernel/hotplug" 4 | su -c "mdev -s" 5 | 6 | #cd /system/lib/modules 7 | #for i in $(ls cpufreq_*) do; 8 | #insmod $i 9 | #done -------------------------------------------------------------------------------- /init/81log.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | 3 | #cd /dev 4 | #for tty in tty $(ls tty[0-9]) $(ls tty[0-9][0-9]); do 5 | #for tty in tty1; do 6 | # su -c dmesg > $tty 7 | # su -c echo -n "\n" > /dev/console 8 | # done 9 | 10 | #su -c script -f -c dmesg /dev/tty1 11 | #su -c dmesg > /dev/tty1 & 12 | #su -c logcat -d -C -b main -b system -b crash -v tag *:D > /dev/tty1 13 | 14 | #for i in s u SPACE - c SPACE d m e s g ENTER; do 15 | # echo $i | su -c virt-key 16 | # done 17 | 18 | echo "d m e s g" | su -c virt-key 19 | echo "ENTER" | su -c virt-key -------------------------------------------------------------------------------- /init/98sdcard_perm.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | 3 | chmod 0771 /data/media/ 4 | chmod 0771 /data/media/0/ -------------------------------------------------------------------------------- /init/README.md: -------------------------------------------------------------------------------- 1 | android boot-up scripts 2 | -------------------------------------------------------------------------------- /keyboard/README.md: -------------------------------------------------------------------------------- 1 | Multiling O keyboard 2 | -------------------------------------------------------------------------------- /keyboard/keyboard_arrows: -------------------------------------------------------------------------------- 1 | [W.LEFT][REDO][ã→a][UNDO][W.RIGHT] 2 | [Fn][PASTE][UP][COPY][CUT] 3 | Tab[LEFT][ALL][RIGHT][Del→] 4 | [SHIFT][HOME][DOWN][END][DEL] 5 | [LOCK][PGUP][CTRL][PGDN][ENTER] -------------------------------------------------------------------------------- /keyboard/keyboard_fn: -------------------------------------------------------------------------------- 1 | [ESC][F1][F2][F3][INFO][DEL] 2 | [TAB][F4][F5][F6][MC:[CTRL][ALT][DEL]:ctl-alt-del][MC:{{M/d/yyyy}}] 3 | [CAPS][F7][F8][F9][SYSRQ][MC:{{h:mm a}}] 4 | [INSERT][F10][F11][F12][SCRLCK][MC:find -iname ] 5 | [Lock][CTRL][SPACE][ALT][NUMLCK][ENTER] -------------------------------------------------------------------------------- /keyboard/keyboard_theme: -------------------------------------------------------------------------------- 1 | OK_Settings_Begin 2 | __V.co6::20000::X 3 | __V.FB::false::B 4 | __V.co7::0::X 5 | __V.co11::ffffffff::X 6 | __V.co8::0::X 7 | __K.fs2::90::I 8 | __V.co13::ffffffff::X 9 | __V.co4::a5000000::X 10 | __K.gw.L::2::I 11 | __K.rx.L::0.0::F 12 | __V.co1::84d8d8d8::X 13 | __V.co9::afc6ced1::X 14 | __K.gh.L::6::I 15 | __K.gh::21::I 16 | __V.co14::ff556677::X 17 | __V.co0::77fffff7::X 18 | __K.fs2.L::90::I 19 | __K.rx::0.0::F 20 | __K.ra0::0::I 21 | __V.co5::ff44aaff::X 22 | __K.ra3::11::I 23 | __V.co15::ff445566::X 24 | __K.fs::77::I 25 | __K.fs.L::77::I 26 | __V.co2::c9333333::X 27 | __V.co17::ff000000::X 28 | __K.ra2::0::I 29 | __V.co12::ee000000::X 30 | __V.co16::1f000000::X 31 | __V.co3::35000000::X 32 | __K.gw::7::I 33 | __V.co10::aa336699::X 34 | __K.ra1::0::I 35 | OK_Settings_End 36 | 37 | -------------------------------------------------------------------------------- /monitor/README.md: -------------------------------------------------------------------------------- 1 | wifi related -------------------------------------------------------------------------------- /monitor/bcmdhd_enable_monitor.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drivers/net/wireless/bcmdhd/Makefile b/drivers/net/wireless/bcmdhd/Makefile 2 | index 09101fa48..5c38d4118 100755 3 | --- a/drivers/net/wireless/bcmdhd/Makefile 4 | +++ b/drivers/net/wireless/bcmdhd/Makefile 5 | @@ -76,7 +76,7 @@ DHDCFLAGS += -DCUSTOM_MAX_TXGLOM_SIZE=32 6 | DHDCFLAGS += -DREPEAT_READFRAME 7 | DHDCFLAGS += -DROAM_AP_ENV_DETECTION 8 | DHDCFLAGS += -DBCM4339_CHIP 9 | -DHDCFLAGS += -DMFP 10 | +#DHDCFLAGS += -DMFP 11 | # throughput monitor 12 | DHDCFLAGS += -DTPUT_MONITOR -DTPUT_MONITOR_USE_PM_QOS 13 | DHDCFLAGS += -DASUS_COUNTRY_CODE -DASUS_CUSTOMIZE_TXPWR 14 | diff --git a/drivers/net/wireless/bcmdhd/dhd.h b/drivers/net/wireless/bcmdhd/dhd.h 15 | index ca0207853..90b80c783 100644 16 | --- a/drivers/net/wireless/bcmdhd/dhd.h 17 | +++ b/drivers/net/wireless/bcmdhd/dhd.h 18 | @@ -47,9 +47,9 @@ int get_scheduler_policy(struct task_struct *p); 19 | #include 20 | #endif /* (BCMWDF) */ 21 | 22 | -#if defined(WL11U) && !defined(MFP) 23 | -#define MFP /* Applying interaction with MFP by spec HS2.0 REL2 */ 24 | -#endif /* WL11U */ 25 | +//#if defined(WL11U) && !defined(MFP) 26 | +//#define MFP /* Applying interaction with MFP by spec HS2.0 REL2 */ 27 | +//#endif /* WL11U */ 28 | 29 | #if defined(KEEP_ALIVE) 30 | /* Default KEEP_ALIVE Period is 55 sec to prevent AP from sending Keep Alive probe frame */ 31 | diff --git a/drivers/net/wireless/bcmdhd/wl_cfg80211.c b/drivers/net/wireless/bcmdhd/wl_cfg80211.c 32 | index 24f30d7cc..5670921bf 100644 33 | --- a/drivers/net/wireless/bcmdhd/wl_cfg80211.c 34 | +++ b/drivers/net/wireless/bcmdhd/wl_cfg80211.c 35 | @@ -1131,6 +1131,10 @@ wl_cfg80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = { 36 | BIT(IEEE80211_STYPE_PROBE_REQ >> 4) 37 | }, 38 | #endif /* WL_CFG80211_P2P_DEV_IF */ 39 | + [NL80211_IFTYPE_MONITOR] = { 40 | + .tx = 0xffff, 41 | + .rx = 0xffff 42 | + }, 43 | }; 44 | 45 | static void swap_key_from_BE(struct wl_wsec_key *key) 46 | @@ -1727,6 +1731,8 @@ wl_cfg80211_change_virtual_iface(struct wiphy *wiphy, struct net_device *ndev, 47 | s32 ap = 0; 48 | s32 infra = 0; 49 | s32 ibss = 0; 50 | + s32 mon = 0; 51 | + s32 promisc = 0; 52 | s32 wlif_type; 53 | s32 mode = 0; 54 | s32 err = BCME_OK; 55 | @@ -1737,6 +1743,10 @@ wl_cfg80211_change_virtual_iface(struct wiphy *wiphy, struct net_device *ndev, 56 | WL_DBG(("Enter type %d\n", type)); 57 | switch (type) { 58 | case NL80211_IFTYPE_MONITOR: 59 | + mon = 2; 60 | + promisc = 1; 61 | + mode = WL_MODE_MONITOR; 62 | + break; 63 | case NL80211_IFTYPE_WDS: 64 | case NL80211_IFTYPE_MESH_POINT: 65 | ap = 1; 66 | @@ -1809,14 +1819,17 @@ wl_cfg80211_change_virtual_iface(struct wiphy *wiphy, struct net_device *ndev, 67 | WL_DBG(("Change_virtual_iface for transition from GO/AP to client/STA")); 68 | } 69 | 70 | - if (ibss) { 71 | - infra = 0; 72 | - wl_set_mode_by_netdev(cfg, ndev, mode); 73 | - err = wldev_ioctl(ndev, WLC_SET_INFRA, &infra, sizeof(s32), true); 74 | - if (err < 0) { 75 | - WL_ERR(("SET Adhoc error %d\n", err)); 76 | - return -EINVAL; 77 | - } 78 | + if (mon) { 79 | + ndev->type = ARPHRD_IEEE80211_RADIOTAP; 80 | + } else { 81 | + ndev->type = ARPHRD_ETHER; 82 | + } 83 | + 84 | + if (!ap) { 85 | + wldev_ioctl(ndev, WLC_SET_INFRA, &infra, sizeof(s32), true); 86 | + wldev_ioctl(ndev, WLC_SET_PROMISC, &promisc, sizeof(s32), true); 87 | + wldev_ioctl(ndev, WLC_SET_MONITOR, &mon, sizeof(s32), true); 88 | + wl_set_mode_by_netdev(cfg, ndev, mode); 89 | } 90 | 91 | ndev->ieee80211_ptr->iftype = type; 92 | @@ -6371,6 +6384,17 @@ change_bw: 93 | return err; 94 | } 95 | 96 | +static s32 97 | +wl_cfg80211_set_monitor_channel(struct wiphy *wiphy, struct cfg80211_chan_def *chandef) 98 | +{ 99 | + 100 | + struct bcm_cfg80211 *cfg = wiphy_priv(wiphy); 101 | + struct net_device *dev = bcmcfg_to_prmry_ndev(cfg); 102 | + enum nl80211_channel_type channel_type = cfg80211_get_chandef_type(chandef); 103 | + 104 | + return(wl_cfg80211_set_channel(wiphy, dev, chandef->chan, channel_type)); 105 | +} 106 | + 107 | #ifdef WL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST 108 | struct net_device * 109 | wl_cfg80211_get_remain_on_channel_ndev(struct bcm_cfg80211 *cfg) 110 | @@ -8263,6 +8287,7 @@ static struct cfg80211_ops wl_cfg80211_ops = { 111 | .mgmt_tx = wl_cfg80211_mgmt_tx, 112 | .mgmt_frame_register = wl_cfg80211_mgmt_frame_register, 113 | .change_bss = wl_cfg80211_change_bss, 114 | + .set_monitor_channel = wl_cfg80211_set_monitor_channel, 115 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0)) || defined(WL_COMPAT_WIRELESS) 116 | .set_channel = wl_cfg80211_set_channel, 117 | #endif /* ((LINUX_VERSION < VERSION(3, 6, 0)) || WL_COMPAT_WIRELESS */ 118 | @@ -8306,6 +8331,8 @@ s32 wl_mode_to_nl80211_iftype(s32 mode) 119 | return NL80211_IFTYPE_ADHOC; 120 | case WL_MODE_AP: 121 | return NL80211_IFTYPE_AP; 122 | + case WL_MODE_MONITOR: 123 | + return NL80211_IFTYPE_MONITOR; 124 | default: 125 | return NL80211_IFTYPE_UNSPECIFIED; 126 | } 127 | @@ -8396,9 +8423,9 @@ static s32 wl_setup_wiphy(struct wireless_dev *wdev, struct device *sdiofunc_dev 128 | wdev->wiphy->interface_modes = 129 | BIT(NL80211_IFTYPE_STATION) 130 | | BIT(NL80211_IFTYPE_ADHOC) 131 | -#if !defined(WL_ENABLE_P2P_IF) && !defined(WL_CFG80211_P2P_DEV_IF) 132 | +//#if !defined(WL_ENABLE_P2P_IF) && !defined(WL_CFG80211_P2P_DEV_IF) 133 | | BIT(NL80211_IFTYPE_MONITOR) 134 | -#endif /* !WL_ENABLE_P2P_IF && !WL_CFG80211_P2P_DEV_IF */ 135 | +//#endif /* !WL_ENABLE_P2P_IF && !WL_CFG80211_P2P_DEV_IF */ 136 | #if defined(WL_IFACE_COMB_NUM_CHANNELS) || defined(WL_CFG80211_P2P_DEV_IF) 137 | | BIT(NL80211_IFTYPE_P2P_CLIENT) 138 | | BIT(NL80211_IFTYPE_P2P_GO) 139 | @@ -11543,8 +11570,14 @@ static s32 wl_config_ifmode(struct bcm_cfg80211 *cfg, struct net_device *ndev, s 140 | s32 infra = 0; 141 | s32 err = 0; 142 | s32 mode = 0; 143 | + s32 mon = 0; 144 | + s32 promisc = 0; 145 | switch (iftype) { 146 | case NL80211_IFTYPE_MONITOR: 147 | + mode = WL_MODE_MONITOR; 148 | + mon = 2; 149 | + promisc = 1; 150 | + break; 151 | case NL80211_IFTYPE_WDS: 152 | WL_ERR(("type (%d) : currently we do not support this mode\n", 153 | iftype)); 154 | @@ -11569,11 +11602,31 @@ static s32 wl_config_ifmode(struct bcm_cfg80211 *cfg, struct net_device *ndev, s 155 | return err; 156 | } 157 | infra = htod32(infra); 158 | + mon = htod32(mon); 159 | + promisc = htod32(promisc); 160 | + 161 | err = wldev_ioctl(ndev, WLC_SET_INFRA, &infra, sizeof(infra), true); 162 | if (unlikely(err)) { 163 | WL_ERR(("WLC_SET_INFRA error (%d)\n", err)); 164 | return err; 165 | } 166 | + err = wldev_ioctl(ndev, WLC_SET_PROMISC, &promisc, sizeof(s32), true); 167 | + if (unlikely(err)) { 168 | + WL_ERR(("WLC_SET_PROMISC error (%d)\n", err)); 169 | + return err; 170 | + } 171 | + err = wldev_ioctl(ndev, WLC_SET_MONITOR, &mon, sizeof(mon), true); 172 | + if (unlikely(err)) { 173 | + WL_ERR(("WLC_SET_MONITOR error (%d)\n", err)); 174 | + return err; 175 | + } 176 | + 177 | + if (mon) { 178 | + ndev->type = ARPHRD_IEEE80211_RADIOTAP; 179 | + } else { 180 | + ndev->type = ARPHRD_ETHER; 181 | + } 182 | + 183 | 184 | wl_set_mode_by_netdev(cfg, ndev, mode); 185 | 186 | diff --git a/drivers/net/wireless/bcmdhd/wl_cfg80211.h b/drivers/net/wireless/bcmdhd/wl_cfg80211.h 187 | index 108e61e1f..0aab2764a 100644 188 | --- a/drivers/net/wireless/bcmdhd/wl_cfg80211.h 189 | +++ b/drivers/net/wireless/bcmdhd/wl_cfg80211.h 190 | @@ -211,7 +211,8 @@ enum wl_status { 191 | enum wl_mode { 192 | WL_MODE_BSS, 193 | WL_MODE_IBSS, 194 | - WL_MODE_AP 195 | + WL_MODE_AP, 196 | + WL_MODE_MONITOR 197 | }; 198 | 199 | /* driver profile list */ 200 | -------------------------------------------------------------------------------- /monitor/chanswitch.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/bash 2 | iface=wlan0 3 | 4 | while true; do 5 | for i in 1 2 3 4 5 6 7 8 9 10 11 12 13; do 6 | iwconfig $iface channel $i 7 | sleep 0.5 8 | done 9 | done -------------------------------------------------------------------------------- /monitor/dismon.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | 3 | iface=wlan0 4 | 5 | ifconfig $iface down 6 | rmmod bcmdhd 7 | insmod /system/lib/modules/bcmdhd.ko -------------------------------------------------------------------------------- /monitor/monitor.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | 3 | iface=wlan0 4 | opmode=512 #random value 5 | 6 | svc wifi disable 7 | rmmod bcmdhd 8 | insmod /system/lib/modules/bcmdhd2.ko iface_name=$iface op_mode=$opmode 9 | ifconfig $iface up -------------------------------------------------------------------------------- /monitor/nexmon.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c 2 | index d4cc5fa92341..1e9cb1538eb6 100644 3 | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c 4 | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c 5 | @@ -530,6 +530,28 @@ static int brcmf_vif_add_validate(struct brcmf_cfg80211_info *cfg, 6 | return cfg80211_check_combinations(cfg->wiphy, ¶ms); 7 | } 8 | 9 | +static int brcmf_set_monitor(struct brcmf_cfg80211_info *cfg) 10 | +{ 11 | + struct brcmf_cfg80211_vif *pos; 12 | + struct brcmf_if *ifp = brcmf_get_ifp(cfg->pub, 0); 13 | + struct iface_combination_params params = { 14 | + .num_different_channels = 1, 15 | + }; 16 | + s32 mon; 17 | + s32 err = 0; 18 | + 19 | + list_for_each_entry(pos, &cfg->vif_list, list) 20 | + params.iftype_num[pos->wdev.iftype]++; 21 | + 22 | + mon = params.iftype_num[NL80211_IFTYPE_MONITOR] ? 2 : 0; 23 | + 24 | + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_MONITOR, mon); 25 | + if (err) 26 | + brcmf_err("failed to set monitor mode err=%d\n", err); 27 | + 28 | + return err; 29 | +} 30 | + 31 | static void convert_key_from_CPU(struct brcmf_wsec_key *key, 32 | struct brcmf_wsec_key_le *key_le) 33 | { 34 | @@ -826,7 +848,8 @@ struct wireless_dev *brcmf_apsta_add_vif(struct wiphy *wiphy, const char *name, 35 | struct brcmf_cfg80211_vif *vif; 36 | int err; 37 | 38 | - if (type != NL80211_IFTYPE_STATION && type != NL80211_IFTYPE_AP) 39 | + if (type != NL80211_IFTYPE_STATION && type != NL80211_IFTYPE_AP && 40 | + type != NL80211_IFTYPE_MONITOR) 41 | return ERR_PTR(-EINVAL); 42 | 43 | if (brcmf_cfg80211_vif_event_armed(cfg)) 44 | @@ -867,6 +890,9 @@ struct wireless_dev *brcmf_apsta_add_vif(struct wiphy *wiphy, const char *name, 45 | goto fail; 46 | } 47 | 48 | + if (type == NL80211_IFTYPE_MONITOR) 49 | + ifp->ndev->type = ARPHRD_IEEE80211_RADIOTAP; 50 | + 51 | strscpy(ifp->ndev->name, name, sizeof(ifp->ndev->name)); 52 | err = brcmf_net_attach(ifp, true); 53 | if (err) { 54 | @@ -875,6 +901,8 @@ struct wireless_dev *brcmf_apsta_add_vif(struct wiphy *wiphy, const char *name, 55 | goto fail; 56 | } 57 | 58 | + brcmf_set_monitor(cfg); 59 | + 60 | return &ifp->vif->wdev; 61 | 62 | fail: 63 | @@ -971,6 +999,22 @@ static int brcmf_mon_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev) 64 | return 0; 65 | } 66 | 67 | +static s32 68 | +brcmf_cfg80211_set_monitor_channel(struct wiphy *wiphy,struct cfg80211_chan_def *chandef) { 69 | + struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); 70 | + struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg)); 71 | + s32 err = 0; 72 | + u16 chanspec; 73 | + 74 | + chanspec = chandef_to_chanspec(&cfg->d11inf, chandef); 75 | + err = brcmf_fil_iovar_int_set(ifp, "chanspec", chanspec); 76 | + if (err < 0) { 77 | + brcmf_err("Set Channel failed: chspec=%d, %d\n", 78 | + chanspec, err); 79 | + } 80 | + return 0; 81 | +} 82 | + 83 | static struct wireless_dev *brcmf_cfg80211_add_iface(struct wiphy *wiphy, 84 | const char *name, 85 | unsigned char name_assign_type, 86 | @@ -995,7 +1039,6 @@ static struct wireless_dev *brcmf_cfg80211_add_iface(struct wiphy *wiphy, 87 | case NL80211_IFTYPE_MESH_POINT: 88 | return ERR_PTR(-EOPNOTSUPP); 89 | case NL80211_IFTYPE_MONITOR: 90 | - return brcmf_mon_add_vif(wiphy, name); 91 | case NL80211_IFTYPE_STATION: 92 | case NL80211_IFTYPE_AP: 93 | wdev = brcmf_apsta_add_vif(wiphy, name, params, type); 94 | @@ -1305,7 +1348,6 @@ int brcmf_cfg80211_del_iface(struct wiphy *wiphy, struct wireless_dev *wdev) 95 | case NL80211_IFTYPE_MESH_POINT: 96 | return -EOPNOTSUPP; 97 | case NL80211_IFTYPE_MONITOR: 98 | - return brcmf_mon_del_vif(wiphy, wdev); 99 | case NL80211_IFTYPE_STATION: 100 | case NL80211_IFTYPE_AP: 101 | return brcmf_cfg80211_del_apsta_iface(wiphy, wdev); 102 | @@ -1329,6 +1371,7 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, 103 | struct brcmf_if *ifp = netdev_priv(ndev); 104 | struct brcmf_cfg80211_vif *vif = ifp->vif; 105 | struct brcmf_pub *drvr = cfg->pub; 106 | + s32 monitor = 0; 107 | s32 infra = 0; 108 | s32 ap = 0; 109 | s32 err = 0; 110 | @@ -1373,6 +1416,8 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, 111 | } 112 | switch (type) { 113 | case NL80211_IFTYPE_MONITOR: 114 | + monitor = 1; 115 | + break; 116 | case NL80211_IFTYPE_WDS: 117 | bphy_err(drvr, "type (%d) : currently we do not support this type\n", 118 | type); 119 | @@ -1407,11 +1452,20 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, 120 | err = -EAGAIN; 121 | goto done; 122 | } 123 | - brcmf_dbg(INFO, "IF Type = %s\n", brcmf_is_ibssmode(vif) ? 124 | - "Adhoc" : "Infra"); 125 | + if (!monitor) 126 | + brcmf_dbg(INFO, "IF Type = %s\n", 127 | + brcmf_is_ibssmode(vif) ? "Adhoc" : "Infra"); 128 | + 129 | } 130 | ndev->ieee80211_ptr->iftype = type; 131 | 132 | + if (monitor) 133 | + ndev->type = ARPHRD_IEEE80211_RADIOTAP; 134 | + else 135 | + ndev->type = ARPHRD_ETHER; 136 | + 137 | + brcmf_set_monitor(cfg); 138 | + 139 | brcmf_cfg80211_update_proto_addr_mode(&vif->wdev); 140 | 141 | done: 142 | @@ -5969,6 +6023,7 @@ static struct cfg80211_ops brcmf_cfg80211_ops = { 143 | .update_connect_params = brcmf_cfg80211_update_conn_params, 144 | .set_pmk = brcmf_cfg80211_set_pmk, 145 | .del_pmk = brcmf_cfg80211_del_pmk, 146 | + .set_monitor_channel = brcmf_cfg80211_set_monitor_channel, 147 | }; 148 | 149 | struct cfg80211_ops *brcmf_cfg80211_get_ops(struct brcmf_mp_device *settings) 150 | @@ -6028,13 +6083,17 @@ void brcmf_free_vif(struct brcmf_cfg80211_vif *vif) 151 | void brcmf_cfg80211_free_netdev(struct net_device *ndev) 152 | { 153 | struct brcmf_cfg80211_vif *vif; 154 | + struct brcmf_cfg80211_info *cfg; 155 | struct brcmf_if *ifp; 156 | 157 | ifp = netdev_priv(ndev); 158 | + cfg = ifp->drvr->config; 159 | vif = ifp->vif; 160 | 161 | if (vif) 162 | brcmf_free_vif(vif); 163 | + 164 | + brcmf_set_monitor(cfg); 165 | } 166 | 167 | static bool brcmf_is_linkup(struct brcmf_cfg80211_vif *vif, 168 | diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c 169 | index bf91b1e1368f..335f823cb1d1 100644 170 | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c 171 | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c 172 | @@ -29,6 +29,10 @@ 173 | #include "proto.h" 174 | #include "pcie.h" 175 | #include "common.h" 176 | +/* NEXMON */ 177 | +#include 178 | +#include 179 | +#include "nexmon_ioctls.h" 180 | 181 | #define MAX_WAIT_FOR_8021X_TX msecs_to_jiffies(950) 182 | 183 | @@ -38,6 +42,34 @@ 184 | 185 | #define D11_PHY_HDR_LEN 6 186 | 187 | +/* NEXMON */ 188 | +#define NETLINK_USER 31 189 | +#define NEXUDP_IOCTL 0 190 | + 191 | +#define MONITOR_DISABLED 0 192 | +#define MONITOR_IEEE80211 1 193 | +#define MONITOR_RADIOTAP 2 194 | +#define MONITOR_LOG_ONLY 3 195 | +#define MONITOR_DROP_FRM 4 196 | +#define MONITOR_IPV4_UDP 5 197 | + 198 | +static struct netlink_kernel_cfg cfg = {0}; 199 | +static struct sock *nl_sock = NULL; 200 | +static struct net_device *ndev_global = NULL; 201 | + 202 | +struct nexudp_header { 203 | + char nex[3]; 204 | + char type; 205 | + int securitycookie; 206 | +} __packed; 207 | + 208 | +struct nexudp_ioctl_header { 209 | + struct nexudp_header nexudphdr; 210 | + unsigned int cmd; 211 | + unsigned int set; 212 | + char payload[1]; 213 | +} __packed; 214 | + 215 | struct d11rxhdr_le { 216 | __le16 RxFrameSize; 217 | u16 PAD; 218 | @@ -64,6 +96,80 @@ struct wlc_d11rxhdr { 219 | s8 rxpwr[4]; 220 | } __packed; 221 | 222 | +/* MEXMON */ 223 | +static void 224 | +nexmon_nl_ioctl_handler(struct sk_buff *skb) 225 | +{ 226 | + struct nlmsghdr *nlh = (struct nlmsghdr *) skb->data; 227 | + struct nexudp_ioctl_header *frame = (struct nexudp_ioctl_header *) nlmsg_data(nlh); 228 | + struct brcmf_if *ifp = netdev_priv(ndev_global); 229 | + struct sk_buff *skb_out; 230 | + struct nlmsghdr *nlh_tx; 231 | + 232 | + brcmf_err("NEXMON: %s: Enter\n", __FUNCTION__); 233 | + 234 | + brcmf_err("NEXMON: %s: %08x %d %d\n", __FUNCTION__, *(int *) frame->nexudphdr.nex, nlmsg_len(nlh), skb->len); 235 | + 236 | + if (memcmp(frame->nexudphdr.nex, "NEX", 3)) { 237 | + brcmf_err("NEXMON: %s: invalid nexudp_ioctl_header\n", __FUNCTION__); 238 | + return; 239 | + } 240 | + 241 | + if (frame->nexudphdr.type != NEXUDP_IOCTL) { 242 | + brcmf_err("NEXMON: %s: invalid frame type\n", __FUNCTION__); 243 | + return; 244 | + } 245 | + 246 | + if (ifp == NULL) { 247 | + brcmf_err("NEXMON: %s: ifp is NULL\n", __FUNCTION__); 248 | + return; 249 | + } 250 | + 251 | + if (frame->set) { 252 | + brcmf_err("NEXMON: %s: calling brcmf_fil_cmd_data_set, cmd: %d\n", __FUNCTION__, frame->cmd); 253 | + brcmf_fil_cmd_data_set(ifp, frame->cmd, frame->payload, nlmsg_len(nlh) - sizeof(struct nexudp_ioctl_header) + sizeof(char)); 254 | + 255 | + if (frame->cmd == BRCMF_C_SET_MONITOR) { 256 | + brcmf_err("NEXMON: %s: WLC_SET_MONITOR = %d\n", __FUNCTION__, *(unsigned int *) frame->payload); 257 | + switch(*(unsigned int *) frame->payload) { 258 | + case MONITOR_IEEE80211: 259 | + ndev_global->type = ARPHRD_IEEE80211; 260 | + ndev_global->ieee80211_ptr->iftype = NL80211_IFTYPE_MONITOR; 261 | + break; 262 | + case MONITOR_RADIOTAP: 263 | + ndev_global->type = ARPHRD_IEEE80211_RADIOTAP; 264 | + ndev_global->ieee80211_ptr->iftype = NL80211_IFTYPE_MONITOR; 265 | + break; 266 | + case MONITOR_DISABLED: 267 | + case MONITOR_LOG_ONLY: 268 | + case MONITOR_DROP_FRM: 269 | + case MONITOR_IPV4_UDP: 270 | + default: 271 | + ndev_global->type = ARPHRD_ETHER; 272 | + ndev_global->ieee80211_ptr->iftype = NL80211_IFTYPE_STATION; 273 | + break; 274 | + } 275 | + } 276 | + 277 | + skb_out = nlmsg_new(4, 0); 278 | + nlh_tx = nlmsg_put(skb_out, 0, 0, NLMSG_DONE, 4, 0); 279 | + NETLINK_CB(skb_out).dst_group = 0; /* not in mcast group */ 280 | + memcpy(nlmsg_data(nlh_tx), "ACK", 4); 281 | + nlmsg_unicast(nl_sock, skb_out, nlh->nlmsg_pid); 282 | + } else { 283 | + brcmf_err("NEXMON: %s: calling brcmf_fil_cmd_data_get, cmd: %d\n", __FUNCTION__, frame->cmd); 284 | + brcmf_fil_cmd_data_get(ifp, frame->cmd, frame->payload, nlmsg_len(nlh) - sizeof(struct nexudp_ioctl_header) + sizeof(char)); 285 | + 286 | + skb_out = nlmsg_new(nlmsg_len(nlh), 0); 287 | + nlh_tx = nlmsg_put(skb_out, 0, 0, NLMSG_DONE, nlmsg_len(nlh), 0); 288 | + NETLINK_CB(skb_out).dst_group = 0; /* not in mcast group */ 289 | + memcpy(nlmsg_data(nlh_tx), frame, nlmsg_len(nlh)); 290 | + nlmsg_unicast(nl_sock, skb_out, nlh->nlmsg_pid); 291 | + } 292 | + 293 | + brcmf_err("NEXMON: %s: Exit\n", __FUNCTION__); 294 | +} 295 | + 296 | char *brcmf_ifname(struct brcmf_if *ifp) 297 | { 298 | if (!ifp) 299 | @@ -618,7 +724,11 @@ static int brcmf_netdev_open(struct net_device *ndev) 300 | } 301 | 302 | /* Clear, carrier, set when connected or AP mode. */ 303 | - netif_carrier_off(ndev); 304 | + if (ndev->type == ARPHRD_IEEE80211_RADIOTAP) 305 | + netif_carrier_on(ndev); 306 | + else 307 | + netif_carrier_off(ndev); 308 | + 309 | return 0; 310 | } 311 | 312 | @@ -639,6 +749,9 @@ int brcmf_net_attach(struct brcmf_if *ifp, bool locked) 313 | brcmf_dbg(TRACE, "Enter, bsscfgidx=%d mac=%pM\n", ifp->bsscfgidx, 314 | ifp->mac_addr); 315 | ndev = ifp->ndev; 316 | + /* NEXMON */ 317 | + if (!ndev_global) 318 | + ndev_global = ndev; 319 | 320 | /* set appropriate operations */ 321 | ndev->netdev_ops = &brcmf_netdev_ops_pri; 322 | @@ -685,6 +798,10 @@ void brcmf_net_detach(struct net_device *ndev, bool locked) 323 | brcmf_cfg80211_free_netdev(ndev); 324 | free_netdev(ndev); 325 | } 326 | + 327 | + /* NEXMON */ 328 | + if (ndev == ndev_global) 329 | + ndev_global = NULL; 330 | } 331 | 332 | static int brcmf_net_mon_open(struct net_device *ndev) 333 | @@ -1547,6 +1664,14 @@ int __init brcmf_core_init(void) 334 | err = brcmf_pcie_register(); 335 | if (err) 336 | goto error_pcie_register; 337 | + 338 | + /* NEXMON netlink init */ 339 | + cfg.input = nexmon_nl_ioctl_handler; 340 | + nl_sock = netlink_kernel_create(&init_net, NETLINK_USER, &cfg); 341 | + if (!nl_sock) { 342 | + brcmf_err("NEXMON: %s: Error creating netlink socket\n", __FUNCTION__); 343 | + } 344 | + 345 | return 0; 346 | 347 | error_pcie_register: 348 | @@ -1558,6 +1683,9 @@ int __init brcmf_core_init(void) 349 | 350 | void __exit brcmf_core_exit(void) 351 | { 352 | + /* NEXMON netlink release */ 353 | + netlink_kernel_release(nl_sock); 354 | + 355 | brcmf_sdio_exit(); 356 | brcmf_usb_exit(); 357 | brcmf_pcie_exit(); 358 | diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c 359 | index f23310a77a5d..b07604466d79 100644 360 | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c 361 | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c 362 | @@ -117,6 +117,8 @@ static void brcmf_feat_firmware_overrides(struct brcmf_pub *drv) 363 | } 364 | } 365 | 366 | + feat_flags |= BIT(BRCMF_FEAT_MONITOR_FLAG); 367 | + 368 | if (!feat_flags) 369 | return; 370 | 371 | diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/nexmon_ioctls.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/nexmon_ioctls.h 372 | new file mode 100644 373 | index 000000000000..2d7d0dadba06 374 | --- /dev/null 375 | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/nexmon_ioctls.h 376 | @@ -0,0 +1,15 @@ 377 | +#ifndef NEXMON_IOCTLS_H 378 | +#define NEXMON_IOCTLS_H 379 | + 380 | +/* see include/dhdioctl.h in bcmdhd driver */ 381 | +typedef struct nex_ioctl { 382 | + uint cmd; /* common ioctl definition */ 383 | + void *buf; /* pointer to user buffer */ 384 | + uint len; /* length of user buffer */ 385 | + bool set; /* get or set request (optional) */ 386 | + uint used; /* bytes read or written (optional) */ 387 | + uint needed; /* bytes needed (optional) */ 388 | + uint driver; /* to identify target driver */ 389 | +} nex_ioctl_t; 390 | + 391 | +#endif /* NEXMON_IOCTLS_H */ 392 | diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c 393 | index 1461dc453ac2..ea6c14cc490f 100644 394 | --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c 395 | +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c 396 | @@ -66,7 +66,7 @@ 397 | #define CBUF_LEN (128) 398 | 399 | /* Device console log buffer state */ 400 | -#define CONSOLE_BUFFER_MAX 2024 401 | +#define CONSOLE_BUFFER_MAX 4096 402 | 403 | struct rte_log_le { 404 | __le32 buf; /* Can't be pointer on (64-bit) hosts */ 405 | -------------------------------------------------------------------------------- /monitor/rfa_bcmon/bcmon_scripts_activate.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | svc wifi disable 3 | sleep 2 4 | rmmod dhd 2&>/dev/null 5 | insmod /system/lib/modules/dhd.ko iface_name=wlan0 firmware_path=$(ls /data/data/com.bcmon.bcmon/files/*.bin) nvram_path=/system/etc/wifi/nvram_net.txt 6 | export LD_LIBRARY_PATH=/data/data/com.bcmon.bcmon/files/libs:$LD_LIBRARY_PATH 7 | export LD_PRELOAD=/data/data/com.bcmon.bcmon/files/libs/libfake_driver.so 8 | cd /data/data/com.bcmon.bcmon/files/tools 9 | ./enable_bcmon 2&>/dev/null 10 | echo "rfasuccess" 11 | exit 12 | -------------------------------------------------------------------------------- /monitor/rfa_bcmon/bcmon_scripts_stop.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | rmmod dhd 3 | svc wifi enable 4 | echo "rfasuccess" 5 | -------------------------------------------------------------------------------- /monitor/rfa_bcmon/bcmon_scripts_warmup.sh: -------------------------------------------------------------------------------- 1 | cd /data/data/com.bcmon.bcmon/files/tools 2 | export LD_LIBRARY_PATH=/data/data/com.bcmon.bcmon/files/libs:$LD_LIBRARY_PATH 3 | export LD_PRELOAD=/data/data/com.bcmon.bcmon/files/libs/libfake_driver.so 4 | -------------------------------------------------------------------------------- /virt_key/README.md: -------------------------------------------------------------------------------- 1 | virt-key 2 | pretends to press keys -------------------------------------------------------------------------------- /virt_key/filters: -------------------------------------------------------------------------------- 1 | sed -e 's/[a-z] /&SPACE /g' -e 's/[a-z]/& /g' -e 's/ / /g' 2 | sed -e 's/[a-z] /&SPACE /g' -e 's/[a-z]/& /g' -e 's/ / /g' -e 's/SPACE ENTER/ENTER/g' 3 | 4 | -------------------------------------------------------------------------------- /virt_key/virt-key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruleh/misc/195da372ce3cfd15f1ba61ce8d02a1b8cf8d9941/virt_key/virt-key -------------------------------------------------------------------------------- /virt_key/virtual_keyboard2.c: -------------------------------------------------------------------------------- 1 | //#!/usr/bin/c 2 | /* 3 | * Virtual Keyboard -- pretend to press keys 4 | */ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #define KEY_PRESS_DELAY 20000 15 | #define CREATE_DELAY 80000 16 | 17 | int create_uhid(int fd) { 18 | int i; 19 | 20 | fd = open("/dev/uinput", O_WRONLY | O_NONBLOCK); 21 | if (fd < 0) { 22 | return -1; 23 | } 24 | ioctl(fd, UI_SET_EVBIT, EV_KEY); 25 | ioctl(fd, UI_SET_EVBIT, EV_SYN); 26 | for(i = KEY_ESC; i <= KEY_F24; i++) { 27 | ioctl(fd,UI_SET_KEYBIT,i); 28 | } 29 | struct uinput_user_dev uidev; 30 | memset (&uidev, 0, sizeof(uidev)); 31 | snprintf(uidev.name, UINPUT_MAX_NAME_SIZE, "virtual keyboard"); 32 | uidev.id.bustype = BUS_VIRTUAL; 33 | write(fd, &uidev, sizeof(uidev)); 34 | ioctl(fd, UI_DEV_CREATE); 35 | return fd; 36 | } 37 | 38 | void write_keys(int fd, int normal_key, int special_key) { 39 | int i; 40 | struct input_event ev; 41 | 42 | memset(&ev, 0, sizeof(ev)); 43 | for (i = 1; i >= 0; i--) { 44 | ev.type = EV_KEY; 45 | ev.code = special_key; 46 | ev.value = i; 47 | write(fd, &ev, sizeof(ev)); 48 | ev.type = EV_KEY; 49 | ev.code = normal_key; 50 | ev.value = i; 51 | write(fd, &ev, sizeof(ev)); 52 | ev.type = EV_SYN; 53 | ev.code = 0; 54 | ev.value = 0; 55 | write(fd, &ev, sizeof(ev)); 56 | usleep(KEY_PRESS_DELAY); 57 | } 58 | return; 59 | } 60 | 61 | long unsigned int read_stdin() { 62 | char *lsd; 63 | lsd = 0; 64 | scanf("%s", &lsd); 65 | return (long unsigned int) lsd; //might overflow 66 | } 67 | 68 | int translate_keys(long unsigned int inpl, int *skey) { 69 | int inp = 0; 70 | switch(inpl) { 71 | /*numbers 0-9*/ 72 | case 48: 73 | inp = KEY_0; 74 | break; 75 | case 49: 76 | inp = KEY_1; 77 | break; 78 | case 50: 79 | inp = KEY_2; 80 | break; 81 | case 51: 82 | inp = KEY_3; 83 | break; 84 | case 52: 85 | inp = KEY_4; 86 | break; 87 | case 53: 88 | inp = KEY_5; 89 | break; 90 | case 54: 91 | inp = KEY_6; 92 | break; 93 | case 55: 94 | inp = KEY_7; 95 | break; 96 | case 56: 97 | inp = KEY_8; 98 | break; 99 | case 57: 100 | inp = KEY_9; 101 | break; 102 | /*a-z in qwerty order*/ 103 | case 113: 104 | inp = KEY_Q; 105 | break; 106 | case 119: 107 | inp = KEY_W; 108 | break; 109 | case 101: 110 | inp = KEY_E; 111 | break; 112 | case 114: 113 | inp = KEY_R; 114 | break; 115 | case 116: 116 | inp = KEY_T; 117 | break; 118 | case 121: 119 | inp = KEY_Y; 120 | break; 121 | case 117: 122 | inp = KEY_U; 123 | break; 124 | case 105: 125 | inp = KEY_I; 126 | break; 127 | case 111: 128 | inp = KEY_O; 129 | break; 130 | case 112: 131 | inp = KEY_P; 132 | break; 133 | 134 | case 97: 135 | inp = KEY_A; 136 | break; 137 | case 115: 138 | inp = KEY_S; 139 | break; 140 | case 100: 141 | inp = KEY_D; 142 | break; 143 | case 102: 144 | inp = KEY_F; 145 | break; 146 | case 103: 147 | inp = KEY_G; 148 | break; 149 | case 104: 150 | inp = KEY_H; 151 | break; 152 | case 106: 153 | inp = KEY_J; 154 | break; 155 | case 107: 156 | inp = KEY_K; 157 | break; 158 | case 108: 159 | inp = KEY_L; 160 | break; 161 | 162 | case 122: 163 | inp = KEY_Z; 164 | break; 165 | case 120: 166 | inp = KEY_X; 167 | break; 168 | case 99: 169 | inp = KEY_C; 170 | break; 171 | case 118: 172 | inp = KEY_V; 173 | break; 174 | case 98: 175 | inp = KEY_B; 176 | break; 177 | case 110: 178 | inp = KEY_N; 179 | break; 180 | case 109: 181 | inp = KEY_M; 182 | break; 183 | /*special characters*/ 184 | case 4412229: /*ESC*/ 185 | inp = KEY_ESC; 186 | break; 187 | case 1480802626: /*BACKSPACE*/ 188 | inp = KEY_BACKSPACE; 189 | break; 190 | case 28252: /*\n*/ 191 | inp = KEY_ENTER; 192 | break; 193 | case 1163152965: /*ENTER*/ 194 | inp = KEY_ENTER; 195 | break; 196 | case 1128353875: /*SPACE*/ 197 | inp = KEY_SPACE; 198 | break; 199 | case 45: /*-*/ 200 | inp = KEY_MINUS; 201 | break; 202 | case 1431193933: /*MINUS*/ 203 | inp = KEY_MINUS; 204 | break; 205 | case 47: /*/*/ 206 | inp = KEY_SLASH; 207 | break; 208 | case 92: /*\*/ 209 | inp = KEY_BACKSLASH; 210 | break; 211 | case 96: /*`*/ 212 | inp = KEY_GRAVE; 213 | break; 214 | case 4342100: /*TAB*/ 215 | inp = KEY_TAB; 216 | break; 217 | case 20565: /*UP*/ 218 | inp = KEY_UP; 219 | break; 220 | case 1314344772: /*DOWN*/ 221 | inp = KEY_DOWN; 222 | break; 223 | case 1413891404: /*LEFT*/ 224 | inp = KEY_LEFT; 225 | break; 226 | case 1212631378: /*RIGHT*/ 227 | inp = KEY_RIGHT; 228 | break; 229 | /*modifier keys*/ 230 | case 1179207763: /*SHIFT*/ 231 | *skey = KEY_LEFTSHIFT; 232 | break; 233 | case 1280463939: /*CTRL*/ 234 | *skey = KEY_LEFTCTRL; 235 | break; 236 | case 5524545: /*ALT*/ 237 | *skey = KEY_LEFTALT; 238 | break; 239 | } 240 | return inp; 241 | } 242 | 243 | int debug(int argn, char *argu, long key_dcode) { 244 | if (argn >= 2) { 245 | if (strncmp(argu, "-d", 2) == 0) { 246 | printf("%lu \n", key_dcode); 247 | } 248 | } 249 | return 0; 250 | } 251 | 252 | int main(int argc, char *argv[]) { 253 | unsigned int key_dcode; 254 | int key; 255 | int fd; 256 | int skey; 257 | 258 | 259 | fd = create_uhid(fd); 260 | /*if (fd == -1){ 261 | return 1; 262 | }*/ 263 | usleep(CREATE_DELAY); 264 | do { 265 | key = 0; 266 | skey = 0; 267 | key_dcode = read_stdin(); 268 | key = translate_keys(key_dcode, &skey); 269 | debug(argc, argv[1], key_dcode); 270 | if (skey != 0) { 271 | key_dcode = read_stdin(); 272 | key = translate_keys(key_dcode, &skey); 273 | debug(argc, argv[1], key_dcode); 274 | } 275 | if (argc == 3) { 276 | if (strncmp(argv[2], "-n", 2) == 0) { 277 | key = 0; 278 | skey = 0; 279 | } 280 | } 281 | write_keys(fd, key, skey); 282 | } while (key_dcode != 0); 283 | ioctl(fd, UI_DEV_DESTROY); 284 | return 0; 285 | } 286 | -------------------------------------------------------------------------------- /zooper/README.md: -------------------------------------------------------------------------------- 1 | zooperwidgets 2 | backups -------------------------------------------------------------------------------- /zooper/background: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruleh/misc/195da372ce3cfd15f1ba61ce8d02a1b8cf8d9941/zooper/background -------------------------------------------------------------------------------- /zooper/batterybar.zw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruleh/misc/195da372ce3cfd15f1ba61ce8d02a1b8cf8d9941/zooper/batterybar.zw -------------------------------------------------------------------------------- /zooper/clockbar.zw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruleh/misc/195da372ce3cfd15f1ba61ce8d02a1b8cf8d9941/zooper/clockbar.zw -------------------------------------------------------------------------------- /zooper/ip.zw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruleh/misc/195da372ce3cfd15f1ba61ce8d02a1b8cf8d9941/zooper/ip.zw -------------------------------------------------------------------------------- /zooper/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruleh/misc/195da372ce3cfd15f1ba61ce8d02a1b8cf8d9941/zooper/screenshot.png -------------------------------------------------------------------------------- /zooper/sysinfo.zw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruleh/misc/195da372ce3cfd15f1ba61ce8d02a1b8cf8d9941/zooper/sysinfo.zw --------------------------------------------------------------------------------