is CellID used in AGPS even if no simcard is inserted in the phone? - gps

In smartphones AGPS is used. For example, in android, network provider uses (AGPS, CellID, WiFi MACID)
I have the following questions:
Is CellID used even when there is no sim card inserted?
Is there a way to view the source code to see how location is
calculated?
Thanks.

Related

How to query the serial number of a UVC camera?

I have two UVC cameras in a stereoscopic setup, controlled with a C++ MediaFoundation app. I need to uniquely identify them in order to assign left and right to each physical device. This camera model has a unique serial number in the USB descriptor. However I can't seem to find a way to get the serial number while enumerating using MediaFoundation.
The MF enumeration order of these cameras is not reliably in port order; 95% of the time, camera 1 is enumerated before camera 2, while on some machines, we get camera 2 before camera 1. So finding the serial number is very important.
Things I've tried:
MediaFoundation doesn't seem to provide a direct way to get the serial number at all
By querying the MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK attribute, you can get a USB symbolic link. The docs say this can be used to call SetupDiOpenDeviceInterface however this doesn't seem to be usable to get the serial number (or the USB descriptor) either.
WinUSB can be used to open some USB devices in a generic manner, so the USB descriptor might be accessible, but this method fails on these cameras also, after passing the handle from CreateFile.
IOCTL the lowest level method, apparently you can send a IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX to the hub device, with a port index, and it will return the descriptor from which you should be able to get the serial number. No idea how to get the hub device and port index from only the symlink though.
Related, but unresolved: How to get hardware ID when enumerating with Windows Media Foundation
I do not wish to reimplement half of the USBView example and enumerate the entire USB world just to get some specific info for a device for which I already have a handle.
Some symbolic links for USB devices can be parsed to extract the serial number, however in the case of composite devices (all the devices in question here) the symbolic link has the &MI_00# style format and does not contain the serial number in the symlink string. So it cannot simply be parsed out.
More generally, the Setup and related APIs in Win32 seem to make it easy to get information such as manufacturer, friendly name, and all sorts of other info. But serial number is conspicuously absent.
So how do you get the serial number associated with a MediaFoundation device instance?
You can do camera identification by USB port connection (Root-Hub-Port identifiers are the same if you don't connect new USB cards or hubs to the system)
Unfortunately StackOverflow doesn't give to attach images (I don't have good enough reputation).
I'll try to show data from debugger:
There is list of my available cameras
+Integrated_Webcam/R1.H2.P4/VID_1BCF&PID_2284&MI_00;
+HBVCAM FHD CAMERA/R4.H2.P4/VID_058F&PID_3821&MI_00;
+HD USB Camera/R5.H2.P5/VID_05A3&PID_9230&MI_00;
+Integrated_Webcam/R5.H2.P6/VID_1BCF&PID_2284&MI_00;
+Logitech HD Webcam C270/R1.H2.P1/VID_046D&PID_0825&MI_00;
Each string consists of Friendly camera name, Rx.Hx.Px camera connection port indexes, (i.e. Controller number"R"-Hub number"H"-Port number"P") and VID-PID-MI presentation string(vendor id, product id and interface number).
1st and 4th cameras are the same, but have different RHP indexes. These indexes I do use for camera identification.
I did USB enumerator which provides these indexes (I did this on the base of Microsoft USBView.exe application which is provided with sources in Windows SDK).
[1]: https://i.stack.imgur.com/6SQcS.png
Usually simple USB cameras (web cameras) doesn't have serial number or something like serial number is encoded inside USB instance ID. More expensive cameras have special drivers and you can read SN by driver.
I see only one way to know, what camera I do use now - by attached USB port. This port is unique... if you don't connect additional hubs or not insert additional USB interface cards in computer. There is USB enumeration process which provides Controller(Root)-Hub-Port enumeration indexes. I do use these indexes for camera identification.
Look on this dialog: you see 5 strings with 5 USB cameras descriptors. Each descriptor consists of "Friendly Camera Name", 3 enumeration indexes (Rx.Hx.Px) and camera vendor ID and product ID (VID and PID).
If I put different camera to the same port, my program will use this different camera. If several cameras of the same type are connected, I do differ between cameras by RHP indexes. For example, the first and the fourth camera in list are the same, but they have different
enter image description here

how to avoid damaging controller during UART communication

i am trying to communicate with my board which uses efm32lg230f256 controller.
I want to buy a cable for RS232 UART communication which properties shown in the table and link bellow.
In the table bellow from the data sheet i cant see to what voltage the controller can accept?
There could be situation where my PC will send a command with a higher values then the controller can handle and damage it.
How can i make sure it wont happen?
Thanks.
https://www.silabs.com/documents/public/data-sheets/efm32lg-datasheet.pdf
https://www.mouser.co.il/datasheet/2/163/DS_C232HD_UART_CABLE-4313.pdf
Chapter 4.2 of the data sheet shows the maximum values. Since the shown cable works at 3.3V levels, it should match perecftly if you power your controller with 3.3V.

