[Q] Regarding USB audio (source code help) - Samsung Galaxy Nexus

By using the GlaDOS kernel and Usb audio recorder ROOT, I was able to listen to music with my USB headset, however I really would like a way to implement it into the kernel or the OS so I can reroute media sound to my headset with other apps.
Here's the source code of the driver... Maybe someone with more knowledge than me will be able to implement it or maybe point me in the right direction.
Code:
#ifndef __USBAUDIO_H
#define __USBAUDIO_H
/*
* (Tentative) USB Audio Driver for ALSA
*
* Copyright (c) 2002 by Takashi Iwai <[email protected]>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* handling of USB vendor/product ID pairs as 32-bit numbers */
#define USB_ID(vendor, product) (((vendor) << 16) | (product))
#define USB_ID_VENDOR(id) ((id) >> 16)
#define USB_ID_PRODUCT(id) ((u16)(id))
/*
*
*/
struct snd_usb_audio {
int index;
struct usb_device *dev;
struct snd_card *card;
struct usb_interface *pm_intf;
u32 usb_id;
struct mutex shutdown_mutex;
unsigned int shutdown:1;
unsigned int probing:1;
unsigned int autosuspended:1;
unsigned int txfr_quirk:1; /* Subframe boundaries on transfers */
int num_interfaces;
int num_suspended_intf;
struct list_head pcm_list; /* list of pcm streams */
int pcm_devs;
struct list_head midi_list; /* list of midi interfaces */
struct list_head mixer_list; /* list of mixer interfaces */
int setup; /* from the 'device_setup' module param */
int nrpacks; /* from the 'nrpacks' module param */
int async_unlink; /* from the 'async_unlink' module param */
struct usb_host_interface *ctrl_intf; /* the audio control interface */
};
/*
* Information about devices with broken descriptors
*/
/* special values for .ifnum */
#define QUIRK_NO_INTERFACE -2
#define QUIRK_ANY_INTERFACE -1
enum quirk_type {
QUIRK_IGNORE_INTERFACE,
QUIRK_COMPOSITE,
QUIRK_MIDI_STANDARD_INTERFACE,
QUIRK_MIDI_FIXED_ENDPOINT,
QUIRK_MIDI_YAMAHA,
QUIRK_MIDI_MIDIMAN,
QUIRK_MIDI_NOVATION,
QUIRK_MIDI_RAW_BYTES,
QUIRK_MIDI_EMAGIC,
QUIRK_MIDI_CME,
QUIRK_MIDI_AKAI,
QUIRK_MIDI_US122L,
QUIRK_AUDIO_STANDARD_INTERFACE,
QUIRK_AUDIO_FIXED_ENDPOINT,
QUIRK_AUDIO_EDIROL_UAXX,
QUIRK_AUDIO_ALIGN_TRANSFER,
QUIRK_AUDIO_STANDARD_MIXER,
QUIRK_TYPE_COUNT
};
struct snd_usb_audio_quirk {
const char *vendor_name;
const char *product_name;
int16_t ifnum;
uint16_t type;
const void *data;
};
#define combine_word(s) ((*(s)) | ((unsigned int)(s)[1] << 8))
#define combine_triple(s) (combine_word(s) | ((unsigned int)(s)[2] << 16))
#define combine_quad(s) (combine_triple(s) | ((unsigned int)(s)[3] << 24))
#endif /* __USBAUDIO_H */

Related

How to get apps IDs ?

