I use WinSCard to list all readers, which gives me a list like this:
ASK RDR4x7 0
SCM Microsystems Inc. SCR3320 USB Smart Card Reader 0
SCM Microsystems Inc. SCR3320 USB Smart Card Reader 1
SCM Microsystems Inc. SCR3320 USB Smart Card Reader 2
Which is great, but I have no clue which name belongs to which card reader.
Where do these names come from? How are they constructed?
What I've found up until now: in the registry, there is a HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services key. Under this key, you can find the subkey which matches the card reader's "service" (which I found by querying the WMI registry). For example: the service for the SCM Microsystems Inc. SCR3320 USB Smart Card Reader readers is SCR3XX2K.
This subkey (SCR3XX2K) has another subkey Enum, which has multiple interesting values:
Count: DWORD, the number of readers connected
0, 1, 2: STRING, hardware Device ID
I guess these are the numbers appended to the 'friendly names', but I can't figure out how the name string is constructed. I need this to map hardware Device ID's (which I get through WMI) to their friendly name.
So, what's the pattern used to create a 'friendly name' for a smart card reader, and where do the values come from?
They are a concatination of these 3 attributes:
SCARD_ATTR_VENDOR_NAME
SCARD_ATTR_VENDOR_IFD_TYPE
SCARD_ATTR_DEVICE_UNIT
The TechNet article Smart Card Events documents this in the "Smart Card reader name" section.
SCARD_??? attributes are requested with the SCardGetAttrib function.
The SCARD_ATTR_DEVICE_SYSTEM_NAME attribute returns the friendly name as the ones you get while listing the readers.
The list of SmartCard readers exists in the registry under HKLM\SOFTWARE\Microsoft\Cryptography\Calais\Readers. Readers are added to this list by the INF file of the SCR driver, so during driver installation.
A link between device and reader can be found in the SmartCardReader class {50DD5230-BA8A-11D1-BF5D-0000F805F530} under HKLM\SYSTEM\CurrentControlSet\Control\Class\{50DD5230-BA8A-11D1-BF5D-0000F805F530}.
Related
I have set of ZK attendance device that using static IP address. I'm enrolling users to this machines using zkmkeeper.dll in C#. now i want to delete old users from these machines using system. I can't find the function to delete users, but there is function to disable. I want to delete that users permanently from devices.
I had a similar issue when deleting userInfo or enrolled data but i found a workaround
objCZKEM.DeleteEnrollData(machineId, userId, machineId, 12)
according to the documentation :
12 indicates deleting the user (including the fingerprints, card number and password).
#Yuuuucef, thank you for reference. According to documentation
5.2.4.3 DeleteEnrollData
VARIANT_BOOL DeleteEnrollData(LONG dwMachineNumber, LONG dwEnrollNumber,
LONG dwEMachineNumber, LONG dwBackupNumber)
The values of dwMachineNumber and dwEMachineNumber must be the same
After trying many ways I have finally found a way. clear all user data using axCZKEM1.ClearData(Convert.ToInt32(number), flag) and re enroll the data using Database.
The way I found works for me.
Use the SSR_deleteEnrollData function with only 3 parameters (while notice asks for 4 parameters)
SSR_deleteEnrolData(dwMachineNumber , dwEnrollNumber , dwBackupNumber)
Maybe depends of device version.
When i run the following command after connecting PL2303 USB to serial converter to my ubuntu system:
dmesg | grep ttyUSB
i get:
usb 1-2: pl2303 converter now attached to ttyUSB0
then i run:
udevadm info -a -n /dev/ttyUSB0
i get:
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-2':
KERNELS=="1-2"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{authorized}=="1"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{bConfigurationValue}=="1"
ATTRS{bDeviceClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{bMaxPower}=="100mA"
ATTRS{bNumConfigurations}=="1"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bcdDevice}=="0400"
ATTRS{bmAttributes}=="80"
ATTRS{busnum}=="1"
ATTRS{configuration}==""
ATTRS{devnum}=="27"
ATTRS{devpath}=="2"
ATTRS{idProduct}=="2303"
ATTRS{idVendor}=="067b"
ATTRS{ltm_capable}=="no"
ATTRS{manufacturer}=="Prolific Technology Inc. "
ATTRS{maxchild}=="0"
ATTRS{product}=="USB-Serial Controller D"
ATTRS{quirks}=="0x0"
ATTRS{removable}=="removable"
ATTRS{speed}=="12"
ATTRS{urbnum}=="20"
ATTRS{version}==" 1.10"
But no
ATTRS{serial}
is found for the above PL2303 USB to serial converter.
Can anyone please tell me why? I get the serial attribute for all other USB devices
The datasheet for the PL2303 serial converter chip includes a description of the EEPROM configuration data for the chip on page 11.
The EEPROM can specify the USB product and vendor IDs for the chip, so instead of using the generic USB-to-serial converter ID, someone using this chip in their products can use an ID that is specific to their product, allowing for seamless auto-detection and use of the product-specific driver, if desired. One would expect that the serial number might also be stored in that EEPROM. But there is no place for a serial number in the EEPROM data layout.
In fact, the entire datasheet does not document any way to retrieve an unique serial number from this serial converter at all. So I must conclude that this serial converter chip series simply does not have unique serial numbers, at least not in its earlier chip revisions (the datasheet is from year 2005).
I have a serial device connected via Bluetooth. It shows up nicely on COM4. I can communicate with it without a problem.
I want to make it simpler for the user to locate (ideally, I'll auto-detect it), so I want to find it by name. In the "Devices and Printers" list, I get a valid name, which is perfect. However, I can't seem to find that value programatically. I've tried a ton of stuff using the "ManagementObjectSearcher" class, including listing out all the Properties and SystemProperties, but no values match the name displayed in "Devices and Printers".
If I look in the "Device Manager" list, it just shows "Standard Serial over Bluetooth link (COM4)", which is not useful for identifying it, obviously.
So how the heck to I get the displayed name in the "Devices and Printers" list?
is this what you're looking for?
http://msdn.microsoft.com/en-us/library/system.drawing.printing.printersettings.installedprinters(v=vs.110).aspx
So, I found a solution. I grabbed the library from these guys:
http://32feet.codeplex.com/
Using that library, added these 2 lines:
BluetoothClient client = new BluetoothClient();
BluetoothDeviceInfo[] devices = client.DiscoverDevices();
That gave me the device "DeviceName" (the name I was after) and "DeviceAddress" (a chunk of the device id, basically).
I then queried the system using the "ManagementObjectSearcher", which gave me a list of COM ports and device IDs (System.Management namespace).
ConnectionOptions options = ProcessConnection.ProcessConnectionOptions();
ManagementScope connectionScope = ProcessConnection.ConnectionScope(Environment.MachineName, options, #"\root\CIMV2");
ObjectQuery objectQuery = new ObjectQuery("SELECT * FROM Win32_PnPEntity");
ManagementObjectSearcher comPortSearcher = new ManagementObjectSearcher(connectionScope, objectQuery);
...etc as I looped over the results, pulled out the COM ports, and so on
I mapped the device IDs from the "ManagementObject" values back to the "devices" list, merged the results, and ended up with something that had the name, device id, a flag indicating if it was a bluetooth device, and the "human readable" name from the bluetooth device, if it existed.
Painful, but it works fairly well. It's slow (client.DiscoverDevices() takes awhile), but that's survivable in my case.
I want to use C# to retrieve the USB headset devices connected to PC. I tried the below solutions but didn't work:
Solution 1:
How to enumerate audio out devices in c#
I tried this but the device name appears as "(Generic USB Audio)" and not the actual name.
Solution 2:
How to get the default audio device?
Solution 3:
Detecting Audio Input & output devices connected to system
Solution 2 and Solution 3 gave me the below result:
The device name is truncated to 31 characters.
Eg: "Microphone (Sennheiser VOICE 689"
****Question: Is there any way I can get the complete name of the device?****
If you know it's an USB audio device, and assuming the driver is correctly written for the device, you could do:
foreach (ManagementObject drive in
new ManagementObjectSearcher(
"select Name from Win32_USBDevice where Service='usbaudio'").Get())
{
{
string s = drive["Name"].ToString();
// Continue
}
}
Addition
You're only getting 31 characters (technically 32) because the PInvoke to the native .DLLs use a char[32], so it can't return more than that; you won't get what you need from solution 1 & 2.
Also, I don't know why you can't use Win32_USBDevice, as I'm also using Win7 x64 and I'm having no problems. This link might help you.
Possible Alternate
You might be able to use the Win32_PnPEntity class:
foreach (ManagementObject drive in
new ManagementObjectSearcher(
"select Name from Win32_PnPEntity where Service='usbaudio'").Get())
{
{
string s = drive["Name"].ToString();
// Continue. Can look at Description, Caption, etc. too
}
}
I have coding I almost always use with my Omnikey RFID CardMan 5321 smart cards. Problem is we received new cards today which are marked "HID iCLASS GL" which do not appear to be working well with our coding.
Without going through the whole source, our problem is arising when we are calling the following line, which basically tells us the length of the data:
lResult = SCardTransmit(hCard, 0, bytCommand, lLen, 0, byReadBuffer, iReturnlength)
We are returning only a length of 2, which the data is marked as "x69 x86". Even if I tell it to read all 255 chr's the rest are just marked as null.
Now I know our reader can read these cards since the OMNIKEY Diagnostic tool is showing us the following:
Status: Smart Card Inserted
FW: 5.10
Port: USB
Lib: 1.0
Smart Card Nme: iCLASS 32KS 8x2+16
ART: Valid
Protocol: ISO 15693 (Part 2)
PICCtoPCD: 26,48 kbps
PCDtoPICC: 26,48 kbps
Frequ: 13.56 MHz
As I explained before, everything is working fine in my coding except no data is being returned for my card besides "x69 x86", which is surely not correct.
If anyone has any experience reading from a HID iCLASS card, I would greatly appreciate some feedback on how to. Even if we have to license software, that is ok.
Thanks in advance!
in case you are trying to access physical access data, I would thoroughly check the crypto protocol between reader and host first and also meke sure you are using a reader with teh latest firmware (5.20 for the OMNIKEY 5321).
I would also introduce code to check the card system withour secure communication channel between host and reader application.
Further references:
http://www.hidglobal.com/documents/ok_contactless_developer_guide_an_en.pdf
The reason cause you get a 2 Byte array is cause your command runs on an error so the chip returns only SW1 and SW2 Flag
in your case it's meaning is
x69 --> Command not allowed (further qualification in SW2, see table 17)
x86 --> Command not allowed (no current EF)
So you might proof that your application file on the chip is correctly selected
further information #
http://www.cardwerk.com/smartcards/smartcard_standard_ISO7816-4_5_basic_organizations.aspx#table17