why wifi not working? here there is the answer... - Android Stick & Console Computers General

hello,
i open this thread to collect informations about a common problem that happens after flashing new roms
this thread has generic purpose, and is not intended for a specific board...
- suggestions on how to discover the cause of the problem
- suggestions on how to fix the problem
anyone that think to have some useful informations on this issue can insert his post
i am not an expert ( and still my wifi is not working )
but i collected some informations, and i would like to share them

The first thing is:
what happens when from the settings i click on wifi to turn it on
to see this, i opened a terminal emulator session
and i have written this:
adb logcat > 'some file name on a writable directory' (for example , i redirected the output to the external sd card)
here is what was written on the file (extracting from the file only the last part, that is the output related to my action of wifi activation):
D/WifiHW ( 368): Read wifi chip type OK ! wifi_chip_type = RK901
D/WifiHW ( 368): wifi_load_driver: DRIVER_MODULE_PATH = /system/lib/modules/rkwifi.ko, DRIVER_MODULE_ARG =
D/BluetoothAdapterService(1097373104)( 811): getState(): mAdapterProperties: [email protected] 4168aef0
D/BluetoothAdapterService(1097373104)( 811): getState(): mAdapterProperties: [email protected] 4168aef0
D/WifiService( 368): setWifiEnabled: true pid=870, uid=1000
D/AudioHardwareALSA( 109): Audio exiting sandby will open audio device
D/AudioHardwareALSA( 109): AudioStreamOutALSA::standby().....
D/WifiHW ( 368): wifi_load_driver: driver load failed
D/WifiHW ( 368): Unable to unload driver module "wlan": No such file or directory
E/WifiStateMachine( 368): Failed to load driver!
E/WifiStateMachine( 368): DriverFailedState
Searching on the web this string: "Read wifi chip type OK ! wifi_chip_type"
i found this:
https://github.com/aloksinha2001/pi****u-3.0.8-alok/blob/master/RK30_MT5931_MT6622/wifi/wifi.c
into procedure check_wifi_chip_type() i saw exactly this part:
else if (0 == strncmp(buf, "RK901", strlen("RK901")) )
{
wifi_chip_type = RK901;
ALOGD("Read wifi chip type OK ! wifi_chip_type = RK901");
}
here is compared the value of string buf with "RK901"
the string buf is read from this file: "/sys/class/rkwifi/chip"
(so i suppose that this file has been written before by some other procedure)
so, i searched the caller procedure of check_wifi_chip_type():
in the same source i find this caller:
int wifi_load_driver()
{
#ifdef WIFI_DRIVER_MODULE_PATH
char driver_status[PROPERTY_VALUE_MAX];
int count = 100; /* wait at most 20 seconds for completion */
int type;
char path[64];
if (is_wifi_driver_loaded()) {
return 0;
}
strcpy(path, DRIVER_MODULE_PATH);
type = check_wifi_chip_type();
if((type == RK901) || (type == RK903) || (type == BCM4330)) {
strcpy(path, "/system/lib/modules/rkwifi.ko");
} else if (type == RTL8188CU) {
....
this procedure as first step checks if the driver is already loaded,
if not:
the driver module path is set by default to "/system/lib/modules/wlan.ko"
Then basing on the chip type is got a more specific path:
for example, for RK901/RK903/BCM4330 the path is set to : "/system/lib/modules/rkwifi.ko"
Then, is checked if the file does exist, and if not the path is seth to the default DRIVER_MODULE_PATH,
that is "/system/lib/modules/wlan.ko"
// judge if the KO file exist, if not, insmod wlan.ko
if (access(path, F_OK) < 0) {
ALOGD("DRIVER_MODULE_PATH = %s (Not such file)...", path);
strcpy(path, DRIVER_MODULE_PATH);
}
Then,
is called insmod (insert module),
to load the driver file in 'memory' (a new module into the kernel, i suppose):
if (insmod(path, DRIVER_MODULE_ARG) < 0) {
ALOGD("%s: driver load failed", __FUNCTION__);
wifi_unload_driver();
if(retry_count-- > 0) goto retry_load_driver;
return -1;
}
Looking the logcat above,
the flow in my case stops here, with : wifi_load_driver: driver load failed
so something happened in insmod:it is not able to load the file /system/lib/modules/rkwifi.ko in memory or initialize it
(the file is found, else the process should stop before, when checking access to the file)
The insmod function does this:
allocates memory for the structure name (type utsname) :
memset(&name, 0, sizeof(name));
and load the file on this area:
module = load_file(filename_release, &size);
Then is checked if the file has been loaded
if (!module)
return -1;
and finally
the module is 'initialized':
ret = init_module(module, size, args);
One of this two events went wrong, because insmod returned -1
My investigation stops here... i am not able to proceed more...
but i am open to all suggestions and hints
Thank you!!

Vicolodo said:
The first thing is:
what happens when from the settings i click on wifi to turn it on
to see this, i opened a terminal emulator session
and i have written this:
adb logcat > 'some file name on a writable directory' (for example , i redirected the output to the external sd card)
here is what was written on the file (extracting from the file only the last part, that is the output related to my action of wifi activation):
D/WifiHW ( 368): Read wifi chip type OK ! wifi_chip_type = RK901
D/WifiHW ( 368): wifi_load_driver: DRIVER_MODULE_PATH = /system/lib/modules/rkwifi.ko, DRIVER_MODULE_ARG =
D/BluetoothAdapterService(1097373104)( 811): getState(): mAdapterProperties: [email protected] 4168aef0
D/BluetoothAdapterService(1097373104)( 811): getState(): mAdapterProperties: [email protected] 4168aef0
D/WifiService( 368): setWifiEnabled: true pid=870, uid=1000
D/AudioHardwareALSA( 109): Audio exiting sandby will open audio device
D/AudioHardwareALSA( 109): AudioStreamOutALSA::standby().....
D/WifiHW ( 368): wifi_load_driver: driver load failed
D/WifiHW ( 368): Unable to unload driver module "wlan": No such file or directory
E/WifiStateMachine( 368): Failed to load driver!
E/WifiStateMachine( 368): DriverFailedState
Searching on the web this string: "Read wifi chip type OK ! wifi_chip_type"
i found this:
https://github.com/aloksinha2001/pi****u-3.0.8-alok/blob/master/RK30_MT5931_MT6622/wifi/wifi.c
into procedure check_wifi_chip_type() i saw exactly this part:
else if (0 == strncmp(buf, "RK901", strlen("RK901")) )
{
wifi_chip_type = RK901;
ALOGD("Read wifi chip type OK ! wifi_chip_type = RK901");
}
here is compared the value of string buf with "RK901"
the string buf is read from this file: "/sys/class/rkwifi/chip"
(so i suppose that this file has been written before by some other procedure)
so, i searched the caller procedure of check_wifi_chip_type():
in the same source i find this caller:
int wifi_load_driver()
{
#ifdef WIFI_DRIVER_MODULE_PATH
char driver_status[PROPERTY_VALUE_MAX];
int count = 100; /* wait at most 20 seconds for completion */
int type;
char path[64];
if (is_wifi_driver_loaded()) {
return 0;
}
strcpy(path, DRIVER_MODULE_PATH);
type = check_wifi_chip_type();
if((type == RK901) || (type == RK903) || (type == BCM4330)) {
strcpy(path, "/system/lib/modules/rkwifi.ko");
} else if (type == RTL8188CU) {
....
this procedure as first step checks if the driver is already loaded,
if not:
the driver module path is set by default to "/system/lib/modules/wlan.ko"
Then basing on the chip type is got a more specific path:
for example, for RK901/RK903/BCM4330 the path is set to : "/system/lib/modules/rkwifi.ko"
Then, is checked if the file does exist, and if not the path is seth to the default DRIVER_MODULE_PATH,
that is "/system/lib/modules/wlan.ko"
// judge if the KO file exist, if not, insmod wlan.ko
if (access(path, F_OK) < 0) {
ALOGD("DRIVER_MODULE_PATH = %s (Not such file)...", path);
strcpy(path, DRIVER_MODULE_PATH);
}
Then,
is called insmod (insert module),
to load the driver file in 'memory' (a new module into the kernel, i suppose):
if (insmod(path, DRIVER_MODULE_ARG) < 0) {
ALOGD("%s: driver load failed", __FUNCTION__);
wifi_unload_driver();
if(retry_count-- > 0) goto retry_load_driver;
return -1;
}
Looking the logcat above,
the flow in my case stops here, with : wifi_load_driver: driver load failed
so something happened in insmod:it is not able to load the file /system/lib/modules/rkwifi.ko in memory or initialize it
(the file is found, else the process should stop before, when checking access to the file)
The insmod function does this:
allocates memory for the structure name (type utsname) :
memset(&name, 0, sizeof(name));
and load the file on this area:
module = load_file(filename_release, &size);
Then is checked if the file has been loaded
if (!module)
return -1;
and finally
the module is 'initialized':
ret = init_module(module, size, args);
One of this two events went wrong, because insmod returned -1
My investigation stops here... i am not able to proceed more...
but i am open to all suggestions and hints
Thank you!!
Click to expand...
Click to collapse
Interesting... Yesterday i was trying to solve this problem caused by a cwm recovery flashing during about 8 hours with my mk809ii. I let my pc downloading about 10 different roms from other similar devices, and this morning i stay to try one by one. Finally i found "mk808B bob finless 2.1 room (jb4.2.2) with wifi APxxxx" (APxxxx is my wifi chip, i can't remember the xxxx just now) fix both wifi and bluetooth.
You did a good research, i will save your post on case i get the error again, but i think the best thing to do is to search for a compatible rom and try, with same both cpu and wifi chipset. Also now after read your post i am going to save a backup of system /lib and system /etc directories, maybe changing the wifi library files fix the error without needing of flash and reflash...
Thanks, i liked your post!
Enviado desde mi GT-P7510 usando Tapatalk 2

Related

[TOOL][Q] C# port of ADB

I am myself a C# developer, and I am interested in interfacing with my phone through USB, but without using ADB command lines.
Is there any project going on what's goal is to create a C# interface for Android phones?
Mostly data management, like file browsing, and such things, and of course sync, the reboot options, device listing and resolving, application management, and so on.
Hi,
If you want, you can use the DroidExplorer source code. Take a look in the namespace DroidExplorer.Core.Adb
That's what I did, but it "just" binds the adb executable with all the commands, while I am looking for a pure C# solution, without involving adb.exe!
fonix232 said:
That's what I did, but it "just" binds the adb executable with all the commands, while I am looking for a pure C# solution, without involving adb.exe!
Click to expand...
Click to collapse
Are you sure ?
Take a look in the class DroidExplorer.Core.Adb.AdbHelper. This class only use pure sockets
Code:
public Socket Open ( IPAddress address, IDevice device, int port ) {
Socket s = new Socket ( AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp );
try {
s.Connect ( address, port );
s.Blocking = true;
s.NoDelay = false;
SetDevice ( s, device );
byte[] req = CreateAdbForwardRequest ( null, port );
if ( !Write ( s, req ) ) {
throw new IOException ( "failed submitting request to ADB" );
}
AdbResponse resp = ReadAdbResponse ( s, false );
if ( !resp.Okay ) {
throw new IOException ( "connection request rejected" );
}
s.Blocking = true;
} catch ( IOException ) {
s.Close ( );
throw;
}
return s;
}
Yes, uses pure sockets to connect to Adb.
Take a look:
Code:
public int GetAdbVersion ( IPEndPoint address ) {
byte[] request = FormAdbRequest ( "host:version" );
byte[] reply;
Socket adbChan = new Socket ( AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp );
try {
adbChan.Connect ( address );
adbChan.Blocking = true;
if ( !Write ( adbChan, request ) )
throw new IOException ( "failed asking for adb version" );
AdbResponse resp = ReadAdbResponse ( adbChan, false /* readDiagString */);
if ( !resp.IOSuccess || !resp.Okay ) {
this.LogError ( "Got timeout or unhappy response from ADB fb req: " + resp.Message );
adbChan.Close ( );
return -1;
}
reply = new byte[4];
if ( !Read ( adbChan, reply ) ) {
this.LogError ( "error in getting data length" );
adbChan.Close ( );
return -1;
}
String lenHex = Encoding.Default.GetString ( reply );
int len = int.Parse ( lenHex, System.Globalization.NumberStyles.HexNumber );
// the protocol version.
reply = new byte[len];
if ( !Read ( adbChan, reply ) ) {
this.LogError ( "did not get the version info" );
adbChan.Close ( );
return -1;
}
String sReply = Encoding.Default.GetString ( reply );
return int.Parse ( sReply, System.Globalization.NumberStyles.HexNumber );
} catch ( Exception ex ) {
Console.WriteLine ( ex );
throw;
}
}
The adbChan socket is used to connect to ADB over TCP. Also there are listeners for ADB responses, and a forwarder to send ADB commands.

[CWM] ClockworkMod 6.0.4.0 that will NOT update your touchscreen firmware

So I have this new tablet, and knowing all the bugs surrounding the touchscreen, decided not to update it (it came as stock JSS15J). However I still want to be able to use CM on it, so I patched the kernel to never update the touchscreen fw. Here's the compiled recovery from CM-10.2 synced today (october 2th), and then the kernel patch:
https://docs.google.com/file/d/0ByHQWL5Q6bSwYXJpaE9JZ0dnbVE/edit?usp=sharing
Code:
diff --git a/drivers/input/touchscreen/ektf3k.c b/drivers/input/touchscreen/ektf3k.c
index 4b6a7e7..451bcee 100755
--- a/drivers/input/touchscreen/ektf3k.c
+++ b/drivers/input/touchscreen/ektf3k.c
@@ -392,7 +392,7 @@ static int check_fw_version(const unsigned char*firmware, unsigned int size, int
id = firmware[size - 2*FIRMWARE_PAGE_SIZE + 122] |
(firmware[size - 2*FIRMWARE_PAGE_SIZE + 123] << 8);
- touch_debug(DEBUG_INFO, "The firmware was version 0x%X and id:0x%X\n", version, id);
+ touch_debug(DEBUG_INFO, "The firmware was version 0x%X and id:0x%X, new fw_version: 0x%X\n", version, id, fw_version);
if (id == 0x3029 && BOOTCODE_VERSION >= 0x6046) {
/*if the touch firmware was empty, always update firmware*/
@@ -1318,7 +1318,10 @@ static int firmware_update_header(struct i2c_client *client, unsigned char *firm
unsigned char nb_isp_cmd[4] = {0x45, 0x49, 0x41, 0x50};
unsigned char *cursor;
struct elan_ktf3k_ts_data *ts = i2c_get_clientdata(client);
-
+
+ printk("[ektf3k]: firmware_update_header: not updating your firmware, bro\n");
+ return 0;
+
if(ts == NULL)
return -1;
I can also upload the kang if anyone needs it. Note my patch has the old/new version swapped (small bug), it says new fw_version, but it's actually the current version.
I tested it with my own device just in case someone is wondering wether it works or not.
On a slightly unrelated note, my CM 10.2 kang would not have the Wi-Fi module loading. I had this error in logcat:
Code:
E/WifiHW ( 190): Failed to write wlan fw path param (Operation not permitted)
E/WifiStateMachine( 597): Failed to reload STA firmware java.lang.IllegalStateException: command '6 softap fwreload wlan0 STA' failed with '400 6 SoftAP command has failed'
Digging a bit further led to this error in the kernel log:
Code:
<6>[ 69.311614] wlan: loading driver v3.2.2.17B
<3>[ 69.314300] wlan: [573:F :HDD] hdd_parse_config_ini: request_firmware failed -2
However the official nightly didn't have this issue. I tracked it down to the lack of a symbolic link, which I had to create manually:
Code:
mount -o remount,rw /dev/block/platform/msm_sdcc.1/by-name/system /system
cd /vendor/firmware/wlan/prima/
ln -s /data/misc/wifi/WCNSS_qcom_cfg.ini WCNSS_qcom_cfg.ini
ln -s /data/misc/wifi/WCNSS_qcom_wlan_nv.bin WCNSS_qcom_wlan_nv.bin
I hope this information will be useful to others. Still not sure why my build has this problem and the official builds don't.

wifi problem

Hello,
i own a RK3188 device (T-R42 with board version B351 V1.1)
I flashed a custom rom and since then i am no more able to reactivate the wifi
I tried many other custom roms and stock roms, but i have always the same behavior:
When from the settings i try to turn it on, it stays on for a few seconds ( no wireless network is shown ), and then it goes off
This is the logcat that is printed when i try to turn my wifi on:
(using command adb logcat on terminal emulator session)
D/WifiHW ( 368): Read wifi chip type OK ! wifi_chip_type = RK901
D/WifiHW ( 368): wifi_load_driver: DRIVER_MODULE_PATH = /system/lib/modules/rkwifi.ko, DRIVER_MODULE_ARG =
D/BluetoothAdapterService(1097373104)( 811): getState(): mAdapterProperties: [email protected] 4168aef0
D/BluetoothAdapterService(1097373104)( 811): getState(): mAdapterProperties: [email protected] 4168aef0
D/WifiService( 368): setWifiEnabled: true pid=870, uid=1000
D/AudioHardwareALSA( 109): Audio exiting sandby will open audio device
D/AudioHardwareALSA( 109): AudioStreamOutALSA::standby().....
D/WifiHW ( 368): wifi_load_driver: driver load failed
D/WifiHW ( 368): Unable to unload driver module "wlan": No such file or directory
E/WifiStateMachine( 368): Failed to load driver!
E/WifiStateMachine( 368): DriverFailedState
i checked that under system/lib/modules do exist these files:
rkwifi.ko
wlan.ko
both with owner 'root', group 'root' and permissions 644
Can someone give me some hints on what is the possible cause of this error,
and how to discover the right wifi drivers for my device?
Thank you!
Try reflashing the baseband again, I was having the same problem with a kernel, and a custom rom, I flashed the stock baseband and reflash the custom rom and my wifi started working again, or check the kernel that you are using, that could be the problem. Hope this helped out a bit, I know its a real headache when this happens, hope you made a backup too.
Vicolodo said:
Hello,
i own a RK3188 device (T-R42 with board version B351 V1.1)
I flashed a custom rom and since then i am no more able to reactivate the wifi
I tried many other custom roms and stock roms, but i have always the same behavior:
When from the settings i try to turn it on, it stays on for a few seconds ( no wireless network is shown ), and then it goes off
This is the logcat that is printed when i try to turn my wifi on:
(using command adb logcat on terminal emulator session)
D/WifiHW ( 368): Read wifi chip type OK ! wifi_chip_type = RK901
D/WifiHW ( 368): wifi_load_driver: DRIVER_MODULE_PATH = /system/lib/modules/rkwifi.ko, DRIVER_MODULE_ARG =
D/BluetoothAdapterService(1097373104)( 811): getState(): mAdapterProperties: [email protected] 4168aef0
D/BluetoothAdapterService(1097373104)( 811): getState(): mAdapterProperties: [email protected] 4168aef0
D/WifiService( 368): setWifiEnabled: true pid=870, uid=1000
D/AudioHardwareALSA( 109): Audio exiting sandby will open audio device
D/AudioHardwareALSA( 109): AudioStreamOutALSA::standby().....
D/WifiHW ( 368): wifi_load_driver: driver load failed
D/WifiHW ( 368): Unable to unload driver module "wlan": No such file or directory
E/WifiStateMachine( 368): Failed to load driver!
E/WifiStateMachine( 368): DriverFailedState
i checked that under system/lib/modules do exist these files:
rkwifi.ko
wlan.ko
both with owner 'root', group 'root' and permissions 644
Can someone give me some hints on what is the possible cause of this error,
and how to discover the right wifi drivers for my device?
Thank you!
Click to expand...
Click to collapse
Do you have stock firmware/rom of your device? If yes then you need to flash(patch) all the files in lib/modules.
Also in updater-script add this code:
symlink("rkwifi.ko", "/system/lib/modules/wlan.ko");
then flash it via cwm
MgudFrn said:
Do you have stock firmware/rom of your device? If yes then you need to flash(patch) all the files in lib/modules.
Also in updater-script add this code:
symlink("rkwifi.ko", "/system/lib/modules/wlan.ko");
then flash it via cwm
Click to expand...
Click to collapse
Ok thank you,
yes, the seller gave me some links for the stock firmware, but he is not sure on which is the original stock firmware
(for T-R42 there are a lot of different board versions with different chipsets...)
i can extract the components with a tool (perhaps i need only system.img and unpack it)
and build a zip to patch the system/lib/modules
by the way, why i have to add that symlink?
i checked that RK901 information is under the sys folder,
the file system under this folder is built dynamically by the kernel, i am right?
do you think that RK901 is hard-coded into the kernel?
because opening the board i checked that i have a different chipset... wifi is managed by chip AP6210
Thank you!
kidkree1 said:
Try reflashing the baseband again, I was having the same problem with a kernel, and a custom rom, I flashed the stock baseband and reflash the custom rom and my wifi started working again, or check the kernel that you are using, that could be the problem. Hope this helped out a bit, I know its a real headache when this happens, hope you made a backup too.
Click to expand...
Click to collapse
Thank you too
The strange thing i see on the settings is that the wifi mac address is not set (unknown)...perhaps this happens because wifi driver cannot be loaded?
The second strange thing i see is that the file
/sys/class/rkwifi/chip
(this is the file used by the wifi driver loader procedure to know which is the wifi chip of the board)
contains RK901
i read somewhere that this chip is used on rk3066 boards, instead i have a rk3188 board
Besides that, i opened my tv box and i saw that i have the chip AP6210...
By the way, this is the link to an example driver loader procedure
https://github.com/gripped/MK808-he...lob/master/RK30_MT5931_MT6622/wifi/wifi.c.new
I found it googling one of the strings that is reported by the logcat
'D/WifiHW ( 368): wifi_load_driver: DRIVER_MODULE_PATH = /system/lib/modules/rkwifi.ko',
this string is contained in the c source file
so also the driver load procedure seems done for other device (rk3066)...
or perhaps rk3066 and rk3188 share the same procedures... i dont know...
Vicolodo said:
Ok thank you,
yes, the seller gave me some links for the stock firmware, but he is not sure on which is the original stock firmware
(for T-R42 there are a lot of different board versions with different chipsets...)
i can extract the components with a tool (perhaps i need only system.img and unpack it)
and build a zip to patch the system/lib/modules
by the way, why i have to add that symlink?
i checked that RK901 information is under the sys folder,
the file system under this folder is built dynamically by the kernel, i am right?
do you think that RK901 is hard-coded into the kernel?
because opening the board i checked that i have a different chipset... wifi is managed by chip AP6210
Thank you!
Click to expand...
Click to collapse
Previously I faced same problem with my mt6575 chipset and that was resolved by this method. I know mine and yours chipset is totally different but the logcat that I got was same as yours mentioning 'loading drivers failed'. So you can give it a try. but plz do a nandroid backup first.
Driver problem??
Vicolodo said:
Hello,
i own a RK3188 device (T-R42 with board version B351 V1.1)
I flashed a custom rom and since then i am no more able to reactivate the wifi
I tried many other custom roms and stock roms, but i have always the same behavior:
When from the settings i try to turn it on, it stays on for a few seconds ( no wireless network is shown ), and then it goes off
This is the logcat that is printed when i try to turn my wifi on:
(using command adb logcat on terminal emulator session)
D/WifiHW ( 368): Read wifi chip type OK ! wifi_chip_type = RK901
D/WifiHW ( 368): wifi_load_driver: DRIVER_MODULE_PATH = /system/lib/modules/rkwifi.ko, DRIVER_MODULE_ARG =
D/BluetoothAdapterService(1097373104)( 811): getState(): mAdapterProperties: [email protected] 4168aef0
D/BluetoothAdapterService(1097373104)( 811): getState(): mAdapterProperties: [email protected] 4168aef0
D/WifiService( 368): setWifiEnabled: true pid=870, uid=1000
D/AudioHardwareALSA( 109): Audio exiting sandby will open audio device
D/AudioHardwareALSA( 109): AudioStreamOutALSA::standby().....
D/WifiHW ( 368): wifi_load_driver: driver load failed
D/WifiHW ( 368): Unable to unload driver module "wlan": No such file or directory
E/WifiStateMachine( 368): Failed to load driver!
E/WifiStateMachine( 368): DriverFailedState
i checked that under system/lib/modules do exist these files:
rkwifi.ko
wlan.ko
both with owner 'root', group 'root' and permissions 644
Can someone give me some hints on what is the possible cause of this error,
and how to discover the right wifi drivers for my device?
Thank you!
Click to expand...
Click to collapse
The last few line sof your logcat show that there is some driver error...try a full wipe, then (as already suggested) flash a stock ROM for your device.
(<--Remember to Thank me if this helps)
Vicolodo said:
Thank you too
The strange thing i see on the settings is that the wifi mac address is not set (unknown)...perhaps this happens because wifi driver cannot be loaded?
The second strange thing i see is that the file
/sys/class/rkwifi/chip
(this is the file used by the wifi driver loader procedure to know which is the wifi chip of the board)
contains RK901
i read somewhere that this chip is used on rk3066 boards, instead i have a rk3188 board
Besides that, i opened my tv box and i saw that i have the chip AP6210...
By the way, this is the link to an example driver loader procedure
https://github.com/gripped/MK808-he...lob/master/RK30_MT5931_MT6622/wifi/wifi.c.new
I found it googling one of the strings that is reported by the logcat
'D/WifiHW ( 368): wifi_load_driver: DRIVER_MODULE_PATH = /system/lib/modules/rkwifi.ko',
this string is contained in the c source file
so also the driver load procedure seems done for other device (rk3066)...
or perhaps rk3066 and rk3188 share the same procedures... i dont know...
Click to expand...
Click to collapse
Vicolodo,
Were you able to get your wifi working again? I am having a similar issue on RK3066 aftermarket GPS car unit and can really use some advice.
Thanks!
P340

Trying to patch Galaxy Store .apk -> SEMS:SamsungAccount: [SignatureCheckUtil]

I'm trying to patch apk mentioned in title. Unpacking and packing back with apktool works well and application can be successfully installed on device and I can browse all applications in store but not all functionality is working. When I try to open My Applications or try to install any new application from store then it briefly blink like trying to switch activity window and nothing else happens. Of course my first assumption was some additional security mechanism is in place so quick look in logcat... and here it is (timestamps removed for clarity):
Code:
I SEMS:SamsungAccount: ================ checkSignatureValidation ================================================
I SEMS:SamsungAccount: [AccountResponse] isSHA2Matched : false
I SEMS:SamsungAccount: [AccountResponse] appId is matched
I SEMS:SamsungAccount: [AccountResponse] isSHA2Matched : continue
I SEMS:SamsungAccount: [AccountResponse] appId is matched
I SEMS:SamsungAccount: [AccountResponse] isSHA2Matched : continue
I SEMS:SamsungAccount: [AccountResponse] appId is matched
I SEMS:SamsungAccount: [AccountResponse] isSHA2Matched : continue
I SEMS:SamsungAccount: [AccountResponse] appId is matched
I SEMS:SamsungAccount: [AccountResponse] isSHA2Matched : widgetapp.samsungapps./64/3cf08
I SEMS:SamsungAccount: [AccountResponse] appId is matched
I SEMS:SamsungAccount: [AccountResponse] isSHA2Matched : sa_apps/64/c67d7
I SEMS:SamsungAccount: [AccountResponse] hash value or app id of this apk is not registered. plz register!!!!!!!
I SEMS:SamsungAccount: [AccountResponse] wrong hashcode : sa_apps/64/06bb6
I SEMS:SamsungAccount: [AccountResponse] checkSignatureValidation - false, sa_apps
I SEMS:SamsungAccount: [SignatureCheckUtil] Not matched cache data of signature
I SEMS:SamsungAccount: [SignatureCheckUtil] start request signatureList
I SEMS:SamsungAccount: [SignatureCheckUtil] Server app list : last server request time is not expired.
I SEMS:SamsungAccount: [SignatureCheckUtil] Server app list : last server request time : 20200215174048
I SEMS:SamsungAccount: [RATA] setFailedResult()
I SEMS:SamsungAccount: [RequestAccessTokenActivity] setResultWithLog resultCode=[1]
I SEMS:SamsungAccount: [RequestAccessTokenActivity] errorCode=[SAC_0205], errorMsg[The signature of this application is not registered with the server.]
From this tiny part of log i can assume that:
Some process is calculating SHA256 signature of file
It is compared with some table of allowed hashes/signatures
This table is cached and is valid for some time
But except that I'm little bit dry about ideas where this table is cached and how can I modify it. Any help appreciated!
--- update ---
Basing on procID from logcat now i know that package: com.samsung.android.mobileservice is responsible for this hash checking. After code investigation I found that the file with hashes is located here:
Code:
/data/data/com.samsung.android.mobileservice/files/package_info.xml
and in that file we can find this entries related to com.sec.android.app.samsungapps:
Code:
<packageInfo>
<appID><![CDATA[6mztkyy858]]></appID>
<package><![CDATA[com.sec.android.app.samsungapps]]></package>
<signature><![CDATA[-109254120]]></signature>
<signature2><![CDATA[]]></signature2>
</packageInfo>
....
<packageInfo>
<appID><![CDATA[6mztkyy858]]></appID>
<package><![CDATA[com.sec.android.app.samsungapps]]></package>
<signature><![CDATA[-965053021]]></signature>
<signature2><![CDATA[]]></signature2>
</packageInfo>
...
<packageInfo>
<appID><![CDATA[6mztkyy858]]></appID>
<package><![CDATA[com.sec.android.app.samsungapps]]></package>
<signature><![CDATA[2040106259]]></signature>
<signature2><![CDATA[c67d72638ec349719fea61118b32f06eb96125b3d687f3d6c521e34f669703e2]]></signature2>
</packageInfo>
signature2 in last entry length is equal to sha256 hash
Below is full function of hash checking:
Code:
private static boolean checkSignature2Validation(Context paramContext, ArrayList<PackageSignatureInfo> paramArrayList, String param_appID, String param_packageName, boolean paramBoolean)
throws PackageManager.NameNotFoundException
{
String[] arrayOfString = null;
Signature[] arrayOfSignature = paramContext.getPackageManager().getPackageInfo(param_packageName, 64).signatures;
int i;
int k;
if ((arrayOfSignature != null) && (arrayOfSignature.length > 0))
{
arrayOfString = new String[arrayOfSignature.length];
i = 0;
int j = arrayOfSignature.length;
for (k = 0;; k++)
{
paramContext = arrayOfString;
if (k >= j) {
break;
}
arrayOfString[i] = HashUtil.getSHA256(arrayOfSignature[k].toCharsString());
LogUtil.getInstance().logD(param_packageName + ", sha2Arr[i]:" + arrayOfString[i]);
i++;
}
}
LogUtil.getInstance().logI("AccountResponse", "sigs is empty");
paramContext = arrayOfString;
boolean bool = false;
if (paramContext != null) {
bool = isSHA2Matched(paramArrayList, param_appID, paramContext, param_packageName, paramBoolean);
}
if (!bool)
{
LogUtil.getInstance().logI("AccountResponse", "hash value or app id of this apk is not registered. plz register!!!!!!!");
LogUtil.getInstance().logD("AccountResponse", "appID : " + param_appID);
if (paramContext != null)
{
i = paramContext.length;
for (k = 0; k < i; k++)
{
paramArrayList = paramContext[k];
LogUtil.getInstance().logI("AccountResponse", "wrong hashcode : " + RestrictionStringRemovalUtil.getInstance().getAvailableKeyString(param_packageName) + "/" + hashCodeToLog(paramArrayList));
}
}
}
return bool;
}
Can i somehow retrieve value of paramContext.getPackageManager().getPackageInfo(param_packageName, 64).signatures; with ADB to confirm my guess?

[APP][PATCH] SnoopSnitch OnePlus Compatibility Patch

After some trial and error, I have identified the reason why snoopsnitch isn't working.
The issue is related to the DIAG initialization code in the diag-helper binary.
I'm attaching a working patch and a compiled APK (PM me for the link or maybe a mod. can attach it. I have 10 post link restriction) for your convenience.
PS: the code specifically look for OnePlus manufacturer but it may work on other devices too (with the appropriate changes)
Code:
diff --git a/contrib/diag_helper/jni/diag-helper.c b/contrib/diag_helper/jni/diag-helper.c
index ddb7fcb1..c1b00a33 100644
--- a/contrib/diag_helper/jni/diag-helper.c
+++ b/contrib/diag_helper/jni/diag-helper.c
@@ -3,6 +3,7 @@
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/un.h>
+#include <sys/system_properties.h>
#include <android/log.h>
@@ -13,6 +14,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <arpa/inet.h>
+#include <string.h>
#define BUF_SIZE 1000000
@@ -62,9 +64,15 @@ open_diag_dev(void)
int diag_fd = -1;
int rv = -1;
int olderrno;
+ bool op = false;
+ char man[PROP_VALUE_MAX + 1];
+
+ __system_property_get("ro.product.manufacturer", man);
logmsg(ANDROID_LOG_DEBUG, "opening diag device");
+ if (strcasecmp("oneplus", man) == 0) op = true;
+
diag_fd = open("/dev/diag", O_RDWR|O_CLOEXEC);
if (diag_fd < 0) {
logmsg(ANDROID_LOG_FATAL, "error opening diag device: %m");
@@ -74,6 +82,7 @@ open_diag_dev(void)
const unsigned long DIAG_IOCTL_SWITCH_LOGGING = 7;
const int MEMORY_DEVICE_MODE = 2;
+ const int mode_param[] = { MEMORY_DEVICE_MODE, -1, 0 };
struct diag_logging_mode_param_t stMode = {
MEMORY_DEVICE_MODE, 0, 1
};
@@ -84,7 +93,10 @@ open_diag_dev(void)
rv = ioctl(diag_fd, DIAG_IOCTL_SWITCH_LOGGING, MEMORY_DEVICE_MODE);
if (rv < 0) {
olderrno = errno;
- rv = ioctl(diag_fd, DIAG_IOCTL_SWITCH_LOGGING, (void *)&stMode);
+ if(op)
+ rv = ioctl(diag_fd, DIAG_IOCTL_SWITCH_LOGGING, (void *)&mode_param, sizeof(mode_param));
+ else
+ rv = ioctl(diag_fd, DIAG_IOCTL_SWITCH_LOGGING, (void *)&stMode);
}
if (rv < 0) {
Credits: SRLabs, original author repository: https://opensource.srlabs.de/projects/snoopsnitch
{Mod edit: Added apk on request of OP @h3ph4est7s}
thanks
I've been looking for this for a while, I sent you a pm
it works perfectly thanks
Hi,
Thanks for the apk! It's great to see it again running (especially initializing) on my device, love it! As I already wrote in another posting in another thread (sorry for the double post, but in this specific case it's OK I think), there are two things that need to be mentioned:
- the patch level checks do not work on my device, maybe this depends in the ROM I'm using (I'm on Havoc 3.8 / Android 10) - I'll have to check if it maybe works with another ROM.
- I currently cannot say if the detection of silent SMS and IMSI Catchers really is working since I've havent't had such events till now. Silent SMSes should appear from time to time IMO. IMSI catcher events are extremely rare in my experience, I used Snoop Snitch for about one year two or three years ago and got two of those events in the whole year: one in Germany, one in Canada.
Cheers
Zap
I am also facing the same DIAG_CHAR initializing issue. I used your snoopsnitch apk to test on my Oneplus 5, LOS16. The app started, but closed immediately. The backend service keep on restarted. My logcat shows as below.
12-11 13:16:12.186 9407 9407 E [email protected]: Could not get passthrough implementation for [email protected]::ICameraProvider/legacy/0.
12-11 13:16:12.198 9417 9417 I diag-helper: starting
12-11 13:16:12.198 9417 9417 I diag-helper: test mode invoked
12-11 13:16:12.198 9417 9417 D diag-helper: opening diag device
12-11 13:16:12.198 9417 9417 F diag-helper: error setting diag device logging mode: Bad address/Invalid argument
12-11 13:16:12.199 9417 9417 E diag-helper: error opening DIAG device
12-11 13:16:12.200 9261 9261 E msd-service: Terminating MsdService after shutting down due to an unexpected error
12-11 13:16:12.202 9261 9261 I opSnitchServic: System.exit called, status: 1
12-11 13:16:12.202 9261 9261 I AndroidRuntime: VM exiting with result code 1, cleanup skipped.
12-11 13:16:12.215 1359 9176 I ActivityManager: Process .SnoopSnitchService (pid 9261) has died: fore SVC
12-11 13:16:12.215 1359 9176 W ActivityManager: Scheduling restart of crashed service de.srlabs.snoopsnitch/.qdmon.MsdService in 1000ms
12-11 13:16:12.215 1359 1405 W libprocessgroup: kill(-9261, 9) failed: No such process
12-11 13:16:12.215 1359 1405 I libprocessgroup: Successfully killed process cgroup uid 10092 pid 9261 in 0ms
Click to expand...
Click to collapse
Any kind of help is appreciated.
Installed this Mod on my OP7T Pro, but it crashes at start. The unmodified version starts flawless, but did mit recognize root privileges (message at the bottom "snoopsnitch require root access..."). On clicking the start network test button it tells me "could not initialize the diag interface". I checked diag_char in system and it is enabled. No Idea whats wrong. Using Android 10 with latest stabile stock OS.
EinsteinXXL said:
Installed this Mod on my OP7T Pro, but it crashes at start. The unmodified version starts flawless, but did mit recognize root privileges (message at the bottom "snoopsnitch require root access..."). On clicking the start network test button it tells me "could not initialize the diag interface". I checked diag_char in system and it is enabled. No Idea whats wrong. Using Android 10 with latest stabile stock OS.
Click to expand...
Click to collapse
Same here with Oxygen OS 11 beta. The modded app crashes on start and the original app can't "initilize diag driver."
On my OP3T with Android 11 (Arrow OS) it works. Same again as before: Starting and initializing perfectly, but the patch level checks do not work.
The Problem seems to be device-/SOC - specific.
Hello and thank you so very much for this. I had been wanting to use it for s long time and finally came across your workaround. Unfortunately it didn't work for me. I originally installed through nethunter store but I uninstalled that and installed yours. I am running Jaguar OS on OP8T rooted with magisk. I created a logcat hoping that you'll be able to hero me get it going. I am attaching it here. Thank you!

Categories

Resources