I have an application for Motorola MC9500 series that uses the device camera.
I use the following method to init the Imager:
Symbol.Generic.Device MyDevice;
int i = 0;
if (imager == null)
{
MyDevice = (Symbol.Generic.Device)Symbol.Imaging.Device.AvailableDevices.GetValue(0);
for (i = 1; MyDevice != null; i++)
{
if (MyDevice.FriendlyName.Equals("Image Capture Driver for Color Camera"))
break;
MyDevice = (Symbol.Generic.Device)Symbol.Imaging.Device.AvailableDevices.GetValue(i);
}
if (MyDevice == null)
{
MessageBox.Show("Camera não foi encontrada.");
this.Close();
return;
}
imager = new Symbol.Imaging.Imager(MyDevice);
}
It works fine on WM6.1 but not on WM6.5, where the last line throws the following exception:
Failed to create Imager: IMAGE_Open failed: E_IMG_INVALIDDEVICE
According to the manufacturer documentation, this means: "The physical device driver (PDD). DLL did not contain the required entry points.". However, I have all the drivers up-to-date. They can be found on: http://support.symbol.com/support/search.do?cmd=displayKC&docType=kc&externalId=12683&sliceId=&dialogID=469856149&stateId=1%200%20469852171
When I'm running the program, I have no other tasks running, since I thought this could be due to another process locking the camera to itself.
Relevant fact is that the camera doesn't seem to work/start in any other application that uses it. However, they seem to work on my client's device (also WM6.5, same device).
Anyone got any suggestion or idea of why this happens, or how to solve it?
I had the same problem, but mine was caused because I also had a Barcode scanner active, disabling the Barcode scanner fixed this for me.
barcode2.Disable()
You have to download and install a CAB to enable second source camera from motorola site (SPR23173).
I had this problem with a Motorola MC75A. Turns out it was the Datawedge application that was also installed on the device that was stopping it from working correctly. The camera and the barcode scanner appear to be kind of linked. You can only use one at once and as the DataWedge was already running, my code/project was producing the IMAGE_Open failed: E_IMG_INVALIDDEVICE. Simply going into DataWedge and stopping the process fixed this instantly.
Related
I'm working in Chrome for MacOS (108.0.5359.124) and Microsoft Edge (107.0.1418.62) on MacOS 12.6.1 (though confirmed the same issue on 13.0.1 as well), and the reset() method of WebUSB does not seem to work - I get no error on the console, but the device also doesn't see the reset.
Meanwhile, the same code does generate a USB reset in Chrome on Linux (same version, 108.0.5359.124, under Ubuntu 18.04 with kernel 5.4.0).
The code is here:
const connectButton = document.getElementById("connect");
const resetButton = document.getElementById("reset");
let device;
connectButton.onclick = async () => {
device = await navigator.usb.requestDevice({
filters: []
});
await device.open();
console.log("open:", device);
await device.selectConfiguration(1);
console.log("select config 1:", device);
await device.claimInterface(0);
console.log("claim interface 0:", device);
};
resetButton.onclick = async () => {
console.log("Device before reset: ", device);
await device.reset();
console.log("Device after reset:", device);
}
I see all the console logging, and no errors are thrown. (If I try to claim one of the HID interfaces on this device, I do get errors - but I believe that's expected). I've also tried without the device.selectConfiguration() and device.claimInterface() calls - exactly the same behavior (ie, no errors, but it doesn't work).
Is there something under MacOS preventing it from sending the reset? I can get similar code working on MacOS under node.js using WebUSB calls, but I suspect it's actually using libusb under the hood... I should say that the device in question has firmware written in Zephyr 3.0 (I wrote a substantial part of it). I haven't gotten resets to work with other devices either, though.
According to https://bugs.chromium.org/p/chromium/issues/detail?id=1189418, it seems like USBDevice.reset() does not work properly on macOS.
Even though a patch was submitted to fix this behaviour, it was reverted due to an expected libusb issue: https://chromium-review.googlesource.com/c/chromium/src/+/2936179
I've pinged the Chromium team at https://bugs.chromium.org/p/chromium/issues/detail?id=1189418#c15. We may want to follow up there.
I am building an iOS app with Xamarin and MvvmCross the required the use of Bluetooth LE. I am trying to use this plugin:
https://github.com/aritchie/bluetoothle
Here is my code:
var server = CrossBleAdapter.Current.CreateGattServer();
await server.Start(new AdvertisementData()); // throws exception
It throws an exception when trying to start the server:
{System.ArgumentException: Invalid State - Unknown at
Plugin.BluetoothLE.Server.GattServer.Start
(Plugin.BluetoothLE.Server.AdvertisementData adData) [0x0005f] in
<4281c4bd57f24525b20baae1afdf610b>:0
Apparently this plugin is easy to use so I must be missing something obvious?
That Exception indicates that the hardware is in invalid or initializing state and can be seen here: https://github.com/aritchie/bluetoothle/blob/master/Plugin.BluetoothLE.Apple.Shared/Server/GattServer.cs#L74
if (this.manager.State != CBPeripheralManagerState.PoweredOn)
throw new ArgumentException("Invalid State - " + this.manager.State);
I believe this is a bug in the code as it does not wait for the delegate to signal that the State has changed.
I found a solution. Instead of placing the code in my Core project, I placed it inside the iOS project itself, in a ViewDidAppear function, and placed a global variable in my UIViewController class:
private IGattServer server = CrossBleAdapter.Current.CreateGattServer();
I think you need to access the adapter with the appropriate thread, or at the appropriate time (after other initialization), hence why it was crashing before. I couldn't find an appropriate place to put this in my Core project, so I'm not sure if I have to put this code in each platform. Anyhow here's a solution for anyone else with this problem.
I can not find how to start WPS client in Windows 10 from command prompt or powershell. When I used Linux, everything was really ease with wla_supplicant (wpa_cli wps_pbc). Is there something similar in Windows?
Does anyone know how to set up Wi-Fi network (over WPS) key without human input in Windows?
I also tried WCN (Windows Connect Now) from Microsoft as it implements WPS features. I got also samples from Windows SDK on WCN, but they could not get key by WPS (it faild). But if I use Windows user interface to connect wiothout PIN, everyting seems to be pretty fine.
I am sure that there is possibility to do that, it is very important to perform Wifi Protected Setup by button start from the command prompt or app (C++/C#) without human intrusion or input (once WPS is on air, Windows should automatically get the network key and connect then).
I don't know if it's too late to answer, just put what I know in here and hope it can help.
First, if your system has updated to 16299(Fall Creator Update), you can just simply use new wifi api from UWP.
Install newest Windows SDK, create a C# console project, target C# version to at least 7.1, then add two reference to the project.
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETCore\v4.5\System.Runtime.WindowsRuntime.dll
C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.16299.0\Windows.winmd
After all of that , code in below should work.
using System;
using System.Threading.Tasks;
using Windows.Devices.Enumeration;
using Windows.Devices.WiFi;
class Program
{
static async Task Main(string[] args)
{
var dic = await DeviceInformation.FindAllAsync(WiFiAdapter.GetDeviceSelector());
if (dic.Count > 0)
{
var adapter = await WiFiAdapter.FromIdAsync(dic[0].Id);
foreach (var an in adapter.NetworkReport.AvailableNetworks)
{
if (an.Ssid == "Ssid which you want to connect to.")
{
// Fouth parameter which is ssid can not be set to null even if we provided
// first one, or an exception will be thrown.
await adapter.ConnectAsync(an, WiFiReconnectionKind.Manual, null, "",
WiFiConnectionMethod.WpsPushButton);
}
}
}
}
}
Build and run the exe, then push your router's button, your pc will be connect to the router.
But if you can not update to 16299, WCN will be your only choice. You may already notice that if call IWCNDevic::Connect frist with push-button method, the WSC(Wifi Simple Configuration) session will fail. That's because WNC would not start a push-button session as a enrollee, but only as a registrar. That means you have to ensure that router's button has been pushed before you call IWCNDevic::Connect. The way to do that is using Native Wifi api to scan your router repeatedly, analyse the newest WSC information element from the scan result, confirm that Selected Registrar attribute has been set to true and Device Password Id attribute has been set to 4. After that, query the IWCNDevice and call Connect function will succeed. Then you can call IWCNDevice::GetNetworkProfile to get a profile that can use to connect to the router. Because it's too much of code, I will only list the main wifi api that will be used.
WlanEnuminterfaces: Use to get a available wifi interface.
WlanRegisterNotification: Use to register a callback to handle scan an connect results.
WlanScan: Use to scan a specified wifi BSS.
WlanGetNetworkBsslist: Use to get newest BSS information after scan.
WlanSetProfile: Use to save profile for a BSS.
WlanConnect: Use to connect to a BSS.
And about the WSC information element and it's attributes, you can find all the information from Wi-Fi Simple Configuration Technical Specification v2.0.5.
For Krisz. About timeout.
You can't cast IAsyncOperation to Task directly. The right way to do that is using AsTask method. And also, you should cancel ConnectAsync after timeout.
Sample code:
var t = adapter.ConnectAsync(an, WiFiReconnectionKind.Manual, null, "",
WiFiConnectionMethod.WpsPushButton).AsTask();
if (!t.Wait(10000))
t.AsAsyncOperation().Cancel();
Is there any way to remove a record from Launch Services database which was added using LSRegisterURL?
I have several apps that can open the same URL and I want to manage which one of them should open it. Unfortunately now I face a problem that at some point LSRegisterURL stop working. E.g. it works until some point, then, I guess, Launch Services database (or cache) gets overflown and subsequent calls to LSRegisterURL don't have any effect.
So my idea is to clean up Launch Services database by removing old records, but I can't find any related function.
I came across a private API in LaunchServices today that appears to do the trick. It seems to work on Mac OS X 10.7 thru 10.11. I've barely tested it yet, so YMMV:
extern void _LSUnregisterURL(CFURLRef url) __attribute__((weak_import));
- (void) unregisterAppAtURL:(NSURL *)appURL
{
if( _LSUnregisterURL != NULL )
{
CFURLRef urlRef = (__bridge CFURLRef)appURL;
if( urlRef )
{
_LSUnregisterURL( urlRef );
}
}
}
There are several other private API's similar to this (which you can find by using nm). Keep in mind that if you go private, you can't submit to the App Store. Hope that helps someone.
As it comes from the further tests OS X frees the Launch Services database itself. The exact algorithm is not clear, but rebooting Mac in most cases helps to remove the records to the missed applications and/or make the app specified by the most recent call to LSRegisterURL to become the default one.
We recently added Windows Filtering Platform capabilities to our driver.
We managed to get the information we required from the wfp with no problem, but the problem is during the boot process - eversince we added the wfp capabilities, machines using the driver cannot boot - they get a deadlock (the computer's "stuck" in the splash screen).
We figured its probably because our driver is dependent only on FltMgr and is probably loaded before the wfp framework is loaded (TcpStack?).
My question is - is there a way to ask the Service Manager or any other authority whether or not the wfp framework is loaded? or even further - what is the drivers wfp is dependent on? (so I could check if they are loaded before starting using it)
Here is what I do in DriverEntry.
//
// Wait for the WFP engine to be ready.
//
FWPM_SERVICE_STATE bfeState;
bfeState = FwpmBfeStateGet0();
if (bfeState != FWPM_SERVICE_RUNNING)
{
WaitTime.QuadPart = (-5000000); // wait 500000us (500ms) relative
do {
KeDelayExecutionThread (KernelMode, FALSE, &WaitTime);
bfeState = FwpmBfeStateGet0();
WaitCycles--;
} while (bfeState != FWPM_SERVICE_RUNNING && WaitCycles > 0);
}
if (bfeState != FWPM_SERVICE_RUNNING)
{
// log and error handling
}