/dev/ttyUSB0 plug detection - usb

I need to make a script (/bin/sh) to detect when a new /dev/ttyUSB* device is plugged and when it's disconnected.
I can't use uevent because they aren't supported on my platform, I can only start a service on boot that wait for /dev/ttyUSB* appears.
How can i made that?

Related

Android Emulator connect external storage Device while running

I have an App that needs to detect, if a USB Storage device is getting mounted. Can i simulate the mounting of an USB Storage Device while the Emulator is already running? This way i can debug the behavior of my app.
As i know, for registering the mounting and unmounting of the USB Storage Device i can use the StorageVolumeCallback(). What do i have to do to write a simple .txt File to that attached USB Storage Device?
Im having trubble to create a StorageManager inside my ViewModel because i do not have access to the Context.
Im thankful for any Tipp related to USB Storage Management at all.
Info:
API Version: 31
IDE: Android Studio
Language: Kotlin
Edit:
So i do not necessarily need to have a external usb drive mounted at startup. If its possible with adb it would be great if i could just forward a usb Pendrive to the running emulator when i need it. Something like adb connectUsbDevice -deviceid=****,vendorid=***
There isn't a .NET library I'm aware of which can do this. However, please refer to this post where the brilliant answer shows how to do this interfacing with the Win 32 API.
How do I disable a system device programmatically?
You'll need a combination of this, and a WMI query to find an attached PnP device of type storage. As a clue:
using (var searcher = new ManagementObjectSearcher(#"SELECT * FROM Win32_USBHub"))
{
collection = searcher.Get();
}
Change Win32_USBHub to the correct class if this isn't giving you what you're looking for.
EDIT: Be warned. If you're disabling storage devices, make sure they're not in use. That's what the "Safely remove USB" option is for in Windows.
Another option, if you don't need to emulate this in code, use a real USB storage device inserted in the system and use PowerShell to get, disable, and enable the device.
The Cmdlets you'll need are:
Get-PnpDevice
Disable-PnpDevice
Enable-PnpDevice

Headless Setup of Asus Tinker Board S

I am trying to set up Tinker Board headlessly as I don't have access to a wired keyboard and mouse.
One method I know that works for Raspi is by creating an SSH file while setting it up and a wpa_supplicant.conf file to provide wifi details. I have flashed the latest Tinker OS v2.2.9 onto the eMMC present on the board as per the instructions. But, in this case I am not able to access the drive once flashed (Contrary to raspi setup).
Is there a way to set it up headlessly?
Thank you for taking out time to read this and helping out.

Can I start the Windows 8 device simulator with a different user account?

I noticed that the simulator in VS2012 is (apparently) opening a new Windows session with the same account, which causes many issues:
I can't use the Modern UI version of IE, because IE is not my default browser. But if I set it as the default browser in the simulator, it also becomes the default browser in my host session, which I don't want
for apps that are scheduled to start when the session starts, a new instance is started in the simulator. For instance:
Dropbox: it could probably cause serious issues if both instances try to synchronize the same physical folder
Spark: it detects that someone else connected with the same account from another computer, so I'm disconnected in the host session
Logitech Setpoint: it captures the mouse wheel in the simulator, which means I can't use the wheel any more in the host session (I have to kill Setpoint in the simulator to fix it)
It seems to me that the best way to fix this problem would be to have the simulator open a session with a different user account, so that it doesn't interfere with my current session. But I couldn't find any option to control the behavior of the simulator... Is it possible at all?
This is not possible as Child Sessions are used for the simulator which is a feature that is only available for the current user. More information on Child Sessions can be seen here
One solution is to virtualize and do a remote debugging on that instance, that way you can deploy and debug without any of the issues above.
http://msdn.microsoft.com/en-us/library/windows/apps/hh441469.aspx

Appcelerator Titanium - how I can open a window at a fixed moment of time

I'm a newbie in using appcelerator titanium, and I'm using this platform to create an alarm application. But I'm facing with a problem. I don't know how I can open an application's window at a fixed moment of time (even when my application is closed, and the device is sleeping). Have any features as Alarm and BroadcastReceiver as in Android OS? Please help me, thanks!
On which alarms do yo want to respond?
On iOS you can't wait for such events when your app is in background in general and you can't listen for them with titanium. With Titanium you can use LocalNotification (working like a timer). In their callback you should set a property and when the user opens your app you should check this property and open your window.
On Android you may create a background service but i have no idea how to listen on native events (except battery) on android.
Thanks for your reply.
I'm finding for a mechanism that has ability to wake up the device when it is sleeping and then open a window in my application. In Android, I know a mechanism called Alarm, I can register an Alarm with the Android OS, and after a specified moment of time (specified when I register Alarm), Android OS would be wake up the device (if it is sleeping) and send an Intend. And then, in my application I can register a BroadcastReceiver that listen for that Intent sent by Android OS. In that BroadcastReceiver, I can do something like start services, open new window (known as Activity in Android).

GPRS and GPS on embedded Linux

I've got an embedded linux and a Telit gprs/gps module ("GM862-GPS" on USB-Port). My current project requires it to be connected via gprs for sending data, while continuously asking the module for the gps position. I'm connected to gprs with a ppp-daemon and chatsripts, but when the connection is established, the module seems to be locked (no reaction on AT-commands through minicom).
I read, that 'AT+CMUX' could be one solution, which is provided by this device, but I don't know how to use it, since the 'CMUX User Guide' by Telit isn't really helpfull (and a program for automatic setup is only provided for windows).
Does anyone know, how to deal with this command, or even knows a better choice to handle this problem ?
My answer might be too late.
You need to use CMUX to create another COM port to talk to it. I played with CMUX once and I understand your frustrations. In my case, it worked for a while and then failed and I couldn't find out why. You might want to post your question at Roundsolutions.
I programmed the module by writing Python scripts and upload to the module. Their Python API provides two channels to send AT commands to the module: MDM and MDM2. I use MDM as the AT command and use MDM2 to create sockets. Initially, you use MDM2 to send AT commands to create a socket connection. Once connected, whatever data sent to it will be interpreted as data stream instead of AT commands. They allow you to send '+++' to switch back to AT command mode.