Related
DFT_SSPL_MINI.c
Hi im sorry, this is decompiled
hi,what is this?
file extension c
tzacapaca said:
hi,what is this?
file extension c
Click to expand...
Click to collapse
Isn't that a file for VS2008 or higher with C-code? I'll check that for you
Checked that for you, and indeed it is decompiled C++. This is what it contains, but I don't know what we should do with this code? Maybe someone who knows C++ can make HSPL with this as a basis?
Code:
/* This file has been generated by the Hex-Rays decompiler.
Copyright (c) 2009 Hex-Rays <[email protected]>
Detected compiler: Visual C++
*/
#include <windows.h>
#include <defs.h>
//-------------------------------------------------------------------------
// Data declarations
extern char aGetprocesswind[]; // idb
extern char aGetuserobjecti[]; // idb
extern char aGetlastactivep[19]; // weak
extern char aGetactivewindo[16]; // weak
extern char aMessageboxa[]; // idb
extern char LibFileName[]; // idb
extern char aRomupdateutili[21]; // weak
extern char Caption[]; // idb
extern _UNKNOWN unk_409300; // weak
extern char Text[]; // idb
extern char aErrorDuringExt[]; // idb
extern _UNKNOWN unk_409400; // weak
extern _UNKNOWN unk_409408; // weak
extern int dword_40AA58; // weak
extern int dword_40ACA0; // weak
extern char off_40ACA4[92]; // idb
extern int dword_40AD10; // weak
extern int dword_40AD1C; // weak
extern int dword_40B2E0; // weak
extern int dword_40B2F0; // weak
extern int dword_40B308; // weak
extern int dword_40B30C; // weak
extern int dword_40B310; // weak
extern int dword_40B314; // weak
extern int dword_40B318; // weak
extern int dword_40B31C; // weak
extern int dword_40B320; // weak
extern int dword_40B324; // weak
extern CHAR Filename; // idb
extern char FileName[]; // idb
extern int dword_40BB68; // weak
//-------------------------------------------------------------------------
// Function declarations
#define __thiscall __cdecl // Test compile in C mode
// signed int __usercall sub_401000<eax>(int a1<eax>, int a2<edx>, int a3<ecx>);
LPVOID __cdecl sub_401050(DWORD NumberOfBytesWritten);
int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd);
// char *__cdecl strrchr(const char *, int);
signed int __cdecl sub_4017D5(int a1);
signed int __cdecl sub_40180C(int a1);
int (*__cdecl sub_40247B())(void);
int (*__cdecl sub_40249F())(void);
// _DWORD __cdecl _encode_pointer(_DWORD); weak
// int _encoded_null(void); weak
// _DWORD __cdecl _decode_pointer(_DWORD); weak
int __cdecl sub_402EE1(int a1);
// int __cdecl _invoke_watson(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); weak
// int __cdecl _invalid_parameter(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); weak
// int *__cdecl _errno();
int __cdecl sub_403325();
int __cdecl sub_4034EC(int a1);
int __cdecl sub_4034F6(int a1);
int __cdecl sub_4035D5(int a1);
int __cdecl sub_403601(int a1, int a2, int a3);
int __thiscall sub_40544A(void *this, char a2);
void __cdecl sub_4055AF();
// void *__cdecl memset(void *, int, size_t);
// _DWORD __thiscall __report_gsfailure(_DWORD ecx0, _BYTE _4); weak
// int __cdecl _unwind_handler(int, int, int, int, int); weak
// int __cdecl _abnormal_termination();
// HANDLE __stdcall CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
// HRSRC __stdcall FindResourceA(HMODULE hModule, LPCSTR lpName, LPCSTR lpType);
// HGLOBAL __stdcall LoadResource(HMODULE hModule, HRSRC hResInfo);
// DWORD __stdcall WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds);
// BOOL __stdcall WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped);
// DWORD __stdcall SizeofResource(HMODULE hModule, HRSRC hResInfo);
// BOOL __stdcall CreateProcessA(LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation);
// BOOL __stdcall SetFileAttributesA(LPCSTR lpFileName, DWORD dwFileAttributes);
// LPVOID __stdcall LockResource(HGLOBAL hResData);
// DWORD __stdcall GetModuleFileNameA(HMODULE hModule, LPCH lpFilename, DWORD nSize);
// BOOL __stdcall CloseHandle(HANDLE hObject);
// BOOL __stdcall DeleteFileA(LPCSTR lpFileName);
// FARPROC __stdcall GetProcAddress(HMODULE hModule, LPCSTR lpProcName);
// HMODULE __stdcall LoadLibraryA(LPCSTR lpLibFileName);
// int __stdcall MessageBoxA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType);
//----- (00401000) --------------------------------------------------------
signed int __usercall sub_401000<eax>(int a1<eax>, int a2<edx>, int a3<ecx>)
{
signed int result; // [email protected]
int v4; // [email protected]
int v5; // [email protected]
v5 = a1;
v4 = a3;
result = 0;
if ( a3 )
{
while ( *(_BYTE *)v5 )
{
*(_BYTE *)a2++ = *(_BYTE *)v5++;
--v4;
if ( !v4 )
{
result = -2147024774;
*(_BYTE *)(a2 - 1) = 0;
return result;
}
}
if ( !v4 )
{
--a2;
result = -2147024774;
}
*(_BYTE *)a2 = 0;
}
else
{
result = -2147024809;
}
return result;
}
//----- (00401050) --------------------------------------------------------
LPVOID __cdecl sub_401050(DWORD NumberOfBytesWritten)
{
HRSRC v1; // [email protected]
HRSRC v2; // [email protected]
LPVOID result; // [email protected]
HGLOBAL v4; // [email protected]
const void *v5; // [email protected]
HANDLE v6; // [email protected]
DWORD v7; // [email protected]
void *v8; // [email protected]
v1 = FindResourceA(0, (LPCSTR)(unsigned __int16)NumberOfBytesWritten, (LPCSTR)0xA);
v2 = v1;
if ( v1 && (v4 = LoadResource(0, v1)) != 0 )
{
result = LockResource(v4);
v5 = result;
if ( result )
{
v7 = SizeofResource(0, v2);
v6 = CreateFileA(FileName, 0x40000000u, 1u, 0, 2u, 2u, 0);
v8 = v6;
if ( v6 == (HANDLE)-1 )
{
result = 0;
}
else
{
WriteFile(v6, v5, v7, &NumberOfBytesWritten, 0);
CloseHandle(v8);
SetFileAttributesA(FileName, 2u);
result = (LPVOID)1;
}
}
}
else
{
result = 0;
}
return result;
}
//----- (004010F0) --------------------------------------------------------
int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
char *v4; // [email protected]
unsigned int v5; // [email protected]
unsigned int v6; // [email protected]
int v7; // [email protected]
signed int v8; // [email protected]
char v9; // [email protected]
int v10; // [email protected]
signed int v11; // [email protected]
char *v12; // [email protected]
int v13; // [email protected]
char *v14; // [email protected]
char v15; // [email protected]
int v16; // [email protected]
signed int v17; // [email protected]
int v18; // [email protected]
signed int v19; // [email protected]
char v20; // [email protected]
int v22; // [email protected]
signed int v23; // [email protected]
char *v24; // [email protected]
int v25; // [email protected]
char *v26; // [email protected]
char v27; // [email protected]
int v28; // [email protected]
signed int v29; // [email protected]
char *v30; // [email protected]
int v31; // [email protected]
char *v32; // [email protected]
char v33; // [email protected]
unsigned int v34; // [email protected]
int v35; // [email protected]
signed int v36; // [email protected]
char v37; // [email protected]
int v38; // [email protected]
signed int v39; // [email protected]
char *v40; // [email protected]
int v41; // [email protected]
char *v42; // [email protected]
char v43; // [email protected]
int v44; // [email protected]
signed int v45; // [email protected]
char *v46; // [email protected]
int v47; // [email protected]
char *v48; // [email protected]
char v49; // [email protected]
struct _PROCESS_INFORMATION ProcessInformation; // [sp+4h] [bp-54h]@64
struct _STARTUPINFOA StartupInfo; // [sp+14h] [bp-44h]@64
Filename = 0;
GetModuleFileNameA(0, &Filename, 0x1FFu);
v4 = strrchr(&Filename, 92);
if ( v4 )
*v4 = 0;
v5 = &Filename - FileName;
v6 = 0;
do
{
v8 = 512;
v7 = (int)FileName;
while ( 1 )
{
v9 = *(_BYTE *)(v5 + v7);
if ( !v9 )
break;
*(_BYTE *)v7++ = v9;
--v8;
if ( !v8 )
goto LABEL_9;
}
if ( v8 )
goto LABEL_10;
LABEL_9:
--v7;
LABEL_10:
*(_BYTE *)v7 = 0;
v11 = 512;
v10 = (int)FileName;
while ( *(_BYTE *)v10 )
{
++v10;
--v11;
if ( !v11 )
goto LABEL_23;
}
if ( v11 )
{
v13 = 512 - (512 - v11);
v12 = &FileName[512 - v11];
if ( 0 != v11 )
{
v14 = (char *)(&unk_409300 - (_UNKNOWN *)v12);
while ( 1 )
{
v15 = *(_BYTE *)((_DWORD)v14 + (_DWORD)v12);
if ( !v15 )
break;
*v12++ = v15;
--v13;
if ( !v13 )
goto LABEL_21;
}
if ( v13 )
goto LABEL_22;
LABEL_21:
--v12;
LABEL_22:
*v12 = 0;
}
}
LABEL_23:
v17 = 512;
v16 = (int)FileName;
while ( *(_BYTE *)v16 )
{
++v16;
--v17;
if ( !v17 )
goto LABEL_29;
}
if ( v17 )
sub_401000(*(_DWORD *)&off_40ACA4[v6], (int)&FileName[512 - v17], 512 - (512 - v17));
LABEL_29:
if ( !sub_401050(*(int *)((char *)&dword_40ACA0 + v6)) )
{
MessageBoxA(0, "Error during application start! Possible file corrupted!", Caption, 0x40010u);
return -1;
}
v6 += 8;
}
while ( v6 < 0x50 );
v19 = 512;
v18 = (int)FileName;
while ( 1 )
{
v20 = *(_BYTE *)(v5 + v18);
if ( !v20 )
break;
*(_BYTE *)v18++ = v20;
--v19;
if ( !v19 )
goto LABEL_37;
}
if ( v19 )
goto LABEL_38;
LABEL_37:
--v18;
LABEL_38:
*(_BYTE *)v18 = 0;
v23 = 512;
v22 = (int)FileName;
while ( *(_BYTE *)v22 )
{
++v22;
--v23;
if ( !v23 )
goto LABEL_51;
}
if ( v23 )
{
v25 = 512 - (512 - v23);
v24 = &FileName[512 - v23];
if ( 0 != v23 )
{
v26 = (char *)(&unk_409300 - (_UNKNOWN *)v24);
while ( 1 )
{
v27 = *(_BYTE *)((_DWORD)v26 + (_DWORD)v24);
if ( !v27 )
break;
*v24++ = v27;
--v25;
if ( !v25 )
goto LABEL_49;
}
if ( v25 )
goto LABEL_50;
LABEL_49:
--v24;
LABEL_50:
*v24 = 0;
}
}
LABEL_51:
v29 = 512;
v28 = (int)FileName;
while ( *(_BYTE *)v28 )
{
++v28;
--v29;
if ( !v29 )
goto LABEL_64;
}
if ( v29 )
{
v31 = 512 - (512 - v29);
v30 = &FileName[512 - v29];
if ( 0 != v29 )
{
v32 = (char *)("ROMUpdateUtility.exe" - v30);
while ( 1 )
{
v33 = *(_BYTE *)((_DWORD)v30 + (_DWORD)v32);
if ( !v33 )
break;
*v30++ = v33;
--v31;
if ( !v31 )
goto LABEL_62;
}
if ( v31 )
goto LABEL_63;
LABEL_62:
--v30;
LABEL_63:
*v30 = 0;
}
}
LABEL_64:
memset(&StartupInfo, 0, 0x44u);
if ( CreateProcessA(FileName, 0, 0, 0, 0, 0, 0, 0, &StartupInfo, &ProcessInformation)
&& (_DWORD)ProcessInformation.hProcess )
{
WaitForSingleObject(ProcessInformation.hProcess, 0xFFFFFFFFu);
CloseHandle(ProcessInformation.hProcess);
}
else
{
MessageBoxA(0, "Error during extraction! Possible file corrupted!", Caption, 0x40010u);
}
v34 = 0;
do
{
v36 = 512;
v35 = (int)FileName;
while ( 1 )
{
v37 = *(_BYTE *)(&Filename - FileName + v35);
if ( !v37 )
break;
*(_BYTE *)v35++ = v37;
--v36;
if ( !v36 )
goto LABEL_74;
}
if ( v36 )
goto LABEL_75;
LABEL_74:
--v35;
LABEL_75:
*(_BYTE *)v35 = 0;
v39 = 512;
v38 = (int)FileName;
while ( *(_BYTE *)v38 )
{
++v38;
--v39;
if ( !v39 )
goto LABEL_88;
}
if ( v39 )
{
v41 = 512 - (512 - v39);
v40 = &FileName[512 - v39];
if ( 0 != v39 )
{
v42 = (char *)(&unk_409300 - (_UNKNOWN *)v40);
while ( 1 )
{
v43 = *(_BYTE *)((_DWORD)v42 + (_DWORD)v40);
if ( !v43 )
break;
*v40++ = v43;
--v41;
if ( !v41 )
goto LABEL_86;
}
if ( v41 )
goto LABEL_87;
LABEL_86:
--v40;
LABEL_87:
*v40 = 0;
}
}
LABEL_88:
v45 = 512;
v44 = (int)FileName;
while ( *(_BYTE *)v44 )
{
++v44;
--v45;
if ( !v45 )
goto LABEL_101;
}
if ( v45 )
{
v47 = 512 - (512 - v45);
v46 = &FileName[512 - v45];
if ( 0 != v45 )
{
v48 = (char *)(*(_DWORD *)&off_40ACA4[v34] - (_DWORD)v46);
while ( 1 )
{
v49 = *(_BYTE *)((_DWORD)v46 + (_DWORD)v48);
if ( !v49 )
break;
*v46++ = v49;
--v47;
if ( !v47 )
goto LABEL_99;
}
if ( v47 )
goto LABEL_100;
LABEL_99:
--v46;
LABEL_100:
*v46 = 0;
}
}
LABEL_101:
SetFileAttributesA(FileName, 0x80u);
DeleteFileA(FileName);
v34 += 8;
}
while ( v34 < 0x50 );
return 0;
}
// 40ACA0: using guessed type int dword_40ACA0;
//----- (004017D5) --------------------------------------------------------
signed int __cdecl sub_4017D5(int a1)
{
signed int result; // [email protected]
if ( a1 && dword_40AD10 )
{
*(_DWORD *)a1 = dword_40AD10;
result = 0;
}
else
{
*_errno() = 22;
_invalid_parameter(0, 0, 0, 0, 0);
result = 22;
}
return result;
}
// 402FE7: using guessed type int __cdecl _invalid_parameter(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
// 40AD10: using guessed type int dword_40AD10;
//----- (0040180C) --------------------------------------------------------
signed int __cdecl sub_40180C(int a1)
{
signed int result; // [email protected]
if ( a1 && dword_40AD10 )
{
*(_DWORD *)a1 = dword_40AD1C;
result = 0;
}
else
{
*_errno() = 22;
_invalid_parameter(0, 0, 0, 0, 0);
result = 22;
}
return result;
}
// 402FE7: using guessed type int __cdecl _invalid_parameter(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
// 40AD10: using guessed type int dword_40AD10;
// 40AD1C: using guessed type int dword_40AD1C;
//----- (0040247B) --------------------------------------------------------
int (*__cdecl sub_40247B())(void)
{
int (*result)(void); // [email protected]
unsigned int v1; // [email protected]
result = (int (*)(void))&unk_409400;
v1 = (unsigned int)&unk_409400;
if ( &unk_409400 < &unk_409400 )
{
do
{
result = *(int (**)(void))v1;
if ( *(_DWORD *)v1 )
result = (int (*)(void))result();
v1 += 4;
}
while ( v1 < (unsigned int)&unk_409400 );
}
return result;
}
//----- (0040249F) --------------------------------------------------------
int (*__cdecl sub_40249F())(void)
{
int (*result)(void); // [email protected]
unsigned int v1; // [email protected]
result = (int (*)(void))&unk_409408;
v1 = (unsigned int)&unk_409408;
if ( &unk_409408 < &unk_409408 )
{
do
{
result = *(int (**)(void))v1;
if ( *(_DWORD *)v1 )
result = (int (*)(void))result();
v1 += 4;
}
while ( v1 < (unsigned int)&unk_409408 );
}
return result;
}
//----- (00402EE1) --------------------------------------------------------
int __cdecl sub_402EE1(int a1)
{
int result; // [email protected]
result = a1;
dword_40B2E0 = a1;
return result;
}
// 40B2E0: using guessed type int dword_40B2E0;
//----- (00403325) --------------------------------------------------------
int __cdecl sub_403325()
{
return _decode_pointer(dword_40B2F0);
}
// 40252F: using guessed type _DWORD __cdecl _decode_pointer(_DWORD);
// 40B2F0: using guessed type int dword_40B2F0;
//----- (004034EC) --------------------------------------------------------
int __cdecl sub_4034EC(int a1)
{
int result; // [email protected]
result = a1;
dword_40B308 = a1;
return result;
}
// 40B308: using guessed type int dword_40B308;
//----- (004034F6) --------------------------------------------------------
int __cdecl sub_4034F6(int a1)
{
int result; // [email protected]
result = a1;
dword_40B30C = a1;
return result;
}
// 40B30C: using guessed type int dword_40B30C;
//----- (004035D5) --------------------------------------------------------
int __cdecl sub_4035D5(int a1)
{
int result; // [email protected]
result = a1;
dword_40B310 = a1;
return result;
}
// 40B310: using guessed type int dword_40B310;
//----- (00403601) --------------------------------------------------------
int __cdecl sub_403601(int a1, int a2, int a3)
{
HMODULE v3; // [email protected]
HMODULE v4; // [email protected]
FARPROC v6; // [email protected]
FARPROC v7; // [email protected]
FARPROC v8; // [email protected]
FARPROC v9; // [email protected]
FARPROC v10; // [email protected]
int v11; // [email protected]
int v12; // [email protected]
int (__thiscall *v13)(_DWORD); // [email protected]
int v14; // [email protected]
int v15; // [email protected]
int (__thiscall *v16)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); // [email protected]
int v17; // [email protected]
int (__thiscall *v18)(_DWORD); // [email protected]
int v19; // [email protected]
int v20; // [email protected]
int (__thiscall *v21)(_DWORD, _DWORD); // [email protected]
int v22; // [email protected]
int v23; // [email protected]
int (__thiscall *v24)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); // [email protected]
int v25; // [email protected]
char v26; // [sp+10h] [bp-20h]@13
char v27; // [sp+18h] [bp-18h]@14
char v28; // [sp+1Ch] [bp-14h]@13
int v29; // [sp+20h] [bp-10h]@1
unsigned int v30; // [sp+24h] [bp-Ch]@1
int v31; // [sp+28h] [bp-8h]@1
int v32; // [sp+2Ch] [bp-4h]@1
v29 = _encoded_null();
v32 = 0;
v31 = 0;
v30 = 0;
if ( !dword_40B314 )
{
v3 = LoadLibraryA("USER32.DLL");
v4 = v3;
if ( !v3 || (v6 = GetProcAddress(v3, "MessageBoxA"), !v6) )
return 0;
dword_40B314 = _encode_pointer(v6);
v7 = GetProcAddress(v4, "GetActiveWindow");
dword_40B318 = _encode_pointer(v7);
v8 = GetProcAddress(v4, "GetLastActivePopup");
dword_40B31C = _encode_pointer(v8);
if ( sub_4017D5((int)&v31) )
_invoke_watson(0, 0, 0, 0, 0);
if ( v31 == 2 )
{
v9 = GetProcAddress(v4, "GetUserObjectInformationA");
dword_40B324 = _encode_pointer(v9);
if ( dword_40B324 )
{
v10 = GetProcAddress(v4, "GetProcessWindowStation");
dword_40B320 = _encode_pointer(v10);
}
}
}
v11 = v29;
if ( dword_40B320 == v29
|| dword_40B324 == v29
|| (v13 = (int (__thiscall *)(_DWORD))_decode_pointer(dword_40B320), (v12 = v13(v14)) != 0)
&& (v15 = v12,
v16 = (int (__thiscall *)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD))_decode_pointer(dword_40B324),
v16(v17, v15, 1, &v26, 12, &v28))
&& v27 & 1 )
{
if ( dword_40B318 != v11 )
{
v18 = (int (__thiscall *)(_DWORD))_decode_pointer(dword_40B318);
v32 = v18(v19);
if ( v32 )
{
if ( dword_40B31C != v11 )
{
v20 = v32;
v21 = (int (__thiscall *)(_DWORD, _DWORD))_decode_pointer(dword_40B31C);
v32 = v21(v22, v20);
}
}
}
}
else
{
if ( sub_40180C((int)&v30) )
_invoke_watson(0, 0, 0, 0, 0);
if ( v30 < 4 )
a3 |= 0x40000u;
else
a3 |= 0x200000u;
}
v23 = v32;
v24 = (int (__thiscall *)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD))_decode_pointer(dword_40B314);
return v24(v25, v23, a1, a2, a3);
}
// 4024C3: using guessed type _DWORD __cdecl _encode_pointer(_DWORD);
// 402526: using guessed type int _encoded_null(void);
// 40252F: using guessed type _DWORD __cdecl _decode_pointer(_DWORD);
// 402EEB: using guessed type int __cdecl _invoke_watson(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
// 40B314: using guessed type int dword_40B314;
// 40B318: using guessed type int dword_40B318;
// 40B31C: using guessed type int dword_40B31C;
// 40B320: using guessed type int dword_40B320;
// 40B324: using guessed type int dword_40B324;
//----- (0040544A) --------------------------------------------------------
int __thiscall sub_40544A(void *this, char a2)
{
if ( this == (void *)dword_40AA58 )
__asm { rep retn }
return __report_gsfailure(this, a2);
}
// 406A85: using guessed type _DWORD __thiscall __report_gsfailure(_DWORD ecx0, _BYTE _4);
// 40AA58: using guessed type int dword_40AA58;
//----- (004055AF) --------------------------------------------------------
void __cdecl sub_4055AF()
{
dword_40BB68 = 0;
}
// 40BB68: using guessed type int dword_40BB68;
// ALL OK, 15 function(s) have been successfully decompiled
for hard spl you must to decompile spl first and than to reverse enginer it to make hard spl. I was try that but im not c++ or c programer
cardsharing said:
for hard spl you must to decompile spl first and than to reverse enginer it to make hard spl. I was try that but im not c++ or c programer
Click to expand...
Click to collapse
Me neither, I do C#
I have tried all this wpa_supplicant files to fix ad-hoc connection on my gsi9001, but every time it is hanging on the obtaining ip. Please someone help me with trying on other roms to manage ad-hoc mod. correctly i have used I9001XXKP4 with cranium mod...
tokokh said:
I have tried all this wpa_supplicant files to fix ad-hoc connection on my gsi9001, but every time it is hanging on the obtaining ip. Please someone help me with trying on other roms to manage ad-hoc mod. correctly i have used I9001XXKP4 with cranium mod...
Click to expand...
Click to collapse
these are modules?
2-of them are zip installation and one is just wpa_supplicant module... the all meaning is to change wpa_supplicant module to see ad-hoc connections...
diff --git a/ctrl_iface.c b/ctrl_iface.c
index ef93533..5accae6 100644
--- a/ctrl_iface.c
+++ b/ctrl_iface.c
@@ -28,6 +28,13 @@
#include "wpa_ctrl.h"
#include "eap.h"
+#define ANDROID_IBSS_HACK
+
+#ifdef ANDROID_IBSS_HACK
+/// NOTE: don't confuse WifiService.parseScanResult
+#define ANDROID_IBSS_PREFIX "(*)"
+#define ANDROID_IBSS_PREFIX_LEN 3
+#endif
static int wpa_supplicant_global_iface_interfaces(struct wpa_global *global,
char *buf, int len);
@@ -230,6 +237,13 @@ static int wpa_supplicant_ctrl_iface_status(struct wpa_supplicant *wpa_s,
ssid_len = _res;
_ssid = ssid_buf;
}
+#ifdef ANDROID_IBSS_HACK
+ if (ssid->mode == IEEE80211_MODE_IBSS)
+ ret = os_snprintf(pos, end - pos, "ssid=%s%s\nid=%d\n",
+ ANDROID_IBSS_PREFIX, wpa_ssid_txt(_ssid, ssid_len),
+ ssid->id);
+ else
+#endif
ret = os_snprintf(pos, end - pos, "ssid=%s\nid=%d\n",
wpa_ssid_txt(_ssid, ssid_len),
ssid->id);
@@ -574,12 +588,14 @@ static int wpa_supplicant_ctrl_iface_scan_results(
return retpos - buf;
pos += ret;
}
+#ifndef ANDROID_IBSS_HACK
if (res->caps & IEEE80211_CAP_IBSS) {
ret = os_snprintf(pos, end - pos, "[IBSS]");
if (ret < 0 || ret >= end - pos)
return retpos - buf;
pos += ret;
}
+#endif
if (!res->wpa_ie_len && !res->rsn_ie_len) {
ret = os_snprintf(pos, end - pos, "\t");
if (ret < 0 || ret >= end - pos)
@@ -587,6 +603,12 @@ static int wpa_supplicant_ctrl_iface_scan_results(
pos += ret;
}
+#ifdef ANDROID_IBSS_HACK
+ if (res->caps & IEEE80211_CAP_IBSS)
+ ret = os_snprintf(pos, end - pos, "\t%s%s",
+ ANDROID_IBSS_PREFIX, wpa_ssid_txt(res->ssid, res->ssid_len));
+ else
+#endif
ret = os_snprintf(pos, end - pos, "\t%s",
wpa_ssid_txt(res->ssid, res->ssid_len));
if (ret < 0 || ret >= end - pos)
@@ -792,6 +814,21 @@ static int wpa_supplicant_ctrl_iface_set_network(
return -1;
}
+#ifdef ANDROID_IBSS_HACK
+ if (os_strcmp(name, "ssid") == 0) {
+ // check prefix
+ if ((value[0] == '"') && (os_strncmp(value+1, ANDROID_IBSS_PREFIX,
+ ANDROID_IBSS_PREFIX_LEN) == 0)) {
+ if (wpa_config_set(ssid, "mode", "1", 0) < 0) {
+ wpa_printf(MSG_DEBUG, "CTRL_IFACE: failed to set IBSS on '%s'",
+ value);
+ return -1;
+ }
+ value += ANDROID_IBSS_PREFIX_LEN;
+ value[0] = '"';
+ }
+ }
+#endif
if (wpa_config_set(ssid, name, value, 0) < 0) {
wpa_printf(MSG_DEBUG, "CTRL_IFACE: Failed to set network "
"variable '%s'", name);
@@ -846,6 +883,11 @@ static int wpa_supplicant_ctrl_iface_get_network(
return -1;
}
+#ifdef ANDROID_IBSS_HACK
+ if ((os_strcmp(name, "ssid") == 0) && (ssid->mode == IEEE80211_MODE_IBSS))
+ os_snprintf(buf, buflen, "\"%s%s", ANDROID_IBSS_PREFIX, value+1);
+ else
+#endif
os_snprintf(buf, buflen, "%s", value);
buf[buflen - 1] = '\0';
diff --git a/events.c b/events.c
index bb5be64..c591f30 100644
--- a/events.c
+++ b/events.c
@@ -479,9 +479,12 @@ wpa_supplicant_select_bss(struct wpa_supplicant *wpa_s, struct wpa_ssid *group,
}
if (bss->caps & IEEE80211_CAP_IBSS) {
+//#ifdef ANDROID_IBSS_HACK // FIXME
+ if (ssid->mode != IEEE80211_MODE_IBSS) {
wpa_printf(MSG_DEBUG, " skip - "
"IBSS (adhoc) network");
continue;
+ }
}
selected = bss;
tokokh said:
diff --git a/ctrl_iface.c b/ctrl_iface.c
index ef93533..5accae6 100644
--- a/ctrl_iface.c
+++ b/ctrl_iface.c
@@ -28,6 +28,13 @@
#include "wpa_ctrl.h"
#include "eap.h"
+#define ANDROID_IBSS_HACK
+
+#ifdef ANDROID_IBSS_HACK
+/// NOTE: don't confuse WifiService.parseScanResult
+#define ANDROID_IBSS_PREFIX "(*)"
+#define ANDROID_IBSS_PREFIX_LEN 3
+#endif
static int wpa_supplicant_global_iface_interfaces(struct wpa_global *global,
char *buf, int len);
@@ -230,6 +237,13 @@ static int wpa_supplicant_ctrl_iface_status(struct wpa_supplicant *wpa_s,
ssid_len = _res;
_ssid = ssid_buf;
}
+#ifdef ANDROID_IBSS_HACK
+ if (ssid->mode == IEEE80211_MODE_IBSS)
+ ret = os_snprintf(pos, end - pos, "ssid=%s%s\nid=%d\n",
+ ANDROID_IBSS_PREFIX, wpa_ssid_txt(_ssid, ssid_len),
+ ssid->id);
+ else
+#endif
ret = os_snprintf(pos, end - pos, "ssid=%s\nid=%d\n",
wpa_ssid_txt(_ssid, ssid_len),
ssid->id);
@@ -574,12 +588,14 @@ static int wpa_supplicant_ctrl_iface_scan_results(
return retpos - buf;
pos += ret;
}
+#ifndef ANDROID_IBSS_HACK
if (res->caps & IEEE80211_CAP_IBSS) {
ret = os_snprintf(pos, end - pos, "[IBSS]");
if (ret < 0 || ret >= end - pos)
return retpos - buf;
pos += ret;
}
+#endif
if (!res->wpa_ie_len && !res->rsn_ie_len) {
ret = os_snprintf(pos, end - pos, "\t");
if (ret < 0 || ret >= end - pos)
@@ -587,6 +603,12 @@ static int wpa_supplicant_ctrl_iface_scan_results(
pos += ret;
}
+#ifdef ANDROID_IBSS_HACK
+ if (res->caps & IEEE80211_CAP_IBSS)
+ ret = os_snprintf(pos, end - pos, "\t%s%s",
+ ANDROID_IBSS_PREFIX, wpa_ssid_txt(res->ssid, res->ssid_len));
+ else
+#endif
ret = os_snprintf(pos, end - pos, "\t%s",
wpa_ssid_txt(res->ssid, res->ssid_len));
if (ret < 0 || ret >= end - pos)
@@ -792,6 +814,21 @@ static int wpa_supplicant_ctrl_iface_set_network(
return -1;
}
+#ifdef ANDROID_IBSS_HACK
+ if (os_strcmp(name, "ssid") == 0) {
+ // check prefix
+ if ((value[0] == '"') && (os_strncmp(value+1, ANDROID_IBSS_PREFIX,
+ ANDROID_IBSS_PREFIX_LEN) == 0)) {
+ if (wpa_config_set(ssid, "mode", "1", 0) < 0) {
+ wpa_printf(MSG_DEBUG, "CTRL_IFACE: failed to set IBSS on '%s'",
+ value);
+ return -1;
+ }
+ value += ANDROID_IBSS_PREFIX_LEN;
+ value[0] = '"';
+ }
+ }
+#endif
if (wpa_config_set(ssid, name, value, 0) < 0) {
wpa_printf(MSG_DEBUG, "CTRL_IFACE: Failed to set network "
"variable '%s'", name);
@@ -846,6 +883,11 @@ static int wpa_supplicant_ctrl_iface_get_network(
return -1;
}
+#ifdef ANDROID_IBSS_HACK
+ if ((os_strcmp(name, "ssid") == 0) && (ssid->mode == IEEE80211_MODE_IBSS))
+ os_snprintf(buf, buflen, "\"%s%s", ANDROID_IBSS_PREFIX, value+1);
+ else
+#endif
os_snprintf(buf, buflen, "%s", value);
buf[buflen - 1] = '\0';
diff --git a/events.c b/events.c
index bb5be64..c591f30 100644
--- a/events.c
+++ b/events.c
@@ -479,9 +479,12 @@ wpa_supplicant_select_bss(struct wpa_supplicant *wpa_s, struct wpa_ssid *group,
}
if (bss->caps & IEEE80211_CAP_IBSS) {
+//#ifdef ANDROID_IBSS_HACK // FIXME
+ if (ssid->mode != IEEE80211_MODE_IBSS) {
wpa_printf(MSG_DEBUG, " skip - "
"IBSS (adhoc) network");
continue;
+ }
}
selected = bss;
Click to expand...
Click to collapse
works this without hangign at obtaining ip ?
Actually it's hanging... but after restarting wifi i'ts getting connected...
I´m having some issues too with connection.
I use Crybernation, before always worked with other ROMs, but now it hangs on getting IP...
I changed scan_interval to 0 too, but nothing happens.
Those files are for? Just change them from mine?
Thanks!
ok now it's working simplest way to get ad hoc running is the ad hoc enabler app from the market
http://www.youtube.com/watch?v=MtqiHcC0x5E
First u need to have superuser and busybox installed
Then download "WiFi Ad Hoc enabler" from market and instal it
Open it and goto settings,tick for disable comparibility check
and then click on 1)Verify Prerequisites
it will ask for superuser permission click Allow
Then click on 2)enable adhoc wifi
it will ask u to restart wifi
vamsikrishnach said:
First u need to have superuser and busybox installed
Then download "WiFi Ad Hoc enabler" from market and instal it
Open it and goto settings,tick for disable comparibility check
and then click on 1)Verify Prerequisites
it will ask for superuser permission click Allow
Then click on 2)enable adhoc wifi
it will ask u to restart wifi
Click to expand...
Click to collapse
Good morning.
I have also SGS Plus (I9001) with Gingerbread. XXKPS (Android 2.3.6) and Kernel 2.6.35.7-perf [email protected]#1.
I have also "WiFi Ad Hoc enabler" Ver. 1.8.3.
My problem is this:
I have an internet connection on my Netbook HP mini (internet key USB H3G Italian provider) and an DHCP method for IP adress my LAN (192.168.0.40 to 192.168.0.50, gateway 192.168.0.1 and subnet mask 255.255.255.0)
I share with an adhoc connection to another Laptop HP with Win 7 64 bits, and it work very well
I share my internet connection from my laptop with Windows XP by WIFI to my laptop Win7.
When i tried to connect my android on this lan, i see the connection, after try to connect and the windows XP PC crashed any time.
I didn' understand the reason of this crash.
If i connect first the Android phone and after the win7 laptop, all is good and i have a very fast connection (adhoc by DHCP)
If i connect first the Win7 laptop and after the android phone, the windows XP netbook crashed.
Can you please give me some indication ?
Important. i didn't have on my "WiFi Ad Hoc enabler" the settigs page, only the "about" page with information on the program.
Thanks in advance for your answers
Ask Microsoft why it happens...?
Sent from my GT-I9001 using XDA App
Hey, how to connect my phone to ad hoc? Im currently used BroodROM RC5 btw. Before this, i've tried wifi ad hoc enabler 1.8.4 but i got an error about ownership of supplicant.conf. I appreciate any help in thi9s regard.
-corrupt1234
as kj6 is supposed to bring some bug fixes, I thought I'd check the kernel source.
there's not a huge amount of difference, but some looks interesting, hopefully of use to anyone wanting to building it.
Code:
--- drivers/input/touchscreen/mxt540e.c 2011-10-20 02:58:48.000000000
+++ drivers/input/touchscreen/mxt540e.c 2011-10-25 17:58:10.000000000
@@ -907,16 +907,16 @@
}
if (object_type == PROCG_NOISESUPPRESSION_T48) {
if (msg[4] == 5) { /* Median filter error */
printk("[TSP] Median filter Error\n");
get_object_info(data, PROCG_NOISESUPPRESSION_T48, &size, &obj_address);
- value = data->calcfg_batt_e;
+ value = 0;
error = write_mem(data, obj_address+2, 1, &value);
- msleep(5);
- value |= 0x20;
+ msleep(15);
+ value = data->calcfg_batt_e;
error |= write_mem(data, obj_address+2, 1, &value);
if(error) printk(KERN_ERR "[TSP] failed to reenable CHRGON\n");
}
}
if (object_type == TOUCH_MULTITOUCHSCREEN_T9) {
Code:
--- drivers/input/keyboard/cypress/cypress-touchkey.c 2011-10-20 02:58:48.000000000
+++ drivers/input/keyboard/cypress/cypress-touchkey.c 2011-10-25 17:58:10.000000000
@@ -1909,18 +1909,20 @@
int ret = 0;
#ifdef TEST_JIG_MODE
unsigned char get_touch = 0x40;
#endif
+#ifndef CONFIG_MACH_Q1_REV02
if (gpio_request(_3_TOUCH_SDA_28V, "_3_TOUCH_SDA_28V"))
WARN(1, "Fail to request gpio (_3_TOUCH_SDA_28V)\n");
if (gpio_request(_3_TOUCH_SCL_28V, "_3_TOUCH_SCL_28V"))
WARN(1, "Fail to request gpio (_3_TOUCH_SCL_28V)\n");
if (gpio_request(_3_GPIO_TOUCH_EN, "_3_GPIO_TOUCH_EN"))
WARN(1, "Fail to request gpio (_3_GPIO_TOUCH_EN)\n");
+#endif
if (gpio_request(_3_GPIO_TOUCH_INT, "_3_GPIO_TOUCH_INT"))
WARN(1, "Fail to request gpio (_3_GPIO_TOUCH_INT)\n");
/*20110222 N1_firmware_sync*/
sec_touchkey = device_create(sec_class, NULL, 0, NULL, "sec_touchkey");
@@ -2212,18 +2214,20 @@
misc_deregister(&touchkey_update_device);
if (touchkey_wq) {
destroy_workqueue(touchkey_wq);
}
+#ifndef CONFIG_MACH_Q1_REV02
gpio_free(_3_TOUCH_SDA_28V);
gpio_free(_3_TOUCH_SCL_28V);
gpio_free(_3_GPIO_TOUCH_EN);
+#endif
gpio_free(_3_GPIO_TOUCH_INT);
}
late_initcall(touchkey_init);
module_exit(touchkey_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("@@@");
MODULE_DESCRIPTION("melfas touch keypad");
Code:
--- drivers/leds/leds-max8997.c 2011-10-20 02:58:48.000000000
+++ drivers/leds/leds-max8997.c 2011-10-25 17:58:10.000000000
@@ -242,19 +242,30 @@
regulator_led_disable(led);
regulator_put(led->vcc);
kfree(led);
return 0;
}
+static void regulator_led_shutdown(struct platform_device *pdev)
+{
+ struct regulator_led *led = platform_get_drvdata(pdev);
+
+ if (regulator_is_enabled(led->vcc)) {
+ regulator_led_disable(led);
+ }
+ return;
+}
+
static struct platform_driver regulator_led_driver = {
.driver = {
.name = "leds-max8997",
.owner = THIS_MODULE,
},
.probe = regulator_led_probe,
.remove = __devexit_p(regulator_led_remove),
+ .shutdown = regulator_led_shutdown,
};
static int __init regulator_led_init(void)
{
return platform_driver_register(®ulator_led_driver);
}
Code:
--- drivers/media/video/samsung/mali/common/mali_kernel_mem_os.c 2011-10-20 02:58:48.000000000
+++ drivers/media/video/samsung/mali/common/mali_kernel_mem_os.c 2011-10-25 17:58:10.000000000
@@ -251,12 +251,13 @@
{
if ( allocation_order > 0 ) {
--allocation_order;
} else {
/* return OOM */
_mali_osk_lock_signal(info->mutex, _MALI_OSK_LOCKMODE_RW);
+ MALI_PRINT(("Failed to allocate consistent memory in all sizes.\n"));
return MALI_MEM_ALLOC_NONE;
}
}
/* try to allocate 2^(allocation_order) pages, if that fails, try
* allocation_order-1 to allocation_order 0 (inclusive) */
@@ -270,18 +271,21 @@
--allocation_order;
}
if ( NULL == virt )
{
MALI_DEBUG_PRINT(1, ("Failed to allocate consistent memory. Is CONSISTENT_DMA_SIZE set too low?\n"));
+ MALI_PRINT(("Failed to allocate consistent memory. Is CONSISTENT_DMA_SIZE set too low?\n"));
/* return OOM */
_mali_osk_lock_signal(info->mutex, _MALI_OSK_LOCKMODE_RW);
return MALI_MEM_ALLOC_NONE;
}
MALI_DEBUG_PRINT(5, ("os_allocator_allocate_page_table_block: Allocation of order %i succeeded\n",
+ allocation_order));
+ MALI_PRINT(("os_allocator_allocate_page_table_block: Allocation of order %i succeeded\n",
allocation_order));
/* we now know the size of the allocation since we know for what
* allocation_order the allocation succeeded */
size = _MALI_OSK_CPU_PAGE_SIZE << allocation_order;
Code:
--- drivers/media/video/m5mo.c 2011-10-20 02:58:48.000000000
+++ drivers/media/video/m5mo.c 2011-10-25 17:58:10.000000000
@@ -1707,13 +1707,13 @@
}
#endif
static int m5mo_set_touch_auto_focus(struct v4l2_subdev *sd, int val)
{
struct m5mo_state *state = to_state(sd);
- int err = -EINVAL;
+ int err;
cam_info("%s\n", val ? "start" : "stop");
state->focus.touch = val;
if (val) {
err = m5mo_set_af_mode(sd, FOCUS_MODE_TOUCH);
@@ -1727,13 +1727,13 @@
err = m5mo_writew(sd, M5MO_CATEGORY_LENS,
M5MO_LENS_AF_TOUCH_POSY, state->focus.pos_y);
CHECK_ERR(err);
}
cam_trace("X\n");
- return err;
+ return 0;
}
static int m5mo_set_zoom(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct m5mo_state *state = to_state(sd);
struct v4l2_queryctrl qc = {0,};
Code:
--- drivers/power/smb328_charger.c 2011-10-20 02:58:49.000000000
+++ drivers/power/smb328_charger.c 2011-10-25 17:58:10.000000000
@@ -820,18 +820,26 @@
{
struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
struct smb328_chip *chip;
int ret = 0;
int gpio = 0;
u8 data;
+ int i;
- if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE))
- return -EIO;
+ i = 10;
+ while (1) {
+ if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE))
+ goto I2CERROR;
- if (smb328_i2c_read(client, 0x36, &data)<0) /* check HW */
- return -EIO;
+ if (smb328_i2c_read(client, 0x36, &data)>=0) /* check HW */
+ break;
+
+I2CERROR:
+ if (!i--) return -EIO;
+ msleep(300);
+ }
dev_info(&client->dev, "%s : SMB328 Charger Driver Loading\n", __func__);
chip = kzalloc(sizeof(struct smb328_chip), GFP_KERNEL);
if (!chip)
return -ENOMEM;
Code:
--- drivers/video/samsung/s3cfb_s6e8aa0.c 2011-10-20 02:58:50.000000000
+++ drivers/video/samsung/s3cfb_s6e8aa0.c 2011-10-25 17:58:10.000000000
@@ -1009,19 +1009,27 @@
return 0;
}
int s6e8ax0_read_mtp(struct lcd_info *lcd, u8 *mtp_data)
{
int ret;
+ u8 retry_cnt = 3;
s6e8ax0_write(lcd, enable_mtp_register, ARRAY_SIZE(enable_mtp_register));
+
+read_retry:
ret = s6e8ax0_read(lcd, LDI_MTP_ADDR, LDI_MTP_LENGTH, mtp_data);
if (!ret) {
- printk("ERROR:MTP read failed\n");
- return 0;
+ if (retry_cnt) {
+ printk("[WARN:LCD] : %s : retry cnt : %d\n", __func__, retry_cnt);
+ retry_cnt--;
+ goto read_retry;
+ } else
+ printk("ERROR:MTP read failed\n");
}
+
s6e8ax0_write(lcd, disable_mtp_register, ARRAY_SIZE(disable_mtp_register));
return ret;
}
#endif
static ssize_t lcdtype_show(struct device *dev, struct
@@ -1228,12 +1236,13 @@
struct s5p_platform_dsim *pd = (struct s5p_platform_dsim *)pdev->dev.platform_data;
#endif
#ifdef SMART_DIMMING
u8 mtp_data[LDI_MTP_LENGTH] = {0,};
u32 i;
u8 id_buf[3] = {0,};
+ u8 retry_cnt = 3;
#endif
lcd = kzalloc(sizeof(struct lcd_info), GFP_KERNEL);
if (!lcd) {
pr_err("failed to allocate for lcd\n");
ret = -ENOMEM;
@@ -1330,17 +1339,24 @@
dev_info(&lcd->ld->dev, "s6e8aa0 lcd panel driver has been probed.\n");
#ifdef SMART_DIMMING
mutex_init(&lcd->bl_lock);
- //read mpt
+read_retry:
ret = s6e8ax0_read(lcd, PANEL_ID_COMMAND, 3, id_buf);
if (!ret) {
- printk("[LCD:ERROR] : %s read id failed\n", __func__);
- //return -1;
+ if (retry_cnt) {
+ printk("[WARN:LCD] : %s : retry cnt : %d\n", __func__, retry_cnt);
+ retry_cnt--;
+ goto read_retry;
+ } else {
+ printk("[ERROR:LCD] : %s : Read ID Failed\n", __func__);
+ /*To protect ELVSS Wrong Operation*/
+ id_buf[2] = 0x33;
+ }
}
printk("Read ID : %x, %x, %x\n", id_buf[0], id_buf[1], id_buf[2]);
if (id_buf[2] == 0x33) {
lcd->support_elvss = 0;
@@ -1361,22 +1377,23 @@
init_table_info(&lcd->smart);
ret = s6e8ax0_read_mtp(lcd, mtp_data);
if (!ret) {
printk("[LCD:ERROR] : %s read mtp failed\n", __func__);
- //return -1;
+ lcd->connected = 0;
+ dev_info(&lcd->ld->dev, "panel is not connected well\n");
+ /*return -1;*/
}
calc_voltage_table(&lcd->smart, mtp_data);
s6e8ax0_adb_brightness_update(lcd, lcd->bd->props.brightness, 1);
#endif
- if (id_buf[0] == 0xa2) {
- lcd->connected = 1;
+ if (lcd->connected) {
INIT_DELAYED_WORK(&hs_clk_re_try, hs_clk_re_try_work);
lcd->irq = gpio_to_irq(GPIO_OLED_DET);
s3c_gpio_cfgpin(GPIO_OLED_DET, S3C_GPIO_SFN(0xf));
s3c_gpio_setpull(GPIO_OLED_DET, S3C_GPIO_PULL_NONE);
@@ -1384,15 +1401,12 @@
if (request_irq(lcd->irq, oled_det_int, IRQF_TRIGGER_FALLING, "vgh_toggle", 0)) {
pr_err("failed to reqeust irq. %d\n", lcd->irq);
ret = -EINVAL;
goto out_free_backlight;
}
- } else {
- lcd->connected = 0;
- dev_info(&lcd->ld->dev, "panel is not connected\n");
}
return 0;
out_free_backlight:
lcd_device_unregister(lcd->ld);
Code:
--- drivers/video/samsung/s5p-dsim.c 2011-10-20 02:58:50.000000000
+++ drivers/video/samsung/s5p-dsim.c 2011-10-25 17:58:10.000000000
@@ -115,13 +115,13 @@
#define MIPI_CMD_GENERIC_RD_2 0x24
#define MIPI_CMD_DSI_RD_0 0x06
#define MIPI_CMD_DSI_SET_PKT_SZ 0x37
-#define MIPI_RX_TIMEOUT HZ
+#define MIPI_RX_TIMEOUT msecs_to_jiffies(250)
#define DSMI_RX_FIFO_READ_DONE 0x30800002
#define DSIM_MAX_RX_FIFO 20
#define S5P_DSIM_INT_SFR_FIFO_EMPTY 29
#define S5P_DSIM_INT_BTA 25
#define S5P_DSIM_INT_MSK_FRAME_DONE 24
@@ -358,13 +358,13 @@
}
rxhd = readl(reg_base + S5P_DSIM_RXFIFO);
printk("rxhd : %x\n", rxhd);
if ((u8)(rxhd & 0xff) != response) {
printk(KERN_ERR "[DSIM:ERROR]:%s wrong response rxhd : %x, response:%x\n"
- ,__func__, rxhd, response);
+ , __func__, rxhd, response);
goto clear_rx_fifo;
}
// for short packet
if (count <= 2) {
for (i = 0; i < count; i++)
buf[i] = (rxhd >> (8+(i*8))) & 0xff;
@@ -379,21 +379,21 @@
goto clear_rx_fifo;
}
for (i = 0; i < rxsize>>2; i++) {
temp = readl(reg_base + S5P_DSIM_RXFIFO);
printk("pkt : %08x\n", temp);
- for(j=0; j < 4; j++) {
+ for (j = 0; j < 4; j++) {
buf[(i*4)+j] = (u8)(temp>>(j*8))&0xff;
//printk("Value : %02x\n",(temp>>(j*8))&0xff);
}
}
if (rxsize % 4) {
temp = readl(reg_base + S5P_DSIM_RXFIFO);
printk("pkt-l : %08x\n", temp);
- for(j=0; j < rxsize%4; j++) {
+ for (j = 0; j < rxsize%4; j++) {
buf[(i*4)+j] = (u8)(temp>>(j*8))&0xff;
//printk("Value : %02x\n",(temp>>(j*8))&0xff);
}
}
}
@@ -1089,30 +1089,30 @@
writel(int_stat, dsim.reg_base + S5P_DSIM_INTMSK);
}
int s5p_dsim_fifo_clear(void)
{
- int dsim_count=0,ret;
+ int dsim_count = 0, ret;
writel(SwRstRelease, dsim.reg_base + S5P_DSIM_INTSRC);
-
+
writel(DSIM_FUNCRST, dsim.reg_base + S5P_DSIM_SWRST);
- do{
- if(++dsim_count>90000){
- printk("dsim fifo clear fail re_try dsim resume\n");
- ret=0;
+ do {
+ if (++dsim_count > 90000) {
+ printk("dsim fifo clear fail re_try dsim resume\n");
+ ret = 0;
break;
- }
-
- if(readl(dsim.reg_base + S5P_DSIM_INTSRC) & SwRstRelease){
- s5p_dsim_interrupt_mask_set();
- ret=1;
+ }
+
+ if (readl(dsim.reg_base + S5P_DSIM_INTSRC) & SwRstRelease) {
+ s5p_dsim_interrupt_mask_set();
+ ret = 1;
break;
}
- }while(1);
+ } while (1);
return ret;
}
#ifdef CONFIG_HAS_EARLYSUSPEND
void s5p_dsim_early_suspend(void)
@@ -1140,24 +1140,24 @@
if (dsim.mipi_drv->suspend)
dsim.mipi_drv->suspend(dsim.dev, state);
if (dsim.mipi_ddi_pd->lcd_power_on)
dsim.mipi_ddi_pd->lcd_power_on(dsim.dev, 0);
-
+
s5p_dsim_enable_hs_clock(dsim.reg_base, 0);
s5p_dsim_set_clock(dsim.reg_base, dsim.dsim_info->e_byte_clk, 0);
-
+
writel(0xffff, dsim.reg_base + S5P_DSIM_CLKCTRL);
writel(0x0, dsim.reg_base + S5P_DSIM_PLLCTRL);
writel(0x0, dsim.reg_base + S5P_DSIM_PLLTMR);
writel(0x0, dsim.reg_base + S5P_DSIM_PHYACCHR);
- writel(0x0, dsim.reg_base + S5P_DSIM_PHYACCHR1);
+ writel(0x0, dsim.reg_base + S5P_DSIM_PHYACCHR1);
writel(0x1, dsim.reg_base + S5P_DSIM_SWRST);
-
+
clk_disable(dsim.clock);
#if 0
if (dsim.pd->mipi_power)
dsim.pd->mipi_power(0);
else
Code:
--- drivers/video/samsung/s6e8aa0_param.h 2011-10-20 02:58:50.000000000
+++ drivers/video/samsung/s6e8aa0_param.h 2011-10-25 17:58:10.000000000
@@ -66,13 +66,14 @@
static const unsigned char SEQ_APPLY_LEVEL_2_KEY[] = {
0xFC,
0x5A, 0x5A
};
static const unsigned char SEQ_SLEEP_OUT[] = {
- 0x11
+ 0x11,
+ 0x00,0x00
};
static const unsigned char SEQ_PANEL_CONDITION_SET[] = {
0xF8,
0x25, 0x34, 0x00, 0x00, 0x00, 0x95, 0x00, 0x3C, 0x7D, 0x08,
0x27, 0x00, 0x00, 0x10, 0x00, 0x00, 0x20, 0x02, 0x00, 0x00,
@@ -83,13 +84,14 @@
static const unsigned char SEQ_DISPLAY_CONDITION_SET[] = {
0xF2,
0x80, 0x03, 0x0D
};
static const unsigned char SEQ_GAMMA_UPDATE[] = {
- 0xF7, 0x03
+ 0xF7, 0x03,
+ 0x00
};
static const unsigned char SEQ_ETC_SOURCE_CONTROL[] = {
0xF6,
0x00, 0x02, 0x00
};
@@ -116,30 +118,35 @@
0x14, 0x40, 0x0C, 0xCB, 0xCE,
0x6E, 0xC4, 0x0F, 0x40, 0x41,
0xD9, 0x00, 0x00, 0x00
};
static const unsigned char SEQ_DISPLAY_ON[] = {
- 0x29
+ 0x29,
+ 0x00,0x00
};
static const unsigned char SEQ_DISPLAY_OFF[] = {
- 0x28
+ 0x28,
+ 0x00,0x00
};
static const unsigned char SEQ_STANDBY_ON[] = {
- 0x01
+ 0x01,
+ 0x00,0x00
};
static const unsigned char SEQ_ACL_ON[] = {
0xC0, 0x01,
+ 0x00
};
static const unsigned char SEQ_ACL_OFF[] = {
0xC0, 0x00,
+ 0x00
};
static const unsigned char SEQ_ACL_CUTOFF_20[] = {
0xC1,
0x47, 0x53, 0x13, 0x53, 0x00,
0x00, 0x03, 0x1F, 0x00, 0x00,
and they changed to codesourcery for toolchain
+CROSS_COMPILE ?= /opt/toolchains/arm-2009q3/bin/arm-none-linux-gnueabi-
Not a massive amount of differences, the screen driver changes looks most interesting to me.
fards said:
and they changed to codesourcery for toolchain
+CROSS_COMPILE ?= /opt/toolchains/arm-2009q3/bin/arm-none-linux-gnueabi-
Not a massive amount of differences, the screen driver changes looks most interesting to me.
Click to expand...
Click to collapse
Is there a new kernel source?
Sent from my GT-I9100
yes, kj6 is up,
the diffs are between kj4 and that kj6
to show the file differences (there's also some docs changes but they aren't really needed)
fards said:
yes, kj6 is up,
the diffs are between kj4 and that kj6
to show the file differences (there's also some docs changes but they aren't really needed)
Click to expand...
Click to collapse
Where did you get the kernel source?
https://opensource.samsung.com/index.jsp
search for N7000
I presume the kkx build will be there under the other device code.
fards said:
https://opensource.samsung.com/index.jsp
search for N7000
I presume the kkx build will be there under the other device code.
Click to expand...
Click to collapse
LOL you have the Hong Kong version source code xD
netchip said:
LOL you have the Hong Kong version source code xD
Click to expand...
Click to collapse
kj6 as I said...
to compare against kj4 as 6 is supposed to bring bugfixes..
fards said:
Not a massive amount of differences, the screen driver changes looks most interesting to me.
Click to expand...
Click to collapse
Maybe that diff solves my screen issue.
Just to explain, sometimes my screen does not wake up even if the phone is still running (long pressing the on/off button makes the phone vibrate which means that it is still working) and when I hard reboot it (8 seconds long on/off button press), it restarts and in the battery usage I can see that the phone has been awake for a long time instead of having been idle (when it happens, it is generally during the night).
As I am facing it globally (with both European stock and Hong Kong ROMs), I hope this kernel change corrects it.
The_Steph said:
Maybe that diff solves my screen issue.
Just to explain, sometimes my screen does not wake up even if the phone is still running (long pressing the on/off button makes the phone vibrate which means that it is still working) and when I hard reboot it (8 seconds long on/off button press), it restarts and in the battery usage I can see that the phone has been awake for a long time instead of having been idle (when it happens, it is generally during the night).
As I am facing it globally (with both European stock and Hong Kong ROMs), I hope this kernel change corrects it.
Click to expand...
Click to collapse
I've seen the same thing a couple of times. Still haven't tested the KJ6 kernel to see the effect of those patches yet.
Actually thats spurred me onto testing the KJ6.. Initialtesting suggests Screen powers back up Much quicker from standby
KJ6, where did you get it?
Edit: I have Baseband version N7000XXKJ6 but Kernel N7000ZSKK1. Is is this version you are talking about?
The_Steph said:
KJ6, where did you get it?
Edit: I have Baseband version N7000XXKJ6 but Kernel N7000ZSKK1. Is is this version you are talking about?
Click to expand...
Click to collapse
no there's threads with the kj6 kernel, including the CF root thread.
I've just built kernel with the patches, working well so far.
Basically, what you did is you installed KJ6 kernel, rooted it and install the kernel you built?
If yes, do you mind, allowing me to download the kernel you built in order to use it?
Yes. it's me again asking for help about another assignment...
Here is a link to the assignment:
http://www2.hawaii.edu/~ztomasze/teaching/ics211/2012fa/hw/A06b.html
I'm having trouble with the "add" method. The "tiny" variable will not update and keep track of the "tiny Meep".
Here is my code (note: all the println statements are there to let me know what process it is going through.):
Code:
public String add (Meep newcomer, boolean print){
Meep tinyMeep;
int move = 0;
int tiny = 0;
int shaft1 = 0;
int shaft2 = 0;
//Drops newcomer into center shaft
burrow.get(1).push(newcomer);
//Moves newcomer over to leftmost shaft if it is empty or it is smaller than current
if (burrow.get(0).size() == 0 || burrow.get(0).peek().compareTo(newcomer) >= 0){
burrow.get(0).push(burrow.get(1).pop());
tiny = 0;
System.out.println("Tiny Meep: "+newcomer.toString());
return "0 "+toString();
}
else {
if (burrow.get(tiny).countLessThan(newcomer) % 2 == 1 || burrow.get(tiny).countLessThan(newcomer) == 1){
//Flurry right
move = 1;
}
else if (burrow.get(tiny).countLessThan(newcomer) % 2 == 0) {
//Flurry left
move = -1;
}
while (burrow.get(1).size() > 0 || burrow.get(2).size() > 0){
Meep tinyMoved = burrow.get(tiny).pop();
tiny = (tiny + move + 3) % 3;
burrow.get(tiny).push(tinyMoved);
//Determines index of other two shafts
switch (tiny){
case 0 : shaft1 = 1;
shaft2 = 2;
break;
case 1 : shaft1 = 0;
shaft2 = 2;
break;
case 2 : shaft1 = 0;
shaft2 = 1;
break;
default: break;
}
System.out.println("teeny: "+tiny);
System.out.println("Shaft1: "+shaft1+" Shaft2: "+shaft2);
if (burrow.get(shaft1).size() > 0 || burrow.get(shaft2).size() > 0){
if (burrow.get(shaft1).size() == 0 && burrow.get(shaft2).peek().compareTo(newcomer) <= 0){
burrow.get(shaft1).push(burrow.get(shaft2).pop());
System.out.println("tiny1. "+tiny);
System.out.println("TM1: "+burrow.get(tiny).peek().toString());
System.out.println("\n1 "+toString());
}
else if (burrow.get(shaft2).size() == 0 && burrow.get(shaft1).peek().compareTo(newcomer) <= 0){
burrow.get(shaft2).push(burrow.get(shaft1).pop());
System.out.println("TM2: "+burrow.get(tiny).peek().toString());
System.out.println("tiny2. "+tiny);
System.out.println("\n2 "+toString());
}
else if (burrow.get(shaft1).size() > 0 || burrow.get(shaft2).size() > 0){
if (tiny == 0){
burrow.get(1).push(burrow.get(tiny).pop());
System.out.println("TM3: "+burrow.get(tiny).peek().toString());
System.out.println("tiny3. "+tiny);
System.out.println("\n3 "+toString());
}
else if (tiny == 1){
burrow.get(2).push(burrow.get(tiny).pop());
System.out.println("TM4: "+burrow.get(tiny).peek().toString());
System.out.println("tiny4. "+tiny);
System.out.println("\n4 "+toString());
}
else {
burrow.get(0).push(burrow.get(tiny).pop());
System.out.println("TM5: "+burrow.get(tiny).peek().toString());
System.out.println("tiny5. "+tiny);
System.out.println("\n5 "+toString());
}
}
}
}
}
return "last return "+toString();
}
Here is one of the sample output (notice where TM (tiny meep) it says M4 rather than M1):
Code:
=== ADDING: M1 ===
Tiny Meep: M1
0 { M1
{
{
=== ADDING: M5 ===
teeny: 1
Shaft1: 0 Shaft2: 2
teeny: 2
Shaft1: 0 Shaft2: 1
tiny1. 2
TM1: M1
1 { M5
{
{ M1
teeny: 0
Shaft1: 1 Shaft2: 2
last return { M5, M1
{
{
=== ADDING: M4 ===
teeny: 1
Shaft1: 0 Shaft2: 2
TM4: M4
tiny4. 1
4 { M5
{ M4
{ M1
Thanks in advance.
Please stop creating multiple threads for the same purpose. Use the existing one.
Thread closed.
1. Why use android_dlopen_ext in the first_stage_entry function to force open /system/bin/app_process?
2. Why dlclose immediately after dlopen in second_stage_entry? Why do it?
// native/jni/zygisk/entry.cpp
static void first_stage_entry() {
android_logging();
ZLOGD("inject 1st stage\n");
char path[PATH_MAX];
char buf[256];
char *ld = getenv("LD_PRELOAD");
if (char *c = strrchr(ld, ':')) {
*c = '\0';
strlcpy(path, c + 1, sizeof(path));
setenv("LD_PRELOAD", ld, 1); // Restore original LD_PRELOAD
} else {
unsetenv("LD_PRELOAD");
strlcpy(path, ld, sizeof(path));
}
// Force the linker to load the library on top of ourselves, so we do not
// need to unmap the 1st stage library that was loaded with LD_PRELOAD.
int fd = xopen(path, O_RDONLY | O_CLOEXEC);
// Use fd here instead of path to make sure inode is the same as 2nd stage
snprintf(buf, sizeof(buf), "%d", fd);
setenv(MAGISKFD_ENV, buf, 1);
struct stat s{};
xfstat(fd, &s);
android_dlextinfo info {
.flags = ANDROID_DLEXT_FORCE_LOAD | ANDROID_DLEXT_USE_LIBRARY_FD,
.library_fd = fd,
};
// 通过 inode 在 maps 中搜索 /sbin/magisk(app_process) 对应的内存区域
auto [addr, size] = find_map_range(path, s.st_ino);
if (addr && size) {
// 下面使用 android_dlopen_ext 重复加载 /sbin/magisk,
// 通过 reserved_addr 强制覆盖内存.
info.flags |= ANDROID_DLEXT_RESERVED_ADDRESS;
info.reserved_addr = addr;
// The existing address is guaranteed to fit, as 1st stage and 2nd stage
// are exactly the same ELF (same inode). However, the linker could over
// estimate the required size and refuse to dlopen. The estimated size
// is not accurate so size the size to unlimited.
info.reserved_size = -1;
}
setenv(INJECT_ENV_2, "1", 1);
// Force dlopen ourselves to make ourselves dlclose-able.
// After this call, all global variables will be reset.
// 重复加载 /sbin/magisk 到内存, 覆盖之后全局变量将被重置
// 这里为什么要强制 dlopen? 只是为了以后可以使用 dlclose 释放 zygisk 吗????
android_dlopen_ext(path, RTLD_LAZY, &info);
}
Code:
// // native/jni/zygisk/entry.cpp
static void second_stage_entry() {
zygisk_logging();
ZLOGD("inject 2nd stage\n");
char path[PATH_MAX];
MAGISKTMP = getenv(MAGISKTMP_ENV);
int fd = parse_int(getenv(MAGISKFD_ENV));
snprintf(path, sizeof(path), "/proc/self/fd/%d", fd);
xreadlink(path, path, PATH_MAX);
android_dlextinfo info {
.flags = ANDROID_DLEXT_USE_LIBRARY_FD,
.library_fd = fd,
};
// 这里的dlopen并不会重新调用 zygisk_init, 这里是假的dlopen? 只是为了下一行的 dlclose?
// 为什么要这样做?
// Why do this?
self_handle = android_dlopen_ext(path, RTLD_LAZY, &info);
dlclose(self_handle);
close(fd);
unsetenv(MAGISKTMP_ENV);
unsetenv(MAGISKFD_ENV);
sanitize_environ();
hook_functions();
}