Understanding "driverless" USB HID

I'm at the beginning of trying to develop a USB HID bootloader for a Kinetis processor, and getting no help from that department. I have made some modifications to Kinetis firmware designed for a similar processor(I'm using the KL26Z, the original code is for KL25Z), and I do now see the beginning of the USB enumeration(on a PC running W7). However, the PC asks for driver software, and I don't understand why, as I thought the whole point of going the HID route was that one didn't need to install drivers. So the device shows up under device manager, but as a non-working problem device. My problem is that I don't really know what should happen. Any insights would be welcome.
Here's what should happen: the computer will ask your device for its USB descriptors when it detects your device. The descriptors must have certain fields like bDeviceClass set properly to indicate that it is an HID. If the computer sees those fields, it will attach the HID driver to your device.
In the Device Manager, you should look at the "Compatible Ids" of your device. Do you see USB\Class_03 in that list? If so, that should match the driver input.inf that comes with Windows, so the INF file will be applied to your device, and you device will show up as "USB Input Device" in the Device Manager. If you don't see USB\Class_03 in your list then there is probably some problem with your device's USB descriptors or its USB stack.

iOS 9.1 BLE Connects and Immediately Disconnects

When I connect to a BLE peripheral using encryption on iOS 9.1 using a iPhone 6S the BLE peripheral is immediately disconnected. I've verified that this works on iOS 8 and 9.02. I've validated that the CBCentralManager didConnect delegate method is being called and a valid CBPeripheral object is being returned.
The BLE peripheral is disconnected immediately. I'm not able to even proceed to discover any services or characteristics before it is disconnected. The CBCentralManager didDisconnect method is called, but no error is returned.
Is anyone else seeing this? This has been working correctly for over a year and like I said it's only happening when using iOS 9.1 on the iPhone 6S. Don't have any other peripherals on 9.1 to test with.
UPDATE
According to Apple the issue is happening because we're not bonding the peripheral with the iPhone. So we've updated the firmware on the peripheral and are now bonding. This is presenting different issues surrounding maintaining bonding pairs between the phone and the peripheral. Our peripheral has a limited amount of memory, so we cannot maintain an infinite amount of bond references. To handle this scenario the peripheral allows for a maximum of 8 BLE bonds to be stored. When it receives a ninth request the first bond is removed from the peripherals list of bonded devices. This presents an issue because the iPhone doesn't know this bond has been removed and when I try to connect with the first device and interact with a characteristic I'm not prompted to pair. Which from my understanding is what kicks off the encryption process.
I'm wondering if there is anyway to remove a bond / device from an iPhones list of bonded devices, other then going into the Bluetooth settings and 'Forgetting' the device.
UPDATE #2
Apple has confirmed that there is NOT a way to remove a bonded peripheral from the 'MY Devices' section within the Bluetooth settings in the application due to security issues.
Based on this the scenario has now turned into the following. The iOS device has a reference to what was once a bonded peripheral under "My Devices" however that peripheral no longer has a reference to the iOS device within it's bonded devices table.
When I attempt to connect the iOS device, which still has the bond reference in it, to the peripheral that no longer has the bond reference we can connect successfully. However, after I connect successfully I discover the characteristic, set it to notify and receive no response and no pairing message. The only solution that fixes this issue is going into 'Settings' and 'Forgetting' the device and then attempting to reconnect.
Has anyone else experience this issue? Suggestions?
Thanks!

Retrieve mount point of WPD device

I've worked with WPD API for a while now, and I seem to run in to problem after problem.
Once I fix one problem, something else pops up. But hey, that's life.
I've been trying to determine if a WPD device is a storage device or a phone or whatever.
Turns out, devices such as iPhone are not set to be recognized as a phone, but instead as a generic device in terms of WPD_DEVICE_TYPE.
But, it is presented to Windows as a storage device.
When connecting external harddrives, SD memory card readers and other more conventional storage devices, they are recognized by the WPD API as well, but ehy that also get a dedicated mount point in Windows.
If I connect an external harddrive, it will have one functional category object, and the value of that object will be the path of that drive, say E:.
Nice. Great!
So my question is: How can I somehow read if the WPD device has a mountpoint?
Sure the functional object indicates that it has one, but is it possible that there could be an indicational value which states that a mount point is available?
Check the device Ids, here's an example how they differ:
\\?\swd#wpdbusenum#_??_usbstor#disk&ven_usb&prod_flash_disk&rev_1100#aa04012700007404&0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}#{6ac27878-a6fa-4155-ba85-f98f491d4f33
vs.
USBSTOR\DISK&VEN_USB&PROD_FLASH_DISK&REV_1100\AA04012700007404&0
The upper one is the Id gathered from PortableDeviceManagerClass (first step to create an PortableDevice object), the lower one I've just read from the Device Manager, but it should be easily retrievable with one of these solutions:
How do I get a Unique Identifier for a Device within Windows 10 Universal?
https://sourceforge.net/projects/sharpdevelop/files/SharpUSBLib/