site_archiver(a)lists.apple.com
Delivered-To: darwin-dev(a)lists.apple.com
On Mon, Nov 3, 2008 at 11:11 PM, Rakesh Singhal
<rakesh.singhal(a)gmail.com> wrote:
> I am using the POSIX APIs to write a library to provide the wrapper functios
> for these APIs. I would like to know about handling the events for serial
> ports. How to handle these events occuring on serial ports? Which APIs I
> have to use?
>
Take a read of the guide on serial I/O programming:
<http://developer.apple.com/documentation/DeviceDrivers/Conceptual/WorkingWS…>
And the related sample code:
<http://developer.apple.com/samplecode/SerialPortSample/>
Phil
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (Darwin-dev(a)lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.app…
This email sent to site_archiver(a)lists.apple.com
site_archiver(a)lists.apple.com
Delivered-To: darwin-dev(a)lists.apple.com
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type; bh=vlPyG4C2jumPOT+Bpqe15LBdQzgPwJvirwpallOg00Y=; b=rUHz5vxC4U5iFWa4k7xK51gq13JO7HAy8R9MHVQPuE9QT3VKzX0CvD6cajqb2F/SYB vxj+TR8KBkJS4ZjocKnUpTBa60FKziyIPUegFgq/xa+txjNcr31Vjoyz3d5/2uPrnUPu fGMW5/2sgJm0kYlanNMSAXt3+SjemyZfXTS8E=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=f6M013pbaKp5/MqNJgQ+DhVu43jVbK66txqrEwDF4Du6OE/oMm67uudD5QbDypoGtS 7mbVd0OMU1A9EzcZCgG71SKxVRzKEZOSXDTiM7PmYsKlGNnRUjEQV2+Ts2f54zkhmLI4 al4V4pllaFnbWathNBhVtn4FVO1Q9RycnLz6k=
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (Darwin-dev(a)lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.app…
This email sent to site_archiver(a)lists.apple.com
site_archiver(a)lists.apple.com
Delivered-To: darwin-dev(a)lists.apple.com
I've recently purchased some external CD/DVD drives, and I am seeing
strange behavior (with multiple devices) which I haven't ever seen
using the Apple supplied drives.
Specifically, I am requesting 775 sectors of CD-DA data and C2 error
flags. Since a CD-DA sector is 2352 bytes and the C2 error flags for
a sector are 294 bytes, I expect to get 2646 bytes per sector of data
from the drive. So in total I expect 2050650 bytes of data per read.
What I'm getting, though, is less data than that. The weird thing is
that the data doesn't even seem to come in multiples of 2646:
Requested 2050650 bytes at sector 33557 (offset 88791822), got 195796
Requested 2050650 bytes at sector 16230 (offset 42944580), got 388960
Requested 2050650 bytes at sector 68572 (offset 181441512), got 388960
Obviously 195796 / 2646 is 73.99, and 388960 / 2646 is 146.99. I
thought perhaps I was only getting CD-DA sectors back (which would
violate MMC), but again 195796 / 2352 is 83.2 and 388960 / 2352 is
165.37. The final check I did was for C2 error flags only but again
the data comes out to partial sectors.
The drive is not a cheap no-name; the results above came from a
Pioneer DVD-RW DVR-116C.
The code I'm using to read looks like this:
dk_cd_read_t cd_read;
NSUInteger blockSize = 0;
if(kCDSectorAreaUser & sectorAreas) blockSize += kCDSectorSizeCDDA;
if(kCDSectorAreaErrorFlags & sectorAreas) blockSize += kCDSectorSizeErrorFlags;
if(kCDSectorAreaSubChannelQ & sectorAreas) blockSize +=
kCDSectorSizeQSubchannel;
bzero(&cd_read, sizeof(cd_read));
bzero(buffer, blockSize * sectorCount);
cd_read.offset = (uint64_t)blockSize * startSector;
cd_read.sectorArea = sectorAreas;
cd_read.sectorType = kCDSectorTypeCDDA;
cd_read.buffer = buffer;
cd_read.bufferLength = blockSize * sectorCount;
if(-1 == ioctl(self.fd, DKIOCCDREAD, &cd_read)) {
self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno
userInfo:nil];
return 0;
}
#if DEBUG
if(cd_read.bufferLength != (blockSize * sectorCount))
NSLog(@"Requested %ld bytes at sector %ld (offset %ld), got %ld",
blockSize * sectorCount, startSector, blockSize * startSector,
cd_read.bufferLength);
#endif
I have never had my Apple-supplied drive (a Matshita DVD-R UJ-867)
return fewer bytes than requested. If I was at least getting complete
sectors back I could handle that.
Has anyone seen this before? Is this a bug somewhere or just a case
that needs to be handled?
Stephen
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (Darwin-dev(a)lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.app…
This email sent to site_archiver(a)lists.apple.com
site_archiver(a)lists.apple.com
Delivered-To: darwin-dev(a)lists.apple.com
Organization: HoffmanLabs LLC
User-agent: Thunderbird 2.0.0.17 (Macintosh/20080914)
Terry Lambert writes:
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (Darwin-dev(a)lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.app…
As far as installation time grants, historically computer scientists
have called those "installed images". VMS had this ability, for
example. I'm not, in principle, against those, as long as there is
some other user controllable way to get the same rights for my
software that are being granted by my OS and OS vendor to some other
software vendor installing code on my machine. If I paid for the
atoms, I own them, and they will freaking well do what I tell them to
do.
The more flexible approach with OpenVMS is not the comparatively
primitive and older installed image mechanism, it is the so-called
subsystem identifier.
The installed privileged image of OpenVMS is roughly akin to setuid,
with the somewhat finer granularity (or the increased confusion) of
forty-some privileges present on OpenVMS. Regardless, the installed
image mechanism is a fairly large hammer. Like setuid, in that regard.
The more flexible subsystem identifier mechanism on OpenVMS is a
particular format of identifier (capability) that can be present within
the ACL of an application. This entry isn't considered when the
application is accessed, but is considered when the application is
invoked. When invoked, the specified identifier (capability) is added
to the list of capabilities available to the process for the duration of
the activation. This operates and is managed much like adding a
privilege or adding root access, but can be far more flexible, and far
more tailored. Obviously, adding the subsystem identifier onto the ACL
is a controlled and restricted operation.
With OpenVMS, ACLs can be attached to most objects. Files, devices,
shared memory, queues, etc. And there are various actions that can be
performed using the entries within ACL, though certainly not as many
actions and options as there should be available there. Security
auditing (roughly security logging) and security alarms (roughly syslog)
are two such options available via ACL entries.
There are other ways to grant privileges for the duration of an
application executing within the OpenVMS environment, and there are a
variety of mechanisms intended to protect the run-time context. And
protect that context with varying degrees of success; code executing
within the TCB is tougher to design and create than it looks.
This email sent to site_archiver(a)lists.apple.com