Hi everyone,
I'm in trouble with my Desire "network usage".
Here is a "screenshot" of my device.
How can I get the application name for "1013" ?
Thank you for your help.
This morning, the situation is worse
open the terminal on your phone (i use betterterminal pro) and type "ps -w" without quotes in superuser mode and it wqill display all the processes with their ids
Eek, that sounds like a really bad bug..
Take a look, not sure if it is what you can use and/or afford:
topic id=12318 on android fr forum
AID_ROOT 0 /* traditional unix root user */
AID_SYSTEM 1000 /* system server */
AID_RADIO 1001 /* telephony subsystem, RIL */
AID_BLUETOOTH 1002 /* bluetooth subsystem */
AID_GRAPHICS 1003 /* graphics devices */
AID_INPUT 1004 /* input devices */
AID_AUDIO 1005 /* audio devices */
AID_CAMERA 1006 /* camera devices */
AID_LOG 1007 /* log devices */
AID_COMPASS 1008 /* compass device */
AID_MOUNT 1009 /* mountd socket */
AID_WIFI 1010 /* wifi subsystem */
AID_ADB 1011 /* android debug bridge (adbd) */
AID_INSTALL 1012 /* group for installing packages */
AID_MEDIA 1013 /* mediaserver process */
AID_DHCP 1014 /* dhcp client */
leub said:
AID_MEDIA 1013 /* mediaserver process */
Click to expand...
Click to collapse
Thank you for your help leub.
Now I need to figure out which process is "mediaserver" ?!
The mediaserver is any Native or Application which uses or streams your media which can be music, videos, even apps like iMeem, streamfurious, Pandora, TuneWiki, You Tube, and the apps
Very interesting problem ...
Someone has a solution please ?!

[Q] root_plug

