USB driver bus relation (virtual Port number) - usb

I want to get the virtual port number of usb driver. This property can be found in device manager name as bus relation or children.
if (SetupDiGetDeviceRegistryProperty(devInfo,
&devInfoData,
SPDRP_ADDRESS,
NULL,
(PBYTE)&dwAddr, //szName,
sizeof(dwAddr),
NULL))
{
int len=_stprintf( szBuf2,TEXT("\n%d"), dwAddr);
Can anybody guide.

If your on Windows Mobile or Windows CE, you should find the active driver in HKEY_LOCAL_MACHINE\drivers\active. Enumerate down the active drivers till you find the USB driver by "Key" and the name of the driver should be its port name, i.e. USB1 or COM8 etc.

Related

How to use symlinked cdc-wdm device with ModemManager?

We have created udev rules to make the device naming consistent for the cdc-wdm devices, no matter in what order our lte usb devices are registered at the usb bus. We had the issue that we could not rename the cdc-wdm devices, which I understand is some limitiation of the usbmisc driver. So we ended up creating symlinks
ACTION!="add|change", GOTO="mm_naming_rules_end"
# only rename the interfaces if the names are wrong
SUBSYSTEM=="usbmisc", ACTION=="add", KERNELS=="1-1.1.2", KERNEL=="cdc-wdm*", SYMLINK+="cdc-lte0"
SUBSYSTEM=="usbmisc", ACTION=="add", KERNELS=="1-1.1.4", KERNEL=="cdc-wdm*", SYMLINK+="cdc-lte1"
LABEL="mm_naming_rules_end"
But ModemManager does not recoqnize those devices when we use that in our nmconnection file
[connection]
id=wwan0
uuid=280d17ff-f4d4-4f47-a6e6-75ba32bc57c2
type=gsm
interface-name=cdc-lte0
permissions=
[gsm]
#apn=internet
[ipv4]
dns-search=
method=auto
[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=auto
[proxy]

DeviceInformation.FindAllAsync(SerialDevice.GetDeviceSelector()) Portname is empty

I am trying to get the Portname of some working USB-to-Serial adapters connected to a Windows IoT RPi unit. I am still able to open and I am getting an instantiated serialDevice that works. I am able to send and receive data on the port but the PortName object is showing "" so I have no idea if its COM1 or COM2 etc. This would not be a problem except that I am connecting multiple adapters and need a way to identify the adapter uniquely. Anyone else seeing this?
The code I am using to query and open the ports is:
Dim dis = Await DeviceInformation.FindAllAsync(SerialDevice.GetDeviceSelector())
Dim Count As Integer = 0
Do Until Count = dis.Count
Debug.WriteLine("UART Port: " & dis(Count).Name & ", " & dis(Count).Id)
If dis(Count).Id.Contains("FTDI") Or dis(Count).Id.Contains("FT232") Then
serialPort = Await SerialDevice.FromIdAsync(dis(Count).Id)
End If
Count += 1
Loop
You can get a valid SerialDevice.PortName on Desktop but not on Windows IoT Core device. Assigning a COM number to a serial device need system-supplied function driver like Serial.sys etc. But these drivers not provided on Windows IoT Core device. You can check it under C:\Windows\System32\drivers path.
To identify multiple devices, there is a workaround that using VID(vendor ID) and PID(product ID). They are considered unique.
So instead of SerialDevice.GetDeviceSelector() you can use SerialDevice.GetDeviceSelectorFromUsbVidPid(vid, pid). You can find VID and PID in DeviceInformation.Id. It will like this:
\\?\USB#VID_10C4&PID_EA60#0001#{86e0d1e0-8089-11d0-9ce4-08003e301f73}

Vulkan physical device

I'm learning Vulkan by API spec (http://vulkan-spec-chunked.ahcox.com/ch02s09.html), and I'm little confused about how physical devices are in Vulkan. I do have only one intel physical video card device, but vkEnumeratePhysicalDevices returns count of 2. The devices are identical, but the queue flags seems differ, and the queue flags are undocumented (actually they are, but only to flag 8, in second queue I do have the flag values 16 and 32).
typedef enum VkQueueFlagBits {
VK_QUEUE_GRAPHICS_BIT = 0x00000001,
VK_QUEUE_COMPUTE_BIT = 0x00000002,
VK_QUEUE_TRANSFER_BIT = 0x00000004,
VK_QUEUE_SPARSE_BINDING_BIT = 0x00000008,
} VkQueueFlagBits;
here is the output of my vulkan code:
GPU count: 2 ( physical devices )
Physical Device 0:
Device API version: 1.0.42 - 4194346
Device Vendor Id: 0x8086
Device Id: 1916
Device Driver version: 0.0.1 - 1
Device type: 1
Device Name: Intel(R) HD Graphics 520 (Skylake GT2)
Device Pipeline UID: f557cfd4
Queue Properties:
Flags: 7
Count: 1
ts Valid Bits: 24
Physical Device 1:
Device API version: 1.0.42 - 4194346
Device Vendor Id: 0x8086
Device Id: 1916
Device Driver version: 0.0.1 - 1
Device type: 1
Device Name: Intel(R) HD Graphics 520 (Skylake GT2)
Device Pipeline UID: f557cfd4
Queue Properties:
Flags: 49
Count: 0
ts Valid Bits: 1
Someone can help me understand why there is 2 physical devices for the same real device and the missing flags ?
The count=0 of the second device is curious. More seriously, its flags and tsVB values are corrupted (49 is not an valid value for flags and 1 not valid for tsVB).
This pretty much boils down to there being one extraneous *.json file on your system.
These *.json files store informations about ICDs present on the machine. They are stored in standard location(s).
vkEnumeratePhysicalDevices+vkGetPhysicalDeviceProperties are relatively dumb commands doing nothing much else than reading said *.json file(s) and returning its contents. I think though that calling something "real" like vkCreateDevice would not work on the badly installed driver.
What exactly happened to creare this problem is up to your curiosity to explore. For starters I believe on Linux distros there is a command to map a file to its originating package. It will probably be something about bad cleanup of previous driver, or possibly bug in the installation script of the new one. At least one person had this problem before.
Based on what I explained here, I believe this is relatively benign bug. The first device should work just fine. And you can just ignore the second one. Or simply delete its *.json manifest to prevent it from showing up in vkEnumeratePD.

using gammu and a DKU2 cable to write a vCard to a nokia 6303i classic

I am trying out gammu for the 1st time because I want to transfer some google contacts back to a nokia 6303i .
While the phone database section in Gammu website states that a number of bluetooth connection settings can be used with this phone, I have no bluetooth connection and will thus have to resort to a DKU2 usb cable that I have. The cable is actually a CA-101 nokia cable but according to gnokii wiki they are technically the same.
I have attempted several different connection types. from the ~/.gammurc
[gammu]
#model = NAUTO
device = 01a5:-1
connection = dku2
synchronizetime = yes
logfile = gammu0.log
logformat = text
use_locking =
gammuloc =
[gammu1]
device = /dev/ttyACM0
connection = at
synchronizetime = yes
logfile = gammu1.log
logformat = text
use_locking =
gammuloc =
[gammu2]
#model = NAUTO
device = /dev/ttyACM0
connection = fbus
synchronizetime = yes
logfile = gammu2.log
logformat = text
use_locking =
gammuloc =
[gammu3]
#model = NAUTO
device = 01a5:-1
connection = fbususb
synchronizetime = yes
logfile = gammu2.log
logformat = text
use_locking =
gammuloc =
I have managed to use the "at" connection with gammu -s 1 identify and correctly read phone info. Then I tried to copy a simple (albeit non gammu generated) vCard from those I exported from google contacts.
It was typically formatted like so:
BEGIN:VCARD
VERSION:2.1
FN:Name Surname
N:Surname;Name
EMAIL;CHARSET=UTF-8;ENCODING=8BIT:name.surname#domain.com
TEL;TYPE=CELL:+10123456789
TEL;TYPE=CELL:+19876543210
END:VCARD
What is frustrating is that from a Windows Pc running nokia PC suite I was able to correctly send that same vCard to the nokia 6303i over the same cable.
However from gammu I have -at most- been able to send the surname from the "N:Surname;Name;;;" field (the contact only shows up with the surname) and the 1st telephone number. So the email and the 2nd phone number have been omitted.
This is not enough for me , because I need all phones, all emails and notes to be transferred. I have not found any information abotu whether the "at" connection supports the "enhancedphonebook" functionality (it appears that it does not), but I apart from "bluefbus" which supposedly supported the "enhancedphonebook" in the "Nokia 6303i Cliassic" I don't know which other cabled connection supports it.
so I have tried
the variations gammu(0) , gammu2 and gammu3 as seen in the config file
but these two do not work.
The gammu and gammu3 dump the following in the log
[Gammu - 1.31.0 built 12:51:10 Jul 24 2016 using GCC 4.7]
[Connection - "dku2"] #or "fbususb for gammu3
[Connection index - 0]
[Model type - ""]
[Device - "01a5:-1"]
[Running on - Linux, kernel 3.2.29-gaze5 (#1 SMP Sat Apr 20 13:57:31 EEST 2013)]
Checking 1d6b:0002 (bus 1, device 1)
Checking 1d6b:0002 (bus 2, device 1)
Checking 1d6b:0001 (bus 3, device 1)
Checking 1d6b:0001 (bus 4, device 1)
Checking 1d6b:0001 (bus 5, device 1)
Checking 1d6b:0001 (bus 6, device 1)
Checking 1d6b:0001 (bus 7, device 1)
Checking 0421:0359 (bus 7, device 35)
Extra CDC subheader: 171
Trying to open device, config=1, c_iface=2, c_alt=0, d_iface=3, d_alt=1
Configuration change not required, unhooking only required interfaces!
Detaching kernel driver from inteface 2
Claiming USB control interface...
Configuring USB control interface...
Claiming USB data interface...
Configuring USB data interface...
Connected!
[Module - "auto"]
Getting model
SENDING frametype 0xD1/length 0x05/5
00 |01 |00 |03 |00 .....
Failed to read from usb (-99)!
Other error
Failed to read from usb (-99)!
Other error
Failed to read from usb (-99)!
Other error
and gammu2
[Gammu - 1.31.0 built 12:51:10 Jul 24 2016 using GCC 4.7]
[Connection - "fbus"]
[Connection index - 0]
[Model type - ""]
[Device - "/dev/ttyACM0"]
[Running on - Linux, kernel 3.2.29-gaze5 (#1 SMP Sat Apr 20 13:57:31 EEST 2013)]
Setting speed to 115200
Serial device: DTR is up, RTS is down, CAR is down, CTS is up
(... and it gets stuck here)
So the main question is: how can I achieve transferring the vCard (and many others) to the phone, over a usb cable???????
Thank you

SoftLayer API How to get uplink port speed value from SoftLayer_Virtual_Guest and SoftLayer_Hardware

For the provisioned SoftLayer virtual Server, and Bare metal servers.
Which attribute/method from SoftLayer_Virtual_Guest and SoftLayer_Hardware
can return the uplink port speed value of the device?
Thanks.
You can try getting the items in the billing item of the device and look for port speed value.
These RestFul will return the items
https://api.softlayer.com/rest/v3.1/SoftLayer_Hardware_Server/$HardwareID/getObject?objectMask=mask[billingItem[children[item]]]
Method GET
https://api.softlayer.com/rest/v3.1/SoftLayer_Virtual_Guest/$VSIID/getObject?objectMask=mask[billingItem[children[item]]]
Method GET
Note: Replace $HardwareID and $VSIID with the ID of the hardware or VSI you wish to see the items
Regards
To get items from a Virtual Guest/Hardware already provisioned, you can use the following GET requests:
* Virtual Guest:
https://[username]:[apikey]#api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/[vsi_id]/getObject?objectMask=mask[id,fullyQualifiedDomainName,billingItem[id,orderItem[id,description,order[id,items]]]]
* Hardware:
https://[username]:[apikey]#api.softlayer.com/rest/v3/SoftLayer_Hardware/[hardware_id]/getObject?objectMask=mask[id,fullyQualifiedDomainName,billingItem[id,orderItem[id,description,order[id,items]]]]