Post

Replies

Boosts

Views

Activity

Reply to How do I use IOUserSCSIPeripheralDeviceType00?
Splendid! Thank you Kevin, thank you for pointing out my spelling mistake. Also, thanks for the extra information about matching. It looks like some IOService subclasses copy properties from their providers to themselves, presumably to facilitate matching - is that so? When you say "DriverKit handles this differently", what do you mean? In a kext, I can crawl down the provider chain to the root, inspecting properties as I go. That doesn't seem possible with DriverKit, which (by design) severely limits access from a dext to its associated objects (at least, those that lie outside its own address space).
Sep ’25
Reply to AudioQueue Output fails playing audio almost immediately?
instead of sleeping for 10 (what? seconds?) try running a runloop for a while: CFRunLoopRunInMode(kCFRunLoopDefaultMode, 10, false); It gets a bit tedious during development if you always have to wait until your program is done (even if it isn't working), so you can set up a runloop dispatch source before hand. Hitting any key then return should exit your program. This example is Objective-C++, I'm sure you can adapt it to C, or just make your main file a .mm file. dispatch_source_t source = dispatch_source_create( DISPATCH_SOURCE_TYPE_READ, // dispatch_source_type_t _Nonnull type, STDIN_FILENO, // uintptr_t handle, 0, // uintptr_t mask, (unused) DISPATCH_TARGET_QUEUE_DEFAULT); dispatch_source_set_event_handler(source, ^{ std::cout << "exiting\n"; exit(0); }); dispatch_activate(source); do { CFRunLoopRunInMode(kCFRunLoopDefaultMode, 10, false); } while (true);
Topic: Media Technologies SubTopic: Audio Tags:
Sep ’25
Reply to Novice SwiftUI developer can't make network call
var banjo = URL(string: myString) is using this initializer for URL: init?(string: String) The ? after init means that it returns an optional URL. If it can't create a URL from your string, it will return nil. Your next line, let task = URLSession.shared.dataTask(with:banjo ) is using this function of URLSession: func dataTask(with url: URL) -> URLSessionDataTask which takes a URL, not an optional URL. You've got to decide what to do in your code if you get a nil in banjo. the simplest thing to do is use if let banjo = URL(string: myString) { // do stuff with banjo } else { // whatever you want to do if you've made a // string that can't be turned into a URL } if let binds a non-nil result from the URL initializer to banjo. It is fine to use let here because you're not going to alter banjo after you've created it.
Topic: Design SubTopic: General
Sep ’25
Reply to Novice SwiftUI developer can't make network call
"Statements are not allowed at the top level" occurs because you put the code into a file but didn't wrap it in a func. The line if let banjo = URL(string: ... etc is a statement, not a declaration. Swift wants you to be clear about when that statement should be executed. You can sprinkle declarations around your program more or less wherever you like, because (generally) a declaration just makes a thing exist as a named object in your program, and doesn't have side effects which may differ depending on order of instantiation. There is built-in documentation in Xcode. Window / Developer Documentation. Type URL into the search field, choose Swift as the language. You can also search on https://developer.apple.com/documentation/ . Click on the magnifying glass icon. The documentation for URL is surprisingly difficult to find on the web site, but it is here: https://developer.apple.com/documentation/foundation/url There is some more comprehensive documentation about using URLSession to download files here: https://developer.apple.com/documentation/foundation/downloading-files-from-websites To your question about the "shared task" - there isn't a shared task. What is shared is the URLSession. Read the documentation for URLSession. https://developer.apple.com/documentation/foundation/urlsession/ URLSession.shared returns a URLSession. You're making a request to the URLSession (a class, which is a collection of functions) to get its shared instance, which is a single URLSession object (a class instance, which is a collection of functions and state). https://developer.apple.com/documentation/foundation/urlsession/shared "For basic requests, the URLSession class provides a shared singleton session object that gives you a reasonable default behavior for creating tasks. Use the shared session to fetch the contents of a URL to memory with just a few lines of code." From that single URLSession object you are creating a dataTask with a URL called "banjo". https://developer.apple.com/documentation/foundation/urlsession/datatask(with:)-10dy7 The dataTask "Creates a task that retrieves the contents of the specified URL." But that task won't do anything until you tell it to, by calling resume() on it. Please, when you post code, wrap it in a code block, using the Code Block widget under the Reply box on this forum. Otherwise your code is difficult to read. You can post up to 7000 characters in a reply - it is easier for us to help you if you post a complete code snippet.
Topic: Design SubTopic: General
Sep ’25
Reply to Mac OS X App for collecting linear displacement of a sample
I've often used serial-to-USB converters connected to a Mac, and not had reliability problems with them. I like to use the Silabs CP2104. Silicon Labs have drivers for these for various platforms. Your code need to know the /dev name of the serial device, which you can derive by inspection in your case (just plug it in, install the driver, list /dev). To get things going, you can use a terminal emulator like CoolTerm. The Modbus RTU protocol is well described in the documentation you linked. If I were you, I'd make a command line tool written in Python which reads one displacement value from the voltmeter. I'd utilize that tool into my app's bundle and call it from there. Since I don't use Python very often and the problem is simple, I'd ask an LLM to write the program for me. you said although the instrument is displaying 0.000 volts, the data collected changes at each message I send to the instrument, proving me that Modbus RTU set up is not working. but what does the data you collected actually represent? (I didn't read the docs in enough depth to decode the hex data you show). It seems like you have nearly all the pieces you need already. Obviously you already have some form of interface to the voltmeter, you just have to replace the Modbusrtubusmaster you mentioned with your own code.
Topic: App & System Services SubTopic: Hardware Tags:
Sep ’25
Reply to Should UserSendCBD work on UAS interfaces?
I uploaded the requested IORegistryExplorer files. I also note a couple of other things: every time I re-attach the device, I get a new driver process and a new IOUserServer at the root of the IORegistry. Even if I delete the app the existing driver process keeps running, unless I kill it from Activity Monitor. Maybe there's something I'm not cleaning up properly, but I don't know what. when I eject the disk, there is a very perceptible delay between ejecting the volume and its associated - Data container. I use Finder/Settings and check the External Disks item in the Sidebar/Locations list. After I click the eject control next to the volume, I unplug the device as soon as it disappears from the sidebar, and very often see a notification about ejecting "volume - data" when it wasn't ready to be ejected. If I keep /Volumes open I can see that "Volume"'s icon disappears first, then "Volume - Data"'s icon. Is this a bug worth filing?
Topic: App & System Services SubTopic: Drivers Tags:
Sep ’25
Reply to Xcode Signing Fails: Provisioning Profile "doesn't match" com.apple.developer.driverkit.userclient-access entitlement
go to ~/Library/Developer/Xcode/UserData/Provisioning Profiles and use QuickLook to inspect the Xcode-generated .provisionprofile file for your app, to be sure that its com.apple.developer.driverkit.userclient-access claim is correct. in the meantime, you could set com.apple.developer.driverkit.allow-any-userclient-access to true in your driver.
Topic: App & System Services SubTopic: Drivers Tags:
Oct ’25
Reply to Xcode Signing Fails: Provisioning Profile "doesn't match" com.apple.developer.driverkit.userclient-access entitlement
are you developing for macOS or iPadOS, or both? com.apple.developer.driverkit.communicates-with-drivers is for iPadOS. It won't do any harm to set this to true in a macOS app, but you don't need it. When you say your driver "fails at runtime", there are various ways this can occur: it fails to load (perhaps due to an entitlement issue), your code fails to find the driver your code finds the driver, but fails to open a user client for it It sounds like you're failing at stage 2. Look in the system log for messages related to your driver's bundle ID. I like to plug in the device, then run log collect --last 1m and peruse the resulting log file in the Console app. Use IORegistryExplorer (part of the additional tools for Xcode) to look for your driver in the IORegistry. If it isn't there, IOServiceGetMatchingService won't find it. IOServiceGetMatchingService takes a matching dictionary as a parameter, but you said you are calling IOServiceGetMatchingService("DriverKitAcxxx") Did you mean IOServiceNameMatching, or IOServiceGetMatchingService and you are passing in a dictionary created with CreateNameMatchingDictionary? Or something else? If you're using a matching dictionary, compare its contents carefully with the properties of your driver. Not that the name of the service is not a property called "name" (or at least, IORegistryExplorer doesn't display it as such). I like to use IOServiceNameMatching with a unique name (i.e. in your case I'd choose "com.accusys.Acxxx.driver"). Then, in your driver's Start_Impl, before you call RegisterService, call SetName("com.accusys.Acxxx.driver"). This enables you to write a generic name for your driver's class like "driver", while having a unique name to look for the in IORegistry.
Topic: App & System Services SubTopic: Drivers Tags:
Oct ’25
Reply to How can I locate a UVC camera for PTZ control by AVCaptureDevice.unique_id
We parse the locationID out of the AVCaptureDevice.uniqueID and then find the IORegistry node with that locationID. Is there's a document declares how AVFoundation generate the unique_id for USB camera, no so I can assume this convert will always work? you can't Or is there's a way to send a PTZ control request to AVCaptureDevice? not that I know of. As far as I know, the only way is what you're doing. It looks that the unique_id provided is (locationID<<32|VendorID<<16|ProductID) as hex string, but I'm not sure if I can always assume this behavior won't change. Correct - it has changed in the past, it might change at any time in the future. Not all AVCaptureDevices are UVC, but they all have uniqueIDs. If you would like an API to clearly identify an AVCapture device in the IORegistry, please file a bug. I already did (in 2019, FB6146541)
Oct ’25
Reply to How do I use IOUserSCSIPeripheralDeviceType00?
Splendid! Thank you Kevin, thank you for pointing out my spelling mistake. Also, thanks for the extra information about matching. It looks like some IOService subclasses copy properties from their providers to themselves, presumably to facilitate matching - is that so? When you say "DriverKit handles this differently", what do you mean? In a kext, I can crawl down the provider chain to the root, inspecting properties as I go. That doesn't seem possible with DriverKit, which (by design) severely limits access from a dext to its associated objects (at least, those that lie outside its own address space).
Replies
Boosts
Views
Activity
Sep ’25
Reply to AudioQueue Output fails playing audio almost immediately?
instead of sleeping for 10 (what? seconds?) try running a runloop for a while: CFRunLoopRunInMode(kCFRunLoopDefaultMode, 10, false); It gets a bit tedious during development if you always have to wait until your program is done (even if it isn't working), so you can set up a runloop dispatch source before hand. Hitting any key then return should exit your program. This example is Objective-C++, I'm sure you can adapt it to C, or just make your main file a .mm file. dispatch_source_t source = dispatch_source_create( DISPATCH_SOURCE_TYPE_READ, // dispatch_source_type_t _Nonnull type, STDIN_FILENO, // uintptr_t handle, 0, // uintptr_t mask, (unused) DISPATCH_TARGET_QUEUE_DEFAULT); dispatch_source_set_event_handler(source, ^{ std::cout << "exiting\n"; exit(0); }); dispatch_activate(source); do { CFRunLoopRunInMode(kCFRunLoopDefaultMode, 10, false); } while (true);
Topic: Media Technologies SubTopic: Audio Tags:
Replies
Boosts
Views
Activity
Sep ’25
Reply to Novice SwiftUI developer can't make network call
var banjo = URL(string: myString) is using this initializer for URL: init?(string: String) The ? after init means that it returns an optional URL. If it can't create a URL from your string, it will return nil. Your next line, let task = URLSession.shared.dataTask(with:banjo ) is using this function of URLSession: func dataTask(with url: URL) -> URLSessionDataTask which takes a URL, not an optional URL. You've got to decide what to do in your code if you get a nil in banjo. the simplest thing to do is use if let banjo = URL(string: myString) { // do stuff with banjo } else { // whatever you want to do if you've made a // string that can't be turned into a URL } if let binds a non-nil result from the URL initializer to banjo. It is fine to use let here because you're not going to alter banjo after you've created it.
Topic: Design SubTopic: General
Replies
Boosts
Views
Activity
Sep ’25
Reply to Novice SwiftUI developer can't make network call
"Statements are not allowed at the top level" occurs because you put the code into a file but didn't wrap it in a func. The line if let banjo = URL(string: ... etc is a statement, not a declaration. Swift wants you to be clear about when that statement should be executed. You can sprinkle declarations around your program more or less wherever you like, because (generally) a declaration just makes a thing exist as a named object in your program, and doesn't have side effects which may differ depending on order of instantiation. There is built-in documentation in Xcode. Window / Developer Documentation. Type URL into the search field, choose Swift as the language. You can also search on https://developer.apple.com/documentation/ . Click on the magnifying glass icon. The documentation for URL is surprisingly difficult to find on the web site, but it is here: https://developer.apple.com/documentation/foundation/url There is some more comprehensive documentation about using URLSession to download files here: https://developer.apple.com/documentation/foundation/downloading-files-from-websites To your question about the "shared task" - there isn't a shared task. What is shared is the URLSession. Read the documentation for URLSession. https://developer.apple.com/documentation/foundation/urlsession/ URLSession.shared returns a URLSession. You're making a request to the URLSession (a class, which is a collection of functions) to get its shared instance, which is a single URLSession object (a class instance, which is a collection of functions and state). https://developer.apple.com/documentation/foundation/urlsession/shared "For basic requests, the URLSession class provides a shared singleton session object that gives you a reasonable default behavior for creating tasks. Use the shared session to fetch the contents of a URL to memory with just a few lines of code." From that single URLSession object you are creating a dataTask with a URL called "banjo". https://developer.apple.com/documentation/foundation/urlsession/datatask(with:)-10dy7 The dataTask "Creates a task that retrieves the contents of the specified URL." But that task won't do anything until you tell it to, by calling resume() on it. Please, when you post code, wrap it in a code block, using the Code Block widget under the Reply box on this forum. Otherwise your code is difficult to read. You can post up to 7000 characters in a reply - it is easier for us to help you if you post a complete code snippet.
Topic: Design SubTopic: General
Replies
Boosts
Views
Activity
Sep ’25
Reply to limitations of UserSendCDB in SCSIPeripheralsDriverKit?
Thank you once again Kevin! I filed a bug against the documentation: FB20379178 Now that I'm using uint8_t senseBuffer[20] = {0}; I run into a new problem. I started a new thread on it: https://developer.apple.com/forums/thread/802099
Topic: App & System Services SubTopic: Drivers Tags:
Replies
Boosts
Views
Activity
Sep ’25
Reply to Should UserSendCBD work on UAS interfaces?
Filed FB20382589
Topic: App & System Services SubTopic: Drivers Tags:
Replies
Boosts
Views
Activity
Sep ’25
Reply to Mac OS X App for collecting linear displacement of a sample
I've often used serial-to-USB converters connected to a Mac, and not had reliability problems with them. I like to use the Silabs CP2104. Silicon Labs have drivers for these for various platforms. Your code need to know the /dev name of the serial device, which you can derive by inspection in your case (just plug it in, install the driver, list /dev). To get things going, you can use a terminal emulator like CoolTerm. The Modbus RTU protocol is well described in the documentation you linked. If I were you, I'd make a command line tool written in Python which reads one displacement value from the voltmeter. I'd utilize that tool into my app's bundle and call it from there. Since I don't use Python very often and the problem is simple, I'd ask an LLM to write the program for me. you said although the instrument is displaying 0.000 volts, the data collected changes at each message I send to the instrument, proving me that Modbus RTU set up is not working. but what does the data you collected actually represent? (I didn't read the docs in enough depth to decode the hex data you show). It seems like you have nearly all the pieces you need already. Obviously you already have some form of interface to the voltmeter, you just have to replace the Modbusrtubusmaster you mentioned with your own code.
Topic: App & System Services SubTopic: Hardware Tags:
Replies
Boosts
Views
Activity
Sep ’25
Reply to Should UserSendCBD work on UAS interfaces?
I uploaded the requested IORegistryExplorer files. I also note a couple of other things: every time I re-attach the device, I get a new driver process and a new IOUserServer at the root of the IORegistry. Even if I delete the app the existing driver process keeps running, unless I kill it from Activity Monitor. Maybe there's something I'm not cleaning up properly, but I don't know what. when I eject the disk, there is a very perceptible delay between ejecting the volume and its associated - Data container. I use Finder/Settings and check the External Disks item in the Sidebar/Locations list. After I click the eject control next to the volume, I unplug the device as soon as it disappears from the sidebar, and very often see a notification about ejecting "volume - data" when it wasn't ready to be ejected. If I keep /Volumes open I can see that "Volume"'s icon disappears first, then "Volume - Data"'s icon. Is this a bug worth filing?
Topic: App & System Services SubTopic: Drivers Tags:
Replies
Boosts
Views
Activity
Sep ’25
Reply to Xcode Signing Fails: Provisioning Profile "doesn't match" com.apple.developer.driverkit.userclient-access entitlement
go to ~/Library/Developer/Xcode/UserData/Provisioning Profiles and use QuickLook to inspect the Xcode-generated .provisionprofile file for your app, to be sure that its com.apple.developer.driverkit.userclient-access claim is correct. in the meantime, you could set com.apple.developer.driverkit.allow-any-userclient-access to true in your driver.
Topic: App & System Services SubTopic: Drivers Tags:
Replies
Boosts
Views
Activity
Oct ’25
Reply to External GPS receiver
most of the information you're looking for is in the support article you linked to. You probably want to scroll down this page and follow the directions to apply to the MFi program. https://mfi.apple.com
Replies
Boosts
Views
Activity
Oct ’25
Reply to Xcode Signing Fails: Provisioning Profile "doesn't match" com.apple.developer.driverkit.userclient-access entitlement
are you developing for macOS or iPadOS, or both? com.apple.developer.driverkit.communicates-with-drivers is for iPadOS. It won't do any harm to set this to true in a macOS app, but you don't need it. When you say your driver "fails at runtime", there are various ways this can occur: it fails to load (perhaps due to an entitlement issue), your code fails to find the driver your code finds the driver, but fails to open a user client for it It sounds like you're failing at stage 2. Look in the system log for messages related to your driver's bundle ID. I like to plug in the device, then run log collect --last 1m and peruse the resulting log file in the Console app. Use IORegistryExplorer (part of the additional tools for Xcode) to look for your driver in the IORegistry. If it isn't there, IOServiceGetMatchingService won't find it. IOServiceGetMatchingService takes a matching dictionary as a parameter, but you said you are calling IOServiceGetMatchingService("DriverKitAcxxx") Did you mean IOServiceNameMatching, or IOServiceGetMatchingService and you are passing in a dictionary created with CreateNameMatchingDictionary? Or something else? If you're using a matching dictionary, compare its contents carefully with the properties of your driver. Not that the name of the service is not a property called "name" (or at least, IORegistryExplorer doesn't display it as such). I like to use IOServiceNameMatching with a unique name (i.e. in your case I'd choose "com.accusys.Acxxx.driver"). Then, in your driver's Start_Impl, before you call RegisterService, call SetName("com.accusys.Acxxx.driver"). This enables you to write a generic name for your driver's class like "driver", while having a unique name to look for the in IORegistry.
Topic: App & System Services SubTopic: Drivers Tags:
Replies
Boosts
Views
Activity
Oct ’25
Reply to Matter Media Playback Cluster
Hi David you can use the Feedback Assistant app on macOS, or https://feedbackassistant.apple.com to log a trackable bug, which you can assign to your self or your development team (if you are a member of one). That other link seems to be for anonymous user feedback.
Replies
Boosts
Views
Activity
Oct ’25
Reply to PCIDriverKit entitlements during development
Just to let you know, FB19449747 has been fixed, so there is now a development-only entitlement for PCI DriverKit. I was asked to follow up on FB19449747 after this was supposedly fixed, so I did. I can't see a DriverKit PCI Transport (development) entitlement in the list of available Capabilities.
Topic: Code Signing SubTopic: Entitlements Tags:
Replies
Boosts
Views
Activity
Oct ’25
Reply to Xcode Signing Fails: Provisioning Profile "doesn't match" com.apple.developer.driverkit.userclient-access entitlement
are you using IOServiceGetMatchingService("DriverKitAcxxx") as shorthand for let dict = IOServiceNameMatching("DriverKitAcxxx") service = IOServiceGetMatchingService(kIOMainPortDefault, dict) and did you call RegisterService from your driver code?
Topic: App & System Services SubTopic: Drivers Tags:
Replies
Boosts
Views
Activity
Oct ’25
Reply to How can I locate a UVC camera for PTZ control by AVCaptureDevice.unique_id
We parse the locationID out of the AVCaptureDevice.uniqueID and then find the IORegistry node with that locationID. Is there's a document declares how AVFoundation generate the unique_id for USB camera, no so I can assume this convert will always work? you can't Or is there's a way to send a PTZ control request to AVCaptureDevice? not that I know of. As far as I know, the only way is what you're doing. It looks that the unique_id provided is (locationID<<32|VendorID<<16|ProductID) as hex string, but I'm not sure if I can always assume this behavior won't change. Correct - it has changed in the past, it might change at any time in the future. Not all AVCaptureDevices are UVC, but they all have uniqueIDs. If you would like an API to clearly identify an AVCapture device in the IORegistry, please file a bug. I already did (in 2019, FB6146541)
Replies
Boosts
Views
Activity
Oct ’25