Not sure if this means anything, just throwing it out there, but i was going through file for froyo on the evo, original file name "supersonic-2.6.32.15-g746f4f0.tar" and found a file named root_plug-notepad, now i'm only guessing, but is this how they are blocking us from being able to root our device, or am i just guessing outta my arse.
on the notepad the full content is:
/*
* Root Plug sample LSM module
*
* Originally written for a Linux Journal.
*
* Copyright (C) 2002 Greg Kroah-Hartman
*
* Prevents any programs running with egid == 0 if a specific USB device
* is not present in the system. Yes, it can be gotten around, but is a
* nice starting point for people to play with, and learn the LSM
* interface.
*
* If you want to turn this into something with a semblance of security,
* you need to hook the task_* functions also.
*
* See for more information
* about this code.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, version 2 of the
* License.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/security.h>
#include <linux/usb.h>
#include <linux/moduleparam.h>
/* default is a generic type of usb to serial converter */
static int vendor_id = 0x0557;
static int product_id = 0x2008;
module_param(vendor_id, uint, 0400);
module_param(product_id, uint, 0400);
/* should we print out debug messages */
static int debug = 0;
module_param(debug, bool, 0600);
#define MY_NAME "root_plug"
#define root_dbg(fmt, arg...) \
do { \
if (debug) \
printk(KERN_DEBUG "%s: %s: " fmt , \
MY_NAME , __func__ , \
## arg); \
} while (0)
static int rootplug_bprm_check_security (struct linux_binprm *bprm)
{
struct usb_device *dev;
root_dbg("file %s, e_uid = %d, e_gid = %d\n",
bprm->filename, bprm->cred->euid, bprm->cred->egid);
if (bprm->cred->egid == 0) {
dev = usb_find_device(vendor_id, product_id);
if (!dev) {
root_dbg("e_gid = 0, and device not found, "
"task not allowed to run...\n");
return -EPERM;
}
usb_put_dev(dev);
}
return 0;
}
static struct security_operations rootplug_security_ops = {
.bprm_check_security = rootplug_bprm_check_security,
};
static int __init rootplug_init (void)
{
/* register ourselves with the security framework */
if (register_security (&rootplug_security_ops)) {
printk (KERN_INFO
"Failure registering Root Plug module with the kernel\n");
return -EINVAL;
}
printk (KERN_INFO "Root Plug module initialized, "
"vendor_id = %4.4x, product id = %4.4x\n", vendor_id, product_id);
return 0;
}
security_initcall (rootplug_init);
nobody, nothing, someone has to have some sort of input, lol.
pubbs.net/200910/kernel/36760-patchrfc-security-remove-rootplug.html
Uncle jimmy says hello

Solved .[eVC++] How to use "srand" function?

Hello.
I want to ask some skilled developers,how to use "srand" function?
I found in help this:
Code:
/* RAND.C: This program seeds the random-number generator
* with the time, then displays 10 random integers.
*/
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
void main( void )
{
int i;
/* Seed the random-number generator with current time so that
the numbers will be different every time we run.
*/
srand( (unsigned)time( NULL ) );
/* Display 10 numbers. */
for( i = 0; i < 10;i++ )
printf( “ %6d\n”, rand() );
}
Problem is,when I use this example,I get errormessages:
CNS.obj : error LNK2019: unresolved external symbol time referenced in function "void __cdecl PrepareWheel(struct HDC__ *)" ([email protected]@[email protected]@@Z)
ARMV4Dbg/CNS.exe : fatal error LNK1120: 1 unresolved externals
Without this function,function "rand" returns all the time same sequence(as we know).
I am using Embedded Visual C++ 4.0 for PocketPC app development.
That's for now,thanks,Tomas.

LG Optimus S Source

I'm not sure how this might help all of you V developers. But the official Gingerbread source was just posted a bit ago on the LG Open Source Code Distribution site for the Optimus S. It is not available in the LG Updater tool yet. I thought this might be useful for anyone developing for the V still.
Can you provide a link please?
Whyzor said:
Can you provide a link please?
Click to expand...
Click to collapse
http://www.lg.com/global/support/opensource/opensource.jsp
in the drop down box select mobile phones
in the other box type ls670
I was getting ready to compile this and give it a go and two questions came up
1) how do you change the keylayout from the kernel
2) the lg optimus v 2.2.2 kernel had some funny business going on if you used the kernel. If you type adb remount without changing the ramdisk you get
an error stating it's not allowed. But if you edit the default prop in the ramdisk to allow this then adb shell would mess up. Any one know how to fix
Asadullah said:
I was getting ready to compile this and give it a go and two questions came up
1) how do you change the keylayout from the kernel
2) the lg optimus v 2.2.2 kernel had some funny business going on if you used the kernel. If you type adb remount without changing the ramdisk you get
an error stating it's not allowed. But if you edit the default prop in the ramdisk to allow this then adb shell would mess up. Any one know how to fix
Click to expand...
Click to collapse
picasticks posted a diff between sprint vd and vm kernels.
diff
original blog post
here's the bit of the diff with the keycodes
Code:
diff -urP vd/kernel/arch/arm/mach-msm/lge/board-thunderc-input.c vm670/kernel/arch/arm/mach-msm/lge/board-thunderc-input.c
--- vd/kernel/arch/arm/mach-msm/lge/board-thunderc-input.c 2011-02-04 19:00:38.000000000 -0500
+++ vm670/kernel/arch/arm/mach-msm/lge/board-thunderc-input.c 2011-04-12 06:00:32.000000000 -0400
@@ -23,7 +23,6 @@
#include <mach/board.h>
#include <mach/board_lge.h>
#include <mach/rpc_server_handset.h>
-// LGE_CHANGE [[email protected]] 2010-07-18, check the pcb revision
#include <mach/board_lge.h>
#include "board-thunderc.h"
@@ -44,12 +43,6 @@
},
};
-/* None qwerty keypad device
- * For Thunder CDMA Keypad [ [email protected] ]
- * gpio key pad device - from keypad-surf-ffa */
-/* LGE_CHANGE [LS670:FW:[email protected]] 2010-05-05, add keys.
- * CAM_SHOT, CAM_AF, VOICE
- */
#if defined(CONFIG_MACH_MSM7X27_THUNDERC_SPRINT)
static unsigned int keypad_row_gpios[] = {
32, 33, 34
@@ -64,16 +57,10 @@
#define KEYMAP_INDEX(row, col) ((row)*ARRAY_SIZE(keypad_col_gpios) + (col))
-/* LGE_CHANGE [LS670:FW:[email protected]] 2010-05-05, add keys.
- * CAM_SHOT, CAM_AF, VOICE
- */
-/* LGE_CHANGE [[email protected]] 2010--05-15, modified the keymap
- * BACK <-> HOME
- */
#if defined(CONFIG_MACH_MSM7X27_THUNDERC_SPRINT)
static const unsigned short keypad_keymap_thunder[9] = {
- [KEYMAP_INDEX(0, 0)] = KEY_HOME,
- [KEYMAP_INDEX(0, 1)] = KEY_MENU,
+ [KEYMAP_INDEX(0, 0)] = KEY_MENU,
+ [KEYMAP_INDEX(0, 1)] = KEY_HOME,
[KEYMAP_INDEX(0, 2)] = KEY_VOLUMEUP,
[KEYMAP_INDEX(1, 0)] = KEY_SEARCH,
[KEYMAP_INDEX(1, 1)] = KEY_BACK,
I cut it short of the whole section it patches but you can see which file and the changes made.
also, I believe this bit here covers ADB shell, but I could be wrong:
Code:
diff -urP vd/kernel/arch/arm/mach-msm/lge/board-thunderc.c vm670/kernel/arch/arm/mach-msm/lge/board-thunderc.c
--- vd/kernel/arch/arm/mach-msm/lge/board-thunderc.c 2011-02-04 19:00:38.000000000 -0500
+++ vm670/kernel/arch/arm/mach-msm/lge/board-thunderc.c 2011-04-12 06:00:32.000000000 -0400
@@ -136,18 +136,39 @@
{
.product_id = 0x6003,
- .functions = 0x0F /* 001111 Modem,diag,NMEA,Mass*/
+ .functions = 0x0F /* 001111 Modem,diag,NMEA,Mass */
},
{
+ .product_id = 0x6004,
+ .functions = 0x1E /* 011110 diag,NMEA,Mass,ADB */
+ },
+
+ {
+ .product_id = 0x6005,
+ .functions = 0x19 /* 011001 Modem,Mass,ADB */
+ },
+
+ {
+ .product_id = 0x6006,
+ .functions = 0x09 /* 001001 Modem,ADB */
+ },
+
+ {
.product_id = 0x618E,
.functions = 0x1F /* 011111 Modem,diag,NMEA,Mass,ADB */
},
+
{
- // LGE_CHANGE [[email protected]] 2010-08-16, LS670 UMS PID: 0x61CC
- .product_id = 0x61CC,
+ .product_id = 0x61CE,
.functions = 0x08 /* 001000 Mass */
},
+
+ {
+ .product_id = 0x61A6,
+ .functions = 0x18 /* 011000 Mass,ADB */
+
+ },
};
#endif
@@ -157,9 +178,6 @@
.phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_65NM),
.vendor_id = 0x1004,
.product_name = "LG Android USB Device",
- /* LGE_CHANGE [[email protected]] 2010-05-22, change the serial_number
- * for LS670
- */
#ifdef CONFIG_MACH_MSM7X27_THUNDERC_SPRINT
.serial_number = "LGANDROIDLS670",
#else
@@ -194,7 +212,6 @@
},
};
-// LGE_CHANGE [[email protected]] 2010-09-28
static struct platform_device testmode_device = {
.name = "testmode",
.id = -1,
@@ -210,7 +227,6 @@
&msm_device_adspdec,
&lg_fw_diagcmd_device,
&lg_diag_cmd_device,
- // LGE_CHANGE [[email protected]] 2010-09-28
&testmode_device,
};
@@ -231,11 +247,6 @@
void msm_serial_debug_init(unsigned int base, int irq,
struct device *clk_device, int signal_irq);
-// LGE_CHANGE [[email protected]] 2010-07-22, merged from thunderg
-/* decrease FB pmem size because thunderg uses hvga
- * qualcomm's original value depends on wvga resolution
- * 2010-04-18, [email protected]
- */
unsigned pmem_fb_size = 0x96000;
unsigned pmem_adsp_size = 0xAE4000;
@@ -314,7 +325,6 @@
#endif
}
-/* LGE_CHANGE [[email protected]] 2010-06-02 [LS670] */
#ifdef CONFIG_MACH_MSM7X27_THUNDERC_SPRINT
MACHINE_START(MSM7X27_THUNDERC, "THUNDER Sprint board (LGE LS670)")
#else
hopefully that's what you're needing, but I'm not positive.
edit: looks like they changed the second bit quite a bit in 2.6.35, it'll take more work to patch in the changes for the v in the product id codes now.
FWIW in order to get USB tethering working, the IHO kernel does not use the stock VM670 USB code, so I wouldn't worry too much about patching anything or maintaining the USB IDs.

