Skip to content

Instantly share code, notes, and snippets.

@kangear
kangear / freg-register_chrdev.c
Last active December 27, 2015 02:09
freg.c sample DON'T EDIT.
#include <linux/module.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <asm/uaccess.h>
/* 主设备号 */
#define MAJOR_NUM 250
static ssize_t freg_read(struct file* filp, char __user *buf, size_t count, loff_t* f_pos);
static ssize_t freg_write(struct file* filp, const char __user *buf, size_t count, loff_t* f_pos);
@kangear
kangear / freg-alloc_chrdev_region.c
Last active December 27, 2015 02:09
That's OK, don't edit.
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/cdev.h>
#include <asm/uaccess.h>
static struct cdev freg_cdev; //An instance of a character device
static dev_t ndev; //The node of the device
/* "freg"设备的全局变量 */
@kangear
kangear / freg-register_chrdev_region.c
Last active December 27, 2015 03:49
is simple DON'T edit.
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/cdev.h>
#include <asm/uaccess.h>
static struct cdev freg_cdev; //An instance of a character device
static dev_t ndev; //The node of the device
/* "freg"设备的全局变量 */
diff --git a/pppd/Makefile.linux b/pppd/Makefile.linux
index 060db6a..65fdde2 100644
--- a/pppd/Makefile.linux
+++ b/pppd/Makefile.linux
@@ -32,7 +32,7 @@ endif
# CC = gcc
#
-COPTS = -O2 -pipe -Wall -g
+COPTS = -static -O2 -pipe -Wall -g
@kangear
kangear / mypopen.c
Created April 23, 2014 07:01
Can get stderr.
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <malloc.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#ifdef __ANDROID__
@kangear
kangear / PhotoService.java
Last active August 29, 2015 14:00
Photo to pdf for print.
package com.wizhong.os.printimage.service;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.MalformedURLException;
import android.util.Log;
import com.itextpdf.text.BadElementException;
From 7ab79f39748021f34c886c8d8ed3834c26319930 Mon Sep 17 00:00:00 2001
From: kangear <[email protected]>
Date: Tue, 3 Sep 2013 15:02:32 +0800
Subject: Update installation.md
---
doc/install/installation.md | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/doc/install/installation.md b/doc/install/installation.md
#!/system/bin/sh
# 1.判断busybox是否存在 如果存在获致其路径
echo "Determining If 'busybox' Exist..."
BUSYBOX_PATH=`busybox find / -name busybox -type f`
if [ $? != 0 ] ; then
echo "Sorry, 'busybox' NOT exist"
exit 1
fi
@kangear
kangear / sound_3.12.30.patch
Last active August 29, 2015 14:09
S3C2440 audio patch
diff --git a/sound/soc/samsung/dma.c b/sound/soc/samsung/dma.c
index 9338d11..96a1b01 100644
--- a/sound/soc/samsung/dma.c
+++ b/sound/soc/samsung/dma.c
@@ -34,7 +34,9 @@ static const struct snd_pcm_hardware dma_hardware = {
.info = SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_MMAP |
- SNDRV_PCM_INFO_MMAP_VALID,
+ SNDRV_PCM_INFO_MMAP_VALID|
@kangear
kangear / coldboot.c
Created December 7, 2014 08:29
coldboot from android tree.
#include <stdio.h>
#include <dirent.h>
#include <signal.h>
#include <time.h>
#include <errno.h>
#include <fcntl.h>
static void do_coldboot(DIR *d, int lvl)
{