|
How to find modules that send messages inside kernel source?
I have found file called host_notifier.c inside /drivers/usb/otg/ inside kernel source!
There is also file called Kconfig which contains this:
#
# USB Host notify configuration
#
config USB_HOST_NOTIFY
boolean "USB Host notify Driver"
depends on USB
help
Android framework needs uevents for usb host operation.
Host notify Driver serves uevent format
that is used by usb host or otg.
config USB_DEBUG_DETEAILED_LOG
boolean "USB detailed log for debugging"
depends on USB
help
Add detailed log for debugging.
modified 24-Jan-17 10:53am.
|
|
|
|
|
That is the kernel config file which defines what has to be compiled. If you have also a Makefile, you can check which sources are compiled when USB_HOST_NOTIFY is set.
But it already contains a hint: It uses uevent .
But again, these might only occur when a device is attached. To know when the cable message is generated, you have to find the message string in the sources.
|
|
|
|
|
I am searching inside /drivers/usb
Which of these folders could contain message:
atm
c67x00
class
core
dwc3
early
gadget
host
image
misc
mon
musb
otg
renesas_usbhs
serial
storage
wusbcore
|
|
|
|
|
Any of them, you need to do some searching.
|
|
|
|
|
I have searched all files and I didn't find kernel message for USB !!!!
|
|
|
|
|
I have searched all files and I didn't find kernel message for USB !!!!
|
|
|
|
|
I have searched all files and I didn't find kernel message for USB !!!!
I ran android terminal on my phone, typed cat /proc/kmsg and when plugged in otg cable I got msm_otg f9a55000.usb : host on
I found that message inside msm_otg kernel source:
static void msm_otg_start_host(struct usb_otg *otg, int on)
{
struct msm_otg *motg = container_of(otg->phy, struct msm_otg, phy);
struct msm_otg_platform_data *pdata = motg->pdata;
struct usb_hcd *hcd;
if (!otg->host)
return;
#ifdef CONFIG_USB_HOST_NOTIFY
msm_otg_host_notify(motg, on);
#endif
hcd = bus_to_hcd(otg->host);
if (on) {
dev_dbg(otg->phy->dev, "host on\n");
if (pdata->otg_control == OTG_PHY_CONTROL)
ulpi_write(otg->phy, OTG_COMP_DISABLE,
ULPI_SET(ULPI_PWR_CLK_MNG_REG));
if (pdata->setup_gpio)
pdata->setup_gpio(OTG_STATE_A_HOST);
usb_add_hcd(hcd, hcd->irq, IRQF_SHARED);
} else {
dev_dbg(otg->phy->dev, "host off\n");
usb_remove_hcd(hcd);
writel_relaxed(0x80000000, USB_PORTSC);
if (pdata->setup_gpio)
pdata->setup_gpio(OTG_STATE_UNDEFINED);
if (pdata->otg_control == OTG_PHY_CONTROL)
ulpi_write(otg->phy, OTG_COMP_DISABLE,
ULPI_CLR(ULPI_PWR_CLK_MNG_REG));
}
}
and do I need to create something like this: As code goes by: UEvents in Android - from kernel events to notifications[^]
modified 24-Jan-17 18:02pm.
|
|
|
|
|
Go to ParentHow to use app to detect when otg cable is plugged in and when it's plugged out? Is there intent for otg cable like this for usb devices: "android.hardware.usb.action.USB_DEVICE_ATTACHED"
I have created app like this but I only detects flash drive not otg cable:
public class MainActivity extends AppCompatActivity
{
private TextView mInfo;
private Logger mLogger;
private HashMap<UsbDevice, UsbDataBinder> mHashMap = new HashMap<UsbDevice, UsbDataBinder>();
private UsbManager mUsbManager;
private PendingIntent mPermissionIntent;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mInfo = (TextView)findViewById(R.id.log);
mLogger = new Logger(this);
mLogger.setMode(Logger.MODE_TOAST);
mUsbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
usbConnection();
}
private void usbConnection() {
IntentFilter filter = new IntentFilter(UsbManager.ACTION_USB_DEVICE_ATTACHED);
registerReceiver(mUsbAttachReceiver , filter);
filter = new IntentFilter(UsbManager.ACTION_USB_DEVICE_DETACHED);
registerReceiver(mUsbDetachReceiver , filter);
mPermissionIntent = PendingIntent.getBroadcast(this, 0, new Intent(ACTION_USB_PERMISSION), 0);
filter = new IntentFilter(ACTION_USB_PERMISSION);
registerReceiver(mUsbReceiver, filter);
showDevices();
}
protected void onDestroy() {
super.onDestroy();
unregisterReceiver(mUsbDetachReceiver);
unregisterReceiver(mUsbAttachReceiver);
unregisterReceiver(mUsbReceiver);
};
BroadcastReceiver mUsbDetachReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (UsbManager.ACTION_USB_DEVICE_DETACHED.equals(action)) {
UsbDevice device = (UsbDevice)intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
if (device != null) {
UsbDataBinder binder = mHashMap.get(device);
if (binder != null) {
binder.onDestroy();
mHashMap.remove(device);
Toast.makeText(MainActivity.this, "Attached!", Toast.LENGTH_SHORT).show();
}
}
}
}
};
BroadcastReceiver mUsbAttachReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (UsbManager.ACTION_USB_DEVICE_ATTACHED.equals(action)) {
showDevices();
Toast.makeText(MainActivity.this, "Detached!", Toast.LENGTH_SHORT).show();
}
}
};
private static final String ACTION_USB_PERMISSION = "com.android.example.USB_PERMISSION";
private final BroadcastReceiver mUsbReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (ACTION_USB_PERMISSION.equals(action)) {
synchronized (this) {
UsbDevice device = (UsbDevice) intent
.getParcelableExtra(UsbManager.EXTRA_DEVICE);
if (intent.getBooleanExtra(
UsbManager.EXTRA_PERMISSION_GRANTED, false)) {
if (device != null) {
UsbDataBinder binder = new UsbDataBinder(mUsbManager, device);
mHashMap.put(device, binder);
Toast.makeText(MainActivity.this, "Permission Granted!", Toast.LENGTH_SHORT).show();
}
} else {
}
}
}
}
};
private void showDevices() {
HashMap<String, UsbDevice> deviceList = mUsbManager.getDeviceList();
Iterator<UsbDevice> deviceIterator = deviceList.values().iterator();
while(deviceIterator.hasNext()){
UsbDevice device = deviceIterator.next();
mUsbManager.requestPermission(device, mPermissionIntent);
mLogger.log("usb", "name: " + device.getDeviceName() + ", " +
"ID: " + device.getDeviceId());
mInfo.append(device.getDeviceName() + "\n");
mInfo.append(device.getDeviceId() + "\n");
mInfo.append(device.getDeviceProtocol() + "\n");
mInfo.append(device.getProductId() + "\n");
mInfo.append(device.getVendorId() + "\n");
}
}
@Override
protected void onResume() {
super.onResume();
}
}
|
|
|
|
|
i need a remote android source code for make a project. i want to view my frnds android phn using my phne and i need to contol his phn. its my android project like remodroid. but i can't make such like app in android eclips. pllz help me to create such lyk app.. please provide the souce code for it
|
|
|
|
|
|
Samsung has disabled OTG support on my S3 Neo I9301I and I have program that enables it.When I plug in otg cable inside phone and open app and enable switch,app writes "1" inside /sys/kernel/debug/regulator/8226_smbbp_otg/enable/ file and writes "0" inside it when I disable switch!When "1" otg is enabled,when "0" otg is disabled!
How to make that app automatically enables switch to write "1" when I plug in cable without going inside app and manually turning on switch?
|
|
|
|
|
This sounds like illegal hacking and we do not condone it, let alone help you to do it.
|
|
|
|
|
Hello Ladies & Gentlemen,
I would like to learn Android Apps and Android Games Apps development. Only latest version of the compiler as of Jan 2017.
Q1. What are your top best Android Apps and Android Games Apps development (latest version of the compiler) programming tutorial paperback books, ebooks, online text tutorials and online video tutorials suitable for complete beginners and why do you suggest them over others ?
Q2. Is it possible to build mobile phone apps and mobile phone game apps (only Android) with Python or do I need to learn Java for that ?
Q3. Where did you learn Android Apps and Android Games Apps development and why particularly from there ?
Q4. How many years experience do you have in Android Apps and Android Games Apps development and which version of the compiler do you use and which compiler ?
Q5. Which other languages you know and how many years experience ?
Q6. Where are your Android Apps and Android Games Apps development portfolios (work samples) ?
Q7. Anything else I should know ?
|
|
|
|
|
|
i have a save button make it to input selected excel file into sqlite Db in android,
|
|
|
|
|
Where is the excel file and how do you read it? What information do you want to store in the database?
|
|
|
|
|
it is in the sd card,it is result data of the students
|
|
|
|
|
Very helpful information.
|
|
|
|
|
Is it a CSV file?
Do you actually need to import it into a database, or can you simply process the file to get the desired numbers?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Hi
Im doing chatting application like whatsapp , so i want to validate the customer mobile no, if any one have the sample code or sample program pl send it to my mail id finalchat193@gmail.com
|
|
|
|
|
Validate it against what?
|
|
|
|
|
|
How to make doctor appointment app in android,i'm new android developer please provide me doctor appointment full source code
|
|
|
|
|
Member 12928292 wrote: please provide me doctor appointment full source code How much are you willing to pay?
BTW, asking questions like this is a sure-fire way to have your account suspended. Since you're new to the site, you may want to read this[^] post.
/ravi
|
|
|
|
|
Firstly, asking for full code is not the right way to get help here. We help people with the programming work that they have tried to produce.
Secondly, as someone new to Android this project is quite advanced. I suggest you go to Learn Android Tutorials and spend some time getting familiar with some of the basics of Android programming.
|
|
|
|