[UTIL][PB]★(¯ `•.MS ® Windows Phone - for Flash.Store.Bin[Ext/Build/Info/More].•´¯)★

[UTIL][PB]★(¯ `•.MS ® Windows Phone - for Flash.Store.Bin[Ext/Build/Info/More].•´¯)★
Now We have tool for Ext/Build/Mod./and More Flash.Store.bin
imgtool - Modyfication Image Store, extract/build/repartition/and more... for system
structure store partition, and general part sections image Windows Phone.
Support All Image Flash.Store.Bin Devices:
-- Toshiba/Dell/HTC/Samsung/Nokia/Etc...
Support Other Image System Devices:
-- bin|dio|xml|raw
Info - Usage:
Code:
ImgTool [...options...] inFile [outFile]
Info - Options:
Code:
Options:
-inFormat bin|dio|xml|raw Input file format
-inCert certificateFile Certificate for input file
-inBase address Raw image base address
-outFormat bin|xml|raw|secbin Output file format
-outHash sum|sha1 Output file hash
-outPvk privateKeyFile Private key for output hash
-outPvkPwd password Password for private key
-outCert certificateFile Certificate for output file
-ui Enable crypto user interface
-sectorSize bytes Output file sector size
-sectorsPerRecord sectors Output file sectors in record
-recordSize Output file maximal record size
-ram2store [...type...] Converts ram to storage image
-extendLast Set last partition size as unlimited
-extractPublicKey Extract public key from input certificate
Platform Info © 2012 By UPE-Product
All Rights Reserved
Support Example Format Store File - BOOT_DOWNLOAD_BIN_FORMAT_STORE:
Code:
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES OR INDEMNITIES.
//
#ifndef __BOOT_DOWNLOAD_BIN_FORMAT_H
#define __BOOT_DOWNLOAD_BIN_FORMAT_H
#include "bootTypes.h"
#ifdef __cplusplus
extern "C" {
#endif
#pragma pack(push, 1)
//------------------------------------------------------------------------------
#define BOOT_BIN_SIGNATURE_RAM "B000FF\x0A"
#define BOOT_BIN_SIGNATURE_SIGNED_RAM "S000FF\x0A"
#define BOOT_BIN_SIGNATURE_RAW "N000FF\x0A"
#define BOOT_BIN_SIGNATURE_SIGNED_RAW "R000FF\x0A"
#define BOOT_BIN_SIGNATURE_STORE "D000FF\x0A"
#define BOOT_BIN_SIGNATURE_JUMP "J00000\x0A"
//------------------------------------------------------------------------------
typedef struct BootBinFormatRamHeader_t {
uint32_t start;
uint32_t size;
} BootBinFormatRamHeader_t;
typedef struct BootBinFormatRamRecordHeader_t {
uint32_t address;
uint32_t length;
uint32_t checksum;
} BootBinFormatRamRecordHeader_t;
//------------------------------------------------------------------------------
typedef struct BootBinFormatSignature_t {
uint8_t signature[7];
} BootBinFormatSignature_t;
enum BootBinFormatFlags_e {
BOOT_BIN_FORMAT_FLAG_CLEAN = (1 << 0)
};
//------------------------------------------------------------------------------
enum BootBinFormatHashType_e {
BOOT_BIN_FORMAT_HASH_SUM = 0,
BOOT_BIN_FORMAT_HASH_SHA1 = 1,
BOOT_BIN_FORMAT_HASH_SHA256 = 2,
BOOT_BIN_FORMAT_HASH_OEM = 0x8000
// OEM can define new hashing algorithms in their own platform-specific
// BSPs. The definitions must start at BOOT_BIN_FORMAT_HASH_OEM, e.g.
// BOOT_BIN_FORMAT_HASH_ALG1 = BOOT_BIN_FORMAT_HASH_OEM + 0,
// BOOT_BIN_FORMAT_HASH_ALG2 = BOOT_BIN_FORMAT_HASH_OEM + 1
};
//------------------------------------------------------------------------------
typedef struct BootBinFormatStoreHeader_t {
uint32_t flags;
uint32_t sectorSize;
uint32_t sectors;
uint32_t segments;
uint32_t hashType;
uint32_t hashSize;
uint32_t hashInfoSize;
} BootBinFormatStoreHeader_t, *BootBinFormatStoreHeader;
typedef struct BootBinFormatStoreSha1Info_t {
uint32_t publicKeySize;
uint32_t seedSize;
/*
uint8_t publicKey[publicKeySize];
uint8_t seed[seedSize];
*/
} BootBinFormatStoreSha1Info_t;
enum BootBinFormatStoreSegmentType_e {
BOOT_BIN_FORMAT_STORE_SEGMENT_BINARY = 1,
BOOT_BIN_FORMAT_STORE_SEGMENT_RESERVED = 2,
BOOT_BIN_FORMAT_STORE_SEGMENT_PARTITION = 3
};
typedef struct BootBinFormatStoreSegmentHeader_t {
uint32_t type;
uint32_t sectors;
uint32_t infoSize;
} BootBinFormatStoreSegmentHeader_t, *BootBinFormatStoreSegmentHeader;
typedef struct BootBinFormatStoreSegmentBinaryInfo_t {
uint8_t index;
} BootBinFormatStoreSegmentBinaryInfo_t;
typedef struct BootBinFormatStoreSegmentReservedInfo_t {
char name[8];
} BootBinFormatStoreSegmentReservedInfo_t;
typedef struct BootBinFormatStoreSegmentPartitionInfo_t {
uint8_t fileSystem;
uint8_t index;
} BootBinFormatStoreSegmentPartitionInfo_t;
typedef struct BootBinFormatStoreRecordHeader_t {
uint32_t segment;
uint32_t sector;
uint32_t sectors;
} BootBinFormatStoreRecordHeader_t;
/*
This is pseudo-C definition of store format
typedef struct BootBinFormatStore_t {
uint8_t signature[7];
BootBinFormatStoreHeader_t header;
uint8_t hashInfo[header.hashInfoSize];
struct {
BootBinFormatStoreSegmentHeader_t segmentHeader;
union {
BootBinFormatStoreSegmentBinaryInfo_t binaryInfo;
BootBinFormatStoreSegmentReservedInfo_t reservedInfo;
BootBinFormatStoreSegmentPartitionInfo_t partitionInfo;
};
} segment[header.segments];
uint8_t hash[header.hashSize]; // Header hash/checksum
struct {
BootBinFormatStoreRecordHeader_t recordHeader;
uint8_t recordData[recordHeader.sectors * header.sectorSize];
uint8_t recordHash[header.hashSize];
} record[];
} BootBinFormatStore_t;
*/
//------------------------------------------------------------------------------
#pragma pack(pop)
#ifdef __cplusplus
}
#endif
#endif // __BOOT_DOWNLOAD_BIN_FORMAT_H

Categories

Resources