Finding Keyspan Twin serial ports, and only those and not the internal modem
Finding Keyspan Twin serial ports, and only those and not the internal modem
- Subject: Finding Keyspan Twin serial ports, and only those and not the internal modem
- From: "email@hidden" <email@hidden>
- Date: Wed, 26 Mar 2003 17:44:44 +0100
I'm using a twin serial Keyspan adapter. I'd like to check whether the
device is connected specifying the kUSBVendorID and kUSBProductID and
using one of Apple's examples.
I only want to see the information about the Keyspan. But whatever I do
it will always start with the /dev/cu.modem path and then
/dev/cu.USA28X11P1.1 and then /dev/cu.USA28X11P2.2.
Adding the dictionary values don't seem to have any effect. What should
I do?
Thanks,
Karel
code snippet:
CFDictionarySetValue( classesToMatch, CFSTR(kIOSerialBSDTypeKey),
CFSTR(kIOSerialBSDAllTypes));
#define KeySpan 1741 long usbVendor = KeySpan;
CFDictionarySetValue( classesToMatch, CFSTR(kUSBVendorID),
CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &usbVendor));
#define TwinSerialPort 275 long usbProduct = TwinSerialPort;
CFDictionarySetValue( classesToMatch, CFSTR(kUSBProductID),
CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &usbProduct));
}
kernResult = IOServiceGetMatchingServices( *masterPort, classesToMatch,
matchingServices);
and then calling MyGetPathOfFirstModem()
...
while (modemService = IOIteratorNext(serialPortIterator))
{
CFTypeRef modemNameAsCFString;
CFTypeRef deviceFilePathAsCFString;
modemNameAsCFString = IORegistryEntryCreateCFProperty ( modemService,
CFSTR(kIOTTYDeviceKey), kCFAllocatorDefault, 0);
if (modemNameAsCFString)
{
char modemName[128]; // Local scope since we're just printing name
for convenience.
//modemFound = true;// Found modem; now look for name.
gotString = CFStringGetCString( modemNameAsCFString, modemName,
sizeof(modemName), kCFStringEncodingASCII);
CFRelease(modemNameAsCFString);
if (gotString)
printf("Serial Stream name: %s\n", modemName);
// Now look for path to modem device file.
deviceFilePathAsCFString = IORegistryEntryCreateCFProperty (
modemService, CFSTR(kIOCalloutDeviceKey), kCFAllocatorDefault, 0);
*deviceFilePath = '\0';
if (deviceFilePathAsCFString)
{
gotString = CFStringGetCString( deviceFilePathAsCFString,
deviceFilePath, maxPathSize, kCFStringEncodingASCII);
CFRelease(deviceFilePathAsCFString);
if (gotString)
{
printf("Device file path: %s\n", deviceFilePath);
kernResult = KERN_SUCCESS;
}
.....
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.