USB HID usage table

This usage table lets usbhidctl decode the HID data correctly for the APC RS/XS1000's.

This work was obtained from riccardo@torrini.org.

Note that the default /usr/share/misc/usb_hid_usages already contains entries for these a Power Device (132 or 0x84) and a Battery System (133 or 0x85).  It is interesting that usbhidctl shows the APC as using 0xff84 and 0xff84 for their values.  The HID Power Devices specification indicates 0x84 and 0x85.  There is at least one macro in /usr/include/dev/usb/usbhid.h which removes the high order bits.  Perhaps we need to do that when using the values.  Perhaps this macro:

#define HID_USAGE2(p,u) (((p) << 16) | u)
阅读全部

Linux/i386 system calls

List of Linux/i386 system calls

Copyright (C) 1999-2000 by Konstantin Boldyshev

This list is NOT READY and is under heavy construction, a lot of entries are missing, and some may be incorrect. This is more a template than a real document. Meanwhile, I suggest you to examinethis listby H-Peter Recktenwald.


阅读全部

Dalvik opcodes

Dalvik opcodes

Author:Gabor Paller


Vx values in the table denote a Dalvik register. Depending on the instruction, 16, 256 or 64k registers can be accessed. Operations on long and double values use two registers, e.g. a double value addressed in the V0 register occupies the V0 and V1 registers.

Boolean values are stored as 1 for true and 0 for false. Operations on booleans are translated into integer operations.

All the examples are in hig-endian format, e.g. 0F00 0A00 is coded as
0F, 00, 0A, 00 sequence.

Note there are no explanation/example at some instructions. This means that I have not seen that instruction "in the wild" and its presence/name is only known from Android opcode constant list.

阅读全部

Android smali代码注入

1.增加log信息

变量为string类型
const-string v3,"message"
invoke-static {v3,v0}, Landroid/util/Log;->v(Ljava/lang/String;Ljava/lang/String;)I
变量为int类型
const-string v3, "message"
invoke-static {v1}, Ljava/lang/Integer;->toString(I)Ljava/lang/String;
move-result-object v4
invoke-static {v3, v4}, Landroid/util/Log;->v(Ljava/lang/String;Ljava/lang/String;)I
变量为bool类型
const-string v3, "message"
invoke-static {v1}, Ljava/lang/Boolean;->toString(Z)Ljava/lang/String;
move-result-object v4
invoke-static {v3, v4}, Landroid/util/Log;->v(Ljava/lang/String;Ljava/lang/String;)I


2.弹出消息框

new AlertDialog.Builder(self)
.setTitle("普通对话框")
.setMessage("你好,Android!")
.show();
new-instance v1,Landroid/app/AlertDialog$Builder;
invoke-direct {v1,p0}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/Context;)V
.local v1,builder:Landroid/app/AlertDialog$Builder;

const-string v2,"\u666e\u901a\u5bf9\u8bdd\u6846"
invoke-virtual {v1,v2}, Landroid/app/AlertDialog$Builder;->setTitle(Ljava/lang/CharSequence;)Landroid/app/AlertDialog$Builder;

const-string v2,"\u4f60\u597d\uff0cAndroid!"
invoke-virtual {v1,v2},Landroid/app/AlertDialog$Builder;->setMessage(Ljava/lang/CharSequence;)Landroid/app/AlertDialog$Builder;

invoke-virtual {v1},Landroid/app/AlertDialog$Builder;->create()Landroid/app/AlertDialog;
move-result-object v2
invoke-virtual {v2},Landroid/app/AlertDialog;->show()V

 

阅读全部

解决mysql使用autocommit导致挂起的bug

torndb使用MySQLdb连接远程mysql,会挂起超时,提示Lost connection to MySQL server during query。

跟踪后发现在autocommit后hang住,解决办法hook这个方法,直接返回。

使用下面的代码,之后再连接数据就不会挂起了。

from MySQLdb.connections import Connection
def func(self,t):
	return None
Connection.autocommit=func
阅读全部

Linux screen

new session: screen -S 
restore session: screen -r 
list session: screen -ls 

In session:
detach session: Ctrl+a,d
create window: Ctrl+a,c
next/prev window: Ctrl+a,n/p
lock/unlock: Ctrl+a,s/q
show status in title: Ctrl+a,w
split window: Ctrl+a,S
change window: Ctrl+a,Tab
kill window: Ctrl+a,K
start/stop log: Ctrl+a,H
阅读全部