device

What triggers the BluetoothDevice.ACTION_ACL broadcasts?

眉间皱痕 提交于 2019-11-28 20:03:15
问题 I would like to know what events in remote physical devices trigger ACTION_ACL_CONNECTED and ACTION_ACL_DISCONNECTED in a listening device. My test results make no sense. I have gathered several devices within a few decimeters of each other: a Galaxy Tab P7500 running Android 3.1 an i5500 phone running Android 2.2 a WinXP PC with a bluetooth USB dongle two headsets with on/off buttons First, I pair manually with all devices from the Tab. Neither the PC nor the phone are paired with any other

How to detect hardware keyboard presence?

…衆ロ難τιáo~ 提交于 2019-11-28 20:00:34
问题 Is there a way to detect if the device I'm currently running on has a hardware keyboard installed? How do I query device capabilities anyway? 回答1: "The flags provided by getResources().getConfiguration().keyboard are a good way of checking which keyboard (if any) is available." [1] http://d.android.com/reference/android/content/res/Configuration.html#keyboard 回答2: Use the following method to ascertain presence of hard keyboard at any time: (To my knowledge, soft keyboards all lack the

Controlling simple relay switch via USB

天大地大妈咪最大 提交于 2019-11-28 19:13:16
问题 I'm looking to control a mains powered light from a simple relay switch connected via USB to the computer. The relay switch isn't even a USB device, it's just a simple switch that requires the USB voltage to turn it on. When the voltage drops below a threshold, the switch will turn the light off. My problem is that I can't control the power output of a USB port. I'm happy to do it using any language on Windows or Linux (but preferably Java because I'm used to it). 回答1: Unfortunately, in most

How to connect with paired Bluetooth device programmatic in Android?

我只是一个虾纸丫 提交于 2019-11-28 19:01:37
I am developing an application where I have to connect to Bluetooth paired device. These two devices are paired with each other. Now when I try to connect with paired device it stuck with the connecting mode dialog. Log shows that it successfully connect but does not dismiss the dialog. Here is my code snippet. Main.java import java.io.BufferedReader; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util

Sending ATA commands directly to device in Windows?

一曲冷凌霜 提交于 2019-11-28 18:50:24
I’m trying to send ATA commands to a physical disk in Windows, and get the response from the device. Note: In this case I want to send the IDENTIFY DEVICE (0xEC) command. The device will respond with a 512-byte block of data. (In particular I’m interested in bit 0 of word 119 - the device’s support for the TRIM command ). I know that I need to use CreateFile to open the device: handle = CreateFile( "\\.\PhysicalDrive0", GENERIC_READ, FILE_SHARE_READ, nil, // no security attributes OPEN_EXISTING, 0, // flags and attributes nil // no template file ); But after this I’m stymied about what to do.

Bash Pipe Handling

只谈情不闲聊 提交于 2019-11-28 17:09:08
问题 Does anyone know how bash handles sending data through pipes? cat file.txt | tail -20 Does this command print all the contents of file.txt into a buffer, which is then read by tail? Or does this command, say, print the contents of file.txt line by line, and then pause at each line for tail to process, and then ask for more data? The reason I ask is that I'm writing a program on an embedded device that basically performs a sequence of operations on some chunk of data, where the output of one

Android listing BLE devices after device scan

余生长醉 提交于 2019-11-28 07:03:52
Can u provide me the simple code for scanning the nearby BLE devices and list it by device name and MAC ID. I tried this using sample code provided in http://developer.android.com/guide/topics/connectivity/bluetooth-le.html . But didn't work, any reference link or ideas since i am new to BLE app. kodartcha This example is based on the developers web you posted and works great for me. This is the code: DeviceScanActivity.class package com.example.android.bluetoothlegatt; import android.app.Activity; import android.app.ListActivity; import android.bluetooth.BluetoothAdapter; import android

Detecting rotation to landscape manually

早过忘川 提交于 2019-11-28 07:01:32
I am working on an iPhone application based on UITabBarController and UIViewControllers for each page. The app needs to run in portrait mode only, so every view controller + app delegate goes with this line of code: - (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationPortrait); } There is one view controller where I would like to pop up a UIImageView when the iPhone is rotaed to landscapeleft. The design of the image looks landscape, although the width and height are 320x460 ( so its portrait ).

Simulate a faulty block device with read errors?

不想你离开。 提交于 2019-11-28 07:00:16
I'm looking for an easier way to test my application against faulty block devices that generate i/o read errors when certain blocks are read. Trying to use a physical hard drive with known bad blocks is a pain and I would like to find a software solution if one exists. I did find the Linux Disk Failure Simulation Driver which allows creating an interface that can be configured to generate errors when certain ranges of blocks are read, but it is for the 2.4 Linux Kernel and hasn't been updated for 2.6. What would be perfect would be an losetup and loop driver that also allowed you to configure

Find which drive corresponds to which USB mass storage device in WinXP

做~自己de王妃 提交于 2019-11-28 06:36:44
I have several USB drives connected to a WinXP SP3 computer, and I need to tell them apart programatically - I need to find which drive letter corresponds to which device (in this case, one device ~ one volume). I can get their Volume IDs and drive letters using mountvol , looking something like this: C:\WINDOWS\> mountvol \\?\Volume{bdb681b2-1ddf-11dd-bf71-806d6172696f}\ C:\ \\?\Volume{6a8784f8-7406-11dd-a8c3-001e8c829b67}\ A:\ Also, using devcon or the Device Manager, I can see the device IDs: C:\WINDOWS\> devcon resources *STOR* STORAGE\REMOVABLEMEDIA\7&190C24E5&0&RM Name: Generic volume